diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 40438c467a170a5d1cd928f78ab3aef76291ff3c..09e84a02fee15785c446c3f178436c6dfedfe0d7 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -238,6 +238,9 @@ class Intonation_Library_View_Wrapper_Record protected function _addAvailableBadgeTo(array $badges) : array { + if ( ! $this->_model->isSigb() || $this->_model->isUnknown()) + return $badges; + $badges[] = new Intonation_Library_AjaxAvailabilityBadge($this); return $badges; } diff --git a/tests/scenarios/OmekaS/OmekaSViewNoticeTest.php b/tests/scenarios/OmekaS/OmekaSViewNoticeTest.php index 0197ba99421dd1d912a1bc7ef26f4efd5b7c5edb..fac4b4be3ffbfcd415f7201411304250497a10a0 100644 --- a/tests/scenarios/OmekaS/OmekaSViewNoticeTest.php +++ b/tests/scenarios/OmekaS/OmekaSViewNoticeTest.php @@ -55,11 +55,16 @@ abstract class OmekaSViewNoticeTestCase extends AbstractControllerTestCase { $this->fixture(Class_Notice::class, ['id' => 1288, + 'type_doc' => 0, 'unimarc' => $unimarc->render(), 'exemplaires' => [$this->fixture(Class_Exemplaire::class, ['id' => 3, 'id_data_profile' => 117, ])]]); + + $this->fixture(Class_TypeDoc::class, + ['id' => '0', + 'label' => 'Non identifié']); } @@ -88,6 +93,13 @@ class OmekaSViewNoticeLoggedTest extends OmekaSViewNoticeTestCase { } + /** @test */ + public function pageViewNoticeShouldNotContainsBadgeRecordAvailability() { + $this->dispatch('/recherche/viewnotice/id/1288'); + $this->assertNotXPath('//span[contains(@class, "badge_record_availability")]'); + } + + /** @test */ public function pageNoticeAjaxShouldContainsButtonToViewRemoteDocument() { $this->dispatch('/noticeajax/resources/id/1288'); diff --git a/tests/scenarios/Templates/TemplatesRecordsTest.php b/tests/scenarios/Templates/TemplatesRecordsTest.php index 5871bbaa2473d194af447e36d8c952f6ca9fd453..c6ba43fb5a33bdf76f28d13d2de842bc7277addf 100644 --- a/tests/scenarios/Templates/TemplatesRecordsTest.php +++ b/tests/scenarios/Templates/TemplatesRecordsTest.php @@ -1738,7 +1738,8 @@ abstract class TemplatesRecordsNoticeajaxAvailabilityTestCase extends AbstractCo $this->_buildTemplateProfil(['id' => 3]); $this->fixture(Class_Notice::class, - ['id' => 1]); + ['id' => 1, + 'type_doc' => 1]); $this->fixture(Class_Exemplaire::class, ['id' => 1,