Skip to content
Snippets Groups Projects

Hotline#30476 recover integration counter

Merged Ghost User requested to merge hotline#30476_recover_integration_counter into hotline-master
Compare and
+ 329
62
Preferences
Compare changes
Files
@@ -146,7 +146,7 @@ class notice_integration {
global $sql;
$id_bib=$this->id_bib;
if(! $this->analyseur ) return false;
$this->statut=0;
$this->statut = static::RECORD_REJECT;
$this->erreur="";
unset($this->notice);
@@ -169,7 +169,7 @@ class notice_integration {
// Traiter le type d'operation : suppressions
if($this->type_operation == 1)
{
$this->statut=2;
$this->statut = static::RECORD_DELETE;
if($this->format == 0 )$this->supprimerNotice($id_notice,$this->notice["id_origine"]);
else $this->supprimerExemplaire($id_notice,$this->notice["exemplaires"][0]);
return;
@@ -177,7 +177,7 @@ class notice_integration {
// Notice a supprimer
if($this->notice["statut"]==1)
{
$this->statut=2;
$this->statut = static::RECORD_DELETE;
$this->supprimerNotice($id_notice,$this->notice["id_origine"]);
return;
}
@@ -236,7 +236,7 @@ class notice_integration {
$this->notice["qualite"]=$this->qualite_bib;
$id_notice=$this->insertNotice();
if(!$id_notice) return;
else $this->statut=1;
else $this->statut = static::RECORD_INSERT;
} else {
$this->updateNoticeWithId($id_notice);
@@ -501,7 +501,7 @@ class notice_integration {
private function insertNotice() {
if(!$this->notice["statut_exemplaires"]["nb_ex"]) {
$this->erreur = "notice sans exemplaire";
$this->statut = 0;
$this->statut = static::RECORD_REJECT;
return false;
}
@@ -514,12 +514,12 @@ class notice_integration {
'data' => serialize($this->notice)])
->save();
$this->statut=7;
$this->statut = static::RECORD_SUCCINCT;
return false;
}
if($this->format == 0 or $this->format==10) $this->erreur="pas de titre principal";
else $this->erreur="Aucun identifiant valide";
$this->statut=0;
$this->statut = static::RECORD_REJECT;
return false;
}
@@ -528,7 +528,7 @@ class notice_integration {
$notice = Class_Notice::newInstance($this->noticeToDBEnreg());
$notice->save();
$this->statut=1;
$this->statut = static::RECORD_INSERT;
return $notice->getId();
}
@@ -658,29 +658,29 @@ class notice_integration {
foreach($valeurs as $valeur)
$this->notice_sgbd->add_zone($zone,$valeur);
$this->statut = 3;
$this->statut = static::RECORD_FULLUPDATE;
}
// --------------------------------------------------------------------------------
// Suppression de notice (ne supprime pas l'enreg notice)
// --------------------------------------------------------------------------------
private function supprimerNotice($id_notice,$id_origine)
{
global $sql;
$id_bib=$this->id_bib;
if(!$id_notice)
{
// On cherche par id_origine
if($id_origine) $id_notice=$sql->fetchOne("select id_notice from exemplaires where id_origine='$id_origine'and id_bib=$id_bib");
if(!$id_notice)
{
$this->statut=0;
$this->erreur="notice à supprimer non reconnue";
return false;
private function supprimerNotice($id_notice,$id_origine) {
foreach (['id_notice' => $id_notice,
'id_origine' => $id_origine] as $key => $value) {
if ($exemplaires = Class_Exemplaire::findAllBy([$key => $value,
'id_bib' => $this->id_bib])) {
foreach ($exemplaires as $exemplaire)
$exemplaire->delete();
return;
}
}
$sql->execute( "delete from exemplaires where id_notice=$id_notice and id_bib=$id_bib");
$this->statut = static::RECORD_REJECT;
$this->erreur="notice à supprimer non reconnue";
return false;
}
@@ -731,7 +731,7 @@ class notice_integration {
public function supprimerExemplaire($id_notice,$ex) {
if(!$id_notice) {
$this->statut=0;
$this->statut = static::RECORD_REJECT;
$this->erreur="notice de l'exemplaire à supprimer non trouvée";
return false;
}
@@ -740,7 +740,7 @@ class notice_integration {
'id_int_bib' => $this->id_int_bib,
'code_barres' => $ex['code_barres']]);
if(!$exemplaires) {
$this->statut=0;
$this->statut = static::RECORD_REJECT;
$this->erreur="code-barres à supprimer non trouvé";
return false;
}
@@ -988,7 +988,7 @@ class notice_integration {
$controle = $sql->execute("delete from notices_articles where clef_chapeau='$clef_chapeau' and clef_numero='$clef_numero' and clef_article='$clef_article'" );
if(!$controle) {
$this->statut = 0;
$this->statut = static::RECORD_REJECT;
$this->erreur = "notice à supprimer non reconnue";
}
}
@@ -1359,6 +1359,11 @@ class notice_integration {
$this->_service_runner = $runner;
return $this;
}
public function getStatut() {
return $this->statut;
}
}