Пример #1
0
 function reindexRecords($list_notices = array())
 {
     global $msg, $dbh, $charset, $PMBusername;
     $result = array();
     $result['nb_reindexed_records'] = 0;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $req = "SELECT notice_id FROM notices ";
         if (count($list_notices)) {
             $req .= "WHERE notice_id IN (" . implode(",", $list_notices) . ") ";
         } else {
             //Si on fait toute la base
             //remise a zero de la table au début
             //mysql_query("truncate notices_global_index",$dbh);
             //mysql_query("truncate notices_mots_global_index",$dbh);
         }
         $req .= " ORDER BY notice_id";
         $query = mysql_query($req, $dbh);
         if ($query && mysql_num_rows($query)) {
             $result['nb_total_records'] = mysql_num_rows($query);
             while ($mesNotices = mysql_fetch_assoc($query)) {
                 notice::majNoticesTotal($mesNotices['notice_id']);
             }
             mysql_free_result($query);
         }
         $req = "SELECT count(1) FROM notices_global_index ";
         if (count($list_notices)) {
             $req .= "WHERE num_notice IN (" . implode(",", $list_notices) . ") ";
         }
         $not = mysql_query($req, $dbh);
         $result['nb_reindexed_records'] = mysql_result($not, 0, 0);
     }
     return $result;
 }
function update_notice_categories_from_form($id_notice = 0, $id_bulletin = 0)
{
    global $dbh;
    global $f_nb_categ;
    if (!$id_notice && $id_bulletin) {
        $query = "select * from bulletins where bulletin_id=" . $id_bulletin;
        $result = pmb_mysql_query($query, $dbh);
        if ($result) {
            $row = mysql_fetch_object($result);
            if ($row->num_notice) {
                $id_notice = $row->num_notice;
            } else {
                //on crée la notice de bulletin
                global $xmlta_doctype_bulletin, $deflt_notice_statut;
                pmb_mysql_query("INSERT INTO notices SET \n\t\t\t\t\ttit1 = '" . $row->bulletin_numero . ($row->mention_date ? " - " . $row->mention_date : "") . ($row->bulletin_titre ? " - " . $row->bulletin_titre : "") . "',\n\t\t\t\t\tstatut = '" . $deflt_notice_statut . "',\t\t\n\t\t\t\t\ttypdoc = '" . $xmlta_doctype_bulletin . "',\n\t\t\t\t\tcreate_date=sysdate(), update_date=sysdate() ", $dbh);
                $id_notice = pmb_mysql_insert_id($dbh);
                // Mise à jour des index de la notice
                notice::majNoticesTotal($id_notice);
                audit::insert_creation(AUDIT_NOTICE, $id_notice);
                //Mise à jour du bulletin
                $requete = "update bulletins set num_notice=" . $id_notice . " where bulletin_id=" . $id_bulletin;
                pmb_mysql_query($requete);
                //Mise à jour des liens bulletin -> notice mère
                $requete = "insert into notices_relations (num_notice,linked_notice,relation_type,rank) values(" . $id_notice . "," . $row->bulletin_notice . ",'b',1)";
                pmb_mysql_query($requete);
            }
        }
    }
    if (!$id_notice) {
        return;
    }
    $query = "SELECT max(ordre_categorie) as ordre FROM notices_categories WHERE notcateg_notice='" . $id_notice . "' ";
    $result = pmb_mysql_query($query);
    $ordre_categ = 0;
    if ($result) {
        $row = mysql_fetch_object($result);
        if (isset($row->ordre)) {
            $ordre_categ = $row->ordre;
        }
    }
    if ($f_nb_categ) {
        $rqt_ins = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ";
        for ($i = 0; $i < $f_nb_categ; $i++) {
            $var_categ = "f_categ{$i}";
            global ${$var_categ};
            if (${$var_categ}) {
                $var_categid = "f_categ_id{$i}";
                global ${$var_categid};
                $rqt_sel = "SELECT notcateg_notice FROM notices_categories WHERE notcateg_notice='" . $id_notice . "' and num_noeud='" . ${$var_categid} . "' ";
                $res_sel = pmb_mysql_query($rqt_sel, $dbh);
                if ($res_sel && !pmb_mysql_num_rows($res_sel)) {
                    $ordre_categ++;
                    $rqt = $rqt_ins . " ('" . $id_notice . "','" . ${$var_categid} . "',{$ordre_categ}) ";
                    $res_ins = @pmb_mysql_query($rqt, $dbh);
                }
            }
        }
    }
}
Пример #3
0
 function move($to_bul)
 {
     global $msg;
     global $dbh;
     global $pmb_synchro_rdf;
     // rattachement du dépouillement
     $requete = 'UPDATE analysis SET analysis_bulletin=' . $to_bul . ' WHERE analysis_notice=' . $this->analysis_id;
     @pmb_mysql_query($requete, $dbh);
     //dates
     $myBul = new bulletinage($to_bul);
     $year = substr($myBul->date_date, 0, 4);
     $date_parution = $myBul->date_date;
     $requete = 'UPDATE notices SET year="' . $year . '", date_parution="' . $date_parution . '", update_date=sysdate() WHERE notice_id=' . $this->analysis_id . ' LIMIT 1';
     @pmb_mysql_query($requete, $dbh);
     //Indexation du dépouillement
     notice::majNoticesTotal($this->analysis_id);
     audit::insert_modif(AUDIT_NOTICE, $this->analysis_id);
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($this->analysis_id, 0);
         $synchro_rdf->addRdf($this->analysis_id, 0);
     }
     return false;
 }
