" ; $nom_fichier_transfert_ftp = "unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic"; $tmp_file = (isset($_FILES['userfile']['tmp_name']) ? $_FILES['userfile']['tmp_name'] : ''); if (!isset($from_file)) $from_file = (isset($_FILES['userfile']['name']) ? $_FILES['userfile']['name'] : ''); $to_file = $base_path.'/temp/'.basename($tmp_file); if ($sub == "import_expl") { echo window_title($msg[520].$msg[1003].$msg[1001]); /* the name of the lender is read in the table */ if ($book_lender_id!="") { $sql_rech="select lender_libelle from lenders where idlender = '".$book_lender_id."' "; $sql_result_rech = pmb_mysql_query($sql_rech) or die ("Couldn't select lenders ! = ".$sql_rech); if (pmb_mysql_num_rows($sql_result_rech)==0) { $book_lender_name = $msg[561]; } else { $book_lender_name = pmb_mysql_result($sql_result_rech,0,"lender_libelle"); } } else { $book_lender_name = $msg[561]; } //------------------------------------- LLIUREX 22/02/2018-------------------------------------- } else if ($sub == "import_reb"){ echo window_title($msg["import_reb"].$msg[1003].$msg[1001]); // ------------------------------------- FIN LLIUREX 22/02/2018 ------------ } else { echo window_title($msg[500].$msg[1003].$msg[1001]); } switch ($action) { case 'beforeupload': if ($sub == "import_expl") { $book_lender_id = ""; $book_statut_id = ""; print $tpl_beforeupload_expl ; // ------------------------------ LLIUREX 22/02/2018-------------------------------------- } else if ($sub == "import_reb") { print $tpl_beforeupload_reb ; // ----------------------------FIN LLIUREX 22/02/2018---------------------------------- } else { // import de notice print $tpl_beforeupload_notices ; } break; case 'afterupload': if (!$statutnot) $statutnot = 1 ; if(!isset($que_faire)) $que_faire = ''; if(!isset($isbn_only)) $isbn_only = ''; if ($sub == "import_expl") { if ($book_lender_id==0 || $book_lender_id=="") { print $msg[561]; break; } if ($book_statut_id==0 || $book_statut_id=="") { print $msg[561]; break; } if ($tmp_file=="") { printf ($msg[503],$from_file); /* wrong permissions to copy the file %s ... Contact your admin... */ break; } if (!move_uploaded_file($tmp_file,$to_file)) { printf ($msg[504],$from_file); /* Fail to copy %s, Contact your admin... */ } else { printf ($msg[505],$from_file); /* File transfered, Loading is about to go on */ print import_expl::get_hidden_form('afterupload', 'preload'); print ""; } // -------------------------------- LLIUREX 22/02/2018-------------------------------------- } else if ($sub == "import_reb") { // import de rebeca if ($to_file=="") { printf ($msg[503],$from_file); /* wrong permissions to copy the file %s ... Contact your admin... */ break; } //if (strrpos(strtolower($from_file), ".reb") == false) { // printf ($msg['import_reb_fail_reb'],$from_file); /* wrong rebeca file %s ... Contact your admin... */ // break; //} if (!move_uploaded_file($tmp_file,$to_file)) { printf ($msg[504],$from_file); /* Fail to copy %s, Contact your admin... */ } else { printf ($msg[505],$from_file); /* File transfered, Loading is about to go on */ print "
"; print ""; print ""; print ""; print ""; print "
"; print ""; } // ------------------------------ FIN LLIUREX 22/02/2018------------------------------------ } else { // import de notice if ($to_file=="") { printf ($msg[503],$from_file); /* wrong permissions to copy the file %s ... Contact your admin... */ break; } if (!move_uploaded_file($tmp_file,$to_file)) { printf ($msg[504],$from_file); /* Fail to copy %s, Contact your admin... */ } else { printf ($msg[505],$from_file); /* File transfered, Loading is about to go on */ print import_records::get_hidden_form('afterupload', 'preload'); print ""; } } 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 */ // ---------------------------------- LLIUREX 22/02/2018-------------------------------------- // Cambiando la ruta de lectura del fichero a leer // Previamente se ha modificado folow_import.php para esc #$filename = $base_path."/admin/import/".$nom_fichier_transfert_ftp; $filename = $base_path."/temp/".$nom_fichier_transfert_ftp; // --------------------------------- FIN LLIUREX 22/02/2018------------------------------------ $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 "

