From cbda8e6dc9b5c91141f87ea84a479feb5f36f5f9 Mon Sep 17 00:00:00 2001 From: efalcy <efalcy@afi-sa.fr> Date: Tue, 13 Nov 2018 10:41:12 +0100 Subject: [PATCH] hotline #81316 : fix integration --- .../php/classes/classe_notice_integration.php | 473 +++++++++--------- 1 file changed, 233 insertions(+), 240 deletions(-) diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 88698f24796..012c58dc912 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -176,13 +176,13 @@ class notice_integration { $id_notice = $this->chercheNotice(); if(Class_Cosmogramme_Integration::TYPE_OPERATION_ITEM_DELETE == $this->type_operation) { - $this->statut = static::RECORD_DELETE; + $this->statut = static::RECORD_DELETE; - if($this->format == Class_IntProfilDonnees::FORMAT_UNIMARC ) - $this->supprimerNotice($id_notice,$this->notice["id_origine"]); - else - $this->supprimerExemplaire($id_notice,$this->notice["exemplaires"][0]); - return; + if($this->format == Class_IntProfilDonnees::FORMAT_UNIMARC ) + $this->supprimerNotice($id_notice,$this->notice["id_origine"]); + else + $this->supprimerExemplaire($id_notice,$this->notice["exemplaires"][0]); + return; } if($this->notice["statut"] == 1) { @@ -289,15 +289,15 @@ class notice_integration { // Statut ok : on remplace la notice if(!$this->analyseur) $this->analyseur=new notice_unimarc(); if($ret["statut_z3950"] > "1") - { - $this->analyseur->ouvrirNotice($ret["unimarc"], - $args['isbn'] - ? profil_donnees::HOMOGENIZATION_ISBN - : profil_donnees::HOMOGENIZATION_EAN); - $this->notice=$this->analyseur->getNoticeIntegration(); - $qualite=getVariable("homogene_code_qualite"); - $this->updateNotice($id_notice,$qualite); - } + { + $this->analyseur->ouvrirNotice($ret["unimarc"], + $args['isbn'] + ? profil_donnees::HOMOGENIZATION_ISBN + : profil_donnees::HOMOGENIZATION_EAN); + $this->notice=$this->analyseur->getNoticeIntegration(); + $qualite=getVariable("homogene_code_qualite"); + $this->updateNotice($id_notice,$qualite); + } return $ret; } @@ -597,7 +597,7 @@ class notice_integration { if (in_array($this->format, [ Class_IntProfilDonnees::FORMAT_DUBLIN_CORE, - Class_IntProfilDonnees::FORMAT_BIBLIONDEMAND])) + Class_IntProfilDonnees::FORMAT_BIBLIONDEMAND])) return $this->_realUpdate($existing_notice); // Zones forcees @@ -698,7 +698,7 @@ class notice_integration { 'id_origine' => $id_origine] as $key => $value) { if ($exemplaires = Class_Exemplaire::findAllBy([$key => $value, - 'id_bib' => $this->id_bib])) { + 'id_bib' => $this->id_bib])) { foreach ($exemplaires as $exemplaire) $exemplaire->delete(); @@ -806,28 +806,28 @@ class notice_integration { // Dewey $this->notice["full_dewey"] = ''; if($this->notice["dewey"]) - { - foreach($this->notice["dewey"] as $indice) { - if (!$dewey = Class_CodifDewey::find($indice)) { - $dewey = Class_CodifDewey::newInstance(['id_dewey' => $indice, - 'libelle' => '']); - $dewey->save(); - } + foreach($this->notice["dewey"] as $indice) + { + if (!$dewey = Class_CodifDewey::find($indice)) { + $dewey = Class_CodifDewey::newInstance(['id_dewey' => $indice, + 'libelle' => '']); + $dewey->save(); + } - $this->notice["full_dewey"] .= $dewey->getLibelle()." "; - $facettes[]="D".$indice; + $this->notice["full_dewey"] .= $dewey->getLibelle()." "; + $facettes[]="D".$indice; + } } - } // Pcdm4 if($this->notice["pcdm4"]) { $indice = $this->notice["pcdm4"]; if (!$pcdm4 = Class_CodifPcdm4::find($indice)) { - $pcdm4 = Class_CodifPcdm4::newInstance(['id_pcdm4' => $indice, - 'libelle' => '']); - $pcdm4->save(); + $pcdm4 = Class_CodifPcdm4::newInstance(['id_pcdm4' => $indice, + 'libelle' => '']); + $pcdm4->save(); } $this->notice["full_dewey"] .= $pcdm4->getLibelle()." "; @@ -849,12 +849,12 @@ class notice_integration { // Auteurs if($this->notice["auteurs"]) - { - foreach($this->notice["auteurs"] as $auteur) { - if ($facette_auteur= $this->getFacetteAuteur($auteur)) - $facettes []= $facette_auteur; + { + foreach($this->notice["auteurs"] as $auteur) { + if ($facette_auteur= $this->getFacetteAuteur($auteur)) + $facettes []= $facette_auteur; + } } - } // Matieres if($this->notice["matieres"]) { @@ -883,30 +883,30 @@ class notice_integration { // Langues if($this->notice["langues"]) - { - foreach($this->notice["langues"] as $langue) { - if (Class_CodifLangue::find($langue)) - $facettes[]="L".$langue; - else - $this->notice["warnings"][]=array("Code langue non reconnu",$langue); + foreach($this->notice["langues"] as $langue) + { + if (Class_CodifLangue::find($langue)) + $facettes[]="L".$langue; + else + $this->notice["warnings"][]=array("Code langue non reconnu",$langue); + } } - } // genres if(isset($this->notice["genres"]) && count($this->notice["genres"])) - { - foreach(array_filter($this->notice["genres"]) as $genre) { - $facettes[]="G".$genre." "; - if ($codif_genre = Class_CodifGenre::find($genre)) - $this->notice["full_dewey"].=$codif_genre->getLibelle(); + foreach(array_filter($this->notice["genres"]) as $genre) + { + $facettes[]="G".$genre." "; + if ($codif_genre = Class_CodifGenre::find($genre)) + $this->notice["full_dewey"].=$codif_genre->getLibelle(); + } } - } // emplacements if (isset($this->notice["emplacements"]) && count($this->notice['emplacements'])) - $facettes = array_merge($facettes, array_map(function($e) { return "E$e";}, $this->notice['emplacements'])); + $facettes = array_merge($facettes, array_map(function($e) { return "E$e";}, $this->notice['emplacements'])); // Maj enreg facette $this->notice["facettes"] = trim(implode(' ', array_unique($facettes))); @@ -953,7 +953,6 @@ class notice_integration { $article = Class_Notice_SerialArticles::findFirstBy(['clef_unimarc' => $this->notice['clef_unimarc']]); } - if(!$this->notice['clef_unimarc']) { $common_attribs = ['clef_chapeau' => $this->notice['clef_chapeau'], 'clef_numero' => $this->notice['clef_numero']]; @@ -961,21 +960,15 @@ class notice_integration { if(!$article = Class_Notice_SerialArticles::findFirstBy(array_merge($common_attribs, ['clef_unimarc' => $title_key]))) $article = Class_Notice_SerialArticles::findFirstBy(array_merge($common_attribs, ['clef_article' => $this->notice['clef_article'], 'clef_unimarc' => ''])); } - if (! $article) - $article = Class_Notice_SerialArticles::newInstance($values); - return $article->save(); - } - - - protected function updateOrInsertArticle($article, $article_from_record) { - return $article - ? $this->updateArticleWith($article, $article_from_record) - : $this->insertArticleWith($article_from_record); + if (! $article) { + return $this->insertArticleWith($values); + } + return updateArticleWith($article,$values); } protected function insertArticleWith($article_from_record) { - Class_Notice_SerialArticles::newInstance($article_from_record->toArray())->save(); + Class_Notice_SerialArticles::newInstance($article_from_record)->save(); Class_Notice_SerialArticles::clearCache(); $this->statut = self::RECORD_INSERT; return; @@ -983,8 +976,8 @@ class notice_integration { protected function updateArticleWith($article, $article_from_record) { - if($enreg["qualite"] >= $article->getQualite()) { - $article->updateAttributes($article_from_record->toArray())->save(); + if($article_from_record["qualite"] >= $article->getQualite()) { + $article->updateAttributes($article_from_record)->save(); $this->statut = self::RECORD_RENEW; } } @@ -1053,7 +1046,7 @@ class notice_integration { $this->analyseur->ouvrirNotice($data,$this->id_profil,$this->sigb); $notice=$this->analyseur->getNoticeIntegration(); - // tracedebug($notice,true); //++++++++++++++++++++++++++++++++++++++++++++++++++++ + // tracedebug($notice,true); //++++++++++++++++++++++++++++++++++++++++++++++++++++ // Titre principal $ret["titre"]=$notice["titre_princ"]; @@ -1062,12 +1055,12 @@ class notice_integration { if($piege_numero){$ret["statut"]=0; return $ret;} if($piege_titre >"" and $this->indexation->codeAlphaTitre($ret["titre"]) == $this->indexation->codeAlphaTitre($piege_titre)) {$ret["statut"]=1; return $ret;} if($piege_code_barres > "" and $notice["statut_exemplaires"]["nb_ex"]>0) - { - foreach($notice["exemplaires"] as $ex) { - if($ex["code_barres"]==$piege_code_barres) {$ret["statut"]=1; return $ret;} + foreach($notice["exemplaires"] as $ex) + { + if($ex["code_barres"]==$piege_code_barres) {$ret["statut"]=1; return $ret;} + } } - } if($piege_isbn > "" and ($notice["isbn10"] == $piege_isbn or $notice["isbn13"] == $piege_isbn)) {$ret["statut"]=1; return $ret;} if($piege_type_doc >"" and $notice["infos_type_doc"]["code"]==$piege_type_doc) {$ret["statut"]=1; return $ret; } if($piege_titre > "" or $piege_code_barres > "" or $piege_isbn > "" or $piege_type_doc >""){$ret["statut"]=0; return $ret;} @@ -1083,87 +1076,87 @@ class notice_integration { $lig[1]="Statut"; $lig[2]="ok"; if($notice["statut"]==1) - { - $lig[0]=3; - $lig[2]='<font color="purple">Notice à supprimer</font>'; - } - else if($td["code"]!="100") - { - if($ret["titre"] == "") {$lig[0]=2; $lig[2]="pas de titre principal";$ret["lig"][]=$lig;} - if($notice["statut_exemplaires"]["nb_ex"]==0) { - $lig[0]=2; - $lig[2]="pas de zone 995"; + $lig[0]=3; + $lig[2]='<font color="purple">Notice à supprimer</font>'; } - else + else if($td["code"]!="100") { - if($notice["statut_exemplaires"]["codes_barres"]==0) {$lig[0]=1; $lig[2]="code-barres non trouvé";} - if($notice["statut_exemplaires"]["cotes"]==0) {$lig[0]=1; $lig[2] ="cote non trouvée";} - if($notice["exportable"]==false)$lig[3]='<font color="purple">notice non libre de droits</font>'; else $lig[3]="notice libre de droits"; + if($ret["titre"] == "") {$lig[0]=2; $lig[2]="pas de titre principal";$ret["lig"][]=$lig;} + if($notice["statut_exemplaires"]["nb_ex"]==0) + { + $lig[0]=2; + $lig[2]="pas de zone 995"; + } + else + { + if($notice["statut_exemplaires"]["codes_barres"]==0) {$lig[0]=1; $lig[2]="code-barres non trouvé";} + if($notice["statut_exemplaires"]["cotes"]==0) {$lig[0]=1; $lig[2] ="cote non trouvée";} + if($notice["exportable"]==false)$lig[3]='<font color="purple">notice non libre de droits</font>'; else $lig[3]="notice libre de droits"; + } } - } $ret["lig"][]=$lig; // articles de periodiques if($td["code"]== "100") - { - $lig[0]=0; - $lig[1]="titre du numéro"; - $lig[2]=$notice["titre_numero"]; - $ret["lig"][]=$lig; - - $lig[0]=0; - $lig[1]="identifiant 001"; - $lig[2]=$notice["info_id"]; - $ret["lig"][]=$lig; - } + { + $lig[0]=0; + $lig[1]="titre du numéro"; + $lig[2]=$notice["titre_numero"]; + $ret["lig"][]=$lig; + + $lig[0]=0; + $lig[1]="identifiant 001"; + $lig[2]=$notice["info_id"]; + $ret["lig"][]=$lig; + } // tout sauf articles de periodiques else - { - // exemplaires - $ret["nb_ex"]=$notice["statut_exemplaires"]["nb_ex"]; - $lig[0]=0; - $lig[1]="Exemplaires"; - $lig[2]=$notice["statut_exemplaires"]["nb_ex"]." ex. actif(s)"; - $lig[3]=""; - if($notice["statut_exemplaires"]["nb_ex_detruits"] > 0 ) $lig[3]=$notice["statut_exemplaires"]["nb_ex_detruits"]." ex. à supprimer"; - $ret["lig"][]=$lig; - - // Identifiants (isbn / ean) - $isbn=$this->analyseur->getIsbn(); - if(!$isbn) $isbn=$this->analyseur->getEan(); - - $lig[0]=0; - $lig[1]="Identifiant"; - $lig[2]=""; - $lig[3]=""; - if($isbn["multiple"]==true) - { - $lig[0]=1; - $lig[2]="Isbn multiple"; - $lig[3]=$isbn["isbn"]; - } - if($isbn["statut"] == 1) - { - $lig[0]=1; - $lig[2]=$isbn["erreur"]; - $lig[3]=$isbn["code_brut"]; - } - else { - if($isbn["isbn"]) {$lig[2]="isbn"; $lig[3]=$isbn["isbn"];} - if($isbn["ean"]) {$lig[2]="ean"; $lig[3]=$isbn["ean"];} + // exemplaires + $ret["nb_ex"]=$notice["statut_exemplaires"]["nb_ex"]; + $lig[0]=0; + $lig[1]="Exemplaires"; + $lig[2]=$notice["statut_exemplaires"]["nb_ex"]." ex. actif(s)"; + $lig[3]=""; + if($notice["statut_exemplaires"]["nb_ex_detruits"] > 0 ) $lig[3]=$notice["statut_exemplaires"]["nb_ex_detruits"]." ex. à supprimer"; + $ret["lig"][]=$lig; + + // Identifiants (isbn / ean) + $isbn=$this->analyseur->getIsbn(); + if(!$isbn) $isbn=$this->analyseur->getEan(); + + $lig[0]=0; + $lig[1]="Identifiant"; + $lig[2]=""; + $lig[3]=""; + if($isbn["multiple"]==true) + { + $lig[0]=1; + $lig[2]="Isbn multiple"; + $lig[3]=$isbn["isbn"]; + } + if($isbn["statut"] == 1) + { + $lig[0]=1; + $lig[2]=$isbn["erreur"]; + $lig[3]=$isbn["code_brut"]; + } + else + { + if($isbn["isbn"]) {$lig[2]="isbn"; $lig[3]=$isbn["isbn"];} + if($isbn["ean"]) {$lig[2]="ean"; $lig[3]=$isbn["ean"];} + } + $ret["lig"][]=$lig; + + // Identifiants ID_COMMERCIALE + $lig[0]=0; + $lig[1]="No commercial"; + $lig[2]=$notice["id_commerciale"]; + $lig[3]=""; + $ret["lig"][]=$lig; } - $ret["lig"][]=$lig; - - // Identifiants ID_COMMERCIALE - $lig[0]=0; - $lig[1]="No commercial"; - $lig[2]=$notice["id_commerciale"]; - $lig[3]=""; - $ret["lig"][]=$lig; - } // Donnes principales $titre=$this->analyseur->getTitres(); @@ -1175,68 +1168,68 @@ class notice_integration { $ret["lig"][]=$lig; if($td["code"]!= "100") // tout sauf articles de periodiques - { - // section - $lig[1]="Section"; - if(!$notice["sections"]) {$lig[0]=1; $lig[2]="non reconnue";} - else { - $lig[0]=0; - $lig[2]=""; - foreach($notice["sections"] as $section) $lig[2].=$sql->fetchOne("select libelle from codif_section where id_section=".$section).BR; - } - $lig[3]=""; - $ret["lig"][]=$lig; + // section + $lig[1]="Section"; + if(!$notice["sections"]) {$lig[0]=1; $lig[2]="non reconnue";} + else + { + $lig[0]=0; + $lig[2]=""; + foreach($notice["sections"] as $section) $lig[2].=$sql->fetchOne("select libelle from codif_section where id_section=".$section).BR; + } + $lig[3]=""; + $ret["lig"][]=$lig; - // genre - $lig[1]="Genre"; - if(!$notice["genres"]) {$lig[0]=1; $lig[2]="non reconnu";} - else - { - $lig[0]=0; - $lig[2]=""; - foreach($notice["genres"] as $genre) $lig[2].=$sql->fetchOne("select libelle from codif_genre where id_genre=".$genre).BR; - } - $lig[3]=""; - $ret["lig"][]=$lig; + // genre + $lig[1]="Genre"; + if(!$notice["genres"]) {$lig[0]=1; $lig[2]="non reconnu";} + else + { + $lig[0]=0; + $lig[2]=""; + foreach($notice["genres"] as $genre) $lig[2].=$sql->fetchOne("select libelle from codif_genre where id_genre=".$genre).BR; + } + $lig[3]=""; + $ret["lig"][]=$lig; - // emplacement - $lig[1]="Emplacement"; - if(!$notice["emplacements"]) {$lig[0]=1; $lig[2]="non reconnu";} - else - { + // emplacement + $lig[1]="Emplacement"; + if(!$notice["emplacements"]) {$lig[0]=1; $lig[2]="non reconnu";} + else + { + $lig[0]=0; + $lig[2]=""; + foreach($notice["emplacements"] as $emplacement) $lig[2].=$sql->fetchOne("select libelle from codif_emplacement where id_emplacement=".$emplacement).BR; + } + $lig[3]=""; + $ret["lig"][]=$lig; + + // Champs forcés $lig[0]=0; + $lig[1]="Champs à conserver"; $lig[2]=""; - foreach($notice["emplacements"] as $emplacement) $lig[2].=$sql->fetchOne("select libelle from codif_emplacement where id_emplacement=".$emplacement).BR; - } - $lig[3]=""; - $ret["lig"][]=$lig; - - // Champs forcés - $lig[0]=0; - $lig[1]="Champs à conserver"; - $lig[2]=""; - $lig[3]=""; - if(count($notice["champs_forces"]) > 0) - { - foreach($notice["champs_forces"] as $zone => $champ) $lig[2].= substr($zone,1)." "; + $lig[3]=""; + if(count($notice["champs_forces"]) > 0) + { + foreach($notice["champs_forces"] as $zone => $champ) $lig[2].= substr($zone,1)." "; + } + else $lig[2]="aucun"; + $ret["lig"][]=$lig; } - else $lig[2]="aucun"; - $ret["lig"][]=$lig; - } // Statut general du retour $ret["statut"]=0; for($i=0; $i < count($ret["lig"]); $i++) - { - if($ret["lig"][$i][0]==2) { - $ret["statut"]=2; - break; + if($ret["lig"][$i][0]==2) + { + $ret["statut"]=2; + break; + } + if($ret["lig"][$i][0]==1) $ret["statut"]=1; + if($ret["lig"][$i][0]==3 and $ret["statut"] <2) $ret["statut"]=3; } - if($ret["lig"][$i][0]==1) $ret["statut"]=1; - if($ret["lig"][$i][0]==3 and $ret["statut"] <2) $ret["statut"]=3; - } return $ret; } // ---------------------------------------------------------------- @@ -1260,10 +1253,10 @@ class notice_integration { // Warnings $ret["statut"]="warning"; if($notice["type_doc"] != Class_TypeDoc::LIVRE_NUM) - { - if(!$notice["statut_exemplaires"]["codes_barres"]) $ret["warnings"][]="code-barres non trouvé"; - if(!$notice["statut_exemplaires"]["cotes"]) $ret["warnings"][]="cote non trouvée"; - } + { + if(!$notice["statut_exemplaires"]["codes_barres"]) $ret["warnings"][]="code-barres non trouvé"; + if(!$notice["statut_exemplaires"]["cotes"]) $ret["warnings"][]="cote non trouvée"; + } if(!$notice["type_doc"])$ret["warnings"][]="Type de document non reconnu"; // Type de doc @@ -1271,53 +1264,53 @@ class notice_integration { // Identifiants (isbn / ean) if($notice["type_doc"] != Class_TypeDoc::LIVRE_NUM) - { - $isbn=$this->analyseur->getIsbn(); - if(!$isbn) $isbn=$this->analyseur->getEan(); - if($isbn["multiple"]==true) $ret["warnings"][]="Isbn multiple"; - if($isbn["statut"] == 1) $ret["warnings"][]="ISBN ou EAN incorrect"; - if($isbn["isbn"]) $ret["identifiant"]="ISBN identifié"; - elseif($isbn["ean"]) $ret["identifiant"]="EAN identifié"; - else $ret["identifiant"]="Aucun identifiant"; - - // Genres - if($notice["genres"]) - { - foreach($notice["genres"] as $genre) $ret["genres"][]=$sql->fetchOne("Select libelle from codif_genre where id_genre='$genre'"); - } - else $ret["warnings"][]="Code genre non reconnu"; - - // Sections - if($notice["sections"]) { - foreach($notice["sections"] as $section) $ret["sections"][]=$sql->fetchOne("Select libelle from codif_section where id_section='$section'"); - } - else $ret["warnings"][]="Code section non reconnu"; + $isbn=$this->analyseur->getIsbn(); + if(!$isbn) $isbn=$this->analyseur->getEan(); + if($isbn["multiple"]==true) $ret["warnings"][]="Isbn multiple"; + if($isbn["statut"] == 1) $ret["warnings"][]="ISBN ou EAN incorrect"; + if($isbn["isbn"]) $ret["identifiant"]="ISBN identifié"; + elseif($isbn["ean"]) $ret["identifiant"]="EAN identifié"; + else $ret["identifiant"]="Aucun identifiant"; + + // Genres + if($notice["genres"]) + { + foreach($notice["genres"] as $genre) $ret["genres"][]=$sql->fetchOne("Select libelle from codif_genre where id_genre='$genre'"); + } + else $ret["warnings"][]="Code genre non reconnu"; - // Emplacements - if($notice["emplacements"]) - { - foreach($notice["emplacements"] as $emplacement) $ret["emplacements"][]=$sql->fetchOne("Select libelle from codif_emplacement where id_emplacement='$emplacement'"); - } - else $ret["warnings"][]="Code emplacement non reconnu"; + // Sections + if($notice["sections"]) + { + foreach($notice["sections"] as $section) $ret["sections"][]=$sql->fetchOne("Select libelle from codif_section where id_section='$section'"); + } + else $ret["warnings"][]="Code section non reconnu"; - // Langues - if($notice["langues"]) - { - foreach($notice["langues"] as $langue) - { - $controle=$sql->fetchOne("Select libelle from codif_langue where id_langue='$langue'"); - if($controle) $ret["langues"][]=$controle; - else $ret["warnings"][]="Code langue non reconnu"; - } - } + // Emplacements + if($notice["emplacements"]) + { + foreach($notice["emplacements"] as $emplacement) $ret["emplacements"][]=$sql->fetchOne("Select libelle from codif_emplacement where id_emplacement='$emplacement'"); + } + else $ret["warnings"][]="Code emplacement non reconnu"; + + // Langues + if($notice["langues"]) + { + foreach($notice["langues"] as $langue) + { + $controle=$sql->fetchOne("Select libelle from codif_langue where id_langue='$langue'"); + if($controle) $ret["langues"][]=$controle; + else $ret["warnings"][]="Code langue non reconnu"; + } + } - // Champs forcés - if(count($notice["champs_forces"]) > 0) - { - foreach($notice["champs_forces"] as $zone => $champ) $ret["zones_forcees"][]= substr($zone,1); + // Champs forcés + if(count($notice["champs_forces"]) > 0) + { + foreach($notice["champs_forces"] as $zone => $champ) $ret["zones_forcees"][]= substr($zone,1); + } } - } // Notice sans anomalie if(!$ret["warnings"]) $ret["statut"]="ok"; @@ -1336,16 +1329,16 @@ class notice_integration { { $this->analyseur->ouvrirNotice($data,$this->id_profil,$this->sigb); foreach($champs as $champ) - { - $zone=substr($champ,0,3); - $sous_champ=substr($champ,-1); - $valeur=$this->analyseur->get_subfield($zone,$sous_champ); - if(!$valeur) $valeur[0] = "non renseigné"; - foreach($valeur as $code) { - $ret[$champ][$code]++; + $zone=substr($champ,0,3); + $sous_champ=substr($champ,-1); + $valeur=$this->analyseur->get_subfield($zone,$sous_champ); + if(!$valeur) $valeur[0] = "non renseigné"; + foreach($valeur as $code) + { + $ret[$champ][$code]++; + } } - } return $ret; } -- GitLab