From 0c3b54bc044c2e544b0a53d5a88addefac22644c Mon Sep 17 00:00:00 2001
From: gloas <gloas@git-test.afi-sa.fr>
Date: Fri, 6 Sep 2013 09:36:42 +0000
Subject: [PATCH] OPSYS webservice: correction getData Nb resas rel #9304 +
 ajout getData Edition + tests

---
 library/Class/CommSigb.php                    |  2 ++
 library/Class/WebService/SIGB/Exemplaire.php  | 12 +++++++++++-
 .../Class/WebService/SIGB/Opsys/Service.php   | 19 ++++++++++++++++---
 .../View/Helper/Notice/Exemplaires.php        |  5 ++++-
 .../WebService/SIGB/OpsysServiceTest.php      | 15 +++++++++++++--
 5 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/library/Class/CommSigb.php b/library/Class/CommSigb.php
index 4ee75a3b3ae..12ef826999e 100644
--- a/library/Class/CommSigb.php
+++ b/library/Class/CommSigb.php
@@ -49,6 +49,7 @@ class Class_CommSigb {
 
 
 	public function getDispoExemplaire($id_bib, $id_origine, $code_barre) {
+	 
 		$exemplaire = ["dispo" => "non connue",
 									 "reservable" => false];
 
@@ -69,6 +70,7 @@ class Class_CommSigb {
 		$exemplaire["reservable"]=$sigb_exemplaire->isReservable();
 		$exemplaire["id_exemplaire"]=$sigb_exemplaire->getId();
 		$exemplaire["nb_resas"]=$sigb_exemplaire->getNbReservations();
+		$exemplaire["edition"]=$sigb_exemplaire->getEdition();
 		
 		if ($cote = $sigb_exemplaire->getCote())
 			$exemplaire["cote"] = $cote;
diff --git a/library/Class/WebService/SIGB/Exemplaire.php b/library/Class/WebService/SIGB/Exemplaire.php
index cd06ba8a7d1..c9de0d2a6c8 100644
--- a/library/Class/WebService/SIGB/Exemplaire.php
+++ b/library/Class/WebService/SIGB/Exemplaire.php
@@ -36,6 +36,7 @@ class Class_WebService_SIGB_Exemplaire {
 	/** @var Class_WebService_SIGB_Notice */
 	protected $notice;
 	protected $nb_resas;
+	protected $edition;
 	protected $titre;
 	protected $reservable;
 	protected $bibliotheque;
@@ -199,7 +200,6 @@ class Class_WebService_SIGB_Exemplaire {
 		return $this;
 	}
 
-
 	public function getSection(){
 		return $this->section;
 	}
@@ -359,6 +359,16 @@ class Class_WebService_SIGB_Exemplaire {
 	}
 
 
+	public function setEdition($edition) {
+		$this->edition = $edition;
+	}
+
+	
+	public function getEdition() {
+		return $this->edition;
+	}
+	
+
 	public function getDisponibiliteLabel() {
 		return $this->_disponibiliteLabel;
 	}
diff --git a/library/Class/WebService/SIGB/Opsys/Service.php b/library/Class/WebService/SIGB/Opsys/Service.php
index 9aac0829b01..f8fbe2b2671 100644
--- a/library/Class/WebService/SIGB/Opsys/Service.php
+++ b/library/Class/WebService/SIGB/Opsys/Service.php
@@ -35,9 +35,11 @@
  ****** Code barre
  ****** Site
  ****** Cote
+ ****** Edition (casqy)
  ****** Emplacement  (code de l'emplacement)
  ****** Retour le
- ****** Nb résas
+ ****** Nb resas
+ ****** Supprimable
  ****** Piegea
  ****** Piegeb
 
@@ -68,6 +70,9 @@
  *** Titre
  *** Retour
  *** Bibliothèque
+ *** Nb resas (casqy)
+ *** Type (casqy)
+ *** Type_libelle (casqy)
 
 
  * EmprListerEntite (EUEntiteEmp::ListeRetard) 
@@ -169,6 +174,7 @@ class Class_WebService_SIGB_Opsys_Service extends Class_WebService_SIGB_Abstract
 
 
 	public function getEmpruntsOf($emprunteur) {
+		xdebug_break();
 		// prets pas en retard
 		$liste_prets_result = $this->search_client->EmprListerEntite(
 																					EmprListerEntite::prets($this->guid));
@@ -738,7 +744,7 @@ class RecupererNoticeResponse {
 	public $RecupererNoticeResult; // RspRecupererNotice
 
 	public function createNotice(){
-	
+		xdebug_break();
 		$rsp_notice = $this->RecupererNoticeResult->Notice;
 		$notice = new Class_WebService_SIGB_Notice($rsp_notice->NumNotice);
 		$notice->setReservable($rsp_notice->Reservable);
@@ -759,6 +765,7 @@ class RecupererNoticeResponse {
 			$exemplaire->setDateRetour($nfille->getDateRetour());
 			$exemplaire->setReservable($nfille->Reservable);
 			$exemplaire->setNbReservations($nfille->getNbResas());
+			$exemplaire->setEdition($nfille->getEdition());
 			$exemplaire->setCote($nfille->getCote());
 			$exemplaire->setEmplacement($nfille->getEmplacement());
 
@@ -856,7 +863,12 @@ class NoticeFille {
 	}
 
 	public function getNbResas(){
-		return $this->getData("Nb résas");
+		return $this->getData("resa");
+	}
+
+
+	public function getEdition() {
+		return $this->getData("Edition");
 	}
 
 
@@ -1363,6 +1375,7 @@ class EmprProlongResponse {
 	public $EmprProlongResult; // RspEmprAction
 
 	public function getReussite(){
+
 		$result = $this->EmprProlongResult->getReussite();
 
 		// cf test OpsysServiceTestProlongerPret::testEmprProlongNotDone
diff --git a/library/ZendAfi/View/Helper/Notice/Exemplaires.php b/library/ZendAfi/View/Helper/Notice/Exemplaires.php
index 09b46005c68..7186e30bd59 100644
--- a/library/ZendAfi/View/Helper/Notice/Exemplaires.php
+++ b/library/ZendAfi/View/Helper/Notice/Exemplaires.php
@@ -129,7 +129,10 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends Zend_View_Helper_HtmlElemen
 			// Lien vers notice en affichage oeuvre
 			if($aff=="oeuvre")
 			{
-				$onclick="document.location=baseUrl+'/recherche/viewnotice/id/".$ex["id_notice"]."'";
+//				$onclick="document.location=baseUrl+'/recherche/viewnotice/id/".$ex["id_notice"]."'";
+				$onclick="document.location='".$this->view->url(['controller' => 'recherche',
+																												'action' => 'viewnotice',
+																												'id' => $ex["id_notice"]])."'";
 				$html.='<td class="oeuvre" style="text-align:center;">';
 				$html.= sprintf('<img src="%s" border="0" alt="%s" title="%s" onclick="%s" style="cursor:pointer" />',
 												URL_IMG.'bouton/loupe.gif',
diff --git a/tests/library/Class/WebService/SIGB/OpsysServiceTest.php b/tests/library/Class/WebService/SIGB/OpsysServiceTest.php
index 0ef2adb370d..3ebf3805a13 100644
--- a/tests/library/Class/WebService/SIGB/OpsysServiceTest.php
+++ b/tests/library/Class/WebService/SIGB/OpsysServiceTest.php
@@ -1008,15 +1008,19 @@ class OpsysServiceRecupererNoticeResponseTestCreateNotice extends Storm_Test_Mod
 
 
 		$nb_resa = new DonneeFille();
-		$nb_resa->NomDonnee = "Nb resa";
+		$nb_resa->NomDonnee = "Nb resas";
 		$nb_resa->ValeurDonnee = "3";
 
+		$edition = new DonneeFille();
+		$edition->NomDonnee = "Edition";
+		$edition->ValeurDonnee = "2012";
+
 
 		$potter = new NoticeFille();
 		$potter->NumFille = "potter";
 		$potter->Reservable = "true";
 		$potter->DonneesFille = new StdClass();
-		$potter->DonneesFille->DonneeFille = [$section_enfant, $dispo_reserve, $code_barre_potter, $piege_manquant,$nb_resa];
+		$potter->DonneesFille->DonneeFille = [$section_enfant, $dispo_reserve, $code_barre_potter, $piege_manquant,$nb_resa, $edition];
 
 		$dispo_empty = new DonneeFille();
 		$dispo_empty->NomDonnee = "Disponibilité";
@@ -1084,6 +1088,13 @@ class OpsysServiceRecupererNoticeResponseTestCreateNotice extends Storm_Test_Mod
 		}
 
 
+	public function testEditionShouldReturn2012() {
+		$notice = $this->response->createNotice();
+		$potter = $notice->exemplaireAt(0);
+		$this->assertEquals("2012", $potter->getEdition());
+	}
+
+
 	/** @test */
 	public function coteScrapShouldBeSCRAP() {
 		$this->assertEquals('SCRAP', $this->response->createNotice()->exemplaireAt(1)->getCote());
-- 
GitLab