diff --git a/VERSIONS_HOTLINE/30552 b/VERSIONS_HOTLINE/30552 new file mode 100644 index 0000000000000000000000000000000000000000..c0ad64a638739af013da8e706c88f60fe84b89f5 --- /dev/null +++ b/VERSIONS_HOTLINE/30552 @@ -0,0 +1 @@ + - ticket #30552 : Nanook: affectation de l'abonné à la bonne bibliothèque à la création temps réel. Nécessite Nanook 3.0 \ No newline at end of file diff --git a/library/Class/WebService/SIGB/Emprunteur.php b/library/Class/WebService/SIGB/Emprunteur.php index f33aebe27698160a77fe186f0152e676131e7c20..f2186806d636857a999d410f6a26995efdd3aa78 100644 --- a/library/Class/WebService/SIGB/Emprunteur.php +++ b/library/Class/WebService/SIGB/Emprunteur.php @@ -713,6 +713,9 @@ class Class_WebService_SIGB_Emprunteur { if ($this->_id) $user->setIdSigb($this->_id); + + if (($annexe = $this->getLibrary()) && ($bib = $annexe->getBib())) + $user->setBib($bib); } diff --git a/library/Class/WebService/SIGB/Nanook/PatronInfoReader.php b/library/Class/WebService/SIGB/Nanook/PatronInfoReader.php index 06e0aab3fde30d9e648a71a751e826dd32a8829a..49af883364194fa5c7f78750c46763dfb80c8292 100644 --- a/library/Class/WebService/SIGB/Nanook/PatronInfoReader.php +++ b/library/Class/WebService/SIGB/Nanook/PatronInfoReader.php @@ -224,5 +224,10 @@ class Class_WebService_SIGB_Nanook_PatronInfoReader extends Class_WebService_SIG public function getSuggestions() { return $this->_suggests; } + + + public function endSiteId($data) { + $this->getEmprunteur()->setLibraryCode($data); + } } ?> \ No newline at end of file diff --git a/tests/fixtures/GetPatronInfoFrancoisMorel.xml b/tests/fixtures/GetPatronInfoFrancoisMorel.xml index 60de13e6f1ce0501bcf21835191117cec8577a17..fc7620a1de16106ef0285725c9ab429530f1eb4b 100644 --- a/tests/fixtures/GetPatronInfoFrancoisMorel.xml +++ b/tests/fixtures/GetPatronInfoFrancoisMorel.xml @@ -1,3 +1,3 @@ <?xml version="1.0" encoding="UTF-8"?> <GetPatronInfo><patronId>5352</patronId><barcode>7942236</barcode><lastName>MOREL</lastName><firstName>François</firstName><displayOrder>1</displayOrder><birthDate>1970-01-01</birthDate><phoneNumber>XX XX XX XX XX</phoneNumber><town>Amityville</town><zipcode>0666</zipcode><address>126 Elm Street -</address><endDate>2015-03-19</endDate><mail></mail><loans><loan><bibId>186567</bibId><itemId>72958</itemId><title>Le garçon qui voulait devenir un être humain</title><author>Jorn Riel</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-06-25</loanDate><dueDate>2014-07-25</dueDate></loan><loan><bibId>186564</bibId><itemId>72955</itemId><title>Le garçon qui voulait devenir un être humain</title><author>Jorn Riel</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-06-25</loanDate><dueDate>2014-07-25</dueDate></loan><loan><bibId>279034</bibId><itemId>111089</itemId><title>La vieille qui voulait tuer le bon Dieu</title><author>Nadine Monfils</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan><loan><bibId>273559</bibId><itemId>111718</itemId><title>Un fleuve de fumée</title><author>Amitav Ghosh</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan><loan><bibId>198354</bibId><itemId>83017</itemId><title>Demoiselles des Lumières</title><author>Jean Diwo</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan><loan><bibId>230310</bibId><itemId>91620</itemId><title>Le naufrage</title><author>Eric Roussel</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan></loans><holds><hold><bibId>280792</bibId><itemId>112771</itemId><title>Le livre du roi</title><author>Arnaldur Indriòason</author><locationLabel>Médiathèque </locationLabel><priority>1</priority><available>0</available><availabilityDate>11/08/2014</availabilityDate></hold><hold><bibId>152968</bibId><itemId>42029</itemId><title>L'énigme de Ravejouls</title><author>Alain Gandy</author><locationLabel>Médiathèque </locationLabel><priority>1</priority><available>0</available><availabilityDate>24/07/2014</availabilityDate></hold></holds><suggests/></GetPatronInfo> +</address><endDate>2015-03-19</endDate><mail></mail><siteId>8</siteId><loans><loan><bibId>186567</bibId><itemId>72958</itemId><title>Le garçon qui voulait devenir un être humain</title><author>Jorn Riel</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-06-25</loanDate><dueDate>2014-07-25</dueDate></loan><loan><bibId>186564</bibId><itemId>72955</itemId><title>Le garçon qui voulait devenir un être humain</title><author>Jorn Riel</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-06-25</loanDate><dueDate>2014-07-25</dueDate></loan><loan><bibId>279034</bibId><itemId>111089</itemId><title>La vieille qui voulait tuer le bon Dieu</title><author>Nadine Monfils</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan><loan><bibId>273559</bibId><itemId>111718</itemId><title>Un fleuve de fumée</title><author>Amitav Ghosh</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan><loan><bibId>198354</bibId><itemId>83017</itemId><title>Demoiselles des Lumières</title><author>Jean Diwo</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan><loan><bibId>230310</bibId><itemId>91620</itemId><title>Le naufrage</title><author>Eric Roussel</author><locationLabel>Médiathèque </locationLabel><loanDate>2014-07-04</loanDate><dueDate>2014-08-03</dueDate></loan></loans><holds><hold><bibId>280792</bibId><itemId>112771</itemId><title>Le livre du roi</title><author>Arnaldur Indriòason</author><locationLabel>Médiathèque </locationLabel><priority>1</priority><available>0</available><availabilityDate>11/08/2014</availabilityDate></hold><hold><bibId>152968</bibId><itemId>42029</itemId><title>L'énigme de Ravejouls</title><author>Alain Gandy</author><locationLabel>Médiathèque </locationLabel><priority>1</priority><available>0</available><availabilityDate>24/07/2014</availabilityDate></hold></holds><suggests/></GetPatronInfo> diff --git a/tests/library/Class/WebService/SIGB/NanookTest.php b/tests/library/Class/WebService/SIGB/NanookTest.php index b957ded7b7f2338e2d63db62b83ac5af3defa27e..ced2ee8c3b32b6d8620582b1189ba84f6c7536d2 100644 --- a/tests/library/Class/WebService/SIGB/NanookTest.php +++ b/tests/library/Class/WebService/SIGB/NanookTest.php @@ -78,11 +78,23 @@ abstract class NanookTestCase extends Storm_Test_ModelTestCase { ->setServerRoot('http://localhost:8080/afi_Nanook/ilsdi/') ->setWebClient($this->_mock_web_client); + $this->fixture('Class_Bib', + ['id' => 3, + 'libelle' => 'Cran-Gévrier']); + $this->fixture('Class_CodifAnnexe' , ['id' => 3, 'libelle' => 'Annexe Cran-Gevrier', 'id_bib' => 3, 'code' => 10]); + $this->fixture('Class_Bib', + ['id' => 5, + 'libelle' => 'Seynod']); + + $this->fixture('Class_CodifAnnexe' , ['id' => 4, + 'libelle' => 'Annexe Seynod', + 'id_bib' => 5, + 'code' => 8]); } } @@ -182,6 +194,7 @@ class NanookHtmlResponseErrorTest extends NanookServiceErrorTestCase { $this->assertEmpty($this->_emprunteur->getEmprunts()); } + /** @test */ public function validShouldBeFalse() { $this->assertFalse($this->_emprunteur->isValid()); @@ -408,7 +421,8 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase { $this->_chrystel = Class_Users::newInstance(['id_sigb' => 1, 'login' => 8765, - 'password' => 2002]); + 'password' => 2002, + 'id_site' => 3]); $this->_emprunteur = $this->_service->getEmprunteur($this->_chrystel); $this->_emprunteur->updateUser($this->_chrystel); @@ -508,6 +522,12 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase { } + /** @test */ + public function userBibShouldStayCranGevrier() { + $this->assertEquals('Cran-Gévrier', $this->_chrystel->getLibelleBib()); + } + + /** @test */ public function nbEmpruntsShouldBeThree() { $this->assertEquals(3, $this->_emprunteur->getNbEmprunts()); @@ -698,6 +718,9 @@ class NanookGetEmprunteurChristelDelpeyrouxTest extends NanookTestCase { } } + + + class NanookGetEmprunteurFrancoisMorelTest extends NanookTestCase { /** @var Class_WebService_SIGB_Emprunteur */ protected $_emprunteur; @@ -716,8 +739,8 @@ class NanookGetEmprunteurFrancoisMorelTest extends NanookTestCase { ->answers(NanookFixtures::xmlGetPatronInfoFrancoisMorel()); $this->_user = Class_Users::newInstance(['id_sigb' => 5352, - 'login' => 7942236, - 'password' => 1900]); + 'login' => 7942236, + 'password' => 1900]); $this->_emprunteur = $this->_service->getEmprunteur($this->_user); $this->_emprunteur->updateUser($this->_user); @@ -726,15 +749,30 @@ class NanookGetEmprunteurFrancoisMorelTest extends NanookTestCase { ->answers(null); } + /** @test */ public function getEmpruntsShouldReturnsAllLoans() { $loans = $this->_emprunteur->getEmprunts(); $this->assertEquals(6, count($loans)); } + + + + /** @test */ + public function emprunteurLibraryLabelShouldBeAnnexeSeynod() { + $this->assertEquals('Annexe Seynod', $this->_emprunteur->getLibraryLabel()); + } + + + /** @test */ + public function userBibShouldBeSeynod() { + $this->assertEquals('Seynod', $this->_user->getBib()->getLibelle()); + } } + class NanookGetEmprunteurWithErrorTest extends NanookTestCase { /** @test */ public function emprunteurShouldBeEmpty() {