From 8770cd1f0a52b94212a3bc71a05e5cd9f831e260 Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@git-test.afi-sa.fr> Date: Fri, 10 Jan 2014 10:34:14 +0000 Subject: [PATCH] =?UTF-8?q?WS=20Koha:=20correction=20deserialization=20des?= =?UTF-8?q?=20param=C3=A8tres=20cosmogramme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/Class/IntBib.php | 4 ++-- .../WebService/SIGB/Koha/GetRecordsResponseReader.php | 2 ++ tests/library/Class/CommSigbTest.php | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/library/Class/IntBib.php b/library/Class/IntBib.php index e471f5fd69a..83505894d4a 100644 --- a/library/Class/IntBib.php +++ b/library/Class/IntBib.php @@ -71,7 +71,7 @@ class Class_IntBib extends Storm_Model_Abstract { public function setCommParams($string_or_array) { if (is_array($string_or_array)) - $cfg = ZendAfi_Filters_Serialize::serialize($string_or_array); + $cfg = serialize($string_or_array); else $cfg = $string_or_array; return $this->_set('comm_params', $cfg); @@ -79,7 +79,7 @@ class Class_IntBib extends Storm_Model_Abstract { public function getCommParamsAsArray() { - $a = ZendAfi_Filters_Serialize::unserialize($this->getCommParams()); + $a = unserialize($this->getCommParams()); if (!is_array($a)) return []; return $a; diff --git a/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php b/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php index 3454128630f..5d060435a69 100644 --- a/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php +++ b/library/Class/WebService/SIGB/Koha/GetRecordsResponseReader.php @@ -49,6 +49,8 @@ class Class_WebService_SIGB_Koha_GetRecordsResponseReader { public function setCodificationDisponibilites($codif) { + if (!trim($codif)) + return $this; foreach($codif as $status => $libelle) $this->_not_for_loan_status[$status] = $libelle; return $this; diff --git a/tests/library/Class/CommSigbTest.php b/tests/library/Class/CommSigbTest.php index 65e9c92e18f..88b8c0e82db 100644 --- a/tests/library/Class/CommSigbTest.php +++ b/tests/library/Class/CommSigbTest.php @@ -346,11 +346,12 @@ class CommSigbMeuseKohaTest extends CommSigbTestCase { public function setUp() { parent::setUp(); - $params = ['url_serveur' => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl']; + $params = ['url_serveur' => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl', + 'Codification_disponibilites' => "1:En prêt\r\n2:Réservable"]; $this->bib_koha = Class_IntBib::getLoader() ->newInstanceWithId(5) - ->setCommParams($params) + ->setCommParams(serialize($params)) ->setCommSigb(5); Class_WebService_SIGB_Koha::setService(array_merge($params, @@ -364,7 +365,8 @@ class CommSigbMeuseKohaTest extends CommSigbTestCase { public function getModeCommShouldReturnAnArrayWithCommParams() { $this->assertEquals(array("url_serveur" => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl', "type" => Class_IntBib::COM_KOHA, - 'id_bib' => 5), + 'id_bib' => 5, + 'Codification_disponibilites' => "1:En prêt\r\n2:Réservable"), $this->bib_koha->getModeComm(5)); } } -- GitLab