function traite_exemplaires()
{
    global $msg, $dbh;
    global $nb_expl_ignores;
    global $prix, $notice_id, $info_996, $info_995, $info_001, $info_345_d;
    global $bulletin_id;
    global $id_expl_fournisseur_opsys, $id_expl_inventaire_opsys;
    // Afin de ne pas remettre en cause le script programmé en 995 :
    $info_995 = $info_996;
    // lu en 010$d de la notice
    $price = $prix[0];
    // prix dvd et video
    if ($info_345_d[0]) {
        $price = $info_345_d[0];
    }
    // la zone 995 est répétable
    for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) {
        /* RAZ expl */
        $expl = array();
        /* préparation du tableau à passer à la méthode */
        $expl['notice'] = $notice_id;
        $expl['cb'] = $info_995[$nb_expl]['f'];
        $expl['cote'] = $info_995[$nb_expl]['k'];
        $expl['note'] = $info_995[$nb_expl]['u'] . $info_995[$nb_expl]['5'];
        $expl['prix'] = $price;
        $expl['cote_mandatory'] = 0;
        $expl['date_depot'] = substr($info_995[$nb_expl]['m'], 0, 4) . "-" . substr($info_995[$nb_expl]['m'], 4, 2) . "-" . substr($info_995[$nb_expl]['m'], 6, 2);
        $expl['date_retour'] = substr($info_995[$nb_expl]['n'], 0, 4) . "-" . substr($info_995[$nb_expl]['n'], 4, 2) . "-" . substr($info_995[$nb_expl]['n'], 6, 2);
        // propriétaire
        $owner = array();
        $owner['lender_libelle'] = $info_995[$nb_expl]['a'];
        if (!$owner['lender_libelle']) {
            $owner['lender_libelle'] = $info_995[$nb_expl]['b'];
        }
        if (!$owner['lender_libelle']) {
            $owner['lender_libelle'] = 'defaut';
        }
        $expl['expl_owner'] = lender::import($owner);
        $book_lender_id = $expl['expl_owner'];
        // docs_location
        $data_doc = array();
        $data_doc['location_libelle'] = $info_995[$nb_expl]['v'];
        $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['w'];
        if (!$data_doc['locdoc_codage_import']) {
            $data_doc['locdoc_codage_import'] = $data_doc['location_libelle'];
        }
        //$data_doc['locdoc_owner'] = $book_lender_id ;
        $data_doc['locdoc_owner'] = 0;
        $expl['location'] = docs_location::import($data_doc);
        // docs_section
        $data_doc = array();
        $data_doc['section_libelle'] = $info_995[$nb_expl]['x'];
        $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['y'];
        if (!$data_doc['sdoc_codage_import']) {
            $data_doc['sdoc_codage_import'] = $data_doc['section_libelle'];
        }
        //$data_doc['sdoc_owner'] = $book_lender_id ;
        $data_doc['sdoc_owner'] = 0;
        $expl['section'] = docs_section::import($data_doc);
        // typedoc
        $data_doc = array();
        $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['e'];
        if (!$data_doc['tdoc_libelle']) {
            $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['r'];
        }
        $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['r'];
        if (!$data_doc['tdoc_codage_import']) {
            $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['e'];
        }
        $data_doc['duree_pret'] = 28;
        /* valeur par défaut */
        $data_doc['tdoc_owner'] = $book_lender_id;
        $expl['typdoc'] = docs_type::import($data_doc);
        // statut doc
        $data_doc = array();
        $data_doc['statut_libelle'] = $info_995[$nb_expl]['1'];
        $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['2'];
        if (!$data_doc['statusdoc_codage_import']) {
            $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['1'];
        }
        $data_doc['pret_flag'] = $info_995[$nb_expl]['3'];
        $data_doc['statusdoc_owner'] = $book_lender_id;
        $expl['statut'] = docs_statut::import($data_doc);
        // codestat
        //$expl['codestat'] = 10 ;
        $data_codestat['codestat_libelle'] = strtolower($info_995[$nb_expl]['x']);
        $expl['codestat'] = docs_codestat::import($data_codestat);
        // quoi_faire
        // $que_faire vient du formulaire de chargement, à utiliser en attente de l'info dans la zone 996
        global $que_faire;
        if ($que_faire == "") {
            if ($info_995[$nb_expl]['0']) {
                $expl['quoi_faire'] = $info_995[$nb_expl]['0'];
            } else {
                $expl['quoi_faire'] = 2;
            }
        } else {
            $expl['quoi_faire'] = $que_faire;
        }
        // 0 : supprimer, 1 ou vide : Mettre à jour ou ajouter, 2 : ajouter si possible, sinon rien.
        //print "<pre>";print_r($info_995);print_r($expl);print "</pre>";
        $expl_id = exemplaire::import($expl);
        if ($expl_id == 0) {
            $nb_expl_ignores++;
        }
        list($num_opsys, $type_opsys) = explode(" ", $info_001[0]);
        if ($type_opsys == 'UMO:13') {
            $requete = "update exemplaires set expl_notice='0', expl_bulletin='{$bulletin_id}' where expl_id='{$expl_id}' ";
            //print "$requete <br />";
            pmb_mysql_query($requete);
        }
        if (!$id_expl_fournisseur_opsys) {
            $rqt = "select idchamp from expl_custom where name='fournisseur'";
            $res = pmb_mysql_query($rqt, $dbh);
            if ($res && ($r = pmb_mysql_fetch_object($res))) {
                $id_expl_fournisseur_opsys = $r->idchamp;
            }
        }
        if (!$id_expl_inventaire_opsys) {
            $rqt = "select idchamp from expl_custom where name='inventaire'";
            $res = pmb_mysql_query($rqt, $dbh);
            if ($res && ($r = pmb_mysql_fetch_object($res))) {
                $id_expl_inventaire_opsys = $r->idchamp;
            }
        }
        //inventaire en champ perso
        if ($field = $info_995[$nb_expl]['6']) {
            $requete = "insert into expl_custom_values (expl_custom_champ,expl_custom_origine,expl_custom_small_text) values({$id_expl_inventaire_opsys},{$expl_id},'" . addslashes($field) . "')";
            pmb_mysql_query($requete);
        }
        //Fournisseur en champ perso
        if ($field = $info_995[$nb_expl]['7']) {
            $requete = "insert into expl_custom_values (expl_custom_champ,expl_custom_origine,expl_custom_small_text) values({$id_expl_fournisseur_opsys},{$expl_id},'" . addslashes($field) . "')";
            pmb_mysql_query($requete);
        }
        //Date de création
        if ($field = $info_995[$nb_expl]['8']) {
            $requete = "update exemplaires set create_date='{$field} 12:00:00' where expl_id='{$expl_id}' ";
            //print $requete;
            pmb_mysql_query($requete);
        }
    }
    // fin for
}
예제 #2
0
function traite_exemplaires()
{
    global $msg, $dbh;
    global $prix, $notice_id, $info_995, $typdoc_995, $tdoc_codage, $book_lender_id, $section_995, $sdoc_codage, $book_statut_id, $locdoc_codage, $codstatdoc_995, $statisdoc_codage, $cote_mandatory, $book_location_id, $nb_expl_ignores;
    // la zone 995 est répétable
    for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) {
        /* RAZ expl */
        $expl = array();
        /* préparation du tableau à passer à la méthode */
        $expl['cb'] = $info_995[$nb_expl]['a'];
        if (!$expl['cb']) {
            $expl['cb'] = "NOTI-" . $notice_id;
        }
        $expl['notice'] = $notice_id;
        $expl['cote'] = $info_995[$nb_expl]['f'];
        $expl['note'] = $info_995[$nb_expl]['u'];
        $expl['prix'] = $info_995[$nb_expl]['B'];
        $expl['date_depot'] = today();
        $expl['date_retour'] = today();
        // type de support
        $data_doc = array();
        $data_doc['tdoc_libelle'] = "Type doc - " . $info_995[$nb_expl]['c'];
        $data_doc['duree_pret'] = 0;
        /* valeur par défaut */
        $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['c'];
        $data_doc['tdoc_owner'] = 0;
        $expl['typdoc'] = docs_type::import($data_doc);
        // $expl['section']    = $info_995[$nb_expl]['x']; à chercher dans docs_section
        $data_doc = array();
        $data_doc['section_libelle'] = $info_995[$nb_expl]['x'];
        $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['x'];
        $data_doc['sdoc_owner'] = 0;
        $expl['section'] = docs_section::import($data_doc);
        if (!$expl['section']) {
            $expl['section'] = 31;
        }
        // $expl['statut']
        $data_doc = array();
        $data_doc['statut_libelle'] = "Statut - " . $info_995[$nb_expl]['y'];
        $data_doc['pret_flag'] = 1;
        $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['y'];
        $data_doc['statusdoc_owner'] = 0;
        $expl['statut'] = docs_statut::import($data_doc);
        // $expl['location']
        $data_doc = array();
        $data_doc['location_libelle'] = "Localisation - " . $info_995[$nb_expl]['w'];
        $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['w'];
        $data_doc['locdoc_owner'] = 0;
        $expl['location'] = docs_location::import($data_doc);
        // $expl['codestat']   = $info_995[$nb_expl]['O']; (O majuscule, pas zéro)
        $data_doc = array();
        $data_doc['codestat_libelle'] = "Code stat - " . $info_995[$nb_expl]['O'];
        $data_doc['statisdoc_codage_import'] = $info_995[$nb_expl]['O'];
        $data_doc['statisdoc_owner'] = 0;
        $expl['codestat'] = docs_codestat::import($data_doc);
        if (!$expl['codestat']) {
            $expl['codestat'] = 38;
        }
        // $expl['expl_owner']
        $data_doc = array();
        $data_doc['lender_libelle'] = $info_995[$nb_expl]['R'];
        $expl['expl_owner'] = lender::import($data_doc);
        if (!$expl['expl_owner']) {
            $expl['expl_owner'] = 3;
        }
        $expl['cote_mandatory'] = $cote_mandatory;
        $expl_id = exemplaire::import($expl);
        if ($expl_id == 0) {
            $nb_expl_ignores++;
        }
        // Numéro du jeu
        if ($info_995[$nb_expl]['v'] && $expl_id) {
            $requete = "insert into expl_custom_values (expl_custom_champ,expl_custom_origine,expl_custom_small_text) values(1,{$expl_id},'" . addslashes($info_995[$nb_expl]['v']) . "')";
            mysql_query($requete);
        }
        //debug : affichage zone 995
        /*
        echo "995\$a =".$info_995[$nb_expl]['a']."<br />";
        echo "995\$b =".$info_995[$nb_expl]['b']."<br />";
        echo "995\$c =".$info_995[$nb_expl]['c']."<br />";
        echo "995\$d =".$info_995[$nb_expl]['d']."<br />";
        echo "995\$f =".$info_995[$nb_expl]['f']."<br />";
        echo "995\$k =".$info_995[$nb_expl]['k']."<br />";
        echo "995\$m =".$info_995[$nb_expl]['m']."<br />";
        echo "995\$n =".$info_995[$nb_expl]['n']."<br />";
        echo "995\$o =".$info_995[$nb_expl]['o']."<br />";
        echo "995\$q =".$info_995[$nb_expl]['q']."<br />";
        echo "995\$r =".$info_995[$nb_expl]['r']."<br />";
        echo "995\$u =".$info_995[$nb_expl]['u']."<br /><br />";
        */
    }
    // fin for
}
예제 #3
0
function traite_exemplaires()
{
    global $msg, $dbh;
    global $nb_expl_ignores;
    global $bulletin_ex;
    global $prix, $notice_id, $info_995, $typdoc_995, $tdoc_codage, $book_lender_id, $section_995, $sdoc_codage, $book_statut_id, $locdoc_codage, $codstatdoc_995, $statisdoc_codage, $cote_mandatory, $book_location_id;
    // lu en 010$d de la notice
    //$price = $prix[0];
    // la zone 995 est répétable
    for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) {
        /* RAZ expl */
        $expl = array();
        if ($bulletin_ex == -1) {
            return;
        } elseif ($bulletin_ex) {
            $expl['bulletin'] = $bulletin_ex;
            $expl['notice'] = 0;
        } else {
            $expl['notice'] = $notice_id;
            $expl['bulletin'] = 0;
        }
        /* préparation du tableau à passer à la méthode */
        $cbarre = $info_995[$nb_expl]['f'];
        if (!$cbarre) {
            $cbarre = "ind";
        }
        $pb = 1;
        $num_login = 1;
        $expl['cb'] = $cbarre;
        while ($pb == 1) {
            $q = "SELECT expl_cb FROM exemplaires WHERE expl_cb='" . $expl['cb'] . "' LIMIT 1 ";
            $r = pmb_mysql_query($q, $dbh);
            //echo "requete : ".$q."<br>";
            $nb = pmb_mysql_num_rows($r);
            if ($nb) {
                $expl['cb'] = $cbarre . "-" . $num_login;
                $num_login++;
            } else {
                $pb = 0;
            }
        }
        // $expl['typdoc']     = $info_995[$nb_expl]['r']; à chercher dans docs_typdoc
        $data_doc = array();
        //$data_doc['tdoc_libelle'] = $info_995[$nb_expl]['r']." -Type doc importé (".$book_lender_id.")";
        $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['r'];
        $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['r'];
        if (!$data_doc['tdoc_libelle']) {
            $data_doc['tdoc_libelle'] = "Indéterminé";
            $data_doc['tdoc_codage_import'] = "Indéterminé";
        }
        $data_doc['duree_pret'] = 0;
        /* valeur par défaut */
        $data_doc['tdoc_owner'] = 0;
        $expl['typdoc'] = docs_type::import($data_doc);
        $expl['cote'] = $info_995[$nb_expl]['k'];
        if ($expl['cote'] == "") {
            $expl['cote'] = "Indetermine";
        }
        // $expl['section']    = $info_995[$nb_expl]['q']; à chercher dans docs_section
        /*$data_doc=array();
        		$info_995[$nb_expl]['q']=trim($info_995[$nb_expl]['q']);
        		if (!$info_995[$nb_expl]['q']) 
        			$info_995[$nb_expl]['q'] = "u";
        		*/
        $data_doc = array();
        $data_doc['section_libelle'] = $info_995[$nb_expl]['q'];
        $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['q'];
        if (!$data_doc['section_libelle']) {
            $data_doc['section_libelle'] = "Indéterminé";
            $data_doc['sdoc_codage_import'] = "Indéterminé";
        }
        $data_doc['sdoc_owner'] = 0;
        $expl['section'] = docs_section::import($data_doc);
        if (!$info_995[$nb_expl]['o']) {
            $expl['statut'] = $book_statut_id;
        } else {
            $info_995[$nb_expl]['o'] = "Indéterminé";
            $data_doc = array();
            $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['o'];
            $data_doc['statut_libelle'] = $info_995[$nb_expl]['o'];
            $data_doc['statusdoc_owner'] = 0;
            $expl['statut'] = docs_statut::import($data_doc);
        }
        //$expl['statut'] = $book_statut_id;
        if ($info_995[$nb_expl]['a'] != "") {
            $data_doc = array();
            $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['a'];
            $data_doc['location_libelle'] = $info_995[$nb_expl]['a'];
            $data_doc['locdoc_owner'] = 0;
            $expl['location'] = docs_location::import($data_doc);
        } else {
            $expl['location'] = $book_location_id;
        }
        // $expl['codestat']   = $info_995[$nb_expl]['q']; 'q' utilisé, éventuellement à fixer par combo_box
        $data_doc = array();
        $data_doc['codestat_libelle'] = $info_995[$nb_expl]['q'];
        $data_doc['statisdoc_codage_import'] = $info_995[$nb_expl]['q'];
        if (!$data_doc['codestat_libelle']) {
            $data_doc['codestat_libelle'] = "Indéterminé";
            $data_doc['statisdoc_codage_import'] = "Indéterminé";
        }
        $data_doc['statisdoc_owner'] = 0;
        $expl['codestat'] = docs_codestat::import($data_doc);
        // $expl['creation']   = $info_995[$nb_expl]['']; à préciser
        // $expl['modif']      = $info_995[$nb_expl]['']; à préciser
        $expl['comment'] = $info_995[$nb_expl]['u'];
        $expl['note'] = "";
        $expl['prix'] = $prix[0];
        $expl['expl_owner'] = $book_lender_id;
        $expl['cote_mandatory'] = $cote_mandatory;
        $data['date_depot'] = "";
        // Attention il faut en post migration mette cette info dans la date de création de l'exemplaire
        // quoi_faire
        $expl['quoi_faire'] = 2;
        $expl_id = exemplaire::import($expl);
        if ($expl_id == 0) {
            $nb_expl_ignores++;
        } else {
        }
    }
    // fin for
}
예제 #4
0
         }
     }
     break;
 case 'preload':
     if ($sub == "import_expl") {
         /* Does the file exist ? */
         if ($file_submit == "") {
             /* l'utilisateur n'est pas passé par le téléchargement du fichier */
             $filename = $base_path . "/admin/import/" . $nom_fichier_transfert_ftp;
             $from_file = "unimarc" . (defined("LOCATION") ? "_" . constant("LOCATION") : "") . ".fic";
         } else {
             $filename = $file_submit;
         }
         if ($book_lender_id == "" || $book_statut_id == "" || $isbn_mandatory == "" || $cote_mandatory == "" || $book_location_id == "" || $statutnot == "") {
             /* l'utilisateur n'est pas passé par le téléchargement du fichier, il faut qu'il choisisse un prêteur s'il n'en a pas communiqué auparavant */
             print "\n\t\t\t\t\t<form class='form-{$current_module}' NAME=\"preload\" METHOD=\"post\" ACTION=\"iimport_expl.php\">\n\t\t\t\t\t\t<h3>" . $msg['import_expl_form_titre'] . "</h3>\n\t\t\t\t\t\t<div class='form-contenu'>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<div class='colonne2'>\n\t\t\t\t\t\t\t\t<label class='etiquette' for='isbn_obligatoire'>{$msg['564']}</label><br />\n\t\t\t\t\t\t\t\t<INPUT TYPE='radio' NAME='isbn_mandatory' id='io1' VALUE='1' CLASS='radio' /><label for='io1'> {$msg['40']} </label>\n\t\t\t\t\t\t\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\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class='colonne-suite'>\n\t\t\t\t\t\t\t\t<label class='etiquette' for='isbn_dedoublonnage'>{$msg['568']}</label><br />\n\t\t\t\t\t\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\t\t\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\t\t\t\t\t<input type='checkbox' name='isbn_only' id='ionly' value='1'/><label for='ionly'> " . $msg["ignore_issn"] . " </label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<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</div>\n                    \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</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>\t\n                   \t\t<div class='row'>&nbsp;</div>\n\t\t\t\t\t\t<div class='row'><hr /></div>\n\t\t\t\t\t\t<div class='row'>\n                            <label class='etiquette' for='prêteur 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\t                    <div class='row'>\n    \t                    <label class='etiquette' for='localisation'>{$msg['import_localisation']}</label>\n        \t                </div>\n            \t        <div class='row'>" . docs_location::gen_combo_box($deflt_docs_location) . "\n                    \t    </div>\n                        <div class='row'><hr /></div>\n                    \t<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' VALUE='1' CLASS='radio' /> {$msg['40']}\n                            <INPUT TYPE='radio' NAME='cote_mandatory' VALUE='0' CLASS='radio' checked='checked' /> {$msg['39']}\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' VALUE='1' CLASS='radio' /> " . $msg["import_expl_codage_proprio"] . "\n                            <INPUT TYPE='radio' NAME='tdoc_codage' VALUE='0' CLASS='radio' checked='checked' /> " . $msg["import_expl_codage_generique"] . "\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' VALUE='1' CLASS='radio' /> " . $msg["import_expl_codage_proprio"] . "\n                            <INPUT TYPE='radio' NAME='statisdoc_codage' VALUE='0' CLASS='radio' checked='checked' /> " . $msg["import_expl_codage_generique"] . "\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' VALUE='1' CLASS='radio' /> " . $msg["import_expl_codage_proprio"] . "\n                            <INPUT TYPE='radio' NAME='sdoc_codage' VALUE='0' CLASS='radio' checked='checked' /> " . $msg["import_expl_codage_generique"] . "\n                            </div>\n                        <div class='row'>\n                            <label class='etiquette'>{$msg['21']}</label>\n                            </div>\n                        </div>\n                    <INPUT TYPE=\"SUBMIT\"  class='bouton' NAME=\"upload\" VALUE=\"" . $msg[502] . "\" />\n                    <INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\" />\n                    <INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"import_expl\" />\n                    <INPUT NAME=\"action\" TYPE=\"hidden\" value=\"preload\" />\n                    <INPUT NAME=\"" . $name_func . "\" TYPE=\"hidden\" value=\"" . ${$name_func} . "\"/>\n                    </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_expl\" />";
             $formulaire .= "<INPUT NAME=\"action\" TYPE=\"hidden\" value=\"load\" />";
             $formulaire .= "<INPUT NAME=\"book_lender_id\" TYPE=\"hidden\" value=\"" . $book_lender_id . "\" />";
             $formulaire .= "<INPUT NAME=\"book_statut_id\" TYPE=\"hidden\" value=\"" . $book_statut_id . "\" />";
             $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";
function traite_exemplaires()
{
    global $nb_expl_ignores, $bulletin_ex;
    global $prix, $notice_id, $info_996, $info_999, $typdoc_995, $tdoc_codage, $book_lender_id, $section_995, $sdoc_codage, $book_statut_id, $codstatdoc_995, $statisdoc_codage, $cote_mandatory, $book_location_id;
    global $suffix;
    // lu en 010$d de la notice
    $price = $prix[0];
    // la zone 995 est répétable
    for ($nb_expl = 0; $nb_expl < sizeof($info_996); $nb_expl++) {
        /* RAZ expl */
        $expl = array();
        $data = array();
        /*if(!$info_996[$nb_expl]['a'])$info_996[$nb_expl]['a'] ="Indéterminé";
        		$data['lender_libelle']=$info_996[$nb_expl]['a'];
        		$book_lender_id=lender::import($data);*/
        //Propriétaire
        if (trim($info_996[$nb_expl]['a'])) {
            $requete = "SELECT idlender FROM lenders WHERE lender_libelle LIKE '" . addslashes($info_996[$nb_expl]['a']) . "'";
            $res = mysql_query($requete);
            if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
                $local_book_lender_id = $id;
            } else {
                $local_book_lender_id = $book_lender_id;
            }
        } else {
            $local_book_lender_id = $book_lender_id;
        }
        /* préparation du tableau à passer à la méthode */
        $cbarre = $info_996[$nb_expl]['f'];
        if (!$cbarre) {
            $cbarre = "ind";
        }
        $pb = 1;
        $num_login = 1;
        $expl['cb'] = $cbarre;
        while ($pb == 1) {
            $q = "SELECT expl_cb FROM exemplaires WHERE expl_cb='" . addslashes($expl['cb']) . "' LIMIT 1 ";
            $r = mysql_query($q);
            $nb = mysql_num_rows($r);
            if ($nb) {
                $expl['cb'] = $cbarre . "-" . $num_login;
                $num_login++;
            } else {
                $pb = 0;
            }
        }
        if ($info_996[$nb_expl]['f'] != $expl['cb']) {
            $mon_msg = "ERREUR : l'exemplaire avec le code barres : " . $info_996[$nb_expl]['f'] . " existe déjà donc il ne sera pas créé";
            mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . addslashes($mon_msg) . "') ");
            continue;
        }
        if ($bulletin_ex) {
            $expl['bulletin'] = $bulletin_ex;
            $expl['notice'] = 0;
        } else {
            $expl['notice'] = $notice_id;
            $expl['bulletin'] = 0;
        }
        $data_doc = array();
        $data_doc['tdoc_libelle'] = $info_996[$nb_expl]['e'];
        if (!$data_doc['tdoc_libelle']) {
            $data_doc['tdoc_libelle'] = "Indéterminé";
        }
        $requete = "SELECT idtyp_doc FROM docs_type WHERE tdoc_libelle LIKE '" . addslashes($data_doc['tdoc_libelle']) . "'";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['typdoc'] = $id;
        } else {
            $data_doc['duree_pret'] = 0;
            /* valeur par défaut */
            $data_doc['tdoc_codage_import'] = $data_doc['tdoc_libelle'];
            if ($tdoc_codage) {
                $data_doc['tdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['tdoc_owner'] = 0;
            }
            $expl['typdoc'] = docs_type::import($data_doc);
        }
        $expl['cote'] = $info_996[$nb_expl]['k'];
        if (!$info_996[$nb_expl]['x']) {
            $info_996[$nb_expl]['x'] = "Indéterminé";
        }
        $requete = "SELECT idsection FROM docs_section WHERE section_libelle LIKE '" . addslashes($info_996[$nb_expl]['x']) . "'";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['section'] = $id;
        } else {
            $data_doc = array();
            $data_doc['section_libelle'] = $info_996[$nb_expl]['x'];
            $data_doc['sdoc_codage_import'] = $info_996[$nb_expl]['x'];
            if ($sdoc_codage) {
                $data_doc['sdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['sdoc_owner'] = 0;
            }
            $expl['section'] = docs_section::import($data_doc);
        }
        if (!$info_996[$nb_expl]['1']) {
            $info_996[$nb_expl]['1'] = "Indéterminé";
        }
        $requete = "SELECT  idstatut FROM docs_statut WHERE statut_libelle LIKE '" . addslashes($info_996[$nb_expl]['1']) . "'";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['statut'] = $id;
        } else {
            $data_doc = array();
            $data_doc['statut_libelle'] = $info_996[$nb_expl]['1'];
            $data_doc['pret_flag'] = 1;
            $data_doc['statusdoc_codage_import'] = $info_996[$nb_expl]['1'];
            if ($sdoc_codage) {
                $data_doc['statusdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['statusdoc_owner'] = 0;
            }
            $expl['statut'] = docs_statut::import($data_doc);
        }
        $requete = "SELECT idlocation FROM docs_location WHERE location_libelle LIKE '" . addslashes($info_996[$nb_expl]['v']) . "'";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['location'] = $id;
        } else {
            $expl['location'] = $book_location_id;
        }
        if (!$info_996[$nb_expl]['c']) {
            $info_996[$nb_expl]['c'] = "Indéterminé";
        }
        $requete = "SELECT idcode FROM docs_codestat WHERE codestat_libelle  LIKE '" . addslashes($info_996[$nb_expl]['c']) . "'";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['codestat'] = $id;
        } else {
            $data_doc = array();
            $data_doc['codestat_libelle'] = $info_996[$nb_expl]['c'];
            $data_doc['statisdoc_codage_import'] = $info_996[$nb_expl]['c'];
            if ($statisdoc_codage) {
                $data_doc['statisdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['statisdoc_owner'] = 0;
            }
            $expl['codestat'] = docs_codestat::import($data_doc);
        }
        if ($info_996[$nb_expl]['4']) {
            $expl['creation'] = $info_996[$nb_expl]['4'];
        }
        $expl['note'] = $info_996[$nb_expl]['u'];
        $expl['comment'] = $info_996[$nb_expl]['z'];
        $expl['prix'] = $price;
        $expl['expl_owner'] = $local_book_lender_id;
        $expl['cote_mandatory'] = $cote_mandatory;
        $expl['date_depot'] = substr($info_996[$nb_expl]['m'], 0, 4) . "-" . substr($info_996[$nb_expl]['m'], 4, 2) . "-" . substr($info_996[$nb_expl]['m'], 6, 2);
        $expl['date_retour'] = substr($info_996[$nb_expl]['n'], 0, 4) . "-" . substr($info_996[$nb_expl]['n'], 4, 2) . "-" . substr($info_996[$nb_expl]['n'], 6, 2);
        // quoi_faire
        $expl['quoi_faire'] = 2;
        $expl_id = exemplaire::import($expl);
        if ($expl_id == 0) {
            $nb_expl_ignores++;
        } else {
            //Champ perso d'exemplaire
            //echo "Passe ici<br>";
            foreach ($info_999 as $key => $value) {
                if ($value["f"] == $info_996[$nb_expl]['f']) {
                    //Je suis bien sur un cp de cet exemplaire
                    if (!renseigne_cp($value["n"], $value["a"], $expl_id, "expl")) {
                        $mon_msg = "La valeur  : " . $value["a"] . " n'a pas été reprise dans le champ personalisé : " . $value["n"] . " car le champ n'existe pas";
                        mysql_query("insert into error_log (error_origin, error_text) values ('import_" . addslashes(SESSid) . ".inc', '" . addslashes($mon_msg) . "') ");
                    } else {
                        unset($info_999[$key]);
                    }
                }
            }
        }
    }
    // fin for
}
예제 #6
0
function traite_exemplaires()
{
    global $msg, $dbh;
    global $nb_expl_ignores;
    global $prix, $notice_id, $info_996, $info_995;
    // Afin de ne pas remettre en cause le script programmé en 995 :
    $info_995 = $info_996;
    // lu en 010$d de la notice
    $price = $prix[0];
    // la zone 995 est répétable
    for ($nb_expl = 0; $nb_expl < sizeof($info_995); $nb_expl++) {
        /* RAZ expl */
        $expl = array();
        /* préparation du tableau à passer à la méthode */
        $expl['notice'] = $notice_id;
        $expl['cb'] = $info_995[$nb_expl]['f'];
        $expl['cote'] = $info_995[$nb_expl]['k'];
        $expl['note'] = $info_995[$nb_expl]['u'];
        $expl['prix'] = $price;
        $expl['cote_mandatory'] = 0;
        $expl['date_depot'] = substr($info_995[$nb_expl]['m'], 0, 4) . "-" . substr($info_995[$nb_expl]['m'], 4, 2) . "-" . substr($info_995[$nb_expl]['m'], 6, 2);
        $expl['date_retour'] = substr($info_995[$nb_expl]['n'], 0, 4) . "-" . substr($info_995[$nb_expl]['n'], 4, 2) . "-" . substr($info_995[$nb_expl]['n'], 6, 2);
        // propriétaire
        $owner = array();
        $owner['lender_libelle'] = $info_995[$nb_expl]['a'];
        if (!$owner['lender_libelle']) {
            $owner['lender_libelle'] = $info_995[$nb_expl]['b'];
        }
        $expl['expl_owner'] = lender::import($owner);
        $book_lender_id = $expl['expl_owner'];
        // docs_location
        $data_doc = array();
        $data_doc['location_libelle'] = $info_995[$nb_expl]['v'];
        $data_doc['locdoc_codage_import'] = $info_995[$nb_expl]['w'];
        if (!$data_doc['locdoc_codage_import']) {
            $data_doc['locdoc_codage_import'] = $data_doc['location_libelle'];
        }
        //$data_doc['locdoc_owner'] = $book_lender_id ;
        $data_doc['locdoc_owner'] = 0;
        $expl['location'] = docs_location::import($data_doc);
        // docs_section
        $data_doc = array();
        $data_doc['section_libelle'] = $info_995[$nb_expl]['x'];
        $data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['y'];
        if (!$data_doc['sdoc_codage_import']) {
            $data_doc['sdoc_codage_import'] = $data_doc['section_libelle'];
        }
        //$data_doc['sdoc_owner'] = $book_lender_id ;
        $data_doc['sdoc_owner'] = 0;
        $expl['section'] = docs_section::import($data_doc);
        // typedoc
        $data_doc = array();
        $data_doc['tdoc_libelle'] = $info_995[$nb_expl]['e'];
        $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['r'];
        if (!$data_doc['tdoc_codage_import']) {
            $data_doc['tdoc_codage_import'] = $info_995[$nb_expl]['e'];
        }
        $data_doc['duree_pret'] = 28;
        /* valeur par défaut */
        $data_doc['tdoc_owner'] = $book_lender_id;
        $expl['typdoc'] = docs_type::import($data_doc);
        // statut doc
        $data_doc = array();
        $data_doc['statut_libelle'] = $info_995[$nb_expl]['1'];
        $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['2'];
        if (!$data_doc['statusdoc_codage_import']) {
            $data_doc['statusdoc_codage_import'] = $info_995[$nb_expl]['1'];
        }
        $data_doc['pret_flag'] = $info_995[$nb_expl]['3'];
        $data_doc['statusdoc_owner'] = $book_lender_id;
        $expl['statut'] = docs_statut::import($data_doc);
        // codestat
        $expl['codestat'] = 1;
        // quoi_faire
        // $que_faire vient du formulaire de chargement, à utiliser en attente de l'info dans la zone 996
        global $que_faire;
        if ($que_faire == "") {
            if ($info_995[$nb_expl]['0']) {
                $expl['quoi_faire'] = $info_995[$nb_expl]['0'];
            } else {
                $expl['quoi_faire'] = 2;
            }
        } else {
            $expl['quoi_faire'] = $que_faire;
        }
        // 0 : supprimer, 1 ou vide : Mettre à jour ou ajouter, 2 : ajouter si possible, sinon rien.
        $expl_id = exemplaire::import($expl);
        if ($expl_id == 0) {
            $nb_expl_ignores++;
        }
        //debug : affichage zone 995
        /*
        echo "995\$a =".$info_995[$nb_expl]['a']."<br />";
        echo "995\$b =".$info_995[$nb_expl]['b']."<br />";
        echo "995\$c =".$info_995[$nb_expl]['c']."<br />";
        echo "995\$d =".$info_995[$nb_expl]['d']."<br />";
        echo "995\$f =".$info_995[$nb_expl]['f']."<br />";
        echo "995\$k =".$info_995[$nb_expl]['k']."<br />";
        echo "995\$m =".$info_995[$nb_expl]['m']."<br />";
        echo "995\$n =".$info_995[$nb_expl]['n']."<br />";
        echo "995\$o =".$info_995[$nb_expl]['o']."<br />";
        echo "995\$q =".$info_995[$nb_expl]['q']."<br />";
        echo "995\$r =".$info_995[$nb_expl]['r']."<br />";
        echo "995\$u =".$info_995[$nb_expl]['u']."<br /><br />";
        */
    }
    // fin for
}
예제 #7
0
                $expl_pointage = str_replace('!!nouveau_codestat!!', $nouv_codestat->libelle, $expl_pointage);
                $expl_pointage = str_replace('!!nouveau_proprio!!', $nouv_proprio->lender_libelle, $expl_pointage);
                $expl_pointage_base = str_replace('!!explencoursdevalidation!!', $expl_pointage, $expl_pointage_base);
            } else {
                $expl_pointage_base = str_replace('!!explencoursdevalidation!!', "<hr /> {$noex} : {$msg['367']}...<hr />", $expl_pointage_base);
            }
        } else {
            $expl_pointage_base = str_replace('!!explencoursdevalidation!!', "", $expl_pointage_base);
        }
        $expl_pointage_base = str_replace('!!book_statut_id!!', docs_statut::gen_combo_box($book_statut_id), $expl_pointage_base);
        $expl_pointage_base = str_replace('!!book_section_id!!', docs_section::gen_combo_box($book_section_id), $expl_pointage_base);
        $expl_pointage_base = str_replace('!!book_location_id!!', docs_location::gen_combo_box($book_location_id), $expl_pointage_base);
        $expl_pointage_base = str_replace('!!book_doctype_id!!', docs_type::gen_combo_box($book_doctype_id), $expl_pointage_base);
        $expl_pointage_base = str_replace('!!book_codestat_id!!', docs_codestat::gen_combo_box($book_codestat_id), $expl_pointage_base);
        $expl_pointage_base = str_replace('!!book_lender_id!!', lender::gen_combo_box($book_lender_id), $expl_pointage_base);
        print $expl_pointage_base;
        break;
    default:
        include "{$include_path}/messages/help/{$lang}/pointage_expl.txt";
        print "\n\t\t\t<form class='form-{$current_module}' METHOD='post' ACTION=\"pointage_expl.php\">\n\t\t\t<h3>{$msg['562']}</h3>\n\t\t\t<div class='form-contenu'>\n\t\t\t\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t\t<!-- CB -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_statut'>{$msg['291']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t<input type='text' class='saisie-20em' name='noex' value=''>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t\t<!-- statut -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_stat'>{$msg['297']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t" . docs_statut::gen_combo_box($book_statut_id) . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t\t<!-- section -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_section'>{$msg['295']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t" . docs_section::gen_combo_box($book_section_id) . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t<!-- localisation -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_location'>{$msg['298']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t" . docs_location::gen_combo_box($book_location_id) . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t&nbsp;\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t\t<!-- typdoc=support -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_typdoc'>{$msg['294']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t" . docs_type::gen_combo_box($book_doctype_id) . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\n\t\t\t\t\t<div class='colonne4'>\n\t\t\t\t\t\t<!-- codestat -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_cstat'>{$msg['299']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t" . docs_codestat::gen_combo_box($book_codestat_id) . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t<div class='colonne_suite'>\n\t\t\t\t\t\t<!-- owner -->\n\t\t\t\t\t\t<label class='etiquette' for='f_ex_owner'>{$msg['651']}</label>\n\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t" . lender::gen_combo_box($book_lender_id) . "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class='row'> </div>\n\t\t\t\n\t\t\t</div>\t\n\t\t\t<INPUT TYPE=\"SUBMIT\" class='bouton' NAME=\"upload\" VALUE=\"" . $msg[502] . "\">\n\t\t\t<INPUT NAME=\"categ\" TYPE=\"hidden\" value=\"import\">\n\t\t\t<INPUT NAME=\"sub\" TYPE=\"hidden\" value=\"pointage_expl\">\n\t\t\t<INPUT NAME=\"action\" TYPE=\"hidden\" value=\"pointage\">\n\t\t\t</FORM>";
        break;
}
function expl_pointage($action, $annuler = '')
{
    global $expl_pointage;
    global $msg;
}
/* fin expl_pointage */
?>

