function _export_($id, $keep_expl) { global $ty, $charset; global $tab_functions; global $mois, $mois_enrichis; if (!$ty) { $ty = array_flip(array("REVUE" => "v", "LIVRE" => "a", "MEMOIRE" => "b", "DOCUMENT AUDIOVISUEL" => "g", "CDROM" => "m", "DOCUMENT EN LIGNE" => "l")); } if (!$tab_functions) { $tab_functions = new marc_list('function'); } if (!$mois) { $mois = array(0 => "", 1 => "janvier", 2 => "fevrier", 3 => "mars", 4 => "avril", 5 => "mai", 6 => "juin", 7 => "juillet", 8 => "aout", 9 => "septembre", 10 => "octobre", 11 => "novembre", 12 => "decembre"); $mois_enrichis = array(0 => "", 1 => "janvier", 2 => "février", 3 => "mars", 4 => "avril", 5 => "mai", 6 => "juin", 7 => "juillet", 8 => "aout", 9 => "septembre", 10 => "octobre", 11 => "novembre", 12 => "décembre"); } if (!$m_thess) { $rqt = "SELECT count(1) FROM thesaurus WHERE active=1"; $m_thess = mysql_result(mysql_query($rqt), 0, 0); } $notice = "<notice>\n"; $requete = "SELECT * FROM notices WHERE notice_id={$id}"; $resultat = mysql_query($requete); $rn = mysql_fetch_object($resultat); //Référence $notice .= " <REF>" . htmlspecialchars($id, ENT_QUOTES, $charset) . "</REF>\n"; //Organisme (OP) $no_champ = trouve_champ_perso("op"); if ($no_champ > 0) { $requete = "SELECT notices_custom_list_lib " . "FROM notices_custom_lists, notices_custom_values " . "WHERE notices_custom_lists.notices_custom_champ={$no_champ} " . "AND notices_custom_values.notices_custom_champ={$no_champ} " . "AND notices_custom_integer=notices_custom_list_value " . "AND notices_custom_origine={$id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $op = mysql_result($resultat, 0, 0); $notice .= " <OP>" . htmlspecialchars($op, ENT_QUOTES, $charset) . "</OP>\n"; } } //Date saisie (DS) $no_champ = trouve_champ_perso("ds"); if ($no_champ > 0) { $requete = "SELECT notices_custom_date FROM notices_custom_values WHERE notices_custom_champ={$no_champ} AND notices_custom_origine={$id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $date = mysql_result($resultat, 0, 0); } else { $date = date("Y") . "-" . date("m") . "-" . date("d"); } $notice .= "<DS>" . $date . "</DS>\n"; } //Type document (TY) if ($rn->niveau_biblio != 'a' && $rn->niveau_biblio != 's') { $tyd = $ty[$rn->typdoc]; } else { if ($rn->niveau_biblio == 'a') { $tyd = "REVUE"; } else { $tyd = "CHAPEAU"; } } if ($tyd == "") { $tyd = "LIVRE"; } $notice .= "<TY>" . htmlspecialchars($tyd, ENT_QUOTES, $charset) . "</TY>\n"; //Genre (GEN) $no_champ = trouve_champ_perso("gen"); if ($no_champ > 0) { $requete = "SELECT notices_custom_list_lib " . "FROM notices_custom_lists, notices_custom_values " . "WHERE notices_custom_lists.notices_custom_champ={$no_champ} " . "AND notices_custom_values.notices_custom_champ={$no_champ} " . "AND notices_custom_integer=notices_custom_list_value " . "AND notices_custom_origine={$id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $notice .= "<GEN>" . htmlspecialchars(mysql_result($resultat, 0, 0), ENT_QUOTES, $charset) . "</GEN>\n"; } } //Auteurs $requete = "SELECT author_name, author_rejete, author_type, responsability_fonction, responsability_type " . "FROM authors, responsability " . "WHERE responsability_notice={$id} AND responsability_author=author_id " . "ORDER BY author_type, responsability_type, responsability_ordre"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $au = array(); $auco = array(); $as = array(); while ($ra = mysql_fetch_object($resultat)) { $a = $ra->author_type == '70' ? strtoupper($ra->author_name) : $ra->author_name; if ($ra->author_rejete) { $a .= " (" . $ra->author_rejete . ")"; } if ($ra->author_type == '70') { //C'est une personne, est-ce un auteur principal ou secondaire ? if ($ra->responsability_type == 2) { if ($ra->responsability_fonction >= 900) { $a .= " " . $tab_functions->table[$ra->responsability_fonction]; } $as[] = $a; } else { $au[] = $a; } } else { //C'est un auteur collectif $auco[] = $a; } } //Auteurs / Réalisateurs (AU) $au_ = implode(", ", $au); if ($au_) { $notice .= "<AU>" . htmlspecialchars($au_, ENT_QUOTES, $charset) . "</AU>\n"; } //Auteurs collectifs (AUCO) $auco_ = implode(", ", $auco); if ($auco_) { $notice .= "<AUCO>" . htmlspecialchars($auco_, ENT_QUOTES, $charset) . "</AUCO>\n"; } //Auteurs secondaires (AS) $as_ = implode(", ", $as); if ($as_) { $notice .= "<AS>" . htmlspecialchars($as_, ENT_QUOTES, $charset) . "</AS>\n"; } } //Distributeur (DIST) if ($rn->ed2_id) { $requete = "SELECT ed_ville,ed_name FROM publishers WHERE ed_id=" . $rn->ed2_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $re = mysql_fetch_object($resultat); $ed = ""; if ($re->ed_ville) { $ed = $re->ed_ville . ":"; } $ed .= $re->ed_name; $notice .= "<DIST>" . htmlspecialchars($ed, ENT_QUOTES, $charset) . "</DIST>\n"; } } //Titre (TI) $serie = ""; if ($rn->tparent_id) { $requete = "SELECT serie_name FROM series WHERE serie_id=" . $rn->tparent_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $serie = mysql_result($resultat, 0, 0); } } if ($rn->tnvol) { $serie .= ($serie ? " " : "") . $rn->tnvol; } if ($serie) { $serie .= ". "; } // ajout GM 15/12/2006 pour export sous-titre dans TI if ($rn->tit4 != "") { $soustitre = " : " . $rn->tit4; } // fin ajout GM // modif GM 15/12/2006 ajout du sous-titre pour l'export // $notice.=" <TI>".htmlspecialchars(strtoupper($serie.$rn->tit1))."</TI>\n"; $notice .= " <TI>" . htmlspecialchars($serie . $rn->tit1 . $soustitre, ENT_QUOTES, $charset) . "</TI>\n"; //Si c'est un article if ($rn->niveau_biblio == 'a') { //Recherche des informations du bulletin $requete = "SELECT * FROM bulletins, analysis WHERE bulletin_id=analysis_bulletin AND analysis_notice={$id}"; $resultat = mysql_query($requete); $rb = mysql_fetch_object($resultat); } //Titre du numéro (TN) if ($rb->bulletin_titre && substr($rb->bulletin_titre, 0, 9) != "Bulletin ") { $notice .= "<TN>" . htmlspecialchars($rb->bulletin_titre, ENT_QUOTES, $charset) . "</TN>\n"; } //Colloques (COL) if ($tyd != "MEMOIRE") { if ($rn->tit3) { $notice .= "<COL>" . htmlspecialchars($rn->tit3, ENT_QUOTES, $charset) . "</COL>\n"; } } //Titre de revue (TP) if ($rb) { $requete = "SELECT tit1 FROM notices WHERE notice_id=" . $rb->bulletin_notice; $resultat = mysql_query($requete); $notice .= "<TP>" . htmlspecialchars(mysql_result($resultat, 0, 0), ENT_QUOTES, $charset) . "</TP>\n"; } //Souces (SO) if ($rb) { $so = ""; if ($rb->bulletin_numero) { $so = $rb->bulletin_numero; } if ($rb->mention_date) { if ($so) { $so .= ", "; } $so .= $rb->mention_date; } } else { $so = $rn->n_gen; } $notice .= "<SO>" . htmlspecialchars($so, ENT_QUOTES, $charset) . "</SO>"; //Editeur / Collection (ED) if ($rn->ed1_id) { $requete = "SELECT ed_ville,ed_name FROM publishers WHERE ed_id=" . $rn->ed1_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $red = mysql_fetch_object($resultat); $ed = ""; if ($red->ed_ville) { $ed = $red->ed_ville . ":"; } $ed .= $red->ed_name; } //Collection if ($rn->coll_id) { $requete = "SELECT collection_name FROM collections WHERE collection_id=" . $rn->coll_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $coll_name = mysql_result($resultat, 0, 0); $ed .= " (" . $coll_name . ")"; } } $notice .= "<ED>" . htmlspecialchars($ed, ENT_QUOTES, $charset) . "</ED>\n"; } //Date de publication (DP) $annee = ""; if ($rn->year && $rn->niveau_biblio != 'a') { $annee = $rn->year; } else { if ($rn->niveau_biblio == 'a') { $req_mention_date = "SELECT YEAR(date_date) FROM bulletins, analysis WHERE bulletin_id=analysis_bulletin AND analysis_notice={$id}"; $res_mention_date = mysql_query($req_mention_date); if ($res_mention_date) { $annee = mysql_result($res_mention_date, 0, 0); } else { if ($rn->year) { $annee = $rn->year; } } } } if ($annee != "") { //on essaie d'enlever les mois for ($bcl_an = 1; $bcl_an < 13; $bcl_an++) { $annee = str_replace($mois[$bcl_an], "", strtolower($annee)); $annee = str_replace($mois_enrichis[$bcl_an], "", strtolower($annee)); } $annee = str_replace("-", "", $annee); $annee = str_replace(",", "", $annee); $annee = substr($annee, 0, 4); $notice .= "<DP>" . htmlspecialchars(trim($annee), ENT_QUOTES, $charset) . "</DP>\n"; } //Diplome (ND) if ($tyd == "MEMOIRE" && $rn->tit3) { $notice .= "<ND>" . htmlspecialchars($rn->tit3, ENT_QUOTES, $charset) . "</ND>\n"; } //Notes (NO) if ($tyd == "REVUE") { $no = $rn->npages; } else { $no = $rn->n_contenu; } if ($no) { $notice .= "<NO>" . htmlspecialchars($no, ENT_QUOTES, $charset) . "</NO>\n"; } $requete = "SELECT num_noeud FROM notices_categories WHERE notcateg_notice={$id} ORDER BY ordre_categorie"; $resultat = mysql_query($requete); $go = array(); $hi = array(); $denp = array(); $de = array(); $cd = array(); if ($m_thess > 1) { while (list($categ_id) = mysql_fetch_row($resultat)) { $categ = new category($categ_id); if (trouve_thesaurus("GO") == $categ->thes->id_thesaurus) { $go[] = $categ->libelle; } elseif (trouve_thesaurus("HI") == $categ->thes->id_thesaurus) { $hi[] = $categ->libelle; } elseif (trouve_thesaurus("DENP") == $categ->thes->id_thesaurus) { $denp[] = $categ->libelle; } elseif (trouve_thesaurus("DE") == $categ->thes->id_thesaurus) { $de[] = $categ->libelle; } elseif (trouve_thesaurus("CD") == $categ->thes->id_thesaurus) { $cd[] = $categ->libelle; } } } else { while (list($categ_id) = mysql_fetch_row($resultat)) { $categ = new categories($categ_id, 'fr_FR'); $list_categ = categories::listAncestors($categ_id, 'fr_FR'); reset($list_categ); list($id, $libelle) = each($list_categ); switch ($libelle["autorite"]) { case "GO": $go[] = $categ->libelle_categorie; break; case "HI": $hi[] = $categ->libelle_categorie; break; case "DENP": $denp[] = $categ->libelle_categorie; break; case "DE": $de[] = $categ->libelle_categorie; break; case "CD": $cd[] = $categ->libelle_categorie; break; } } } //Zone (GO) if (count($go)) { //sort($go); $notice .= "<GO>" . htmlspecialchars(strtoupper(implode(", ", $go)), ENT_QUOTES, $charset) . "</GO>\n"; } //Période historique (HI) if (count($hi)) { //sort($hi); $notice .= "<HI>" . htmlspecialchars(strtoupper(implode(", ", $hi)), ENT_QUOTES, $charset) . "</HI>\n"; } //Descripteurs noms propres (DENP) if (count($denp)) { //sort($denp); $notice .= "<DENP>" . htmlspecialchars(strtoupper(implode(", ", $denp)), ENT_QUOTES, $charset) . "</DENP>\n"; } //Descripteurs (DE) if (count($de)) { //sort($de); $notice .= "<DE>" . htmlspecialchars(strtoupper(implode(", ", $de)), ENT_QUOTES, $charset) . "</DE>\n"; } //Candidats descripteurs (CD) if (count($cd)) { //sort($cd); $notice .= "<CD>" . htmlspecialchars(strtoupper(implode(", ", $cd)), ENT_QUOTES, $charset) . "</CD>\n"; } //Resumé (RESU) if ($rn->n_resume) { $notice .= "<RESU>" . htmlspecialchars($rn->n_resume, ENT_QUOTES, $charset) . "</RESU>\n"; } //date de tri (DATRI) if ($rb->date_date) { $notice .= "<DATRI>" . htmlspecialchars($rb->date_date, ENT_QUOTES, $charset) . "</DATRI>\n"; } //url (URL) if ($rn->lien) { $notice .= "<URL>" . htmlspecialchars($rn->lien, ENT_QUOTES, $charset) . "</URL>\n"; } //isbn (ISBN) if ($rn->code) { $notice .= "<ISBN>" . htmlspecialchars(str_replace("-", "", $rn->code), ENT_QUOTES, $charset) . "</ISBN>\n"; } $notice .= "</notice>"; return $notice; }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464, $info_676; global $info_606_a, $info_606_x; global $info_900, $info_901, $info_902, $info_200, $info_903, $info_904, $info_910; global $rs, $bl, $dt; global $bulletin_ex; global $m_thess; //si on est en multi-thesaurus if (!$m_thess) { $rqt = "SELECT count(1) FROM thesaurus WHERE active=1"; $m_thess = mysql_result(mysql_query($rqt), 0, 0); } //Cas des périodiques if (is_array($info_464)) { $requete = "SELECT * FROM notices WHERE notice_id={$notice_id}"; $resultat = mysql_query($requete); $r = mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "SELECT notice_id FROM notices WHERE tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = mysql_result($resultat, 0, 0); //Mise à jour du champ commentaire de gestion si nécessaire if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}"; mysql_query($requete); } //Bulletin existe-t-il ? $requete = "SELECT bulletin_id FROM bulletins WHERE bulletin_numero='" . addslashes($info_464[0]['v']) . "' AND mention_date='" . addslashes($info_464[0]['d']) . "' AND bulletin_notice={$chapeau_id}"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = mysql_result($resultat, 0, 0); } else { //Si non, création bulletin $info = array(); $bulletin = new bulletinage("", $chapeau_id); if ($info_464[0]['u']) { $info['bul_titre'] = addslashes($info_464[0]['u']); } else { $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']); } $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_902[0]) { $info['date_date'] = $info_902[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; //Mise à jour du champ commentaire de gestion si nécessaire if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion=concat(commentaire_gestion,' ','" . addslashes($info_903[0]) . "') WHERE notice_id={$chapeau_id}"; mysql_query($requete); } $bulletin = new bulletinage("", $chapeau_id); $info = array(); if ($info_464[0]['u']) { $info['bul_titre'] = addslashes($info_464[0]['u']); } else { $info['bul_titre'] = addslashes("Bulletin " . $info_464[0]['v']); } $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { if ($info_902[0]) { $info['date_date'] = $info_902[0]; } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Passage de la notice en article $requete = "UPDATE notices SET niveau_biblio='a', niveau_hierar='2', npages='" . addslashes($info_464[0]['p']) . "' WHERE notice_id={$notice_id}"; mysql_query($requete); $requete = "INSERT INTO analysis (analysis_bulletin,analysis_notice) VALUES({$bulletin_id},{$notice_id})"; mysql_query($requete); $bulletin_ex = $bulletin_id; } else { $bulletin_ex = 0; } //Traitement du thésaurus if ($m_thess > 1) { //on est en multi-thesaurus for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur_tete = $info_606_a[$i][$j]; $descripteur_fils = $info_606_x[$i][$j]; //Recherche du thésaurus $thes_id = trouve_thesaurus($descripteur_tete); //Recherche du terme fils if ($thes_id > 0) { $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $thes_id, "fr_FR"); if (!$categ_id_fils) { //Création $new_thes = $thes_id == 1 ? 4 : $thes_id; //Choix du thesaurus Candidats descripteurs si descripteur inexistant $categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $new_thes, "fr_FR"); if (!$categ_id_fils) { $noeud = new noeuds(); $noeud->num_thesaurus = $new_thes; $thesau = new thesaurus($new_thes); $noeud->num_parent = $thesau->num_noeud_racine; $noeud->save(); $categ_id_fils = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_fils; $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " "; $categ->save(); } } $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id},{$categ_id_fils}, " . ($i + 1) . ")"; mysql_query($requete); } } } //for($i } else { //Traitement du thésaurus unique for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur_tete = $info_606_a[$i][$j]; $descripteur_fils = $info_606_x[$i][$j]; //Recherche du terme de tête //$requete="SELECT num_noeud FROM categories WHERE libelle_categorie='".addslashes($descripteur_tete)."' AND langue='fr_FR'"; $requete = "SELECT id_noeud FROM noeuds WHERE autorite='" . addslashes($descripteur_tete) . "'"; $resultat = mysql_query($requete); if (@mysql_num_rows($resultat)) { //la tête existe ! $categ_id_tete = mysql_result($resultat, 0, 0); } else { //Création de la tête //Nouveau Noeud ! $th = new thesaurus(1); $noeud = new noeuds(); $noeud->num_thesaurus = $th->id_thesaurus; $noeud->num_parent = $th->num_noeud_racine; $noeud->autorite = $descripteur_tete; $noeud->save(); $categ_id_tete = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_tete; $categ->index_categorie = " " . strip_empty_words($descripteur_tete) . " "; $categ->save(); } //Recherche du terme fils $categ_id_fils = categories::searchLibelle(addslashes($descripteur_fils), 1, "fr_FR"); if (!$categ_id_fils) { //Création $noeud = new noeuds(); $noeud->num_thesaurus = 1; $noeud->num_parent = $categ_id_tete; $noeud->save(); $categ_id_fils = $noeud->id_noeud; //Création du libellé $categ = new categories($noeud->id_noeud, 'fr_FR'); $categ->libelle_categorie = $descripteur_fils; $categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " "; $categ->save(); } $requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id}, {$categ_id_fils}, " . ($i + 1) . ")"; mysql_query($requete); } } } //Indexation décimale if ($info_676[0]) { $requete = "select indexint_id from indexint where indexint_name='" . addslashes($info_676[0]) . "'"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $indexint = mysql_result($resultat, 0, 0); } else { $requete = "insert into indexint (indexint_name) values('" . addslashes($info_676[0]) . "')"; mysql_query($requete); $indexint = mysql_insert_id(); } $requete = "update notices set indexint=" . $indexint . " where notice_id=" . $notice_id; mysql_query($requete); } //Organisme if ($info_900[0]) { $no_champ = trouve_champ_perso("op"); if ($no_champ > 0) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_900[0]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_900[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } //Genre if ($info_901[0]) { $no_champ = trouve_champ_perso("gen"); if ($no_champ > 0) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_901[0]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_901[0]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } //Type de texte if (count($info_904)) { $no_champ = trouve_champ_perso("typtext"); if ($no_champ > 0) { for ($i = 0; $i < count($info_904); $i++) { for ($j = 0; $j < count($info_904[$i]); $j++) { $requete = "SELECT max(notices_custom_list_value*1) FROM notices_custom_lists WHERE notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); $max = @mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "SELECT notices_custom_list_value FROM notices_custom_lists WHERE notices_custom_list_lib='" . addslashes($info_904[$i][$j]) . "' AND notices_custom_champ=" . $no_champ; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $value = mysql_result($resultat, 0, 0); } else { $requete = "INSERT INTO notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) VALUES({$no_champ},{$n},'" . addslashes($info_904[$i][$j]) . "')"; mysql_query($requete); $value = $n; $n++; } $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) VALUES({$no_champ},{$notice_id},{$value})"; mysql_query($requete); } } } } //Date de saisie if ($info_902[0]) { $no_champ = trouve_champ_perso("ds"); if ($no_champ > 0) { $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) VALUES({$no_champ},{$notice_id},'" . str_replace(".", "-", $info_902[0]) . "')"; mysql_query($requete); } } //N° de lot if ($info_903[0]) { $requete = "UPDATE notices SET commentaire_gestion='" . addslashes($info_903[0]) . "' WHERE notice_id={$notice_id}"; mysql_query($requete); } //Cas de la mise à jour des périodiques ou du champ bord (notices chapeau) if ($bl == "s") { //Si c'est un périodique if ($dt == "a") { //Passage de la notice en notice chapeau $requete = "UPDATE notices SET niveau_biblio='s', niveau_hierar='1' WHERE notice_id={$notice_id}"; mysql_query($requete); //Recherche si la notice existe déjà par rapport au titre $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); $update = false; if (mysql_num_rows($resultat)) { $update = true; $n_update = mysql_result($resultat, 0, 0); //Mise à jour de tous les bulletins $requete = "UPDATE bulletins SET bulletin_notice=" . $notice_id . " WHERE bulletin_notice=" . $n_update; mysql_query($requete); //Suppression de l'ancienne notice $requete = "DELETE FROM notices WHERE notice_id={$n_update}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update; mysql_query($requete); } if (!$update && $rs != "n") { //Si il n'y a pas de création, on supprime la notice $requete = "DELETE FROM notices WHERE notice_id={$notice_id}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $notice_id; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $notice_id; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $notice_id; mysql_query($requete); } } else { if ($dt == "l") { //Recherche si la notice existe déjà par rapport au titre $requete = "select notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND typdoc='l' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); $update = false; if (mysql_num_rows($resultat)) { $update = true; $n_update = mysql_result($resultat, 0, 0); //Suppression de l'ancienne notice $requete = "DELETE FROM notices WHERE notice_id={$n_update}"; mysql_query($requete); $requete = "DELETE FROM notices_categories WHERE notcateg_notice=" . $n_update; mysql_query($requete); $requete = "DELETE FROM notices_custom_values WHERE notices_custom_origine=" . $n_update; mysql_query($requete); $requete = "DELETE FROM responsability WHERE responsability_author=" . $n_update; mysql_query($requete); } } else { if ($dt == "r") { //Mise à jour du champ bord if ($info_910[0]) { $no_champ = trouve_champ_perso("bord"); if ($no_champ > 0) { //Recherche si la notice existe déjà par rapport au titre $requete = "SELECT notice_id FROM notices WHERE ucase(tit1)='" . addslashes(strtoupper($info_200[0])) . "' AND niveau_biblio='s' AND niveau_hierar='1' AND notice_id!={$notice_id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $notice_update = mysql_result($resultat, 0, 0); $requete = "UPDATE notices_custom_values SET notices_custom_text='" . addslashes(str_replace("##", "\n", $info_910[0])) . "' WHERE notices_custom_champ={$no_champ} AND notices_custom_origine=" . $notice_update; mysql_query($requete); if (!mysql_affected_rows()) { $requete = "INSERT INTO notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_text) VALUES({$no_champ},{$notice_update},'" . addslashes(str_replace("##", "\n", $info_910[0])) . "')"; mysql_query($requete); } } } } //Suppression de la nouvelle notice $requete = "DELETE FROM notices WHERE notice_id=" . $notice_id; mysql_query($requete); } } } } }