Skip to content
Snippets Groups Projects
Commit 6d52ee87 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch 'hotline#56056_ressource_1d_touch_dans_la_liste_des_prets' into 'stable'

hotline #56056 fix item fetching from sigb operations

See merge request !2041
parents 574f0273 cf93d655
Branches
Tags
5 merge requests!2080Sandbox detach zf from storm,!2061Master,!2048Master,!2047Hotline master,!2041hotline #56056 fix item fetching from sigb operations
Pipeline #558 passed with stage
in 22 minutes and 38 seconds
- ticket #56056 : Compte lecteur : correction de l'affichage des lites de prêts et de réservations
\ No newline at end of file
......@@ -39,7 +39,16 @@ class Class_ExemplaireLoader extends Storm_Model_Loader {
if (!array_filter($params))
return null;
return Class_Exemplaire::findFirstBy($params);
$matches = (new Storm_Model_Collection(Class_Exemplaire::findAllBy($params)))
->reject(function($item)
{
return $item->getNotice()->isRessourceNumerique();
});
if($matches->isEmpty())
return null;
return $matches->first();
}
}
......
......@@ -49,4 +49,57 @@ class ExemplaireSIGBTest extends Storm_Test_ModelTestCase {
}
}
?>
\ No newline at end of file
class ExemplaireWithMultipleItems extends Storm_Test_ModelTestCase {
protected $_storm_default_to_volatile = true;
public function setUp() {
parent::setUp();
ZendAfi_Auth::getInstance()->logUser($this->fixture('Class_Users',
['id' => 78,
'login' => 'Troll',
'password' => 'in the wood']));
Storm_Test_ObjectWrapper::onloaderOfModel('Class_IntBib')
->whenCalled('findAllAvailableForUser')
->answers(new Storm_Model_Collection([$this->fixture('Class_IntBib',
['id' => 5])]));
$this->fixture('Class_Exemplaire',
['id' => 89,
'id_int_bib' => 5,
'code_barres' => 456,
'id_notice' => 321]);
$this->fixture('Class_Exemplaire',
['id' => 45,
'id_int_bib' => 5,
'code_barres' => 456,
'id_notice' => 654]);
$trolls_de_troy = $this->fixture('Class_Notice',
['id' => 654,
'type_doc' => 2]);
$this->fixture('Class_Notice',
['id' => 321,
'type_doc' => 103]);
$this->_sigb_item =
(new Class_WebService_SIGB_Exemplaire(289))
->setCodeBarre(456);
}
/** @test */
public function shouldReturnTrollsDeTroyBeCauseItIsABook() {
$item = $this->_sigb_item->getExemplaireOPAC();
$this->assertNotNull($item);
$this->assertEquals(45, $item->getId());
}
}
\ No newline at end of file
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