Skip to content
Snippets Groups Projects
Commit 05cf33ef authored by Patrick Barroca's avatar Patrick Barroca 😁
Browse files

Merge branch...

Merge branch 'hotline#103837_probleme_d_affichage_des_disponibilites_sur_notre_catalogue' into 'hotline'

hotlne #103837 : fix bundled items detection

See merge request !3367
parents 5408bbb2 a9e4f769
3 merge requests!3370Master,!3369Hotline,!3367hotlne #103837 : fix bundled items detection
Pipeline #9150 passed with stage
in 49 minutes and 41 seconds
- ticket #103837 : Affichage notices : correction de la détection de l'appartenance des exemplaires à un lot
\ No newline at end of file
......@@ -451,6 +451,7 @@ class Class_Exemplaire extends Storm_Model_Abstract {
return null;
}
public function toRaw() {
$raw = $this->getRawAttributes() ;
// LL: pour Opsys nous avons besoin de l'identifiant de l'annexe, d'où sauvegarde pour réutilisation dans ReservationLink
......@@ -470,6 +471,7 @@ class Class_Exemplaire extends Storm_Model_Abstract {
return $this->annexe;
}
public function getNbResas() {
return $this->getSigbExemplaire()->getNbReservations();
}
......@@ -490,15 +492,15 @@ class Class_Exemplaire extends Storm_Model_Abstract {
public function getBundle() {
if (!$data_profile = $this->getDataProfile())
if ((!$id_int_bib = $this->getIdIntBib())
|| (!$data_profile = $this->getDataProfile())
|| (!$bundle_id_field = $data_profile->getBundleIdField())
|| (!$id_origine = $this->getSubfield($bundle_id_field)))
return null;
$bundle_id_field = $data_profile->getBundleIdField();
$bundle_id = $this->getSubfield($bundle_id_field);
$bundle_item = Class_Exemplaire::getLoader()
->findFirstBy(['id_int_bib' => $this->getIdIntBib(),
'id_origine' => $bundle_id]);
->findFirstBy(['id_int_bib' => $id_int_bib,
'id_origine' => $id_origine]);
return $bundle_item
? $bundle_item->getNotice()
......
......@@ -295,8 +295,7 @@ class NoticeAjaxControllerItemsCustomIconsTest
class NoticeAjaxControllerItemBelongsToBundleTest
abstract class NoticeAjaxControllerItemBundleTestCase
extends NoticeAjaxControllerItemsTestCase {
protected function _prepareFixtures() {
......@@ -304,11 +303,10 @@ class NoticeAjaxControllerItemBelongsToBundleTest
$config['exemplaires']['grouper'] = '1';
Class_Profil::getCurrentProfil()->setCfgNotice($config);
$data_profile = Class_IntProfilDonnees::forKoha()->setId(23);
$data_profile
->setItemField(Class_IntProfilDonnees::FIELD_ITEM_BUNDLE_ID,
7)
$this->_bundleIdField())
->save();
$bundled_item = $this->fixture('Class_Exemplaire',
......@@ -337,7 +335,6 @@ class NoticeAjaxControllerItemBelongsToBundleTest
'valeur' => '']])
]);
$bundle_not_exists = $this->fixture('Class_Exemplaire',
['id' => 103,
'id_bib' => 3,
......@@ -352,7 +349,7 @@ class NoticeAjaxControllerItemBelongsToBundleTest
]);
$no_bundle_field = $this->fixture('Class_Exemplaire',
['id' => 103,
['id' => 104,
'id_bib' => 3,
'id_int_bib' => 3,
'section' => 14,
......@@ -363,7 +360,6 @@ class NoticeAjaxControllerItemBelongsToBundleTest
'zone995' => serialize([[]])
]);
$this->fixture('Class_Notice',
['id' => 34,
'titre_principal' => 'La fausse malle du piège du int_bib',
......@@ -374,7 +370,6 @@ class NoticeAjaxControllerItemBelongsToBundleTest
'id_origine' => 87346])
]]);
$this->fixture('Class_Notice',
['id' => 25,
'titre_principal' => 'Se faire la malle',
......@@ -395,10 +390,56 @@ class NoticeAjaxControllerItemBelongsToBundleTest
}
protected function _bundleIdField() {
return null;
}
}
class NoticeAjaxControllerItemBelongsToBundleTest
extends NoticeAjaxControllerItemBundleTestCase {
protected function _bundleIdField() {
return 7;
}
/** @test */
public function tdShouldContainsLinkToRecordSeFaireLaMalleId25() {
$this->assertXPathContentContains('//td//a[contains(@href, "/recherche/viewnotice/id/25")]',
'Fait partie du lot "Se faire la malle"');
}
}
/** @see http://forge.afi-sa.fr/issues/103837 */
class NoticeAjaxControllerItemWithEmptyBundleIdTest
extends NoticeAjaxControllerItemBundleTestCase {
protected function _bundleIdField() {
return 7;
}
/** @test */
public function tdShouldNotContainsLinkToEmptyBundle() {
$this->assertNotXPathContentContains('//td//a', 'Fait partie du lot ""');
}
}
/** @see http://forge.afi-sa.fr/issues/103837 */
class NoticeAjaxControllerItemBelongsToBundleButWithoutBundleFieldIdTest
extends NoticeAjaxControllerItemBundleTestCase {
/** @test */
public function tdShouldNotContainsLinkToRecordSeFaireLaMalleId25() {
$this->assertNotXPathContentContains('//td//a[contains(@href, "/recherche/viewnotice/id/25")]',
'Fait partie du lot "Se faire la malle"');
}
}
\ 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