Пример #4
0
                 $res = mysql_query($requete);
                 if (mysql_num_rows($res)) {
                     $row = mysql_fetch_object($res);
                     if ($row->expl_notice) {
                         notice::majNoticesTotal($row->expl_notice);
                     } else {
                         $requete = "SELECT bulletin_titre, num_notice FROM bulletins WHERE bulletin_id='" . $row->expl_bulletin . "'";
                         $res2 = mysql_query($requete);
                         if (mysql_num_rows($res2)) {
                             $element = mysql_fetch_object($res2);
                             if (trim($element->bulletin_titre)) {
                                 $requete = "UPDATE bulletins SET index_titre=' " . addslashes(strip_empty_words($element->bulletin_titre)) . " ' WHERE bulletin_id='" . $row->expl_bulletin . "'";
                                 mysql_query($requete);
                             }
                             if ($element->num_notice) {
                                 notice::majNoticesTotal($element->num_notice);
                             }
                         }
                     }
                 }
                 $pb->progress();
             }
         }
         $pb->hide();
     }
     print "<br /><h3>{$msg['caddie_situation_reindex']}</h3>";
     print sprintf($msg["caddie_action_flag_processed"], $nb_elements_flag) . "<br />";
     print sprintf($msg["caddie_action_no_flag_processed"], $nb_elements_no_flag) . "<br />";
     print "<b>" . sprintf($msg["caddie_action_total_processed"], $nb_elements_total) . "</b><br /><br />";
     print aff_cart_nb_items($myCart);
 default:
Пример #5
0
 static function majNotices_clean_tags($notice = 0, $with_reindex = true)
 {
     global $dbh;
     $requete = "select index_l ,notice_id from notices where index_l is not null and index_l!='' ";
     if ($notice) {
         $requete .= " and notice_id = {$notice} ";
     }
     $res = pmb_mysql_query($requete, $dbh);
     if ($res && pmb_mysql_num_rows($res)) {
         while ($r = pmb_mysql_fetch_object($res)) {
             $val = clean_tags($r->index_l);
             $requete = "update notices set index_l='" . addslashes($val) . "' where notice_id=" . $r->notice_id;
             pmb_mysql_query($requete, $dbh);
             if ($with_reindex && $val != $r->index_l) {
                 //On réindexe la notice si le nettoyage à réalisé des changements
                 notice::majNoticesTotal($r->notice_id);
             }
         }
     }
 }
