diff -Nuar pmb.orig/admin/convert/folow_import.php pmb/admin/convert/folow_import.php
--- pmb.orig/admin/convert/folow_import.php 2007-02-23 14:49:10.000000000 +0100
+++ pmb/admin/convert/folow_import.php 2010-10-25 14:37:55.920774926 +0200
@@ -42,11 +42,16 @@
@readfile("$base_path/temp/$file_out");
@unlink("$base_path/temp/$file_out");
} else {
- //@copy("$base_path/temp/$file_out","$base_path/admin/import/unimarc.fic");
- @copy("$base_path/temp/$file_out","$base_path/admin/import/unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic");
+ //@copy("$base_path/temp/$file_out","$base_path/admin/import/unimarc.fic");
+
+
+//-------------------------------------> L L I U R E X <--------------------------------------
+ @copy("$base_path/temp/$file_out","$base_path/temp/unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic");
+//-------------------------------------> L L I U R E X <--------------------------------------
+
@unlink("$base_path/temp/$file_out");
if ($deliver==1) $sub="import"; else $sub="import_expl";
echo "";
}
-?>
\ No hay ningún carácter de nueva lÃnea al final del archivo
+?>
diff -Nuar pmb.orig/admin/convert/imports/input_xml.inc.php pmb/admin/convert/imports/input_xml.inc.php
--- pmb.orig/admin/convert/imports/input_xml.inc.php 2007-03-10 09:32:24.000000000 +0100
+++ pmb/admin/convert/imports/input_xml.inc.php 2010-10-25 14:37:55.924768869 +0200
@@ -4,7 +4,29 @@
// +-------------------------------------------------+
// $Id: input_xml.inc.php,v 1.8 2007/03/10 08:32:25 touraine37 Exp $
-if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) die("no access");
+if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) die("no access");
+
+function fix_htmlspecialchars($notice) {
+
+ $notice2="";
+ $notice2_r;
+
+ if (strpos($notice,"\n") !== false) {
+ $notice2_r = explode("\n",$notice);
+ foreach ($notice2_r as $noti) {
+ $noti=trim($noti);
+ $prin1=strpos($noti, '');
+ $fin=strrpos($noti, '');
+ if ($prin1 !== false && $prin1 === 0 && $prin2 !== false && $fin !== false) {
+ $notice2.=substr($noti, $prin1, $prin2+2).htmlspecialchars(htmlspecialchars_decode(substr($noti, $prin2+2, $fin-($prin2+2))))."\n";
+ } else $notice2.=$noti."\n";
+ }
+ $notice2=trim($notice2);
+ } else $notice2=$notice;
+
+ return $notice2;
+}
function _get_n_notices_($fi,$file_in,$input_params,$origine) {
//mysql_query("delete from import_marc");
@@ -22,7 +44,8 @@
$i1=strpos($fcontents,"".$input_params['NOTICEELEMENT'].">");
}
if ($i1!==false) {
- $notice=substr($fcontents,$i,$i1+strlen("".$input_params['NOTICEELEMENT'].">")-$i);
+ $notice=substr($fcontents,$i,$i1+strlen("".$input_params['NOTICEELEMENT'].">")-$i);
+ $notice=fix_htmlspecialchars($notice);
$requete="insert into import_marc (no_notice, notice, origine) values($n,'".addslashes($notice)."','$origine')";
mysql_query($requete);
$n++;
@@ -40,4 +63,4 @@
return $index;
}
-?>
\ No hay ningún carácter de nueva lÃnea al final del archivo
+?>
diff -Nuar pmb.orig/admin/convert/start_import.php pmb/admin/convert/start_import.php
--- pmb.orig/admin/convert/start_import.php 2007-08-25 08:45:30.000000000 +0200
+++ pmb/admin/convert/start_import.php 2010-10-25 14:37:55.928769378 +0200
@@ -157,8 +157,35 @@
$fo = fopen("$base_path/temp/".$file_out, "w+");
+
+//-------------------------------------> L L I U R E X <--------------------------------------
+ //Cambiamos codificacion y modificamos el texto del campo unimarc (si fuese xml)
+ if ($input_type == "xml") {
+ $fi = fopen($base_path."/temp/".$file_in, "r+");
+ while (!feof($fi)){ //metemos el fichero en una variable
+ $linea.=fgets($fi);
+ }
+ $linea= str_replace("encoding=\"ISO-8859-1\"", "encoding=\"UTF-8\"", $linea);
+ $fitemp = fopen($base_path."/temp/tempo", "w+");
+ fwrite($fitemp, $linea);
+ fclose($fitemp);
+ $fitemp = fopen($base_path."/temp/tempo", "r");
+ fclose($fi);
+ unlink($base_path."/temp/".$file_in);
+ $fi = fopen($base_path."/temp/".$file_in, "w");
+ $bool=recode_file("iso-8859-1..utf-8", $fitemp, $fi);
+ fclose($fitemp);
+ fclose($fi);
+ unlink($base_path."/temp/tempo");
+ }
+//-------------------------------------> L L I U R E X <--------------------------------------
+
+
//Ouverture du fichier d'origine
$fi = fopen("$base_path/temp/".$file_in, "r");
+
+
+
//Récupération du nombre de notices et enregistrement dans la base de données des notices
$index = _get_n_notices_($fi, "$base_path/temp/".$file_in, $input_params,$origine);
@@ -277,4 +304,4 @@
fclose($fo);
echo "";
}
-?>
\ No hay ningún carácter de nueva lÃnea al final del archivo
+?>
diff -Nuar pmb.orig/admin/empr/main.inc.php pmb/admin/empr/main.inc.php
--- pmb.orig/admin/empr/main.inc.php 2007-05-17 09:08:38.000000000 +0200
+++ pmb/admin/empr/main.inc.php 2010-10-25 14:37:55.928769378 +0200
@@ -30,8 +30,8 @@
$admin_layout = str_replace('!!menu_sous_rub!!', $msg["import_lec_lien"], $admin_layout);
print $admin_layout;
echo window_title($database_window_title.$msg["import_lec_lien"].$msg[1003].$msg[1001]);
- if ($pmb_import_modele_lecteur) $import_modele=$pmb_import_modele_lecteur; else $import_modele="import_empr.inc.php";
- include("./admin/empr/$import_modele");
+ if ($pmb_import_modele_lecteur) $import_modele=$pmb_import_modele_lecteur; else $import_modele="usur_imp.php";
+ include("$import_modele");
break;
case 'ldap':
$admin_layout = str_replace('!!menu_sous_rub!!', $msg["import_ldap"], $admin_layout);
diff -Nuar pmb.orig/admin/import/func_bdp.inc.php pmb/admin/import/func_bdp.inc.php
--- pmb.orig/admin/import/func_bdp.inc.php 2007-03-10 09:32:22.000000000 +0100
+++ pmb/admin/import/func_bdp.inc.php 2010-10-25 14:37:55.932769048 +0200
@@ -109,7 +109,7 @@
// $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'])
+ if (!$info_995[$nb_expl]['q'] || !$section_995[$info_995[$nb_expl]['q']])
$info_995[$nb_expl]['q'] = "u";
$data_doc['section_libelle'] = $section_995[$info_995[$nb_expl]['q']];
$data_doc['sdoc_codage_import'] = $info_995[$nb_expl]['q'] ;
@@ -225,4 +225,4 @@
return $subfields ;
- }
\ No hay ningún carácter de nueva lÃnea al final del archivo
+ }
diff -Nuar pmb.orig/admin/import/iimport_expl.php pmb/admin/import/iimport_expl.php
--- pmb.orig/admin/import/iimport_expl.php 2007-10-26 11:26:44.000000000 +0200
+++ pmb/admin/import/iimport_expl.php 2010-10-25 14:37:55.932769048 +0200
@@ -40,8 +40,20 @@
$nom_fichier_transfert_ftp = "unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic";
-$userfile_name = $_FILES['userfile']['name'] ;
+$userfile_name = $_FILES['userfile']['name'] ;
+
+
+//-------------------------------------> L L I U R E X <--------------------------------------
+//cambiamos la ruta para que escriba en el temporal
+if ((stripos($userfile_name, "/temp/"))===false){
+$userfile_name=$base_path."/temp/".$userfile_name;
+}
+//-------------------------------------> L L I U R E X <--------------------------------------
+
+
+
$userfile = $_FILES['userfile']['tmp_name'] ;
+
/* this script does nearly the same thing that import.inc does,
the difference is between the loading of the exemplaires table.
@@ -63,21 +75,29 @@
}
} else {
$book_lender_name = $msg[561];
- }
- } else {
- echo window_title($msg[500].$msg[1003].$msg[1001]);
- }
+ }
+//-------------------------------------> L L I U R E X <--------------------------------------
+ } else if ($sub == "import_reb"){
+ echo window_title($msg["import_reb"].$msg[1003].$msg[1001]);
+//-------------------------------------> L L I U R E X <--------------------------------------
+ } 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 ;
- } else {
- // import de notice
- print $tpl_beforeupload_notices ;
- }
+ print $tpl_beforeupload_expl ;
+//-------------------------------------> L L I U R E X <--------------------------------------
+ } else if ($sub == "import_reb") {
+ print $tpl_beforeupload_reb ;
+//-------------------------------------> L L I U R E X <--------------------------------------
+ } else {
+ // import de notice
+ print $tpl_beforeupload_notices ;
+ }
break;
case 'afterupload':
if (!$statutnot) $statutnot = 1 ;
@@ -97,7 +117,8 @@
//if (!is_writeable($userfile)) {
// printf ($msg[503],$userfile_name); /* wrong permissions to copy the file %s ... Contact your admin... */
// break;
- // }
+ // }
+
if (!move_uploaded_file($userfile,$userfile_name)) {
printf ($msg[504],$userfile_name); /* Fail to copy %s, Contact your admin... */
} else {
@@ -120,42 +141,75 @@
print "\n";
print "\n";
print "";
- print "";
- }
- } else {
- // import de notice
- if ($userfile_name=="") {
- printf ($msg[503],$userfile_name); /* wrong permissions to copy the file %s ... Contact your admin... */
- break;
- }
- //if (!is_writeable($userfile)) {
- // printf ($msg[503],$userfile_name); /* wrong permissions to copy the file %s ... Contact your admin... */
- // break;
- // }
- if (!move_uploaded_file($userfile,$userfile_name)) {
- printf ($msg[504],$userfile_name); /* Fail to copy %s, Contact your admin... */
- } else {
- printf ($msg[505],$userfile_name); /* File transfered, Loading is about to go on */
- print "
";
- print "";
- }
- }
+ print "";
+
+ }
+//-------------------------------------> L L I U R E X <--------------------------------------
+ } else if ($sub == "import_reb") {
+
+ // import de rebeca
+ if ($userfile_name=="") {
+ printf ($msg[503],$userfile_name); /* wrong permissions to copy the file %s ... Contact your admin... */
+ break;
+ }
+
+ if (strrpos(strtolower($userfile_name), ".reb") === false) {
+ printf ($msg['import_reb_fail_reb'],$userfile_name); /* wrong rebeca file %s ... Contact your admin... */
+ break;
+ }
+
+ if (!move_uploaded_file($userfile,$userfile_name)) {
+ printf ($msg[504],$userfile_name); /* Fail to copy %s, Contact your admin... */
+ } else {
+ printf ($msg[505],$userfile_name); /* File transfered, Loading is about to go on */
+ print "";
+ print "";
+ }
+//-------------------------------------> L L I U R E X <--------------------------------------
+ } else {
+ // import de notice
+ if ($userfile_name=="") {
+ printf ($msg[503],$userfile_name); /* wrong permissions to copy the file %s ... Contact your admin... */
+ break;
+ }
+ //if (!is_writeable($userfile)) {
+ // printf ($msg[503],$userfile_name); /* wrong permissions to copy the file %s ... Contact your admin... */
+ // break;
+ // }
+ if (!move_uploaded_file($userfile,$userfile_name)) {
+ printf ($msg[504],$userfile_name); /* Fail to copy %s, Contact your admin... */
+ } else {
+ printf ($msg[505],$userfile_name); /* File transfered, Loading is about to go on */
+ print "";
+ 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 */
- $filename = "unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic";
+ /* l'utilisateur n'est pas passé par le téléchargement du fichier */
+
+//-------------------------------------> L L I U R E X <--------------------------------------
+//el fichero se encuentra en el temporal, lo referenciamos.
+ $filename = "$base_path/temp/unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic";
+// $filename = "$base_path/temp/unimarc_pmb.fic";
+//-------------------------------------> L L I U R E X <--------------------------------------
} else {
$filename=$file_submit;
}
@@ -239,8 +293,8 @@
";
break;
- }
- loadfile_in_table() ;
+ }
+ loadfile_in_table() ;
if ($pb_fini=="EOF") {
$formulaire="";
+ printf ($msg[509].$msg[512], $filename, $filename); /* File %s... . End of preload... */
+ $script = "";
+
+ print $formulaire;
+ print $script;
+//-------------------------------------> L L I U R E X <--------------------------------------
+
+ } else {
// import de notice
/* Does the file exist ? */
if ($file_submit=="") $filename = "unimarc".(defined("LOCATION")?"_".constant("LOCATION"):"").".fic"; else $filename=$file_submit;
@@ -361,7 +461,52 @@
print $script;
}
break;
- case 'load':
+ case 'load':
+//-------------------------------------> L L I U R E X <--------------------------------------
+ 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;
+ }
+//-------------------------------------> L L I U R E X <--------------------------------------
+
if (!$statutnot) $statutnot=1;
printf ($msg[509], $filename) ;
if ($nbtot_notice=="") {
@@ -607,7 +752,10 @@
}
break;
default:
- if ($sub == "import_expl") include("$include_path/messages/help/$lang/import_expl.txt") ;
+ if ($sub == "import_expl") include("$include_path/messages/help/$lang/import_expl.txt") ;
+//-------------------------------------> L L I U R E X <--------------------------------------
+ else if ($sub == "import_reb") include("$include_path/messages/help/$lang/import_reb.txt") ;
+//-------------------------------------> L L I U R E X <--------------------------------------
else include("$include_path/messages/help/$lang/import.txt") ;
break;
}
diff -Nuar pmb.orig/admin/import/import_func.inc.php pmb/admin/import/import_func.inc.php
--- pmb.orig/admin/import/import_func.inc.php 2007-09-25 08:47:28.000000000 +0200
+++ pmb/admin/import/import_func.inc.php 2010-10-25 14:37:55.936769347 +0200
@@ -129,7 +129,25 @@
- ";
+ ";
+//-------------------------------------> L L I U R E X <--------------------------------------
+$tpl_beforeupload_reb = "
+
+
".$msg['import_reb_form_titre']."
+
+
+
+
+
+
+
+
+
+
+
+
+ ";
+//-------------------------------------> L L I U R E X <--------------------------------------
// PRELOAD
function loadfile_in_table () {
@@ -137,7 +155,14 @@
global $sub, $book_lender_name ;
global $noticenumber, $filename, $pb_fini, $recharge ;
global $pmb_import_limit_read_file ;
-
+
+//-------------------------------------> L L I U R E X <--------------------------------------
+//en principio parece que no le hace falta, pero lo dejo comentado porque puede servir de referencia para futuras modificaciones
+// if ((stripos($filename, "/temp/"))==false){
+// $filename="../../temp/".$filename;
+//}
+//-------------------------------------> L L I U R E X <--------------------------------------
+
if ($noticenumber=="") $noticenumber=0;
if (!file_exists($filename)) {
@@ -161,42 +186,51 @@
printf ($msg[509], $filename) ;
printf ($msg[511], "\"".$book_lender_name."\"") ;
}
+
+
+ $file_size=filesize ($filename);
+
- $file_size=filesize ($filename);
- $contents = fread ($handle, $file_size);
- fclose ($handle);
+ $contents = fread ($handle, $file_size);
+ fclose ($handle);
+
+
/* First load of the shot, let's empty the import table */
- if ($recharge=="") {
- $sql = "truncate table import_marc ";
- $sql_result = mysql_query($sql) or die ("Couldn't delete import table !");
+ if ($recharge=="") {
+ $sql = "truncate table import_marc ";
+ $sql_result = mysql_query($sql) or die ("Couldn't delete import table !");
$sql = "truncate table error_log ";
- $sql_result = mysql_query($sql) or die ("Couldn't delete error_log table !");
+ $sql_result = mysql_query($sql) or die ("Couldn't delete error_log table !");
+
}
-
+
/* The whole file is in $contents, let's read it */
$str_lu="";
$j=0;
$i=0;
$pb_fini="";
- $txt="";
+ $txt="";
while ( ($i<=strlen($contents)) && ($pb_fini=="") ) {
$car_lu=substr($contents,$i,1) ;
- $i++;
+ $i++;
+
if ($i<=strlen($contents)) {
if ($car_lu != chr(0x1d)) {
/* the read car isn't the end of the notice */
- $str_lu = $str_lu.$car_lu;
+ $str_lu = $str_lu.$car_lu;
} else {
/* the read car is the end of a notice */
$str_lu = $str_lu.$car_lu;
- $j++;
+ $j++;
+
$sql = "INSERT INTO import_marc (notice) VALUES(\"".addslashes($str_lu)."\")";
$sql_result = mysql_query($sql)
- or die ("Couldn't insert record!");
+ or die ("Couldn't insert record!");
+
if ($j>=$pmb_import_limit_read_file && $i L L I U R E X <--------------------------------------
+ case 'import_reb':
+ $admin_layout = str_replace('!!menu_sous_rub!!', $msg["import_reb"], $admin_layout);
+ print $admin_layout;
+ include("./admin/import/import_expl.inc.php");
+ break;
+//-------------------------------------> L L I U R E X <--------------------------------------
default:
$admin_layout = str_replace('!!menu_sous_rub!!', "", $admin_layout);
print $admin_layout;
diff -Nuar pmb.orig/admin/sauvegarde/main.inc.php pmb/admin/sauvegarde/main.inc.php
--- pmb.orig/admin/sauvegarde/main.inc.php 2007-03-10 09:32:24.000000000 +0100
+++ pmb/admin/sauvegarde/main.inc.php 2010-10-25 14:37:55.936769347 +0200
@@ -42,6 +42,24 @@
echo window_title($msg["sauv_title_sauv_list"]);
include("./admin/sauvegarde/sauvegarde_list.inc.php");
break;
+//-------------------------------------> L L I U R E X <--------------------------------------
+//Ponemos los links en la pagina de administracion/copias de seguridad
+ case 'lliurexp':
+ //Lliurex modulo exportacion de toda la base de datos
+ $admin_layout = str_replace('!!menu_sous_rub!!', $msg["sauv_title_lliurex"], $admin_layout);
+ print $admin_layout;
+ echo window_title($msg["sauv_title_lliurex"]);
+ include("./copia_seg.php");
+ break;
+
+ case 'lliureximp':
+ //Lliurex modulo exportacion de toda la base de datos
+ $admin_layout = str_replace('!!menu_sous_rub!!', $msg["sauv_title_lliurex"], $admin_layout);
+ print $admin_layout;
+ echo window_title($msg["sauv_title_lliurex"]);
+ include("./copia_seg_importa.php");
+ break;
+//-------------------------------------> L L I U R E X <--------------------------------------
default :
//Page de gestion des sauvegardes déjà effectuées
$admin_layout = str_replace('!!menu_sous_rub!!', "", $admin_layout);
diff -Nuar pmb.orig/catalog/catalog.inc.php pmb/catalog/catalog.inc.php
--- pmb.orig/catalog/catalog.inc.php 2007-03-11 09:07:42.000000000 +0100
+++ pmb/catalog/catalog.inc.php 2010-10-25 14:37:55.940768040 +0200
@@ -37,7 +37,13 @@
if ($pmb_prefill_cote) require_once("./catalog/expl/$pmb_prefill_cote");
else require_once("./catalog/expl/custom_no_cote.inc.php");
+
switch($categ) {
+//-------------------------------------> L L I U R E X <--------------------------------------
+ case 'tejuelo':
+ include('./tejuelo.php');
+ break;
+//-------------------------------------> L L I U R E X <--------------------------------------
case 'update':
include('./catalog/notices/update_notice.inc.php');
break;
diff -Nuar pmb.orig/catalog/expl/expl_create.inc.php pmb/catalog/expl/expl_create.inc.php
--- pmb.orig/catalog/expl/expl_create.inc.php 2007-09-07 14:43:46.000000000 +0200
+++ pmb/catalog/expl/expl_create.inc.php 2010-10-25 14:37:55.940768040 +0200
@@ -6,15 +6,26 @@
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) die("no access");
+function f_rellena_ceros($as_dato) {
+ if(strlen($as_dato)>0 && strlen($as_dato)<9){
+ for($i=strlen($as_dato); $i<9; $i++)
+ $as_dato="0".$as_dato;}
+
+ return $as_dato;
+
+}
+
// gestion des exemplaires
print "
".$msg[290]."
";
// on checke si l'exemplaire n'existe pas déjà
$requete = "SELECT count(1) FROM exemplaires WHERE expl_cb='$noex' ";
+$requete2 = "SELECT count(1) FROM exemplaires WHERE expl_cb='".f_rellena_ceros($noex)."' ";
$res = mysql_query($requete, $dbh);
+$res2 = mysql_query($requete2, $dbh);
-if(!mysql_result($res, 0, 0)) {
+if(!mysql_result($res, 0, 0) && !mysql_result($res2, 0, 0)) {
$notice = new mono_display($id, 1, './catalog.php?categ=modif&id=!!id!!', FALSE);
print pmb_bidi("
');
@@ -22,7 +33,7 @@
// visibilité des exemplaires
// On ne vérifie que si l'utlisateur peut créer sur au moins une localisation :
if (!$pmb_droits_explr_localises||$explr_visible_mod) {
- $nex = new exemplaire($noex, 0, $id);
+ $nex = new exemplaire(f_rellena_ceros($noex), 0, $id);
print "