Commit 71edd5f9 authored by Patrick Barroca's avatar Patrick Barroca 🐧

hotline #88224 : for Nanook remove items with same barcode but different record id

parent c4856400
- ticket #88224 : SIGB Nanook : Amélioration de la prise en charge dans Bokeh du dédoublonnage effectué dans le SIGB
\ No newline at end of file
......@@ -94,7 +94,26 @@ class Class_Notice_DoubleFinder {
if ($this->_barcode_uniq_mode == Class_CosmoVar::UNIQ_BARCODE_WITHIN_LIBRARY)
$conditions['id_int_bib'] = (int) $this->_library->getId();
return $this->_getRecordIdByItem($conditions);
if (($this->_double_mode != Class_CosmoVar::DOUBLE_SEARCH_NONE)
|| !$this->_library->isPergame())
return $this->_getRecordIdByItem($conditions);
$conditions['type'] = Class_Notice::TYPE_BIBLIOGRAPHIC;
$founds = Class_Exemplaire::findAllBy($conditions);
if (empty($founds))
return;
foreach($founds as $found) {
if ($this->_data->gettype_doc() != $found->getTypeDoc())
continue;
if ($this->_data->getid_origine() != $found->getIdOrigine()) {
$found->delete();
continue;
}
return $found->getIdNotice();
}
}
......
......@@ -22,7 +22,6 @@
abstract class DoubleFinderTestCase extends ModelTestCase {
protected
$_storm_default_to_volatile = true,
$_data = ['type_doc' => Class_TypeDoc::LIVRE],
$_library_id = 1,
$_finder,
......@@ -304,4 +303,52 @@ class DoubleFinderWithExistingIdOrigneNoDedupModeForNanookTestTest extends Doubl
public function shouldHaveMatchedIdOrigine() {
$this->assertEquals('id_origine', $this->_finder->getMatchedCriteria());
}
}
/** @see #88224 */
class DoubleFinderWithExistingCodeBarreInRemotelyDeletedRecordNoDedupModeForNanookTest
extends DoubleFinderWithRecordMatchingTestCase {
protected $_data = ['type_doc' => Class_TypeDoc::LIVRE,
'id_origine' => '88903',
'statut_exemplaires' => ['nb_ex' => 1],
'exemplaires' => [ [ 'code_barres' => 'CLJ0003D82' ] ]];
protected function _prepareFixtures() {
parent::_prepareFixtures();
$this->fixture('Class_IntBib',
['id' => 1,
'sigb' => Class_IntBib::SIGB_NANOOK]);
$this->fixture('Class_CosmoVar',
['id' => Class_Notice_DoubleFinder::VAR_DOUBLE_MODE,
'valeur' => Class_CosmoVar::DOUBLE_SEARCH_NONE]);
$this->fixture('Class_Notice',
['id' => 55,
'type_doc' => Class_TypeDoc::LIVRE,
'isbn' => '2-85868-161-9',
'clef_alpha' => 'JESUISNEBONHOMME--SARA--EDTHIERRYMAGNIER-2010-1',
'exemplaires' => [ $this->fixture('Class_Exemplaire',
['id' => 4,
'id_origine' => '99283087',
'code_barres' => 'CLJ0003D82',
'id_int_bib' => 1,
])]]);
}
/** @test */
public function shouldHaveMatchedIdOrigine() {
$this->assertEquals('id_origine', $this->_finder->getMatchedCriteria());
}
/** @test */
public function itemInPreviousRecordShouldBeDeleted() {
$this->assertNull(Class_Exemplaire::find(4));
}
}
\ 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