Пример #6
0
 function analysis_update($values)
 {
     global $dbh, $pmb_notice_img_folder_id, $opac_url_base, $pmb_notice_img_pics_max_size;
     if (is_array($values)) {
         $this->analysis_biblio_level = 'a';
         $this->analysis_hierar_level = '2';
         $this->analysis_typdoc = $values['typdoc'];
         $this->analysis_statut = $values['statut'];
         $this->analysis_commentaire_gestion = $values['f_commentaire_gestion'];
         $this->analysis_thumbnail_url = $values['f_thumbnail_url'];
         $this->analysis_tit1 = $values['f_tit1'];
         $this->analysis_tit2 = $values['f_tit2'];
         $this->analysis_tit3 = $values['f_tit3'];
         $this->analysis_tit4 = $values['f_tit4'];
         $this->analysis_n_gen = $values['f_n_gen'];
         $this->analysis_n_contenu = $values['f_n_contenu'];
         $this->analysis_n_resume = $values['f_n_resume'];
         $this->analysis_indexint = $values['f_indexint_id'];
         $this->analysis_index_l = $values['f_indexation'];
         $this->analysis_lien = $values['f_lien'];
         $this->analysis_eformat = $values['f_eformat'];
         $this->analysis_pages = $values['pages'];
         $this->analysis_signature = $values['signature'];
         $this->analysis_indexation_lang = $values['indexation_lang'];
         // insert de year à partir de la date de parution du bulletin
         if ($this->date_date) {
             $this->analysis_year = substr($this->date_date, 0, 4);
         }
         $this->date_parution_perio = $this->date_date;
         // construction de la requête :
         $data = "typdoc='" . $this->analysis_typdoc . "'";
         $data .= ", statut='" . $this->analysis_statut . "'";
         $data .= ", tit1='" . $this->analysis_tit1 . "'";
         $data .= ", tit3='" . $this->analysis_tit3 . "'";
         $data .= ", tit4='" . $this->analysis_tit4 . "'";
         $data .= ", year='" . $this->analysis_year . "'";
         $data .= ", npages='" . $this->analysis_pages . "'";
         $data .= ", n_contenu='" . $this->analysis_n_contenu . "'";
         $data .= ", n_gen='" . $this->analysis_n_gen . "'";
         $data .= ", n_resume='{$this->analysis_n_resume}'";
         $data .= ", lien='" . $this->analysis_lien . "'";
         $data .= ", eformat='" . $this->analysis_eformat . "'";
         $data .= ", indexint='" . $this->analysis_indexint . "'";
         $data .= ", index_l='" . clean_tags($this->analysis_index_l) . "'";
         $data .= ", niveau_biblio='" . $this->analysis_biblio_level . "'";
         $data .= ", niveau_hierar='" . $this->analysis_hierar_level . "'";
         $data .= ", commentaire_gestion='" . $this->analysis_commentaire_gestion . "'";
         $data .= ", thumbnail_url='" . $this->analysis_thumbnail_url . "'";
         $data .= ", signature='" . $this->analysis_signature . "'";
         $data .= ", date_parution='" . $this->date_parution_perio . "'";
         $data .= ", indexation_lang='" . $this->analysis_indexation_lang . "'";
         $result = 0;
         if (!$this->analysis_id) {
             // si c'est une création
             // fabrication de la requête finale
             $requete = "INSERT INTO notices SET {$data} , create_date=sysdate(), update_date=sysdate() ";
             $myQuery = mysql_query($requete, $dbh);
             $this->analysis_id = mysql_insert_id($dbh);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
             // si l'insertion est OK, il faut créer l'entrée dans la table 'analysis'
             if ($this->analysis_id) {
                 // Mise à jour des index de la notice
                 notice::majNoticesTotal($this->analysis_id);
                 audit::insert_creation(AUDIT_NOTICE, $this->analysis_id);
                 $requete = 'INSERT INTO analysis SET';
                 $requete .= ' analysis_bulletin=' . $this->id_bulletinage;
                 $requete .= ', analysis_notice=' . $this->analysis_id;
                 $myQuery = mysql_query($requete, $dbh);
             }
         } else {
             $requete = "UPDATE notices SET {$data} , update_date=sysdate() WHERE notice_id='" . $this->analysis_id . "' LIMIT 1";
             $myQuery = mysql_query($requete, $dbh);
             // Mise à jour des index de la notice
             notice::majNoticesTotal($this->analysis_id);
             audit::insert_modif(AUDIT_NOTICE, $this->analysis_id);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
         }
         // vignette de la notice uploadé dans un répertoire
         $id = $this->analysis_id;
         if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
             $poids_fichier_max = 1024 * 1024;
             //Limite la taille de l'image à 1 Mo
             $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
             $res = mysql_query($req, $dbh);
             if (mysql_num_rows($res)) {
                 $rep = mysql_fetch_object($res);
                 $filename_output = $rep->repertoire_path . "img_" . $id;
             }
             if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
                 $image = "";
                 $size = 0;
                 $flag = true;
                 while (!feof($fp)) {
                     $image .= fread($fp, 4096);
                     $size = strlen($image);
                     if ($size > $poids_fichier_max) {
                         $flag = false;
                         break;
                     }
                 }
                 if ($flag) {
                     if ($img = imagecreatefromstring($image)) {
                         if (!($pmb_notice_img_pics_max_size * 1)) {
                             $pmb_notice_img_pics_max_size = 100;
                         }
                         $redim = false;
                         if (imagesx($img) >= imagesy($img)) {
                             if (imagesx($img) <= $pmb_notice_img_pics_max_size) {
                                 $largeur = imagesx($img);
                                 $hauteur = imagesy($img);
                             } else {
                                 $redim = true;
                                 $largeur = $pmb_notice_img_pics_max_size;
                                 $hauteur = $largeur * imagesy($img) / imagesx($img);
                             }
                         } else {
                             if (imagesy($img) <= $pmb_notice_img_pics_max_size) {
                                 $hauteur = imagesy($img);
                                 $largeur = imagesx($img);
                             } else {
                                 $redim = true;
                                 $hauteur = $pmb_notice_img_pics_max_size;
                                 $largeur = $hauteur * imagesx($img) / imagesy($img);
                             }
                         }
                         if ($redim) {
                             $dest = imagecreatetruecolor($largeur, $hauteur);
                             imagecopyresampled($dest, $img, 0, 0, 0, 0, $largeur, $hauteur, imagesx($img), imagesy($img));
                             imagepng($dest, $filename_output);
                             imagedestroy($dest);
                         } else {
                             imagepng($img, $filename_output);
                         }
                         imagedestroy($img);
                         $thumbnail_url = $opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $id;
                         $req = "update notices set  thumbnail_url='" . $thumbnail_url . "' where notice_id ='" . $id . "'";
                         $res = mysql_query($req, $dbh);
                     }
                 }
             }
         }
         return $result;
     }
     //if(is_array($values))
 }
