function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $info_461, $info_463;
    global $info_606_a;
    global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906;
    global $info_907, $info_908, $info_909, $info_910, $info_911;
    global $bl, $hl;
    //cas d'un article
    if ($bl == "a" && $hl == "2") {
        $bulletin = array('num' => (clean_string($info_461[0]["v"]) ? 'vol ' . clean_string($info_461[0]["v"]) . ' ' : '') . 'n°' . clean_string($info_463[0]["v"]));
        $perio = array('titre' => $info_461[0]['t'], 'volume' => $info_461[0]['v']);
        notice_to_article($perio, $bulletin);
    } elseif ($bl == "s" && $hl == "1") {
        update_notice("s", "1");
    }
    //Branche MOTCLE du Thésaurus DOC
    do_thesaurus_ascodocpsy(3, "MOTCLE", $info_606_a);
    //Branche CANDES du Thésaurus DOC
    if (count($info_900)) {
        do_thesaurus_ascodocpsy(3, "CANDES", $info_900);
    }
    //Branche THEME du Thésaurus DOC
    if (count($info_901)) {
        do_thesaurus_ascodocpsy(3, "THEME", $info_901);
    }
    //Branche NOMP du Thésaurus DOC
    if (count($info_902)) {
        do_thesaurus_ascodocpsy(3, "NOMP", $info_902);
    }
    //Producteur de la fiche
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_prodfich'");
    if (count($info_903) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=" . $cp_id;
        $resultat = pmb_mysql_query($requete);
        $max = @pmb_mysql_result($resultat, 0, 0);
        $n = $max + 1;
        for ($i = 0; $i < count($info_903); $i++) {
            for ($j = 0; $j < count($info_903[$i]); $j++) {
                $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_903[$i][$j]) . "' and notices_custom_champ=" . $cp_id;
                $resultat = pmb_mysql_query($requete);
                if (pmb_mysql_num_rows($resultat)) {
                    $value = pmb_mysql_result($resultat, 0, 0);
                } else {
                    $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values({$cp_id},{$n},'" . addslashes($info_903[$i][$j]) . "')";
                    pmb_mysql_query($requete);
                    $value = $n;
                    $n++;
                }
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$cp_id},{$notice_id},{$value})";
                pmb_mysql_query($requete);
            }
        }
    }
    //DIPSPE
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_dipspe'");
    if ($info_904[0] && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$cp_id},{$notice_id},'" . addslashes($info_904[0]) . "')";
        pmb_mysql_query($requete);
    }
    //Annexe
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_annexe'");
    if (count($info_905) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        for ($i = 0; $i < count($info_905); $i++) {
            for ($j = 0; $j < count($info_905[$i]); $j++) {
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$cp_id},{$notice_id},'" . addslashes($info_905[$i][$j]) . "')";
                pmb_mysql_query($requete);
            }
        }
    }
    //Lien annexe
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_lienanne'");
    if (count($info_906) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        for ($i = 0; $i < count($info_906); $i++) {
            for ($j = 0; $j < count($info_906[$i]); $j++) {
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$cp_id},{$notice_id},'" . addslashes($info_906[$i][$j]) . "')";
                pmb_mysql_query($requete);
            }
        }
    }
    //Localisation
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_loc'");
    if (count($info_907) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ=" . $cp_id;
        $resultat = pmb_mysql_query($requete);
        $max = @pmb_mysql_result($resultat, 0, 0);
        $n = $max + 1;
        for ($i = 0; $i < count($info_907); $i++) {
            for ($j = 0; $j < count($info_907[$i]); $j++) {
                $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_907[$i][$j]) . "' and notices_custom_champ=" . $cp_id;
                $resultat = pmb_mysql_query($requete);
                if (pmb_mysql_num_rows($resultat)) {
                    $value = pmb_mysql_result($resultat, 0, 0);
                } else {
                    $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values({$cp_id},{$n},'" . addslashes($info_907[$i][$j]) . "')";
                    pmb_mysql_query($requete);
                    $value = $n;
                    $n++;
                }
                $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_integer) values({$cp_id},{$notice_id},{$value})";
                pmb_mysql_query($requete);
            }
        }
    }
    //Nature du texte
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_nattext'");
    if (count($info_908[0]) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$cp_id},{$notice_id},'" . addslashes($info_908[0]) . "')";
        pmb_mysql_query($requete);
    }
    //Date du texte
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_datetext'");
    if (count($info_909[0]) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_date) values({$cp_id},{$notice_id},'" . $info_909[0] . "')";
        pmb_mysql_query($requete);
    }
    //Numéro du texte officiel
    $res = pmb_mysql_query("select idchamp from notices_custom where name='cp_numtexof'");
    if (count($info_910[0]) && $res && pmb_mysql_num_rows($res)) {
        $cp_id = pmb_mysql_result($res, 0, 0);
        $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_small_text) values({$cp_id},{$notice_id},'" . addslashes($info_910[0]) . "')";
        pmb_mysql_query($requete);
    }
}
示例#2
0
function import_new_notice_suite()
{
    global $dbh;
    global $notice_id;
    global $hl, $bl;
    global $info_461, $info_463;
    global $info_606;
    global $id_unimarc;
    global $delphe_convert;
    //Récupération des id de thésaurus
    $thesEntreprise = identifiants_thesaurus("Entreprise");
    $thesDelphes = identifiants_thesaurus("Mot clé Delphes");
    $thesAciege = identifiants_thesaurus("Aciege");
    //les notices ne sont que des articles...
    if ($hl == 2 && $bl == "a") {
        $bulletin = array('date' => decoupe_date($info_463[0]['d']), 'num' => clean_string($info_463[0]['v']));
        $perio = array('titre' => clean_string($info_461[0]));
        notice_to_article($perio, $bulletin);
    }
    //les descripteurs
    if (count($delphe_convert) == 0) {
        init_delphe_term_convert();
    }
    $lang = "fr_FR";
    $ordre_categ = 0;
    foreach ($info_606 as $terms) {
        $categ_id = 0;
        $term = $terms['a'];
        switch ($terms['2']) {
            case "local":
                $id_thesaurus = $thesEntreprise[TOP];
                $non_classes = $thesEntreprise[NONCLASSES];
                $categ_id = find_categ($term, $id_thesaurus, $lang);
                if ($categ_id == 0) {
                    $categ_id = add_categ($term, $id_thesaurus, $non_classes, $lang);
                }
                break;
            default:
                //on regarde par défault dans Aciège...
                $id_thesaurus = $thesAciege[TOP];
                $non_classes = $thesAciege[NONCLASSES];
                $categ_id = find_categ($term, $id_thesaurus, $lang);
                if ($categ_id == 0) {
                    //pas trouvé dans aciège, on regarde dans delphes
                    $id_thesaurus = $thesDelphes[TOP];
                    $non_classes = $thesDelphes[NONCLASSES];
                    $categ_id = find_categ($term, $id_thesaurus, $lang);
                    if ($categ_id == 0) {
                        //pas trouvé dans delphe, on regarde la table de correspondance
                        if (isset($delphe_convert[$term]['aciege']) && $delphe_convert[$term]['aciege'] != "") {
                            //on reprend la correspondance dans Aciège
                            //on peut avoir plusieurs termes séparés par un +...
                            $terms_to_keep = explode("+", $delphe_convert[$term]['aciege']);
                            if (count($terms_to_keep) > 1) {
                                foreach ($terms_to_keep as $term_to_keep) {
                                    $term_to_keep = trim($term_to_keep);
                                    $categ_id = find_categ($term_to_keep, 1, $lang);
                                    if ($categ_id) {
                                        save_categ($categ_id, $ordre_categ);
                                        $ordre_categ++;
                                    }
                                    $categ_id = 0;
                                }
                            } else {
                                $categ_id = find_categ($delphe_convert[$term]['aciege'], 1, $lang);
                            }
                        } else {
                            if (isset($delphe_convert[$term]['aciege']) && $delphe_convert[$term]['delphes'] != "") {
                                //ou dans delphes
                                $categ_id = find_categ($delphe_convert[$term]['delphes'], $id_thesaurus, $lang);
                            } else {
                                if (!isset($delphe_convert[$term])) {
                                    //si le terme est présent dans le fichier sans aucunes correspondances,on veut juste pas le traiter du tout, sinon reprise en non classé...
                                    $categ_id = add_categ($term, $id_thesaurus, $non_classes, $lang);
                                }
                            }
                        }
                    }
                }
                break;
        }
        if ($categ_id) {
            save_categ($categ_id, $ordre_categ);
            $ordre_categ++;
        }
    }
    //on renseigne le champ perso indexpresse avec le 001...
    //on récup l'id du champ
    $rqt = "select idchamp, datatype from notices_custom where name ='cp_index' ";
    $res = pmb_mysql_query($rqt);
    if (pmb_mysql_num_rows($res)) {
        $cp_indexpresse = pmb_mysql_fetch_object($res);
        $insert = "insert into notices_custom_values set notices_custom_champ=" . $cp_indexpresse->idchamp . ", notices_custom_origine=" . $notice_id . ", notices_custom_" . $cp_indexpresse->datatype . " = '" . $id_unimarc . "'";
        pmb_mysql_query($insert) or die(pmb_mysql_error());
    }
}
示例#3
0
function import_new_notice_suite()
{
    global $info_461, $info_463, $info_530;
    global $info_900, $info_901, $tit_200a;
    global $info_215, $titre_ppal_200, $champ_210, $titre_perio_530a;
    global $info_606_a, $info_897;
    global $notice_id;
    global $bull_id;
    global $bl, $hl;
    echo "<pre>";
    $bull_id = 0;
    //cas d'un article
    if ($bl == "a" && $hl == "2") {
        //on peut pas découper une date, on a pas de date mais une mention
        if (decoupe_date($info_463[0]["d"]) == 0 && clean_string($info_463[0]["e"]) == "") {
            $info_463[0]["e"] = $info_463[0]["d"];
            $info_463[0]["d"] = "";
        }
        $bulletin = array('titre' => clean_string($info_463[0]["t"]), 'date' => decoupe_date($info_463[0]["d"]), 'mention' => clean_string($info_463[0]["e"]), 'num' => clean_string($info_463[0]["v"]));
        $perio = array('titre' => $info_461[0]['t'], 'code' => $info_461[0]['x']);
        notice_to_article($perio, $bulletin);
        $update = " update notices set typdoc='t' where notice_id = {$notice_id}";
        mysql_query($update);
        //cas d'un bulletin
    } else {
        if ($bl == "s" && $hl == "2") {
            if (decoupe_date($champ_210[0]['h']) == 0 && clean_string($titre_ppal_200[0]['h']) == "") {
                $titre_ppal_200[0]['h'] = $champ_210[0]['h'];
                $champ_210[0]['h'] = "";
            }
            $bulletin = array('titre' => clean_string($titre_ppal_200[0]['i']), 'date' => decoupe_date($champ_210[0]['h']), 'mention' => clean_string($champ_210[0]['d']), 'num' => clean_string($titre_ppal_200[0]['h']));
            $perio = array('titre' => $info_461[0]['t'], 'code' => $info_461[0]['x']);
            $bull_id = genere_bulletin($perio, $bulletin);
            $update = " update notices set typdoc='t' where notice_id = {$notice_id}";
            mysql_query($update);
        }
    }
    //on s'occupe des descripteurs;
    $id_thesaurus = 1;
    $non_classes = 3;
    $lang = "fr_FR";
    $ordre_categ = 0;
    foreach ($info_606_a as $terms) {
        foreach ($terms as $term) {
            $categ_id = categories::searchLibelle(addslashes($term), $id_thesaurus, $lang);
            if ($categ_id) {
                //le terme existe
                $noeud = new noeuds($categ_id);
                if ($noeud->num_renvoi_voir) {
                    $categ_to_index = $noeud->num_renvoi_voir;
                } else {
                    $categ_to_index = $categ_id;
                }
            } else {
                //le terme est à créé
                $n = new noeuds();
                $n->num_thesaurus = $id_thesaurus;
                $n->num_parent = $non_classes;
                $n->save();
                $c = new categories($n->id_noeud, $lang);
                $c->libelle_categorie = $term;
                $c->index_categorie = ' ' . strip_empty_words($term) . ' ';
                $c->save();
                $categ_to_index = $n->id_noeud;
            }
            $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_to_index},{$ordre_categ})";
            mysql_query($requete);
            $ordre_categ++;
        }
    }
    //on traite le commentaire de gestion
    $up = "update notices set commentaire_gestion = '" . addslashes($info_901[0][0]) . "' where notice_id = {$notice_id}";
    mysql_query($up);
    //traitement des Champs perso
    //classique on commence par cherché l'id
    foreach ($info_900 as $champperso) {
        $champ = array('libelle' => $champperso['l'], 'nom' => $champperso['n'], 'value' => $champperso['a']);
        recup_champ_perso($champ, "notices", $notice_id);
    }
    //gestion des 897$...
    foreach ($info_897 as $docnum) {
        //si on a pas d'url, on traite pas
        if ($docnum['u']) {
            //on reprend pas les site web...
            if ($docnum['m'] != "text/html") {
                $doc = array('titre' => clean_string($docnum['a']), 'mimetype' => $docnum['m'], 'nom_fic' => clean_string($docnum['f']), 'url' => $docnum['u']);
                create_docnum($doc);
            }
        }
    }
    echo "</pre>";
}