Commit 00081322 authored by efalcy's avatar efalcy
Browse files

hotline #72297 : fix call notice from exemplaire without notice

parent 954248af
Pipeline #3634 failed with stage
in 27 minutes and 3 seconds
- ticket #72297 : Corrige le probleme d'intégration si un exemplaire n'a plus de notice
\ No newline at end of file
......@@ -182,7 +182,9 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function getTomeAlpha() {
return $this->getNotice()->getTomeAlpha();
return $this->getNotice() ?
$this->getNotice()->getTomeAlpha()
: '';
}
......@@ -225,32 +227,44 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function getTitrePrincipal() {
return $this->getNotice()->getTitrePrincipal();
return $this->getNotice()
? $this->getNotice()->getTitrePrincipal()
: '';
}
public function getTitreEtSousTitre() {
return $this->getNotice()->getTitreEtSousTitre();
return $this->getNotice()
? $this->getNotice()->getTitreEtSousTitre()
: '';
}
public function getAuteurPrincipal() {
return $this->getNotice()->getAuteurPrincipal();
return $this->getNotice()
? $this->getNotice()->getAuteurPrincipal()
: '';
}
public function getEditeur() {
return $this->getNotice()->getEditeur();
return $this->getNotice()
? $this->getNotice()->getEditeur()
: '';
}
public function getCollectionPrincipale() {
return $this->getNotice()->getCollections(true);
return $this->getNotice()
? $this->getNotice()->getCollections(true)
: '';
}
public function getTypeDoc() {
return $this->getNotice()->getTypeDoc();
return $this->getNotice()
? $this->getNotice()->getTypeDoc()
: '';
}
......@@ -279,7 +293,7 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function isDisponible($cache_only = false) {
if ($this->getNotice()->isRessourceNumerique())
if ($this->getNotice() && $this->getNotice()->isRessourceNumerique())
return true;
if ($cache_only)
......
......@@ -92,7 +92,35 @@ abstract class DoubleFinderTestCase extends ModelTestCase {
}
class DoubleFinderWithNotNoticeTest extends DoubleFinderTestCase {
protected $_data = ['type_doc' => Class_TypeDoc::DILICOM,
'statut_exemplaires' => ['nb_ex' => 1],
'exemplaires' => [ ['code_barres' => '302'] ]];
public function setUp() {
parent::setUp();
$this->_prepareFixtures();
$this->fixture('Class_Exemplaire',
['id' => 30,
'code_barres' => '302',
'id_origine' => '789',
'type_doc' => Class_TypeDoc::DILICOM,
'id_int_bib' => 1]);
$this->_finder = new Class_Notice_BarcodeDoubleFinder($this->_data, $this->_library_id);
$this->_found = $this->_finder->find();
}
/** @test */
public function WithExemplaireWithoutNoticeShouldNotFound() {
$this->assertFalse($this->_found);
}
}
class DoubleFinderWithoutAnyRecordTest extends DoubleFinderTestCase {
/** @test */
public function shouldNotFindDouble() {
......
Markdown is supported
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