From 5948b382304aff00a4bbc1924373603ab209a571 Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.pergame.net>
Date: Tue, 17 Feb 2015 11:04:31 +0100
Subject: [PATCH] fix fatal error on noticeDomain update domain

---
 library/Class/NoticeDomain.php | 32 +++-----------------------------
 1 file changed, 3 insertions(+), 29 deletions(-)

diff --git a/library/Class/NoticeDomain.php b/library/Class/NoticeDomain.php
index 574bd23e57d..04a87e1d58b 100644
--- a/library/Class/NoticeDomain.php
+++ b/library/Class/NoticeDomain.php
@@ -91,39 +91,13 @@ class NoticeDomainLoader extends Storm_Model_Loader {
 
 
 	public function updateRecordsFacette($domain_id) {
-		foreach(Class_NoticeDomain::getRecordsForDomain($domain_id) as $record) {
-			$record->updateFacette(Class_Catalogue::find($domain_id)->getFacette())->save();
+		if($catalogue = Class_Catalogue::find($domain_id)) {
+			foreach(Class_NoticeDomain::getRecordsForDomain($domain_id) as $record)
+				$record->updateFacette($catalogue->getFacette())->save();
 		}
 	}
 
 
-	/* public function deleteRecordsFacetteForDomain($domain_id) { */
-	/* 	if (!Class_Catalogue::find($domain_id)) */
-	/* 		return; */
-
-	/* 	if (!$records = Class_NoticeDomain::getRecordsForDomain($domain_id)) */
-	/* 		return; */
-
-	/* 	foreach($records as $record) { */
-	/* 		$record->deleteFacettes(Class_Catalogue::find($domain_id)->getFacette())->save(); */
-	/* 	} */
-	/* } */
-
-
-	/* public function deleteRecordsFacetteForCart($domain_id, $cart_id) { */
-	/* 	if (!Class_PanierNotice::find($cart_id)) */
-	/* 		return; */
-
-	/* 	if (!$records = Class_NoticeDomain::getRecordsForCart($cart_id)) */
-	/* 		return; */
-
-	/* 	foreach($records as $record) { */
-	/* 		$record->deleteFacettes(Class_Catalogue::find($domain_id)->getFacette())->save(); */
-	/* 		Class_NoticeDomain::updateRecordsFacette($domain_id); */
-	/* 	} */
-	/* } */
-
-
 	public function deleteByCart($id_cart, $attributs = []) {
 		$notices_domains = Class_NoticeDomain::findAllBy(array_merge(['panier_id' => $id_cart],
 																																 $attributs));
-- 
GitLab