Пример #7
0
 public function get_notice_id($metas, $mimetype = "", $name = "")
 {
     global $pmb_keyword_sep;
     $this->metas = $metas;
     $this->mimetype = $mimetype;
     $this->name = $name;
     $notice_id = 0;
     $this->data = array();
     $this->data['tit1'] = $this->data['tit4'] = $this->data['authors'] = $this->data['co_authors'] = $this->data['code'] = $this->data['npages'] = $this->data['year'] = $this->data['index_l'] = $this->data['url'] = $this->data['thumbnail_content'] = $this->data['publisher'] = $this->data['n_resume'] = "";
     if ($this->mimetype == "application/epub+zip") {
         //pour les ebook, on gère ca directement ici !
         $this->data['tit1'] = $this->metas['title'][0];
         $this->data['authors'] = $this->metas['creator'];
         $this->data['co_authors'] = $this->metas['contributor'];
         if ($this->metas['identifier']['isbn']) {
             $this->data['code'] = \formatISBN($this->metas['identifier']['isbn'], 13);
         } else {
             if ($this->metas['identifier']['ean']) {
                 $this->data['code'] = \EANtoISBN($this->metas['identifier']['ean']);
                 $this->data['code'] = \formatISBN($code, 13);
             }
         }
         if ($this->metas['identifier']['uri']) {
             $this->data['url'] = \clean_string($this->metas['identifier']['uri']);
         }
         $this->data['publisher'] = $this->metas['publisher'][0];
         $this->data['year'] = $this->metas['date'][0]['value'];
         if (strlen($this->data['year']) && strlen($this->data['year']) != 4) {
             $this->data['year'] = \formatdate(detectFormatDate($this->data['year']));
         }
         $this->data['lang'] = $this->metas['language'];
         $this->data['n_resume'] = implode("\n", $this->metas['description']);
         $this->data['keywords'] = implode($pmb_keyword_sep, $this->metas['subject']);
         $this->data['thumbnail_content'] = $this->metas['thumbnail_content'];
     } else {
         $this->exec_map();
     }
     if (!$this->data['tit1']) {
         $this->data['tit1'] = $this->name;
     }
     $notice_id = $this->create_notice();
     $notice_id = $this->dedoublonne($notice_id);
     // Indexation
     \notice::majNoticesTotal($notice_id);
     return $notice_id;
 }