".$msg['import_expl_form_titre']."



 
".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)."

 
".$msg['39']." ".$msg['40']."

 

".origin::gen_combo_box("authorities","authorities_default_origin")."
 

". lender::gen_combo_box($book_lender_id)."  ". docs_statut::gen_combo_box($book_statut_id)."
". docs_location::gen_combo_box($deflt_docs_location)."

$msg[40] $msg[39]

".$msg["import_expl_codage_proprio"]." ".$msg["import_expl_codage_generique"]."
".$msg["import_expl_codage_proprio"]." ".$msg["import_expl_codage_generique"]."
".$msg["import_expl_codage_proprio"]." ".$msg["import_expl_codage_generique"]."
".import_expl::get_advanced_form()."
"; break; } loadfile_in_table() ; if ($pb_fini=="EOF") { $formulaire = import_expl::get_hidden_form('load', 'load'); printf ($msg[512], $from_file); /* File %s... . End of preload... */ $fo = fopen("$base_path/temp/liste_id".SESSid.".txt","w"); fwrite($fo,""); fclose($fo); //file_put_contents("$base_path/temp/liste_id".SESSid.".txt",""); $script = ""; } else { $formulaire = import_expl::get_hidden_form('preload', 'preload'); $script = ""; } print $formulaire; print $script; // ----------------------------------- LLIUREX 22/02/2018-------------------------------------- } else if ($sub == "import_reb") { // import de notice /* Does the file exist ? */ if ($file_submit=="") $filename = "unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic"; else $filename=$file_submit; if ($noticenumber=="") $noticenumber=0; if (!file_exists($filename)) { printf ($msg[506],$filename); /* The file %s doesn't exist... */ return; } if (filesize($filename)==0) { printf ($msg[507],$filename); /* The file % is empty, it's going to be deleted */ unlink ($filename); return; } $handle = fopen ($filename, "rb"); if (!$handle) { printf ($msg[508],$filename); /* Unable to open the file %s ... */ return; } exec("yaz-marcdump -o marc -s ".$base_path."/temp/rebdump ".$filename." >/dev/null", $output, $return_var); if ($return_var) { printf ($msg['import_reb_fail_dump'],$filename); /* dump failed */ unlink ($filename); return; } $formulaire="
"; $formulaire.=""; $formulaire.=""; $formulaire.=""; $formulaire.=""; $formulaire.="
"; printf ($msg[509].$msg[512], $filename, $filename); /* File %s... . End of preload... */ $script = ""; print $formulaire; print $script; // ------------------------------FIN LLIUREX 22/02/2018 --------------------------- } else { // import de notice /* Does the file exist ? */ if ($file_submit=="") { // ---------------------------------- LLIUREX 22/02/2018-------------------------------------- // Cambiando la ruta de lectura del fichero a leer // Previamente se ha modificado folow_import.php para escribir en esta nueva ruta // $filename = $base_path."/admin/import/".$nom_fichier_transfert_ftp; $filename = $base_path."/temp/".$nom_fichier_transfert_ftp; // ------------------------------- FIN LLIUREX 22/02/2018-------------------------------------- $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 "

".$msg['import_noti_form_titre']."



 
".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)."

 
".$msg['39']." ".$msg['40']."

 

".origin::gen_combo_box("authorities","authorities_default_origin")."
 
