Commit 55baf019 authored by Laurent's avatar Laurent Committed by Patrick Barroca

hotline #89128 fix label and inconsistency of cosmo var unicite_code_barres

parent 4c048e87
- ticket #89128 : Cosmogramme : Correction du libellé de la variable "unicite_code_barres"
\ No newline at end of file
......@@ -736,10 +736,13 @@ class notice_integration {
}
if (!empty($code_barres)) {
$unicite_codes_barres = getVariable('unicite_code_barres');
$delete_duplicates_args = ($unicite_codes_barres == '1') ? [] : ['id_int_bib' => $this->id_int_bib];
$delete_duplicates_args['id_notice'] = $id_notice;
$delete_duplicates_args['code_barres'] = $code_barres;
$unicite_codes_barres = Class_CosmoVar::get(Class_Notice_DoubleFinder::VAR_BARCODE_UNIQ_MODE);
$delete_duplicates_args = ['id_notice' => $id_notice,
'code_barres' => $code_barres];
if ($unicite_codes_barres == Class_CosmoVar::UNIQ_BARCODE_WITHIN_LIBRARY)
$delete_duplicates_args['id_int_bib'] = $this->id_int_bib;
Class_Exemplaire::deleteBy($delete_duplicates_args);
}
......
<?php
$adapter = Zend_Db_Table_Abstract::getDefaultAdapter();
try {
$adapter->query("UPDATE `variables` SET liste='0:Code-barres uniquement\r\n1:Bibliothèque + codes-barres' WHERE clef='unicite_code_barres'");
} catch(Exception $e) {}
......@@ -32,7 +32,7 @@ abstract class CarthameIntegrationTestCase extends NoticeIntegrationTestCase {
'non_exportable'=> 'electre;decitre;gam;zebris',
'controle_codes_barres'=> 0,
'unimarc_zone_titre' => '200$a;461$t',
'unicite_code_barres' => 0,
'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY,
'champs_sup' => '',
'ean_345' => ''];
foreach($vars as $key => $value)
......
......@@ -24,7 +24,13 @@ require_once 'NoticeIntegrationTest.php';
abstract class NoticeIntegrationAloesTestCase extends NoticeIntegrationTestCase {
public function getProfilDonnees() {
public function setUp() {
parent::setUp();
Class_CosmoVar::setValueOf('unicite_code_barres', Class_CosmoVar::UNIQ_BARCODE_WITHIN_LIBRARY);
}
public function getProfilDonnees() {
return Class_IntProfilDonnees::forALOES()
->setIdProfil(111)
->getRawAttributes();
......@@ -32,6 +38,7 @@ abstract class NoticeIntegrationAloesTestCase extends NoticeIntegrationTestCase
}
class NoticeIntegrationAloes11septembre2001Test extends NoticeIntegrationAloesTestCase {
public function getProfilDonnees() {
return Class_IntProfilDonnees::forALOES()
......@@ -275,7 +282,7 @@ class NoticeIntegrationAloesDimancheALaPiscineTest extends NoticeIntegrationAloe
->setIdProfil(111)
->setItemField(Class_IntProfilDonnees::FIELD_ITEM_EMPLACEMENT, 'u')
->getRawAttributes();
}
}
public function setUp() {
......@@ -302,7 +309,7 @@ class NoticeIntegrationAloesDimancheALaPiscineTest extends NoticeIntegrationAloe
'id_bib' => 4,
'invisible' => 0]);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Exemplaire');
$this->onLoaderOfModel('Class_Exemplaire');
$this->loadNotice("unimarc_dimanche_a_la_piscine");
}
......
......@@ -63,7 +63,7 @@ class NoticeIntegrationDedupWithoutIsbnTest extends NoticeIntegrationTestCase {
'non_exportable'=> 'electre;decitre;gam;zebris',
'controle_codes_barres'=> 0,
'unimarc_zone_titre' => '200$a;461$t',
'unicite_code_barres' => 0,
'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY,
'champs_sup' => '',
'ean_345' => '']);
......@@ -96,7 +96,7 @@ class NoticeIntegrationDedupSameUnimarcLoadedTest extends NoticeIntegrationTestC
'non_exportable'=> 'electre;decitre;gam;zebris',
'controle_codes_barres'=> 0,
'unimarc_zone_titre' => '200$a;461$t',
'unicite_code_barres' => 0,
'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY,
'champs_sup' => '',
'ean_345' => '']);
......@@ -171,7 +171,7 @@ class NoticeIntegrationDedupCaliceWithoutIsbnTest extends NoticeIntegrationTestC
'non_exportable'=> 'electre;decitre;gam;zebris',
'controle_codes_barres' => 1,
'unimarc_zone_titre' => '200$a;461$t',
'unicite_code_barres' => 0,
'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY,
'champs_sup' => '',
'ean_345' => 1]);
......@@ -184,3 +184,69 @@ class NoticeIntegrationDedupCaliceWithoutIsbnTest extends NoticeIntegrationTestC
$this->assertEquals(2, Class_Notice::count());
}
}
/** @see http://forge.afi-sa.fr/issues/89128 */
class NoticeIntegrationDedupOnBarcodeWithinLibraryTest extends NoticeIntegrationTestCase {
public function getProfilDonnees() {
return Class_IntProfilDonnees::forPMB()
->setIdProfil(113)
->getRawAttributes();
}
public function setUp() {
parent::setUp();
$this->fixture('Class_Notice',
['id' => 30,
'type_doc' => 1,
'alpha_titre' => 'ACTUALITE DU VIRTUEL',
'alpha_auteur' => 'FR BNF',
'titres' => 'ACTUALITE AKTUALIT VIRTUEL',
'auteurs' => 'BNF',
'editeur' => '[Centre national d\'art et de culture Georges-Pompidou (Paris)]',
'isbn' => '978-2-7189-6666-4',
'unimarc' => '',
'ean' => null,
'id_commerciale' => '',
'id_bnf' => '',
'clef_alpha' => 'ACTUALITEDUVIRTUEL--FRB--CENTRENATIONALDARTETDECULTUREGEORGESPOMPIDOUPARIS-1997-5',
'clef_oeuvre' => 'ACTUALITEDUVIRTUEL--FRB-',
'clef_chapeau' => '',
'qualite' => 10,
'date_creation' => '2015-05-02 00:00:00',
'date_maj' => '2015-09-13 13:22:53',
'url_vignette' => Class_WebService_Vignette::NO_DATA,
'url_image' => Class_WebService_Vignette::NO_DATA]);
$this->fixture('Class_Exemplaire',
['id' => 23,
'id_notice' => 30,
'code_barres' => '18120',
'id_int_bib' => 6]);
}
/** @test */
public function withUniciteCodeBarresOnlyNumberOfRecordsShouldBeOne() {
Class_CosmoVar::set(Class_Notice_DoubleFinder::VAR_BARCODE_UNIQ_MODE,
Class_CosmoVar::UNIQ_BARCODE_ONLY);
$this->loadNotice('unimarc_pmb_pierres');
$this->assertCount(1, Class_Notice::findAll());
$this->assertCount(1, Class_Exemplaire::findAll());
}
/** @test */
public function withUniciteCodeBarresWithLibraryNumberOfRecordsShouldBeTwo() {
Class_CosmoVar::set(Class_Notice_DoubleFinder::VAR_BARCODE_UNIQ_MODE,
Class_CosmoVar::UNIQ_BARCODE_WITHIN_LIBRARY);
$this->loadNotice('unimarc_pmb_pierres');
$this->assertCount(2, Class_Notice::findAll());
$this->assertCount(2, Class_Exemplaire::findAll());
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ class NoticeIntegrationSuccinteTest extends ModelTestCase {
'non_exportable'=> 'electre;decitre;gam;zebris',
'controle_codes_barres'=> 0,
'unimarc_zone_titre' => '200$a;461$t',
'unicite_code_barres' => 0,
'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY,
'champs_sup' => '',
'ean_345' => '',
'Z3950_cache_only' => '0',
......@@ -104,7 +104,7 @@ class NoticeIntegrationSuccinteTest extends ModelTestCase {
'statut_z3950' => "3",
'serveur' => "Bnf",
'erreur' => false,
'unimarc' => '01075cjm 22002893 450 001002100000009004700021020001700068021005400085071004100139073001800180100004100198101000800239102000700247126002500254200007900279210006800358215004700426306003500473608002100508608001600529608003500545686007000580700003600650716002900686801003900715930003100754FRBNF400642570000008http://catalogue.bnf.fr/ark:/12148/cb400642576 aFRb70601036 5FR-759999999:SDC 12-202181aFRbDLS-20051103-917001bInsideOutMusicaSPV 48622 CDcboite 0a0693723486222 a20051103d2005 u y0frey50 ba0 aeng aDE aaguxhxx||||||cdbbex1 a?bEnregistrement sonorefNeal Morse, chant, guit., claviers [acc. instr.] aKlevecInsideOutMusica[Paris]c[distrib. Wagram music]dP 2005 a1 disque compact (56 min 26 s)e1 brochure aProd. : InsideOutMusic, P 2005 arock, pop2frTAV arock2frTAV aedition phonographique2frTAV a1062Cadre de classement de la Bibliographie nationale francaise |314208951aMorsebNeal47214545 314032403aInsideOutMusic 0aFRbBNFc20051103gAFNOR2intermrc 5FR-759999999:SDC 12-202181'])
'unimarc' => '01075cjm 22002893 450 001002100000009004700021020001700068021005400085071004100139073001800180100004100198101000800239102000700247126002500254200007900279210006800358215004700426306003500473608002100508608001600529608003500545686007000580700003600650716002900686801003900715930003100754FRBNF400642570000008http://catalogue.bnf.fr/ark:/12148/cb400642576 aFRb70601036 5FR-759999999:SDC 12-202181aFRbDLS-20051103-917001bInsideOutMusicaSPV 48622 CDcboîte 0a0693723486222 a20051103d2005 u y0frey50 ba0 aeng aDE aaguxhxx||||||cdbbex1 a?bEnregistrement sonorefNeal Morse, chant, guit., claviers [acc. instr.] aKlevecInsideOutMusica[Paris]c[distrib. Wagram music]dP 2005 a1 disque compact (56 min 26 s)e1 brochure aProd. : InsideOutMusic, P 2005 arock, pop2frTAV arock2frTAV aÉdition phonographique2frTAV a1062Cadre de classement de la Bibliographie nationale française |314208951aMorsebNeal47214545 314032403aInsideOutMusic 0aFRbBNFc20051103gAFNOR2intermrc 5FR-759999999:SDC 12-202181'])
->beStrict())
->traiteSuccinte($succinte);
......
......@@ -92,7 +92,7 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase {
'non_exportable'=> 'electre;decitre;gam;zebris',
'controle_codes_barres'=> 0,
'unimarc_zone_titre' => '200$a;461$t',
'unicite_code_barres' => 0,
'unicite_code_barres' => Class_CosmoVar::UNIQ_BARCODE_ONLY,
'champs_sup' => '',
'ean_345' => ''])
->setListeCache(['nature_docs'=> "1:Collection\r\n2:Dataset\r\n3:Event\r\n4:Image",
......
01446nam0 22002291i 450 0010005000001000035000050090015000402000087000550100031001421010008001732150018001813270010001993190028002097000028002377020043002652100040003082250039003484100039003878960186004269950085006129960519006972872 a20101012u u u0frey50  a1979-01-011 aCes pierres qui attendentePour un dialogue entre l'hindouisme et le christianisme a978-2-7189-0137-4dE 28.200 afre a268 p.d20 cm aIndex aAucun droit spécifique 1aCocagnacbA.M.9id:2149 1aDorébJoseph4080f1936-....9id:1123 aParisbPariscDescléed19799id:412 aJésus et Jésus-Christv89id:201 0tJésus et Jésus-Christv89id:201 ahttps://brieuc.bibliossimo.net/pmb/opac_css/getimage.php?url_image=http%3A%2F%2Fimages-eu.amazon.com%2Fimages%2FP%2F%21%21isbn%21%21.08.MZZZZZZZ.jpg&noticecode=9782718901374&vigurl= aMédiathèque Saint-YvescMédiathèque Saint-Yvesf18120kC274ruuqCollections f18120kC274m00000000n00000000aMédiathèque Saint-Yvesb1vSalle RuffeletxCollectionsyCollectionseLivre1Empruntable319expl_id:191029create_date:2014-03-04 10:31:219expl_cb:181209expl_cote:C2749expl_statut:19statut_libelle:Empruntable9expl_typdoc:19tdoc_libelle:Livre9expl_section:19section_libelle:Collections9sdoc_codage_import:Collections9expl_owner:19lender_libelle:Médiathèque Saint-Yves9codestat_libelle:Exemplaires9pret_flag:19location_libelle:Salle Ruffelet9locdoc_codage_import:8
\ No newline at end of file
......@@ -105,6 +105,9 @@ class Class_CosmoVar extends Storm_Model_Abstract {
const DOUBLE_SEARCH_ALPHA_KEY = 1;
const DOUBLE_SEARCH_IDS = 0;
const UNIQ_BARCODE_ONLY = 0;
const UNIQ_BARCODE_WITHIN_LIBRARY = 1;
const PICKUP_LOCATION_ITEM = 0;
const PICKUP_LOCATION_CHOICE = 1;
const PICKUP_LOCATION_PATRON = 2;
......
......@@ -21,8 +21,9 @@
class Class_Notice_DoubleFinder {
const VAR_BARCODE_UNIQ_MODE = 'unicite_code_barres';
const VAR_DOUBLE_MODE = 'mode_doublon';
const
VAR_BARCODE_UNIQ_MODE = 'unicite_code_barres',
VAR_DOUBLE_MODE = 'mode_doublon';
protected
$_barcode_uniq_mode,
......@@ -90,7 +91,7 @@ class Class_Notice_DoubleFinder {
return;
$conditions = ['code_barres' => $item['code_barres']];
if ($this->_barcode_uniq_mode == '1')
if ($this->_barcode_uniq_mode == Class_CosmoVar::UNIQ_BARCODE_WITHIN_LIBRARY)
$conditions['id_int_bib'] = (int) $this->_library->getId();
return $this->_getRecordIdByItem($conditions);
......
......@@ -2625,6 +2625,7 @@ class UpgradeDB_371_Test extends UpgradeDBTestCase {
class UpgradeDB_372_Test extends UpgradeDBTestCase {
public function prepare() {
$this->dropTable('rendez_vous_user_notification');
......@@ -2674,4 +2675,22 @@ class UpgradeDB_372_Test extends UpgradeDBTestCase {
public function shouldHavePrimaryId() {
$this->assertPrimary('rendez_vous_user_notification', 'id');
}
}
class UpgradeDB_373_Test extends UpgradeDBTestCase {
public function prepare() {
$this->silentQuery("UPDATE `variables` SET liste='0:Bibliothèque + codes-barres\r\n1:Code-barres uniquement' WHERE clef='unicite_code_barres'");
}
/** @test */
public function firstOptionShouldBeBarcodeOnlyThenWithBib() {
$this->assertEquals(['0' => 'Code-barres uniquement',
'1' => 'Bibliothèque + codes-barres'],
Class_CosmoVar::getList('unicite_code_barres'));
}
}
\ No newline at end of file
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