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

Merge branch 'hotline#72297_invisibilite_des_nouveautes_sur_le_site' into 'hotline'

hotline #72297 : fix  call notice from exemplaire without notice

See merge request !2536
parents a396f858 b57a3823
Branches
Tags
3 merge requests!2542Master,!2541Hotline,!2536hotline #72297 : fix call notice from exemplaire without notice
Pipeline #3654 passed with stage
in 32 minutes and 59 seconds
- ticket #72297 : Cosmogramme : correction du système de dédoublonnage
\ 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 ($record = $this->getNotice())
? $record->getTomeAlpha()
: '';
}
......@@ -225,32 +227,44 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function getTitrePrincipal() {
return $this->getNotice()->getTitrePrincipal();
return ($record = $this->getNotice())
? $record->getTitrePrincipal()
: '';
}
public function getTitreEtSousTitre() {
return $this->getNotice()->getTitreEtSousTitre();
return ($record = $this->getNotice())
? $record->getTitreEtSousTitre()
: '';
}
public function getAuteurPrincipal() {
return $this->getNotice()->getAuteurPrincipal();
return ($record =$this->getNotice())
? $record->getAuteurPrincipal()
: '';
}
public function getEditeur() {
return $this->getNotice()->getEditeur();
return ($record = $this->getNotice())
? $record->getEditeur()
: '';
}
public function getCollectionPrincipale() {
return $this->getNotice()->getCollections(true);
return ($record = $this->getNotice())
? $record->getCollections(true)
: '';
}
public function getTypeDoc() {
return $this->getNotice()->getTypeDoc();
return ($record = $this->getNotice())
? $record->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)
......@@ -334,7 +348,10 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function toUnimarcIso2709() {
$writer = new Class_NoticeUnimarc_Writer();
$writer->setNotice($this->getNotice()->getUnimarc());
$unimarc = ($record = $this->getNotice())
? $record->getUnimarc()
: '';
$writer->setNotice($unimarc);
$subfields = [];
foreach ($this->zone995toArray() as $subfield)
$subfields[] = [$this->get995Key($subfield), $subfield['valeur']];
......@@ -420,7 +437,9 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function isSigbLoanable() {
$record = $this->getNotice();
if(!$record = $this->getNotice())
return false;
return $this->isLoanable() && (!$record->isDilicom());
}
}
\ No newline at end of file
......@@ -93,6 +93,31 @@ abstract class DoubleFinderTestCase extends ModelTestCase {
class DoubleFinderWithNoNoticeTest extends DoubleFinderTestCase {
protected $_data = ['type_doc' => Class_TypeDoc::DILICOM,
'statut_exemplaires' => ['nb_ex' => 1],
'exemplaires' => [ ['code_barres' => '302'] ]];
protected function _prepareFixtures() {
$this->fixture('Class_Exemplaire',
['id' => 30,
'code_barres' => '302',
'id_origine' => '789',
'type_doc' => Class_TypeDoc::DILICOM,
'id_int_bib' => 1]);
}
/** @test */
public function WithExemplaireWithoutNoticeShouldNotFound() {
$this->assertFalse($this->_found);
}
}
class DoubleFinderWithoutAnyRecordTest extends DoubleFinderTestCase {
/** @test */
public function shouldNotFindDouble() {
......
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