예제 #1
0
function creer_bulletinage_et_articles($bull = array(), $art = array())
{
    global $notice_id, $dbh, $notices_a_creer, $bulletins_crees, $notices_crees, $tit_200a, $isbn_OK, $id_unimarc, $msg;
    global $force_creation_notice_perio;
    //On regarde si la notice n'existe pas déjà dans la base
    $requete = "select notice_id from notices where tit1 LIKE '" . addslashes(clean_string(implode(" ; ", $tit_200a))) . "' and niveau_biblio='s' and niveau_hierar='1' and notice_id !='" . addslashes($notice_id) . "' ";
    if ($isbn_OK) {
        $requete .= "and code = '" . addslashes($isbn_OK) . "'";
    }
    $res = mysql_query($requete, $dbh);
    if ((!isset($force_creation_notice_perio) || !$force_creation_notice_perio) && mysql_num_rows($res)) {
        $id_perio_garde = 0;
        while (($r = mysql_fetch_object($res)) && !$id_perio_garde) {
            if (!array_search($r->notice_id, $notices_crees)) {
                //Si le periodique ne fait pas parti des notices créées (il était déja dans la base)
                $id_perio_garde = $r->notice_id;
            }
        }
        if ($id_perio_garde) {
            mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . $msg[542] . " {$id_unimarc} " . " {$isbn_OK} " . addslashes(clean_string(implode(" ; ", $tit_200a))) . "') ", $dbh);
            //Si j'ai déja une notice dans la base avec ce titre et ce code je supprime celle que je suis en train d'importer
            $perio_traite = new serial($notice_id);
            $perio_traite->replace($id_perio_garde);
            $perio_traite->serial_delete();
            //Je travail avec le periodique qui était dans la base
            $notice_id = $id_perio_garde;
            $notices_crees[$id_unimarc] = $id_perio_garde;
        }
    }
    if ($bull) {
        for ($i = 0; $i < sizeof($bull); $i++) {
            $bulletin = array();
            $bulletin = array("titre" => $bull[$i]['t'][0], "date" => $bull[$i]['d'][0], "mention" => $bull[$i]['e'][0], "num" => $bull[$i]['v'][0]);
            creer_bulletin($notice_id, $bulletin, "", "");
        }
    }
    if ($art) {
        for ($i = 0; $i < sizeof($art); $i++) {
            if (!$notices_crees[get_valeur_champ9($art[$i]['9'], 'id')] && !$art[$i]['0'][0]) {
                $bulletin = array();
                $bulletin = array("titre" => $art[$i]['t'][1], "date" => $art[$i]['d'][0], "mention" => $art[$i]['e'][0], "num" => $art[$i]['v'][0]);
                creer_notice_article(get_valeur_champ9($art[$i]['9'], 'id'), $art[$i]['t'][0], get_valeur_champ9($art[$i]['9'], 'page'), 0, $bulletin, "", "", $notice_id);
            } elseif ($art[$i]['0'][0]) {
                $id = get_valeur_champ9($art[$i]['9'], 'id');
                $type_lien = get_valeur_champ9($art[$i]['9'], 'type_lnk');
                $lien = get_valeur_champ9($art[$i]['9'], 'lnk');
                $rank = get_valeur_champ9($art[$i]['9'], 'rank') * 1;
                $page = get_valeur_champ9($art[$i]['9'], 'page');
                //On enregistre les informations pour créer l'article plus tard
                $notices_a_creer[$id][] = array("type_lnk" => $type_lien, "lnk" => $lien, "rank" => $rank, "titre_art" => $art[$i]['t'][0], "titre" => $art[$i]['t'][1], "num" => $art[$i]['v'][0], "mention" => $art[$i]['e'][0], "date" => $art[$i]['d'][0], "id_asso" => $notice_id, "page" => $page);
            }
        }
    }
}
예제 #2
0
// +-------------------------------------------------+
// $Id: serial_replace.inc.php,v 1.2 2009-03-13 16:36:16 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
//verification des droits de modification notice
$acces_m = 1;
if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
    require_once "{$class_path}/acces.class.php";
    $ac = new acces();
    $dom_1 = $ac->setDomain(1);
    $acces_m = $dom_1->getRights($PMBuserid, $serial_id, 8);
}
if ($acces_m == 0) {
    error_message('', htmlentities($dom_1->getComment('mod_seri_error'), ENT_QUOTES, $charset), 1, '');
} else {
    print pmb_bidi("<h1>{$msg['catal_rep_per_h1']}</h1>");
    if (!$by) {
        $perio = new serial($serial_id);
        $perio->replace_form();
    } else {
        // routine de remplacement
        $perio = new serial($serial_id);
        $rep_result = $perio->replace($by);
        if (!$rep_result) {
            print pmb_bidi("<div class='row'><div class='msg-perio'>" . $msg["maj_encours"] . "</div></div>\n\t\t\t\t\t\t<script type=\"text/javascript\">document.location='./catalog.php?categ=serials&sub=view&serial_id={$by}'</script>");
        } else {
            error_message($msg[132], $rep_result, 1, "./catalog.php?categ=serials&sub=view&serial_id={$id}");
        }
    }
}