Commit 8195c2de authored by Patrick Barroca's avatar Patrick Barroca 😠

dev #71412 : fix double finder refacto

parent d4cd34b6
......@@ -170,7 +170,7 @@ class notice_integration {
$id_notice = $this->chercheNotice();
if($this->type_operation == 1) {
if(Class_Cosmogramme_Integration::TYPE_OPERATION_ITEM_DELETE == $this->type_operation) {
$this->statut = static::RECORD_DELETE;
if($this->format == Class_IntProfilDonnees::FORMAT_UNIMARC )
......@@ -439,9 +439,13 @@ class notice_integration {
private function chercheNotice() {
$this->identification = ['statut' => static::STATUS_NOTFOUND];
$double = new Class_Notice_DoubleFinder($this->notice,
$this->id_int_bib,
$this->id_profil);
$double_class = Class_Cosmogramme_Integration::TYPE_OPERATION_ITEM_DELETE == $this->type_operation
? 'Class_Notice_BarcodeDoubleFinder'
: 'Class_Notice_DoubleFinder';
$double = new $double_class($this->notice,
$this->id_int_bib,
$this->id_profil);
if (!$double->find())
return '';
......
<?php
/**
* Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Notice_BarcodeDoubleFinder extends Class_Notice_DoubleFinder {
public function find() {
$this->_on_barcode = null;
$this->_id = null;
if ($this->_id = $this->findByBarcodes()) {
$this->_found_on = 'code_barres';
return true;
}
return false;
}
protected function _getRecordIdByItem($conditions) {
if ($id = parent::_getRecordIdByItem($conditions))
return $id;
$founds = Class_Exemplaire::findAllBy($conditions);
if (empty($founds))
return;
foreach($founds as $found)
if ($found->isSigbLoanable())
return $found->getIdNotice();
}
}
\ No newline at end of file
......@@ -108,15 +108,12 @@ class Class_Notice_DoubleFinder {
protected function _getRecordIdByItem($conditions) {
$founds = Class_Exemplaire::findAllBy($conditions);
if(empty($founds))
if (empty($founds))
return;
foreach($founds as $found)
if($this->_data->gettype_doc() == $found->getTypeDoc())
if ($this->_data->gettype_doc() == $found->getTypeDoc())
return $found->getIdNotice();
if (0 == $this->_data->gettype_doc())
return $founds[0]->getIdNotice();
}
......
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