public function get_tab()
 {
     global $origin_tab_display;
     $list_origins = origin::get_list($this->type);
     $origin_tab_display = str_replace("!!type!!", $this->type, $origin_tab_display);
     $rows = "";
     if (count($list_origins) > 0) {
         for ($i = 0; $i < count($list_origins); $i++) {
             $origin = new origin($list_origins[$i]);
             $rows .= $origin->show_tab_row();
         }
     }
     return str_replace("!!rows!!", $rows, $origin_tab_display);
 }
Beispiel #2
0
         $script = "<script>setTimeout(\"document.preload.submit()\",2000);</script>";
     }
     print $formulaire;
     print $script;
 } else {
     // import de notice
     /* Does the file exist ? */
     if ($file_submit == "") {
         $filename = $base_path . "/admin/import/" . $nom_fichier_transfert_ftp;
         $from_file = "unimarc" . (defined("LOCATION") ? "_" . constant("LOCATION") : "") . ".fic";
     } else {
         $filename = $file_submit;
     }
     if ($isbn_mandatory == "") {
         /* l'utilisateur n'est pas passé par le téléchargement du fichier, il faut qu'il nous dise si l'ISBN est obligatoire */
         print "\n\t\t            <form class='form-{$current_module}' NAME=\"preload\" METHOD=\"post\" ACTION=\"iimport_expl.php\">\n\t\t            <h3>" . $msg['import_noti_form_titre'] . "</h3>\n\t\t            <div class='form-contenu'>\n\t\t        \t<div class='row'>\n\t\t        \t    <div class='colonne2'>\n\t\t    \t            <label class='etiquette' for='isbn_obligatoire'>{$msg['564']}</label><br />\n\t\t\t                <INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n\t\t                    <INPUT TYPE='radio' NAME='isbn_mandatory' id='io0' VALUE='0' CLASS='radio' checked='checked' /><label for='io0'> {$msg['39']} </label>\n\t\t                </div>\n\t\t                <div class='colonne-suite'>\n\t\t            \t    <label class='etiquette' for='isbn_dedoublonnage'>{$msg['568']}</label><br />\n\t\t        \t        <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di1' VALUE='1' CLASS='radio' checked='checked' /><label for='di1'> {$msg['40']} </label>\n\t\t    \t            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di0' VALUE='0' CLASS='radio' /><label for='di0'> {$msg['39']} </label>\n\t\t\t                <input type='checkbox' name='isbn_only' id='ionly' value='1' /><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n\t\t                </div>\n\t\t             </div>\n\t\t\t\t\t<div class='row'>&nbsp;</div>\n\t\t            <div class='row'>\n                        <div class='colonne2'>\t\n                    \t\t<label class='etiquette' for='statutnot'>{$msg['import_statutnot']}</label>\n                    \t\t<div>\n                    \t\t" . gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "statutnot", "", 1, "", "", "", "", 0) . "\n                    \t\t</div>\n                    \t</div>\n                    \t<div class='colonne-suite'>\n                    \t\t<label class='etiquette' for='generer_lien'>" . $msg['import_genere_liens'] . "</label><br />\n                    \t\t<INPUT TYPE='radio' NAME='link_generate' id='link1' VALUE=' 1' CLASS='radio' /><label for='link1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='link_generate' id='link0' VALUE='0' CLASS='radio' checked='checked' /><label for='link0'> {$msg['39']} </label>\n                    \t</div>\n                    </div>\n                    <div class='row'>&nbsp;</div>\n                   \t<div class='row'>\n                   \t\t<div class='colonne2'>\n                   \t\t\t&nbsp;<br />\n                   \t\t\t&nbsp;\n                   \t\t</div>\n                   \t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t<label class='etiquette' for='authorities_notices'>" . htmlentities($msg['import_with_authorities_notices'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices1' value='1' class='radio' /><label for='authorities_notices1'>" . htmlentities($msg[40], ENT_QUOTES, $charset) . "</label>          \t\t\t\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices0' value='0' class='radio' checked='checked'/><label for='authorities_notices0'>" . htmlentities($msg[39], ENT_QUOTES, $charset) . "</label>\n                    \t</div>\n                   \t</div>\n                   \t<div class='row'>&nbsp;</div>\n                   \t<div clas='row'>\n                   \t\t<div class='colonne2'>\n                   \t\t\t&nbsp;<br />\n                   \t\t\t&nbsp;\n                   \t\t</div>\n                   \t\t<div class='colonne-suite'>\n                   \t\t\t<label class='etiquette' for='authorities_default_origin'>" . htmlentities($msg['import_authorities_origin_default_value'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t" . origin::gen_combo_box("authorities", "authorities_default_origin") . "\n                   \t\t</div> \n                   \t</div>\n                   \t<div class='row'>&nbsp;</div>\n                    <div clas='row'>\n\t\t            \t<INPUT TYPE=\"SUBMIT\"  class='bouton' NAME=\"upload\" VALUE=\"" . $msg[502] . "\" />\n\t\t            </div>\n\t\t            <INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />\n\t\t            <INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import\" />\n\t\t            <INPUT NAME=\"action\" TYPE=\"hidden\" value=\"preload\" />\n\t\t            <INPUT NAME=\"" . $name_func . "\" TYPE=\"hidden\" value=\"" . ${$name_func} . "\"/>\n\t\t            </FORM>";
         break;
     }
     loadfile_in_table();
     if ($pb_fini == "EOF") {
         $formulaire = "<form class='form-{$current_module}' name=\"load\" method=\"post\" action=\"iimport_expl.php\">";
         $formulaire .= "<INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />";
         $formulaire .= "<INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import\" />";
         $formulaire .= "<INPUT NAME=\"action\" TYPE=\"hidden\" value=\"load\" />";
         $formulaire .= "<input type=\"hidden\" name=\"filename\" value=\"{$filename}\" />";
         $formulaire .= "<input type=\"hidden\" name=\"from_file\" value=\"{$from_file}\" />";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"isbn_mandatory\" VALUE=\"{$isbn_mandatory}\" />\n";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"isbn_dedoublonnage\" VALUE=\"{$isbn_dedoublonnage}\" />\n";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"isbn_only\" VALUE=\"{$isbn_only}\" />\n";
         $formulaire .= "<INPUT TYPE=\"hidden\" NAME=\"statutnot\" VALUE=\"{$statutnot}\" />\n";
         $formulaire .= "<input type=\"hidden\" name=\"recharge\" value=\"YES\" />";
Beispiel #3
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: import_func.inc.php,v 1.111.2.3 2015-02-04 08:48:20 mbertin Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/serials.class.php";
require_once $class_path . "/category_auto.class.php";
require_once $class_path . "/origin.class.php";
require_once $class_path . "/notice_doublon.class.php";
// templates
$tpl_beforeupload_expl = "\n                <form class='form-{$current_module}' ENCTYPE=\"multipart/form-data\" METHOD=\"post\" ACTION=\"iimport_expl.php\">\n                <h3>" . $msg['import_expl_form_titre'] . "</h3>\n                <div class='form-contenu'>\n                    <div class='row'>\n                        <div class='colonne2'>\n                            <label class='etiquette' >{$msg['564']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io0' VALUE='0' CLASS='radio' checked='checked' /><label for='io0'> {$msg['39']} </label>\n                        </div>\n                        <div class='colonne-suite'>\n                            <label class='etiquette' >{$msg['568']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di1' VALUE='1' CLASS='radio' checked='checked' /><label for='di1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di0' VALUE='0' CLASS='radio' /><label for='di0'> {$msg['39']} </label>\n                            <input type='checkbox' name='isbn_only' id='ionly' value='1' checked='checked' /><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n                       </div>\n                    </div>\n                    <div class='row'>&nbsp;</div>\n                    <div class='row'>\n                        <div class='colonne2'>\t\n                    \t\t<label class='etiquette' for='statutnot'>{$msg['import_statutnot']}</label>\n                    \t\t<div>\n                    \t\t" . gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "statutnot", "", 1, "", "", "", "", 0) . "\n                    \t\t</div>\n                    \t</div>\n                    \t<div class='colonne-suite'>\n                    \t\t<label class='etiquette' >" . $msg['import_genere_liens'] . "</label><br />\n                    \t\t<INPUT TYPE='radio' NAME='link_generate' id='link1' VALUE=' 1' CLASS='radio' /><label for='link1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='link_generate' id='link0' VALUE='0' CLASS='radio' checked='checked' /><label for='link0'> {$msg['39']} </label>\n                    \t</div>\n                    </div>\n                    <div class='row'>&nbsp;</div>\n                   \t<div class='row'>\n                   \t\t<div class='colonne2'>\n                   \t\t\t&nbsp;<br />\n                   \t\t\t&nbsp;\n                   \t\t</div>\n                   \t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t<label class='etiquette' for='authorities_notices'>" . htmlentities($msg['import_with_authorities_notices'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices1' value='1' class='radio' /><label for='authorities_notices1'>" . htmlentities($msg[40], ENT_QUOTES, $charset) . "</label>          \t\t\t\n\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices0' value='0' class='radio' checked='checked'/><label for='authorities_notices0'>" . htmlentities($msg[39], ENT_QUOTES, $charset) . "</label>\n                    \t</div>\n                   \t</div>\n                   \t<div class='row'>&nbsp;</div>\n                   \t\t<div clas='row'>\n                   \t\t\t<div class='colonne2'>\n                   \t\t\t\t&nbsp;<br />\n                   \t\t\t\t&nbsp;\n                   \t\t\t</div>\n                   \t\t\t<div class='colonne-suite'>\n                   \t\t\t\t<label class='etiquette' for='authorities_default_origin'>" . htmlentities($msg['import_authorities_origin_default_value'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t\t" . origin::gen_combo_box("authorities") . "\n                   \t\t\t</div> \n                   \t\t</div>\n                    <div class='row'><hr /></div>\n\t\t\t\t\t<div class='row'>\n                        <label class='etiquette' for='preteur statut'>{$msg['560']}</label>\n                    </div>\n                    <div class='row'>" . lender::gen_combo_box($book_lender_id) . "&nbsp;&nbsp;" . docs_statut::gen_combo_box($book_statut_id) . "\n                    </div>\n                    <div class='row'>\n                        <label class='etiquette' for='localisation'>{$msg['import_localisation']}</label>\n                    </div>\n                    <div class='row'>" . docs_location::gen_combo_box($deflt_docs_location) . "\n                    </div>\n                    <div class='row'><hr /></div>\n                    <div class='row'>\n                        <label class='etiquette' for='cote_obligatoire'>{$msg['566']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='cote_mandatory' id='cm1' VALUE='1' CLASS='radio' /><label for='cm1'> {$msg['40']} </label>\n                        <INPUT TYPE='radio' NAME='cote_mandatory' id='cm0' VALUE='0' CLASS='radio' checked='checked' /><label for='cm0'> {$msg['39']} </label>\n                    </div>\n                    <div class='row'><hr /></div>\n                    <div class='row'>\n                        <label class='etiquette'>{$msg['17']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='tdoc_codage' id='td1' VALUE='1' CLASS='radio' /><label for='td1'> " . $msg["import_expl_codage_proprio"] . "</label>\n                        <INPUT TYPE='radio' NAME='tdoc_codage' id='td0' VALUE='0' CLASS='radio' checked='checked' /><label for='td0'> " . $msg["import_expl_codage_generique"] . "</label>\n                    </div>\n                    <div class='row'>\n                        <label class='etiquette'>{$msg['24']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='statisdoc_codage' id='sd1' VALUE='1' CLASS='radio' /><label for='sd1'> " . $msg["import_expl_codage_proprio"] . "</label>\n                        <INPUT TYPE='radio' NAME='statisdoc_codage' id='sd0' VALUE='0' CLASS='radio' checked='checked' /><label for='sd0'> " . $msg["import_expl_codage_generique"] . "</label>\n                    </div>\n                    <div class='row'>\n                        <label class='etiquette'>{$msg['19']}</label>\n                    </div>\n                    <div class='row'>\n                        <INPUT TYPE='radio' NAME='sdoc_codage' id='sdc1' VALUE='1' CLASS='radio' /><label for='sdc1'> " . $msg["import_expl_codage_proprio"] . "</label>\n                        <INPUT TYPE='radio' NAME='sdoc_codage' id='sdc0' VALUE='0' CLASS='radio' checked='checked' /><label for='sdc0'> " . $msg["import_expl_codage_generique"] . "</label>\n                    </div>\n                    <div class='row'><hr /></div>\n\n                    <div class='row'>\n                        <label class='etiquette' for='txt_suite'>{$msg['501']}</label>\n                        </div>\n                    <div class='row'>\n                        <INPUT NAME='userfile' class='saisie-80em' TYPE='file' size='60' />\n                        <INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />\n                        <INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import_expl\" />\n                        <INPUT NAME=\"action\" TYPE=\"hidden\" value=\"afterupload\" />\n                    </div>\n                    </div>\n                <INPUT TYPE='SUBMIT' class='bouton' NAME='upload' VALUE='" . $msg[502] . "' />\n                </FORM>";
$tpl_beforeupload_notices = "\n                    <form class='form-{$current_module}' ENCTYPE='multipart/form-data' METHOD='post' ACTION='iimport_expl.php' />\n                    <h3>" . $msg['import_noti_form_titre'] . "</h3>\n                    <div class='form-contenu'>\n                    <div class='row'>\n                        <div class='colonne2'>\n                            <label class='etiquette' for='isbn_obligatoire'>{$msg['564']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_mandatory' id='io0' VALUE='0' CLASS='radio' checked='checked' /><label for='io0'> {$msg['39']} </label>\n                            </div>\n                        <div class='colonne-suite'>\n                            <label class='etiquette' for='isbn_dedoublonnage'>{$msg['568']}</label><br />\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di1' VALUE='1' CLASS='radio' checked='checked' /><label for='di1'> {$msg['40']} </label>\n                            <INPUT TYPE='radio' NAME='isbn_dedoublonnage' id='di0' VALUE='0' CLASS='radio' /><label for='di0'> {$msg['39']} </label>\n                            <input type='checkbox' name='isbn_only' id='ionly' value='1' /><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n                            </div>\n                        </div>\n                        <div class='row'>&nbsp;</div>\n\t\t\t\t\t\t<div class='row'>\n\t                        <div class='colonne2'>\t\n\t                    \t\t<label class='etiquette' for='statutnot'>{$msg['import_statutnot']}</label>\n\t                    \t\t<div>\n\t                    \t\t" . gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "statutnot", "", 1, "", "", "", "", 0) . "\n\t                    \t\t</div>\n\t                    \t</div>\n\t                    \t<div class='colonne-suite'>\n\t                    \t\t<label class='etiquette' for='generer_lien'>" . $msg['import_genere_liens'] . "</label><br />\n\t                    \t\t<INPUT TYPE='radio' NAME='link_generate' id='link1' VALUE='1' CLASS='radio' /><label for='link1'> {$msg['40']} </label>\n\t                            <INPUT TYPE='radio' NAME='link_generate' id='link0' VALUE='0' CLASS='radio' checked='checked' /><label for='link0'> {$msg['39']} </label>\n\t                    \t</div>\n                   \t\t</div>\n                   \t\t<div class='row'>&nbsp;</div>\n                   \t\t<div class='row'>\n                   \t\t\t<div class='colonne2'>\n                   \t\t\t\t&nbsp;<br />\n                   \t\t\t\t&nbsp;\n                   \t\t\t</div>\n                   \t\t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t\t<label class='etiquette' for='authorities_notices'>" . htmlentities($msg['import_with_authorities_notices'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices1' value='1' class='radio' /><label for='authorities_notices1'>" . htmlentities($msg[40], ENT_QUOTES, $charset) . "</label>          \t\t\t\n\t\t\t\t\t\t\t\t<input type='radio' name='authorities_notices' id='authorities_notices0' value='0' class='radio' checked='checked'/><label for='authorities_notices0'>" . htmlentities($msg[39], ENT_QUOTES, $charset) . "</label>\n                   \t\t\t</div>\n                   \t\t</div>\n                   \t\t<div class='row'>&nbsp;</div>\n                   \t\t<div clas='row'>\n                   \t\t\t<div class='colonne2'>\n                   \t\t\t\t&nbsp;<br />\n                   \t\t\t\t&nbsp;\n                   \t\t\t</div>\n                   \t\t\t<div class='colonne-suite'>\n                   \t\t\t\t<label class='etiquette' for='authorities_default_origin'>" . htmlentities($msg['import_authorities_origin_default_value'], ENT_QUOTES, $charset) . "</label><br />\n\t\t\t\t\t\t\t\t" . origin::gen_combo_box("authorities", "authorities_default_origin") . "\n                   \t\t\t</div> \n                   \t\t</div>\n\t                    <div class='row'>&nbsp;</div>\n                        <div class='row'>\n                            <label class='etiquette' for='txt_suite'>{$msg['501']}</label>\n                            </div>\n                        <div class='row'>\n                            <INPUT NAME='userfile' class='saisie-80em' TYPE='file' size='60' />\n                            <INPUT NAME='categ' TYPE='hidden' value='import' />\n                            <INPUT NAME='sub' TYPE='hidden' value='import' />\n                            <INPUT NAME='action' TYPE='hidden' value='afterupload' />\n                            </div>\n                        </div>\n                    <INPUT TYPE='SUBMIT' class='bouton' NAME='upload' VALUE='" . $msg[502] . "' />\n                    </FORM>";
// PRELOAD
function loadfile_in_table()
{
    global $msg;
    global $sub, $book_lender_name;
    global $noticenumber, $filename, $from_file, $pb_fini, $recharge;
    global $pmb_import_limit_read_file;
    if ($noticenumber == "") {
        $noticenumber = 0;
    }
    if (!file_exists($filename)) {
        printf($msg[506], $from_file);
        /* The file %s doesn't exist... */
        return;
    }
 public function import()
 {
     global $msg;
     $this->num_origin = origin::import("authorities", $this->notice->common_data['source']);
     //on commence par regarder si le numéro d'autorité est présent dans la table authorities_sources...
     if ($this->notice->common_data['authority_number']) {
         $query = "select num_authority from authorities_sources where authority_number = '" . $this->notice->common_data['authority_number'] . "' and authority_type = '" . $this->notice->type . "' and num_origin_authority = " . $this->num_origin;
         $result = mysql_query($query);
         if (mysql_num_rows($result)) {
             //existe dans la table authority_source
             $row = mysql_fetch_object($result);
             $id_authority = $row->num_authority;
         }
         if ($id_authority == 0) {
             //existe pas, on regarde si l'autorité existe dans PMB
             $id_authority = $this->notice->check_if_exists($this->notice->specifics_data);
         }
     }
     if ($id_authority != 0) {
         //on regarde si l'autorité PMB est déjà importée dans un autre source authorities_sources
         $query = "select * from authorities_sources where num_authority = " . $id_authority . " and authority_type= '" . $this->notice->type . "' and authority_favorite = 1 and num_origin_authority != " . $this->num_origin;
         $result = mysql_query($query);
         if (mysql_num_rows($result)) {
             //déjà importée avec une autre source, on la sépare
             $this->split_authority($id_authority);
         } else {
             //jamais citée, on la met à jour
             $this->update_authority($id_authority);
         }
     } else {
         $this->create_authority();
     }
     if ($this->authority_id != 0 && $this->create_link != 0) {
         $this->import_link();
     }
 }