Skip to content
Snippets Groups Projects
Commit 40f096e5 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch...

Merge branch 'hotline#41431_mention_disponibilite_absente_dans_le_pave_exemplaire_en_recherche_portail_interface_avec_pmb' into 'hotline-master'

Hotline#41431 mention disponibilite absente dans le pave exemplaire en recherche portail interface avec pmb

See merge request !1632
parents 393cd0c8 8fa14c58
Branches
Tags
2 merge requests!1659Master,!1645Hotline master
- ticket #41431 : Mention disponibilité absente dans le pavé exemplaire en recherche (portail interfacé avec PMB)
\ No newline at end of file
......@@ -256,19 +256,21 @@ class Class_Webservice_SIGB_PMB_Service extends Class_WebService_SIGB_AbstractSe
->setSection($item_json['section_caption'])
->setCodeAnnexe($item_json['location_id']);
if(static::$ITEM_AVAILABLE == $item_json['situation'])
$item->setReservable(true);
$item->setDisponibilite($item_json['situation']);
if(static::$ITEM_LOANABLE == $item_json['statut'])
if (static::$ITEM_AVAILABLE == $item_json['situation'])
$item->setDisponibiliteLibre();
if(static::$ITEM_LOANABLE == $item_json['statut'])
$item->setReservable(true);
return $item;
}
protected function _getItemByBarCode($items, $bar_code) {
if($items = array_filter($items, function($item) use($bar_code) {return $item->getCodeBarre() == $bar_code;}))
return $items[0];
return array_values($items)[0];
return Class_WebService_SIGB_Exemplaire::newInstance();
}
......
......@@ -36,7 +36,7 @@ class PmbFixtures {
public static function itemJson() {
return '{"id":1,"result":[{"id":"54","cb":"000018","cote":"A GRA","location_id":"1","location_caption":"AFI","section_id":"26","section_caption":"Albums","support":"Livre","statut":"Empruntable","situation":"Disponible"}],"error":null}';
return '{"id":1,"result":[{"id":"54","cb":"000018","cote":"A GRA","location_id":"1","location_caption":"AFI","section_id":"26","section_caption":"Albums","support":"Livre","statut":"Empruntable","situation":"Disponible"},{"id":"56","cb":"000020","cote":"A GRA","location_id":"1","location_caption":"AFI","section_id":"26","section_caption":"Albums","support":"Livre","statut":"Exclu du prêt","situation":"Exclu du prêt"}],"error":null}';
}
......
......@@ -185,12 +185,26 @@ class PMBServiceTest extends PMBTestCase {
/** @test */
public function item54ShouldBeDisponible() {
public function item54ShouldBeAvailable() {
$item = $this->_service->getExemplaire('54', '000018');
$this->assertEquals('Disponible', $item->getDisponibilite());
}
/** @test */
public function item54ShouldBeHoldable() {
$item = $this->_service->getExemplaire('54', '000018');
$this->assertTrue($item->isReservable());
}
/** @test */
public function item20AvailabilityShouldBeExcluDuPret() {
$item = $this->_service->getExemplaire('54', '000020');
$this->assertEquals('Exclu du prêt', $item->getDisponibilite());
}
/** @test */
public function renewLoansShouldReturnError() {
$this->assertContains(false, $this->_service->prolongerPret($this->_paul, 15));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment