From 9d64a778db6a3ad748d8489223659c0502a35788 Mon Sep 17 00:00:00 2001
From: Laurent <llaffont@afi-sa.fr>
Date: Thu, 2 Oct 2014 17:58:19 +0200
Subject: [PATCH] Cosmogramme find annexes and places from storm

---
 cosmogramme/php/classes/classe_codif_cache.php | 2 +-
 cosmogramme/php/classes/classe_unimarc.php     | 6 ++----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/cosmogramme/php/classes/classe_codif_cache.php b/cosmogramme/php/classes/classe_codif_cache.php
index cbb2d00c608..17406c58ce4 100644
--- a/cosmogramme/php/classes/classe_codif_cache.php
+++ b/cosmogramme/php/classes/classe_codif_cache.php
@@ -27,7 +27,7 @@ abstract class CodifCacheAbstract {
 
 	public static function getInstance() {
 		if (!isset(static::$_instance))
-			static::$_instance = new self();
+			static::$_instance = new static();
 		return static::$_instance;
 	}
 
diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php
index aebfb9d6163..9a2d9ac5542 100644
--- a/cosmogramme/php/classes/classe_unimarc.php
+++ b/cosmogramme/php/classes/classe_unimarc.php
@@ -441,8 +441,7 @@ class notice_unimarc extends iso2709_record {
 	protected function isSectionInvisible($id) {
 		if (0==(int)$id)
 			return false;
-		return ($enreg = fetchEnreg('select * from codif_section where id_section=' . $id))
-						 && $enreg['invisible'] == 1;
+		return ($section = Class_CodifSection::find($id)) && ($section->getInvisible() == 1);
 	}
 
 
@@ -453,8 +452,7 @@ class notice_unimarc extends iso2709_record {
 
 
 	protected function isEmplacementInvisible($id) {
-		return ($invisible = fetchOne('select ne_pas_afficher from codif_emplacement where id_emplacement=' . $id))
-						&& $invisible == 1;
+		return ($emplacement = Class_CodifEmplacement::find($id)) && ($emplacement->getInvisible() == 1);
 	}
 
 
-- 
GitLab