Пример #8
0
    /**
     * @param array $entry le tableau $entry généré par la fonction buildEntry()
     * 
     * Fonction d'import d'une notice formaté par la fonction buildEntry()
     * Ajoute les informations d'audit
     * Ajoute les champs personnalisés
     * Ajoute les tables annexes [responsability], [notices_categories] et [notices_langues]
     * Met à jours l'indexation de la notice
     */
    static function buildNotice(&$entry)
    {
        global $pmb_type_audit;
        global $webdav_current_user_name, $webdav_current_user_id;
        //la notice existe déjà ? si oui, on renvoi l'id trouvé
        if ($entry['niveau_biblio'] . $entry['niveau_hierar'] == 'a2') {
            $query = '
			SELECT n1.* FROM notices AS n1
			JOIN analysis ON n1.notice_id=analysis_notice
			JOIN bulletins ON bulletin_id=analysis_bulletin
			JOIN notices AS n2 ON n2.notice_id=bulletin_notice
			WHERE n1.tit1="' . addslashes($entry['tit1']) . '" 
			AND n1.niveau_biblio="' . addslashes($entry['niveau_biblio']) . '" 
			AND n1.niveau_hierar="' . addslashes($entry['niveau_hierar']) . '"
			AND bulletin_numero="' . addslashes($entry['bulletin']['bulletin_numero']) . '"
			AND mention_date="' . addslashes($entry['bulletin']['mention_date']) . '"
			AND date_date="' . addslashes($entry['bulletin']['date_date']) . '"
			AND n2.tit1="' . addslashes($entry['periodique']['tit1']) . '" 
			AND n2.niveau_biblio="' . addslashes($entry['periodique']['niveau_biblio']) . '" 
			AND n2.niveau_hierar="' . addslashes($entry['periodique']['niveau_hierar']) . '"
			';
            $result = mysql_query($query);
        } else {
            $query = 'SELECT * FROM notices WHERE tit1="' . addslashes($entry['tit1']) . '" AND niveau_biblio="' . addslashes($entry['niveau_biblio']) . '" AND niveau_hierar="' . addslashes($entry['niveau_hierar']) . '"';
            $result = mysql_query($query);
        }
        if (mysql_num_rows($result)) {
            // La notice existe
            $entry = array_merge(mysql_fetch_array($result, MYSQL_ASSOC), $entry);
            //TODO : A vérifier
            $first = true;
            $query = 'UPDATE notices SET ';
            foreach (array_keys($entry) as $fieldName) {
                if (!is_array($entry[$fieldName]) && $entry[$fieldName] != '' && $fieldName != 'ancien_num_name') {
                    if (!$first) {
                        $query .= ',';
                    }
                    $query .= $fieldName . '="' . addslashes($entry[$fieldName]) . '"';
                    $first = false;
                }
            }
            $query .= ' WHERE notice_id="' . addslashes($entry['notice_id']) . '"';
            mysql_query($query) or die('echec de la requete : ' . $query . '<br/>' . mysql_error() . "\n");
        } else {
            //les éditeurs
            if (sizeof($entry['publishers'])) {
                foreach ($entry['publishers'] as $id => $publisher) {
                    if ($id < 2) {
                        if ($id === 0) {
                            $entry['ed1_id'] = \editeur::import($publisher);
                        } elseif ($id === 1) {
                            $entry['ed2_id'] = \editeur::import($publisher);
                        }
                    }
                }
            }
            //la collection
            if (sizeof($entry['collections']) && $entry['ed1_id']) {
                $entry['collections']['parent'] = $entry['ed1_id'];
                $entry['coll_id'] = \collection::import($entry['collections']);
            }
            $first = true;
            $query = 'INSERT INTO notices SET ';
            foreach ($entry as $fieldName => $value) {
                if (!is_array($value) && $value != '') {
                    if (!$first) {
                        $query .= ',';
                    }
                    $query .= $fieldName . '="' . addslashes(trim($value)) . '"';
                    $first = false;
                }
            }
            mysql_query($query) or die('Echec d\'execution de la requete ' . $query . '  : ' . mysql_error());
            $entry['notice_id'] = mysql_insert_id();
            if ($pmb_type_audit && ($webdav_current_user_id || $webdav_current_user_name) && $entry['create_date']) {
                //ajout des informations d'audit
                $query = 'INSERT INTO audit (type_obj,object_id,user_id,user_name,type_modif,quand) VALUES (1,' . $entry['notice_id'] . ',' . $webdav_current_user_id . ',"' . addslashes($webdav_current_user_name) . '",1,"' . $entry['create_date'] . '")';
                mysql_query($query) or die('Echec d\'execution de la requete ' . $query . '  : ' . mysql_error());
            }
        }
        //les champs persos
        if (sizeof($entry['cp'])) {
            foreach ($entry['cp'] as $cp) {
                \parametres_perso::import($entry['notice_id'], $cp['field'], $cp['value'], 'notices');
            }
        }
        //ajout dans les tables annexes a la notice
        if (sizeof($entry['annexes'])) {
            foreach ($entry['annexes'] as $typeAnnexe => $annexes) {
                foreach ($annexes as $id => $annexe) {
                    switch ($typeAnnexe) {
                        case 'responsability':
                            //Import et récupération des identifiants auteurs
                            $entry['annexes'][$typeAnnexe][$id]['responsability_author'] = \auteur::import($entry['annexes'][$typeAnnexe][$id]['authors']);
                            $entry['annexes'][$typeAnnexe][$id]['responsability_notice'] = $entry['notice_id'];
                            break;
                        case 'notices_categories':
                            //Import et récupération des identifiants catégories
                            $query = 'SELECT num_noeud FROM categories WHERE libelle_categorie="' . addslashes(trim($entry['annexes'][$typeAnnexe][$id]['categories']['libelle_categorie'])) . '" AND num_thesaurus=' . $entry['annexes'][$typeAnnexe][$id]['categories']['num_thesaurus'] . ' AND langue="' . $entry['annexes'][$typeAnnexe][$id]['categories']['langue'] . '"';
                            $result = mysql_query($query) or die('Echec d\'execution de la requete ' . $query . '  : ' . mysql_error());
                            if (mysql_num_rows($result)) {
                                //le noeud existe déjà
                                $entry['annexes'][$typeAnnexe][$id]['num_noeud'] = mysql_result($result, 0, 0);
                            } else {
                                //le noeud n'existe pas, on cherche le parent non classé
                                $query = 'SELECT id_noeud FROM noeuds WHERE autorite="NONCLASSES" AND num_thesaurus=' . $entry['annexes'][$typeAnnexe][$id]['categories']['num_thesaurus'];
                                $result = mysql_query($query) or die('Echec d\'execution de la requete ' . $query . '  : ' . mysql_error());
                                if (mysql_num_rows($result)) {
                                    //on ajoute le noeud
                                    $query = 'INSERT INTO noeuds SET num_parent=' . mysql_result($result, 0, 0) . ', visible=1, num_thesaurus=' . $entry['annexes'][$typeAnnexe][$id]['categories']['num_thesaurus'];
                                    mysql_query($query) or die('Echec d\'execution de la requete ' . $query . '  : ' . mysql_error());
                                    $entry['annexes']['notices_categories'][$id]['num_noeud'] = mysql_insert_id();
                                    //on ajoute la catégorie
                                    $categorie = new \categories($entry['annexes'][$typeAnnexe][$id]['num_noeud'], $entry['annexes'][$typeAnnexe][$id]['categories']['langue']);
                                    $categorie->libelle_categorie = trim($entry['annexes'][$typeAnnexe][$id]['categories']['libelle_categorie']);
                                    $categorie->save();
                                }
                            }
                            $entry['annexes'][$typeAnnexe][$id]['notcateg_notice'] = $entry['notice_id'];
                            break;
                        case 'notices_langues':
                            $entry['annexes'][$typeAnnexe][$id]['num_notice'] = $entry['notice_id'];
                            break;
                        case 'notices_authorities_sources':
                            $entry['annexes'][$typeAnnexe][$id]['num_notice'] = $entry['notice_id'];
                            break;
                        case 'notices_relations':
                            $entry['annexes'][$typeAnnexe][$id]['num_notice'] = $entry['notice_id'];
                            break;
                        case 'notices_titres_uniformes':
                            $entry['annexes'][$typeAnnexe][$id]['ntu_num_notice'] = $entry['notice_id'];
                            break;
                    }
                    $first = true;
                    $query = 'INSERT IGNORE INTO ' . $typeAnnexe . ' SET ';
                    foreach ($entry['annexes'][$typeAnnexe][$id] as $fieldName => $value) {
                        if (!is_array($value) && $value != '') {
                            if (!$first) {
                                $query .= ',';
                            }
                            $query .= $fieldName . '="' . addslashes(trim($value)) . '"';
                            $first = false;
                        }
                    }
                    mysql_query($query) or die('Echec d\'execution de la requete ' . $query . '  : ' . mysql_error());
                }
            }
        }
        \notice::majNoticesTotal($entry['notice_id']);
    }