"; break; } loadfile_in_table() ; if ($pb_fini=="EOF") { $formulaire = import_records::get_hidden_form('load', 'load'); printf ($msg[509].$msg[512], $from_file, $from_file); /* File %s... . End of preload... */ $fo = fopen("$base_path/temp/liste_id".SESSid.".txt","w"); fwrite($fo,""); fclose($fo); //file_put_contents("$base_path/temp/liste_id".SESSid.".txt",""); $script = ""; } else { $formulaire = import_records::get_hidden_form('preload', 'preload'); $script = ""; } print $formulaire; print $script; } break; case 'load': // -----------------------------------LLIUREX 22/02/2018-------------------------------------- if ($sub == "import_reb") { include("$class_path/audit.class.php"); require ($base_path."/catalog/z3950/notice.inc.php"); include("$include_path/templates/expl.tpl.php"); include ("$class_path/z3950_notice.class.php"); require_once($base_path."/catalog/z3950/func_other.inc.php"); $integration_OK=0; $integration_UP=0; $dirrec=scandir($base_path."/temp/"); foreach($dirrec as $file) { if ( (strpos($file, "rebdump")) !== false ) { $fp = fopen ($base_path."/temp/".$file,"r"); $buffer=""; while (!feof($fp)) { $buffer.= fread($fp, 4096); } fclose($fp); unlink($base_path."/temp/".$file); $notice = new z3950_notice ("usmarc", $buffer); $res_integration = $notice->insert_in_database($show=false); $new_notice=$res_integration[0]; $num_notice=$res_integration[1]; //if (($new_notice==0) && ($num_notice==0)) $integration_OK="ECHEC"; //if (($new_notice==0) && ($num_notice!=0)) $integration_OK="EXISTAIT"; if (($new_notice==1) && ($num_notice!=0)) $integration_OK++; if (($new_notice==2) && ($num_notice!=0)) $integration_UP++; //if (($new_notice==1) && ($num_notice==0)) $integration_OK="NEWRATEE"; } } unlink($filename); printf ($msg['import_reb_ok'], $integration_OK); printf ($msg['import_reb_up'], $integration_UP); return; } // ----------------------------------FIN LLIUREX 22/02/2018 ------------------------------- if (!$statutnot) $statutnot=1; printf ($msg[509], $from_file); if (!isset($nbtot_notice) || $nbtot_notice=="") { $sql = "select count(1) from import_marc where origine='".addslashes(SESSid)."' "; $sql_result = pmb_mysql_query($sql) or die ("Couldn't select count(1) from import table !"); $nbtot_notice=pmb_mysql_result($sql_result, 0, 0); } if ($sub == "import_expl") { $section_995_=new marc_list("section_995"); $section_995=$section_995_->table; $typdoc_995_=new marc_list("typdoc_995"); $typdoc_995=$typdoc_995_->table; $codstatdoc_995_=new marc_list("codstatdoc_995"); $codstatdoc_995=$codstatdoc_995_->table; /* let's initialize the counters if necessary */ if ($nb_expl_ignores == "") $nb_expl_ignores=0; printf ($msg[511], "\"".$book_lender_name."\"") ; } $sql = "select notice, id_import from import_marc where origine='".addslashes(SESSid)."' ORDER BY id_import limit $pmb_import_limit_record_load "; $sql_result_import = pmb_mysql_query($sql) or die ("Couldn't select import table !"); $n_notice=pmb_mysql_num_rows($sql_result_import); if (!isset($notice_deja_presente) || $notice_deja_presente=="") { $notice_deja_presente=0; } if (!isset($notice_remplacee) || $notice_remplacee=="") { $notice_remplacee=0; } $inotice=0; $notice_rejetee=0; $txt=""; while (($notobj = pmb_mysql_fetch_object($sql_result_import))) { $notice=$notobj->notice ; $idnotice_import=$notobj->id_import ; $inotice++; $res_lecture = recup_noticeunimarc($notice) ; if($link_generate) $res_link = recup_noticeunimarc_link($notice); if (!$res_lecture || !$tit_200a[0]) { $res_lecture = 0; // ".$inotice." $fp = fopen ("../../temp/err_import.unimarc","a+"); fwrite ($fp, $notice); fclose ($fp); $notice_rejetee++; } if ($res_lecture) { recup_noticeunimarc_suite($notice) ; /* We've got everything, let's have a look if ISBN already exists in notices table */ if(!isset($isbn[0])) $isbn[0] = ''; if($isbn[0]=="NULL") $isbn[0]=""; // si isbn vide, on va tenter de prendre l'EAN stocké en 345$b if ($isbn[0]=="") $isbn[0] = (isset($EAN[0]) ? $EAN[0] : ''); // si isbn vide, on va tenter de prendre le serial en 011 if ($isbn[0]=="") $isbn[0] = (isset($issn_011[0]) ? $issn_011[0] : ''); // si ISBN obligatoire et isbn toujours vide : if ($isbn_mandatory == 1 && $isbn[0]=="") { // on va tenter de prendre l'ISSN stocké en 225$x $isbn[0]=$collection_225[0]['x'] ; // si isbn toujours vide, on va tenter de prendre l'ISSN stocké en 410$x if ($isbn[0]=="") $isbn[0]=$collection_410[0]['x'] ; } // on commence par voir ce que le code est (basé sur la recherche par code du module catalogage $ex_query = clean_string($isbn[0]); $EAN = ''; $isbn = ''; $code = ''; $code10 = '' ; if(isEAN($ex_query)) { // la saisie est un EAN -> on tente de le formater en ISBN $EAN=$ex_query; $isbn = EANtoISBN($ex_query); // si échec, on prend l'EAN comme il vient if(!$isbn) $code = str_replace("*","%",$ex_query); else { $code=$isbn; $code10=formatISBN($code,10); } } else { if(isISBN($ex_query)) { // si la saisie est un ISBN $isbn = formatISBN($ex_query); // si échec, ISBN erroné on le prend sous cette forme if(!$isbn) $code = str_replace("*","%",$ex_query); else { $code10=$isbn ; $code=formatISBN($code10,13); } } else { // ce n'est rien de tout ça, on prend la saisie telle quelle $code = str_replace("*","%",$ex_query); } } $isbn_OK=$code; $new_notice = 0; $notice_id = 0 ; // le paramétrage est-il : dédoublonnage sur code ? / Ne dédoublonner que sur code ISBN (ignorer les ISSN) ? if ((($isbn_dedoublonnage)&&(!$isbn_only))||(($isbn_dedoublonnage)&&($isbn_only)&&(isISBN($isbn)))) { $trouvees=0; if ($EAN && $isbn) { // cas des EAN purs : constitution de la requête $requete = "SELECT distinct notice_id FROM notices "; $requete.= " WHERE notices.code in ('$code','$EAN'".($code10?",'$code10'":"").") limit 1"; $myQuery = pmb_mysql_query($requete, $dbh); $trouvees=pmb_mysql_num_rows($myQuery); } elseif ($isbn) { // recherche d'un isbn $requete = "SELECT distinct notice_id FROM notices "; $requete.= " WHERE notices.code in ('$code'".($code10?",'$code10'":"").") limit 1"; $myQuery = pmb_mysql_query($requete, $dbh); $trouvees=pmb_mysql_num_rows($myQuery); } elseif ($code) { // note : le code est recherché dans le champ code des notices // (cas des code-barres disques qui échappent à l'EAN) // $requete = "SELECT notice_id FROM notices "; $requete.= " WHERE notices.code like '$code' limit 10"; $myQuery = pmb_mysql_query($requete, $dbh); $trouvees=pmb_mysql_num_rows($myQuery); } // dédoublonnage sur isbn if ($EAN || $isbn || $code) { if ($trouvees==0) { $new_notice=1; } else { if(isset($import_notice_existing_replace) && $import_notice_existing_replace == 1) { $new_notice=1; $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_".addslashes(SESSid).".inc', '".$msg['import_notice_replaced']." $EAN || $isbn || $code ".addslashes($tit[0]['a'])."') ") ; } else { $new_notice=0; $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('import_expl_".addslashes(SESSid).".inc', '".$msg[542]." $EAN || $isbn || $code ".addslashes($tit[0]['a'])."') ") ; } $notice_id = pmb_mysql_result($myQuery,0,"notice_id"); } } else { if ($isbn_mandatory == 1) { $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('import_".addslashes(SESSid).".inc', '".$msg[543]."') ") ; } else { $new_notice = 1; $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('import_".addslashes(SESSid).".inc', '".$msg[565]."') ") ; } } } else { // pas de dédoublonnage if ($isbn_mandatory == 1 && $isbn_OK=="") { $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('import_".addslashes(SESSid).".inc', '".$msg[543]."') ") ; }elseif($isbn_OK){ $new_notice = 1; }else{ $new_notice = 1; $sql_log = pmb_mysql_query("insert into error_log (error_origin, error_text) values ('import_".addslashes(SESSid).".inc', '".$msg[565]."') ") ; } } /* the notice is new, we are going to import it... */ if ($new_notice==1) { if(isset($import_notice_existing_replace) && $import_notice_existing_replace == 1 && $notice_id) { $notice_remplacee++; } import_new_notice($notice_id) ; if($link_generate) import_notice_link(); import_new_notice_suite() ; // Mise à jour de la table "notices_global_index" notice::majNoticesGlobalIndex($notice_id); // Mise à jour de la table "notices_mots_global_index" notice::majNoticesMotsGlobalIndex($notice_id); if ($sub == "import_expl") { if(!empty($import_explajtNOTI) && !empty($import_expl_caddie_NOTI)) { import_expl::add_object_caddie($notice_id, 'NOTI', $import_expl_caddie_NOTI); } } else { if(!empty($import_recordsajtNOTI) && !empty($import_records_caddie_NOTI)) { import_records::add_object_caddie($notice_id, 'NOTI', $import_records_caddie_NOTI); } } } else { $notice_deja_presente++; //TRAITEMENT DES DOCS NUMERIQUES SUR NOTICE EXISTANTE if ($add_explnum===TRUE) ajoute_explnum(); } // TRAITEMENT DES EXEMPLAIRES ICI if ($sub == "import_expl") { traite_exemplaires () ; } // fin if $sub=import_expl } /* this has been succesfuly read, it can be deleted */ $sql_del = "delete from import_marc where id_import = '".$idnotice_import."' "; $sql_result_del = pmb_mysql_query($sql_del) or die ("Couldn't delete import_marc $idnotice_import !"); } /* end while records in import table */ $sql = "select count(1) as reste from import_marc where origine='".addslashes(SESSid)."'"; $sql_result = pmb_mysql_query($sql) or die ("Couldn't select count import table !"); $reste=pmb_mysql_result($sql_result,0,"reste"); if ($sub == "import_expl") { if ($reste > 0 ) { $formulaire = import_expl::get_hidden_form('load', 'load'); //On enregistre les ids utilisés avant le rechargement global $notices_crees, $notices_a_creer,$bulletins_crees,$bulletins_a_creer; $tabimport_id['notices_existantes'] = $notices_crees; $tabimport_id['notices_a_creer'] = $notices_a_creer; $tabimport_id['bulletins_crees'] = $bulletins_crees; $tabimport_id['bulletins_a_creer'] = $bulletins_a_creer; $fo = fopen("$base_path/temp/liste_id".SESSid.".txt","w"); fwrite($fo,serialize($tabimport_id)); $formulaire.="\n"; printf ($msg[513], $reste, $nbtot_notice); /* File %s ... . Still %s notices to load (total = %s) ... */ if ($notice_deja_presente==1) { printf ($msg[514],$notice_deja_presente) ; /*
($notice_deja_presente notice already in the database has been ignored since the begining) */ } elseif ($notice_deja_presente>1) { printf ($msg[515],$notice_deja_presente) ; /*
($notice_deja_presente notices already in the database have been ignored since the begining) */ } if ($notice_remplacee==1) { printf ($msg['import_notice_replace_only_one'],$notice_remplacee) ; /*
($notice_remplacee notice already in the database has been replaced since the begining) */ } elseif ($notice_remplacee>1) { printf ($msg['import_notice_replace_many'],$notice_remplacee) ; /*
($notice_remplacee notices already in the database have been replaced since the begining) */ } if ($notice_rejetee>0) { print "
".$notice_rejetee." ".$msg['notices_invalides']; } printf ($msg[521], $nb_expl_ignores); /* ## exemplaire(s) ignoré(s) */ } else { $formulaire=""; $script=""; printf ($msg[516], $nbtot_notice); /* There were $nbtot_notice notice(s) to load, everything is OK... */ if ($notice_deja_presente==1) { printf ($msg[517], $notice_deja_presente); /* $notice_deja_presente notice already in the database has been ignored... */ } elseif ($notice_deja_presente>1) { printf ($msg[518], $notice_deja_presente); /* dont $notice_deja_presente notices already in the database have been ignored... */ } if ($notice_remplacee==1) { printf ($msg['import_notice_replace_only_one'],$notice_remplacee) ; /*
($notice_remplacee notice already in the database has been replaced since the begining) */ } elseif ($notice_remplacee>1) { printf ($msg['import_notice_replace_many'],$notice_remplacee) ; /*
($notice_remplacee notices already in the database have been replaced since the begining) */ } if ($notice_rejetee>0) { print "
".$notice_rejetee." ".$msg['notices_invalides']; } printf ($msg[521], $nb_expl_ignores); /* ## exemplaire(s) ignoré(s) */ /* ajouter ici SELECT error_origin, error_text, count(*) FROM error_log group by error_origin, error_text */ $gen_liste_log=""; $array_isbn_doublons = array(); $datetime_import=''; $resultat_liste=pmb_mysql_query("SELECT error_origin, error_text, error_date, count(*) as nb_error FROM error_log where error_origin in ('expl_".addslashes(SESSid).".class','import_expl_".addslashes(SESSid).".inc','iimport_expl_".addslashes(SESSid).".inc','import_".addslashes(SESSid).".inc.php','import_".addslashes(SESSid).".inc','import_func_".addslashes(SESSid).".inc.php') group by error_origin, error_text" ); $nb_liste=pmb_mysql_num_rows($resultat_liste); if ($nb_liste>0) { $gen_liste_log = "

".$msg[538]."
!!dbls_isbn!!" ; $gen_liste_log.=""; $i_log=0; while ($i_log<$nb_liste) { if (preg_match('`^'.$msg['542'].'(.*)\|\|(.*)\|\|(.*)$`',pmb_mysql_result($resultat_liste,$i_log,"error_text"),$out)) { for ($j=1;$j<=3;$j++) { if ($tmp_isbn = trim($out[$j])) { $tmp_isbn = "'".$tmp_isbn."'"; if ((!count($array_isbn_doublons))||(!in_array($tmp_isbn,$array_isbn_doublons))) { $array_isbn_doublons[] = $tmp_isbn; } } } } $gen_liste_log.=""; $gen_liste_log.="" ; $gen_liste_log.="" ; $gen_liste_log.="" ; $gen_liste_log.="" ; $datetime_import = pmb_mysql_result($resultat_liste,$i_log,"error_date"); $i_log++; } } $gen_liste_log.="
".$msg[539]."".$msg[540]."".$msg[541]."
".pmb_mysql_result($resultat_liste,$i_log,"error_origin")."".pmb_mysql_result($resultat_liste,$i_log,"error_text")."".pmb_mysql_result($resultat_liste,$i_log,"nb_error")."
\n" ; if (count($array_isbn_doublons)) { $gen_liste_log = str_replace('!!dbls_isbn!!','
'.$msg['last_import_isbn_doublons_found'].''.$msg['search_expl'].'
',$gen_liste_log); } else { $gen_liste_log = str_replace('!!dbls_isbn!!','',$gen_liste_log); } print $gen_liste_log; $_SESSION["last_import_isbn_doublons"] = json_encode(implode(',',$array_isbn_doublons)); $_SESSION["last_import_isbn_doublons_datetime"] = $datetime_import; @unlink("$base_path/temp/liste_id".SESSid.".txt"); } print $formulaire; print $script; //Options avancées print "

".import_expl::get_links_caddies(); } else { // import de notices if ($reste > 0 ) { $formulaire = import_records::get_hidden_form('load', 'load'); //On enregistre les ids utilisés avant le rechargement global $notices_crees, $notices_a_creer,$bulletins_crees,$bulletins_a_creer; $tabimport_id['notices_existantes'] = $notices_crees; $tabimport_id['notices_a_creer'] = $notices_a_creer; $tabimport_id['bulletins_crees'] = $bulletins_crees; $tabimport_id['bulletins_a_creer'] = $bulletins_a_creer; $fo = fopen("$base_path/temp/liste_id".SESSid.".txt","w"); fwrite($fo,serialize($tabimport_id)); $formulaire.="\n"; printf ($msg[509].$msg[513],$from_file, $reste, $nbtot_notice); /* File %s ... . Still %s notices to load (total = %s) ... */ if ($notice_deja_presente==1) { printf ($msg[514],$notice_deja_presente) ; /*
($notice_deja_presente notice already in the database has been ignored since the begining) */ } elseif ($notice_deja_presente>1) { printf ($msg[515],$notice_deja_presente) ; /*
($notice_deja_presente notices already in the database have been ignored since the begining) */ } if ($notice_remplacee==1) { printf ($msg['import_notice_replace_only_one'],$notice_remplacee) ; /*
($notice_remplacee notice already in the database has been replaced since the begining) */ } elseif ($notice_remplacee>1) { printf ($msg['import_notice_replace_many'],$notice_remplacee) ; /*
($notice_remplacee notices already in the database have been replaced since the begining) */ } if ($notice_rejetee>0) { print "
".$notice_rejetee." ".$msg['notices_invalides']; } } else { $formulaire=""; $script=""; printf ($msg[509].$msg[516], $from_file, $nbtot_notice); /* There were $nbtot_notice notice(s) to load, everything is OK... */ if ($notice_deja_presente==1) { printf ($msg[517], $notice_deja_presente); /* $notice_deja_presente notice already in the database has been ignored... */ } elseif ($notice_deja_presente>1) { printf ($msg[518], $notice_deja_presente); /* dont $notice_deja_presente notices already in the database have been ignored... */ } if ($notice_remplacee==1) { printf ($msg['import_notice_replace_only_one'],$notice_remplacee) ; /*
($notice_remplacee notice already in the database has been replaced since the begining) */ } elseif ($notice_remplacee>1) { printf ($msg['import_notice_replace_many'],$notice_remplacee) ; /*
($notice_remplacee notices already in the database have been replaced since the begining) */ } if ($notice_rejetee>0) { print "
".$notice_rejetee." ".$msg['notices_invalides'] ; } /* ajouter ici SELECT error_origin, error_text, count(*) FROM error_log group by error_origin, error_text */ $gen_liste_log=""; $array_isbn_doublons = array(); $datetime_import=''; $resultat_liste=pmb_mysql_query("SELECT error_origin, error_text, error_date, count(*) as nb_error FROM error_log where error_origin in ('expl_".addslashes(SESSid).".class','import_expl_".addslashes(SESSid).".inc','iimport_expl_".addslashes(SESSid).".inc','import_".addslashes(SESSid).".inc.php', 'import_".addslashes(SESSid).".inc','import_func_".addslashes(SESSid).".inc.php') group by error_origin, error_text" ); $nb_liste=pmb_mysql_num_rows($resultat_liste); if ($nb_liste>0) { $gen_liste_log = "

".$msg[538]."
!!dbls_isbn!!" ; $gen_liste_log.=""; $i_log=0; while ($i_log<$nb_liste) { if (preg_match('`^'.$msg['542'].'(.*)\|\|(.*)\|\|(.*)$`',pmb_mysql_result($resultat_liste,$i_log,"error_text"),$out)) { for ($j=1;$j<=3;$j++) { if ($tmp_isbn = trim($out[$j])) { $tmp_isbn = "'".$tmp_isbn."'"; if ((!count($array_isbn_doublons))||(!in_array($tmp_isbn,$array_isbn_doublons))) { $array_isbn_doublons[] = $tmp_isbn; } } } } $gen_liste_log.=""; $gen_liste_log.="" ; $gen_liste_log.="" ; $gen_liste_log.="" ; $gen_liste_log.="" ; $datetime_import = pmb_mysql_result($resultat_liste,$i_log,"error_date"); $i_log++; } } $gen_liste_log.="
".$msg[539]."".$msg[540]."".$msg[541]."
".pmb_mysql_result($resultat_liste,$i_log,"error_origin")."".pmb_mysql_result($resultat_liste,$i_log,"error_text")."".pmb_mysql_result($resultat_liste,$i_log,"nb_error")."
\n" ; if (count($array_isbn_doublons)) { $gen_liste_log = str_replace('!!dbls_isbn!!','
'.$msg['last_import_isbn_doublons_found'].''.$msg['search_extended'].'
',$gen_liste_log); } else { $gen_liste_log = str_replace('!!dbls_isbn!!','',$gen_liste_log); } print $gen_liste_log; $_SESSION["last_import_isbn_doublons"] = json_encode(implode(',',$array_isbn_doublons)); $_SESSION["last_import_isbn_doublons_datetime"] = $datetime_import; @unlink("$base_path/temp/liste_id".SESSid.".txt"); } print $formulaire; print $script; //Options avancées print "

".import_records::get_links_caddies(); } break; default: $formulaire="
"; $formulaire.=""; $formulaire.=""; $form_text=""; if ($sub == "import_expl"){ $formulaire.=""; $form_text=file_get_contents("$include_path/messages/help/$lang/import_expl.txt"); } // ---------------------------------- LLIUREX 22/02/2018-------------------------------------- else if ($sub == "import_reb") { $formulaire.=""; $form_text=file_get_contents("$include_path/messages/help/$lang/import_reb.txt") ; } // --------------------------------- FIN LLIUREX 22/02/2018------------------------------- else{ $formulaire.=""; $form_text=file_get_contents("$include_path/messages/help/$lang/import.txt"); } $formulaire.=str_replace(array("!!nom_fic!!","!!nom_bouton!!"),array(htmlentities($nom_fichier_transfert_ftp,ENT_QUOTES,$charset),htmlentities($msg["admin_import_notice_prechargement"],ENT_QUOTES,$charset)),$form_text); if(!$table_list_func_import){ if(file_exists("func_import_subst.xml")){ $table_list_func_import=_parser_text_no_function_(file_get_contents("func_import_subst.xml"),"CATALOG"); }elseif(file_exists("func_import.xml")){ $table_list_func_import=_parser_text_no_function_(file_get_contents("func_import.xml"),"CATALOG"); } } $code_js=$selecteur_fic=""; if(is_array($table_list_func_import["ITEM"]) && count($table_list_func_import["ITEM"])){ $incr=0; $text_desc_func_import=""; $code_js.=""; } // ---------------------------- LLIUREX 22/02/2018 --------------------------------- /* $formulaire.=$selecteur_fic; $formulaire.="
\n"; $formulaire.=""; $formulaire.=import_entities::get_encoding_selector(); $formulaire.="

"; $formulaire.=""; $formulaire.=""; */ if ($sub <> "import_reb") $formulaire.=$selecteur_fic; if ($sub <> "import_reb") $formulaire.="

\n"; $formulaire.=""; if ($sub <> "import_reb") $formulaire.=""; // ----------------------------- FIN LLIUREX 22/02/2018---------------------- $formulaire.="
\n"; $formulaire.=$code_js; print $formulaire; break; } print "
";