Commit a67f5e1e authored by Ghislain Loas's avatar Ghislain Loas

Merge branch…

Merge branch 'hotline#97326_minsoc_incoherences_entre_les_listes_publiques_koha_et_les_paniers_des_professionnels_bokeh' into 'master'

hotline#97326 : lists were desynchronized between ILS and Bokeh

See merge request !3312
parents 1c81b3a3 2effe62f
Pipeline #8764 passed with stage
in 44 minutes and 17 seconds
......@@ -201,11 +201,7 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action {
return $this->_redirect("admin/catalogue/index");
if ($id_panier_to_remove = (int)$this->_getParam('remove')) {
$panier = Class_PanierNotice::find($id_panier_to_remove);
$catalogue->removePanierNotice($panier)->save();
$panier->removeCatalogue($catalogue)->save();
$this->_helper->notify($this->_('Panier "%s" retiré', $panier->getLibelle()));
$this->_removePanierFromCatalogue($id_panier_to_remove,$catalogue);
return $this->_redirect('admin/catalogue/paniers/id_catalogue/' . $catalogue->getId());
}
......@@ -229,6 +225,16 @@ class Admin_CatalogueController extends ZendAfi_Controller_Action {
}
protected function _removePanierFromCatalogue($panier_id,$catalogue){
$panier = Class_PanierNotice::find($panier_id);
if (!$panier)
return;
$catalogue->removePanierNotice($panier)->save();
$panier->removeCatalogue($catalogue)->save();
$this->_helper->notify($this->_('Panier "%s" retiré', $panier->getLibelle()));
}
protected function formAjoutPanier($catalogue) {
$options = ['' => $this->_('Veuiller sélectionner un panier')];
$paniers = Class_PanierNotice::findAllBelongsToAdmin();
......
......@@ -175,5 +175,6 @@ class Class_Cosmogramme_Integration_PhasePanier extends Class_Cosmogramme_Integr
protected function _afterFileProcessed($integration) {
$cart_todelete = Class_PanierNotice::deleteBy(['notices'=>"", 'id_int_bib'=>$integration->getIdBib()]);
}
}
......@@ -105,4 +105,4 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_
protected function _getWrapper() {
return 'Intonation_Library_View_Wrapper_Record';
}
}
\ No newline at end of file
}
......@@ -186,15 +186,8 @@ class PhasePanierKohaSameIdOrigineTest extends PhasePanierKohaTestCase {
/** @test */
public function fourthBasketRecordsShouldBeEmpty() {
$this->assertEmpty(Class_PanierNotice::find(4)->getClesNotices());
}
/** @test */
public function fourthBasketIntegrationHashShouldBe577f79a2c26968b6f5e1360df0dc17af() {
$this->assertEquals('577f79a2c26968b6f5e1360df0dc17af',
Class_PanierNotice::find(4)->getIntegrationHash());
public function fourthBasketRecordsShouldBeDeleted() {
$this->assertEmpty(Class_PanierNotice::find(4));
}
......@@ -234,8 +227,8 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase {
/** @test */
public function numberOfBasketsShouldBeTen() {
$this->assertCount(10, Class_PanierNotice::findAll());
public function numberOfBasketsShouldBeEight() {
$this->assertCount(8, Class_PanierNotice::findAll());
}
......@@ -281,11 +274,6 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase {
}
/** @test */
public function basketTitiShouldBeEmpty() {
$this->assertEmpty(Class_PanierNotice::findFirstBy(['id_sigb' => 7])->getClesNotices());
}
/** @test */
public function litteratureShouldHave1Item() {
......@@ -325,6 +313,13 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase {
public function missingIDAbonWithEmailShouldBeOk(){
$this->assertEquals('tintin', Class_PanierNotice::findFirstBy(['libelle' => 'bd,texte'])->getUser()->getLogin());
}
/* cf. https://forge.afi-sa.net/issues/97326 */
/** @test */
public function emptyCart7RelatedToIntBib2ShouldBeDeleted(){
$this->assertEquals(null,Class_PanierNotice::find(7));
}
}
......@@ -342,6 +337,8 @@ class PhasePanierFullImportWithCSVSemicolonTest extends PhasePanierFullImportTes
'format' => Class_IntProfilDonnees::FORMAT_SEMI_COLON_ASCII,
'attributs' => [3 => ['champs' => 'ID_SIGB;LIBELLE;IDABON;MAIL;ROLE;ID_NOTICE_SIGB']]]);
Class_PanierNotice::find(4)->setIntegrationHash('998745bb68ef9ab13b4de262b444e5d1')->save();
Class_Cosmogramme_Integration::find(999)
->setFichier('baskets-semicolon.txt')
->setProfilDonnees(Class_IntProfilDonnees::find(103))
......@@ -363,6 +360,7 @@ class PhasePanierFullImportWithCSVPipedTest extends PhasePanierFullImportTest {
'format' => Class_IntProfilDonnees::FORMAT_PIPED_ASCII,
'attributs' => [3 => ['champs' => 'ID_SIGB;LIBELLE;IDABON;MAIL;ROLE;ID_NOTICE_SIGB']]]);
Class_PanierNotice::find(4)->setIntegrationHash('279f738e761e127ec19ca08cec9386ce')->save();
Class_Cosmogramme_Integration::find(999)
->setFichier('baskets-piped.txt')
->setProfilDonnees(Class_IntProfilDonnees::find(104))
......@@ -456,6 +454,7 @@ class PhasePanierNanookTest extends PhasePanierTestCase {
$this->fixture('Class_Notice',
['id' => 23,
'type_doc' => Class_TypeDoc::LIVRE,
'clef_alpha' => 'CASTAFIORE',
'exemplaires' => [$this->fixture('Class_Exemplaire',
['id' => 231,
......
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