예제 #8
0
function traite_exemplaires()
{
    global $nb_expl_ignores, $bulletin_ex;
    global $prix, $notice_id, $info_996_9, $info_999, $typdoc_995, $tdoc_codage, $book_lender_id, $section_995, $sdoc_codage, $book_statut_id, $codstatdoc_995, $statisdoc_codage, $cote_mandatory, $book_location_id;
    global $suffix;
    // lu en 010$d de la notice
    $price = $prix[0];
    $exemplaires = array();
    for ($i = 0; $i < count($info_996_9); $i++) {
        foreach ($info_996_9[$i] as $value) {
            if (preg_match("/^(.*?):(.*)\$/", $value, $matches)) {
                $exemplaires[$i][$matches[1]] = $matches[2];
            }
        }
    }
    // la zone 995 est répétable
    for ($nb_expl = 0; $nb_expl < sizeof($exemplaires); $nb_expl++) {
        /* RAZ expl */
        $expl = array();
        $data = array();
        /*if(!$info_996[$nb_expl]['a'])$info_996[$nb_expl]['a'] ="Indéterminé";
        		$data['lender_libelle']=$info_996[$nb_expl]['a'];
        		$book_lender_id=lender::import($data);*/
        //Propriétaire
        if ($tmp = trim($exemplaires[$nb_expl]["lender_libelle"])) {
            $requete = "SELECT idlender FROM lenders WHERE lender_libelle LIKE '" . addslashes($tmp) . "'";
            $res = mysql_query($requete);
            if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
                $local_book_lender_id = $id;
            } else {
                $local_book_lender_id = $book_lender_id;
            }
        } else {
            $local_book_lender_id = $book_lender_id;
        }
        /* préparation du tableau à passer à la méthode */
        $cbarre = $exemplaires[$nb_expl]["expl_cb"];
        if (!$cbarre) {
            $mon_msg = "ERREUR : J'ai un exemplaire sans code barres il ne sera donc pas créé";
            affiche_mes_erreurs($mon_msg);
            continue;
        }
        $pb = 1;
        $num_login = 1;
        $expl['cb'] = $cbarre;
        while ($pb == 1) {
            $q = "SELECT expl_cb FROM exemplaires WHERE expl_cb='" . addslashes($expl['cb']) . "' LIMIT 1 ";
            $r = mysql_query($q);
            $nb = mysql_num_rows($r);
            if ($nb) {
                $expl['cb'] = $cbarre . "-" . $num_login;
                $num_login++;
            } else {
                $pb = 0;
            }
        }
        if ($cbarre != $expl['cb']) {
            $mon_msg = "ERREUR : l'exemplaire avec le code barres : " . $cbarre . " existe déjà donc il ne sera pas créé";
            affiche_mes_erreurs($mon_msg);
            continue;
        }
        if ($bulletin_ex) {
            $expl['bulletin'] = $bulletin_ex;
            $expl['notice'] = 0;
        } else {
            $expl['notice'] = $notice_id;
            $expl['bulletin'] = 0;
        }
        //Support exemplaire
        $data_doc = array();
        $data_doc['tdoc_libelle'] = $exemplaires[$nb_expl]["tdoc_libelle"];
        //if (!$data_doc['tdoc_libelle']) $data_doc['tdoc_libelle'] = "Indéterminé" ;
        $requete = "SELECT idtyp_doc FROM docs_type WHERE tdoc_libelle LIKE '" . addslashes($data_doc['tdoc_libelle']) . "'";
        $res = mysql_query($requete);
        if ($data_doc['tdoc_libelle'] && mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['typdoc'] = $id;
        } else {
            $data_doc['duree_pret'] = 0;
            /* valeur par défaut */
            $data_doc['tdoc_codage_import'] = $exemplaires[$nb_expl]["tdoc_codage_import"];
            if ($tdoc_codage) {
                $data_doc['tdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['tdoc_owner'] = 0;
            }
            $expl['typdoc'] = docs_type::import($data_doc);
        }
        $expl['cote'] = $exemplaires[$nb_expl]["expl_cote"];
        //Section
        $data_doc = array();
        $data_doc['section_libelle'] = $exemplaires[$nb_expl]["section_libelle"];
        $requete = "SELECT idsection FROM docs_section WHERE section_libelle LIKE '" . addslashes($data_doc['section_libelle']) . "'";
        $res = mysql_query($requete);
        if ($data_doc['section_libelle'] && mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['section'] = $id;
        } else {
            $data_doc['sdoc_codage_import'] = $exemplaires[$nb_expl]["sdoc_codage_import"];
            if ($sdoc_codage) {
                $data_doc['sdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['sdoc_owner'] = 0;
            }
            $expl['section'] = docs_section::import($data_doc);
        }
        //Statut
        $data_doc = array();
        $data_doc['statut_libelle'] = $exemplaires[$nb_expl]["statut_libelle"];
        $requete = "SELECT  idstatut FROM docs_statut WHERE statut_libelle LIKE '" . addslashes($data_doc['statut_libelle']) . "'";
        $res = mysql_query($requete);
        if ($data_doc['statut_libelle'] && mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['statut'] = $id;
        } elseif ($exemplaires[$nb_expl]["statusdoc_codage_import"]) {
            $data_doc['pret_flag'] = 1;
            $data_doc['statusdoc_codage_import'] = $exemplaires[$nb_expl]["statusdoc_codage_import"];
            if ($sdoc_codage) {
                $data_doc['statusdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['statusdoc_owner'] = 0;
            }
            $expl['statut'] = docs_statut::import($data_doc);
        } else {
            $expl['statut'] = $book_statut_id;
        }
        //Localisation
        $requete = "SELECT idlocation FROM docs_location WHERE location_libelle LIKE '" . addslashes($exemplaires[$nb_expl]["location_libelle"]) . "'";
        $res = mysql_query($requete);
        if (mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['location'] = $id;
        } else {
            $expl['location'] = $book_location_id;
        }
        //Code stat
        $data_doc = array();
        $data_doc['codestat_libelle'] = $exemplaires[$nb_expl]["codestat_libelle"];
        $requete = "SELECT idcode FROM docs_codestat WHERE codestat_libelle  LIKE '" . addslashes($data_doc['codestat_libelle']) . "'";
        $res = mysql_query($requete);
        if ($data_doc['codestat_libelle'] && mysql_num_rows($res) && ($id = mysql_result($res, 0, 0))) {
            $expl['codestat'] = $id;
        } else {
            $data_doc['statisdoc_codage_import'] = $exemplaires[$nb_expl]["statisdoc_codage_import"];
            if ($statisdoc_codage) {
                $data_doc['statisdoc_owner'] = $local_book_lender_id;
            } else {
                $data_doc['statisdoc_owner'] = 0;
            }
            $expl['codestat'] = docs_codestat::import($data_doc);
        }
        $expl['creation'] = $exemplaires[$nb_expl]["create_date"];
        $expl['note'] = $exemplaires[$nb_expl]["expl_note"];
        $expl['comment'] = $exemplaires[$nb_expl]["expl_comment"];
        $expl['prix'] = $exemplaires[$nb_expl]["expl_prix"];
        $expl['expl_owner'] = $local_book_lender_id;
        $expl['cote_mandatory'] = $cote_mandatory;
        $expl['date_depot'] = $exemplaires[$nb_expl]["date_depot"];
        $expl['date_retour'] = $exemplaires[$nb_expl]["date_retour"];
        // quoi_faire
        $expl['quoi_faire'] = 2;
        $expl_id = exemplaire::import($expl);
        if ($expl_id == 0) {
            $nb_expl_ignores++;
        } else {
            //Champ perso d'exemplaire
            //echo "Passe ici<br>";
            foreach ($info_999 as $key => $value) {
                if ($value["f"] == $cbarre) {
                    //Je suis bien sur un cp de cet exemplaire
                    if (!renseigne_cp($value, $expl_id, "expl")) {
                        $mon_msg = "La valeur  : " . $value["a"] . " n'a pas été reprise dans le champ personnalisé : " . $value["n"] . " car le champ n'existe pas";
                        affiche_mes_erreurs($mon_msg);
                    } else {
                        unset($info_999[$key]);
                    }
                }
            }
        }
    }
    // fin for
}