diff --git a/VERSIONS_HOTLINE/80612 b/VERSIONS_HOTLINE/80612 new file mode 100644 index 0000000000000000000000000000000000000000..3426a387b2e8ccd1003f366ccd860df6d3c03766 --- /dev/null +++ b/VERSIONS_HOTLINE/80612 @@ -0,0 +1 @@ + - ticket #80612 : SIGB Orphee : Correction de la détection de la disponibilité des exemplaires par webservice \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Orphee/Exemplaire.php b/library/Class/WebService/SIGB/Orphee/Exemplaire.php index 39cb2ebd54b5f2f33059289ac3e93edcf699f856..e2675a91994151f9364da46a0987af939e1609bf 100644 --- a/library/Class/WebService/SIGB/Orphee/Exemplaire.php +++ b/library/Class/WebService/SIGB/Orphee/Exemplaire.php @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE * along with BOKEH; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ class Class_WebService_SIGB_Orphee_Exemplaire extends Class_WebService_SIGB_Exemplaire { @@ -29,14 +29,14 @@ class Class_WebService_SIGB_Orphee_Exemplaire extends Class_WebService_SIGB_Exem $this->_allow_hold_available_items = $allow_hold_available_items; } + public function isReservable() { - return ( - parent::isReservable() - || ( $this->isDisponible() && $this->_allow_hold_available_items ) - ); + return parent::isReservable() + || ( $this->isDisponible() && $this->_allow_hold_available_items ); } + public function isDisponible() { - return self::DISPO_LIBRE == $this->disponibilite; + return strtolower(self::DISPO_LIBRE) == strtolower(trim($this->disponibilite)); } } \ No newline at end of file diff --git a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php index 93c11db9017f449dc7d0f0e3c94fe1757cb562e3..d4788e1d868a24427df53131bdd3a02d3773906c 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeFixtures.php +++ b/tests/library/Class/WebService/SIGB/OrpheeFixtures.php @@ -243,6 +243,46 @@ class OrpheeFixtures { <![CDATA[2008]]> </date_edi> </document> + + <document> + <no><![CDATA[148816]]></no> + <ntc><![CDATA[1301700727]]></ntc> + <carte><![CDATA[200019001649]]></carte> + <sit><![CDATA[2]]></sit> + <lib_sit><![CDATA[ en rayon]]></lib_sit> + <loc><![CDATA[2]]></loc> + <lib_loc><![CDATA[ Salle bleue]]></lib_loc> + <loc_ori><![CDATA[2]]></loc_ori> + <lib_loc_ori><![CDATA[ Salle bleue]]></lib_loc_ori> + <cote><![CDATA[952.05 SCO]]></cote> + <anx_ori><![CDATA[1]]></anx_ori> + <lib_anx_ori><![CDATA[ Bibliothèque]]></lib_anx_ori> + <anx_cur><![CDATA[1]]></anx_cur> + <lib_anx_cur><![CDATA[ Bibliothèque]]></lib_anx_cur> + <anx_nxt><![CDATA[1]]></anx_nxt> + <lib_anx_nxt><![CDATA[ Bibliothèque]]></lib_anx_nxt> + <no_coll><![CDATA[0]]></no_coll> + <site><![CDATA[20]]></site> + <lib_site><![CDATA[ Saint Cloud]]></lib_site> + <sup><![CDATA[108]]></sup> + <lib_sup><![CDATA[ Livre]]></lib_sup> + <sec><![CDATA[2]]></sec> + <lib_sec><![CDATA[ Adultes]]></lib_sec> + <uti><![CDATA[2]]></uti> + <lib_uti><![CDATA[ Prêt normal]]></lib_uti> + <sta1><![CDATA[98]]></sta1> + <lib_sta1><![CDATA[ Docum Adulte]]></lib_sta1> + <sta2><![CDATA[57]]></sta2> + <lib_sta2><![CDATA[ Histoire]]></lib_sta2> + <sta3><![CDATA[0]]></sta3> + <lib_sta3 /> + <date_last_pret><![CDATA[03/05/2018]]></date_last_pret> + <date_last_retour><![CDATA[31/08/2018]]></date_last_retour> + <droit_resa><![CDATA[0]]></droit_resa> + <lib_droit_resa /> + <titre><![CDATA[[Millenium (Larsson, Stieg (1954-2004))]]></titre> + <date_edi><![CDATA[2010]]></date_edi> + </document> </documents> </datas>'; } diff --git a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php index 1a67fbd70b5c0cee80c57474cbcb42687ded92d8..efcceec424e619c437b18ffd4eb960d7b4ca8813 100644 --- a/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php +++ b/tests/library/Class/WebService/SIGB/OrpheeServiceTest.php @@ -29,6 +29,7 @@ class Class_WebService_SIGB_Orphee_ServiceForTesting extends Class_WebService_SI $this->_search_client = $search_client; } + public function getSearchClient() { $result = $this->_search_client->GetId(new GetId()); $this->_guid = $result->GetIdResult; @@ -69,6 +70,7 @@ class OrpheeServiceGetServiceTest extends ModelTestCase { } + abstract class OrpheeServiceTestCase extends ModelTestCase { protected $_storm_default_to_volatile = true, @@ -115,6 +117,7 @@ abstract class OrpheeServiceTestCase extends ModelTestCase { } + class OrpheeServiceBorrowerSoapActionDetectionTest extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -171,7 +174,6 @@ class OrpheeServiceBorrowerSoapActionDetectionTest extends OrpheeServiceTestCase } - /** @test */ public function withGetAdhShouldCallItOnGetEmprunteur() { $this->_search_client @@ -275,6 +277,7 @@ class OrpheeServiceTestAutoConnectSuccessful extends OrpheeServiceTestCase { } + class OrpheeServiceTestAutoConnectError extends OrpheeServiceTestCase { protected $_search_client; protected $_orphee; @@ -302,6 +305,7 @@ class OrpheeServiceTestAutoConnectError extends OrpheeServiceTestCase { } + class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -310,18 +314,22 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { ['id' => 34, 'tome_alpha' => '', 'exemplaires' => [ - $this->fixture('Class_Exemplaire', - ['id' => 1, - 'code_barres' => '00106001488142', - 'id_origine' => 'frOr1301700727']), - - $this->fixture('Class_Exemplaire', - ['id' => 2, - 'code_barres' => '00106001488155', - 'id_origine' => 'frOr1301700727']) - ] - ]); - + $this->fixture('Class_Exemplaire', + ['id' => 1, + 'code_barres' => '00106001488142', + 'id_origine' => 'frOr1301700727']), + + $this->fixture('Class_Exemplaire', + ['id' => 2, + 'code_barres' => '00106001488155', + 'id_origine' => 'frOr1301700727']), + + $this->fixture('Class_Exemplaire', + ['id' => 3, + 'code_barres' => '200019001649', + 'id_origine' => 'frOr1301200059']), + ] + ]); $this->_search_client ->whenCalled('GetLstDmt') @@ -382,6 +390,7 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { $this->assertEquals('27/03/2012', $exemplaire->getDateRetour()); } + /** @test */ public function exemplaireByCodeBarre00106001488142WithAllowHoldAvailShouldNotBeEmpty() { $exemplaire = $this->_orphee_allow_hold_avail->getExemplaire('frOr1301700727', '00106001488142'); @@ -389,6 +398,7 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { return $exemplaire; } + /** * @test * @depends exemplaireByCodeBarre00106001488142WithAllowHoldAvailShouldNotBeEmpty @@ -397,6 +407,7 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { $this->assertTrue($exemplaire->isReservable()); } + /** @test */ public function exemplaireByCodeBarre00106001488155ShouldNotBeEmpty() { $exemplaire = $this->_orphee->getExemplaire('frOr1301700727', '00106001488155'); @@ -431,6 +442,7 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { $this->assertFalse($exemplaire->isReservable()); } + /** @test */ public function exemplaireByCodeBarre00106001488155WithAllowHoldAvailShouldNotBeEmpty() { $exemplaire = $this->_orphee_allow_hold_avail->getExemplaire('frOr1301700727', '00106001488155'); @@ -438,6 +450,7 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { return $exemplaire; } + /** * @test * @depends exemplaireByCodeBarre00106001488155WithAllowHoldAvailShouldNotBeEmpty @@ -446,9 +459,17 @@ class OrpheeServiceTestGetLstDmntWithMillenium extends OrpheeServiceTestCase { $this->assertTrue($exemplaire->isReservable()); } + + /** @test */ + public function exemplaireByCodeBarre200019001649ShouldNotBeEmptyAndBeAvailable() { + $exemplaire = $this->_orphee->getExemplaire('frOr1301700727', '200019001649'); + $this->assertNotEmpty($exemplaire); + $this->assertTrue($exemplaire->isDisponible()); + } } + class OrpheeServiceTestGetLstDmntWithLivreEspagnol extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -479,6 +500,7 @@ class OrpheeServiceTestGetLstDmntWithLivreEspagnol extends OrpheeServiceTestCase } + class OrpheeServiceTestGetLstDmntLAmourDansLeSangReserve extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -508,6 +530,7 @@ class OrpheeServiceTestGetLstDmntLAmourDansLeSangReserve extends OrpheeServiceTe } + class OrpheeServiceTestGetLstDmntPhosphoreNo5632 extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -544,6 +567,7 @@ class OrpheeServiceTestGetLstDmntPhosphoreNo5632 extends OrpheeServiceTestCase { } + class OrpheeServiceTestGetLstDmntVagabondEnArchivage extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -573,6 +597,7 @@ class OrpheeServiceTestGetLstDmntVagabondEnArchivage extends OrpheeServiceTestCa } + class OrpheeServiceTestGetLstDmntMetamausEnCatalogage extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -601,6 +626,7 @@ class OrpheeServiceTestGetLstDmntMetamausEnCatalogage extends OrpheeServiceTestC } + class OrpheeServiceTestGetLstDmntErrorsTest extends OrpheeServiceTestCase { /** @test */ public function onInexistingExemplaireShouldReturnEmptyExemplaire() { @@ -623,6 +649,7 @@ class OrpheeServiceTestGetLstDmntErrorsTest extends OrpheeServiceTestCase { } + class OrpheeServiceGetLstDmtResponseTest extends ModelTestCase { /** @test */ public function withStandardXmlShouldGetXMLShouldRetunsIt() { @@ -701,7 +728,6 @@ class OrpheeServiceGetInfoUserCarteHenryDupontWithErrorTest extends OrpheeServic $this->_orphee->supprimerReservation($this->_henry_dupont, new Class_Exemplaire())); } - } @@ -748,6 +774,7 @@ class OrpheeServiceGetInfoUserCarteHenryDupontActionErrorTest extends OrpheeServ } + class OrpheeServiceGetInfoUserCarteHenryDupontWithNoXMLTest extends OrpheeServiceTestCase { public function setUp() { parent::setUp(); @@ -842,6 +869,7 @@ class OrpheeServiceGetInfoUserCarteHenryDupontTest extends OrpheeServiceTestCase $this->assertNotEmpty($this->emprunteur); } + /** @test */ public function nbOfHoldsWaitingToBePulledShouldBeOne() { $this->assertCount(1, $this->emprunteur->getHoldsWaitingToBePulled());