diff --git a/cosmogramme/php/classes/classe_sql.php b/cosmogramme/php/classes/classe_sql.php index 845cec63dfe0a5c635e00ece1430789242f65f5c..d62a90e750c009aa9eb17b27182d71e8d6144ebc 100644 --- a/cosmogramme/php/classes/classe_sql.php +++ b/cosmogramme/php/classes/classe_sql.php @@ -146,8 +146,7 @@ class sql : $this->statements[$table][$cols] = $this->createInsertPrepareStatement($table, $data); foreach($data as $col => $valeur) { - $valeur = trim($valeur); - $statement->bindParam(":$col", $valeur); + $statement->bindValue(":$col", trim($valeur)); } try { diff --git a/cosmogramme/php/integre_generation_pergame.php b/cosmogramme/php/integre_generation_pergame.php index ac873ca2cf53ad176b8a2c3de2521c2745cf7594..003328ee020fbcf66a7efafb5264af3825deff5e 100644 --- a/cosmogramme/php/integre_generation_pergame.php +++ b/cosmogramme/php/integre_generation_pergame.php @@ -143,8 +143,8 @@ if($_REQUEST["action"]=="CONTROLE") sqlExecute("delete from int_bib where id_bib=".$enreg["ID_SITE"]); $enreg1["id_bib"]=$enreg["ID_SITE"]; - $enreg1["nom"]=$enreg["LIBELLE"]; - $enreg1["nom_court"]=$enreg["LIBELLE"]; + $enreg1["nom"]=trim($enreg["LIBELLE"]); + $enreg1["nom_court"]=trim($enreg["LIBELLE"]); $enreg1["qualite"]=5; $enreg1["sigb"]=$type_sigb; $enreg1["planif_mode"]="r"; @@ -160,7 +160,8 @@ if($_REQUEST["action"]=="CONTROLE") $enreg1["comm_sigb"]=1; $enreg1["comm_params"]=serialize(array("Autoriser_docs_disponibles"=>"0","Max_par_carte"=>"3","Max_par_document"=>"3")); } - sqlInsert("int_bib", $enreg1); + + (new Class_IntBib)->updateAttributes($enreg1)->save(); $nb_bibs++; } print('</table></div>'); @@ -216,7 +217,7 @@ if($_REQUEST["action"]=="CONTROLE") $enreg["type_operation"]=1; $enreg["nom_fichier"]=$path_fichier."site".$id_bib."/suppressions.txt"; $enreg["rang"]=$id_prog; - sqlInsert("int_maj_auto", $enreg); + (new Class_IntMajAuto)->updateAttributes($enreg)->save(); } // notices total @@ -229,7 +230,8 @@ if($_REQUEST["action"]=="CONTROLE") $enreg["type_operation"]=2; $enreg["nom_fichier"]=$path_fichier."site".$id_bib."/notices_total.txt"; $enreg["rang"]=$id_prog; - sqlInsert("int_maj_auto", $enreg); + (new Class_IntMajAuto)->updateAttributes($enreg)->save(); + // notices incrémentiel echo '<tr><td class="blank"> </td><td class="blank">Import incrémentiel des notices</td></tr>'; @@ -241,7 +243,7 @@ if($_REQUEST["action"]=="CONTROLE") $enreg["type_operation"]=0; $enreg["nom_fichier"]=$path_fichier."site".$id_bib."/notices.txt"; $enreg["rang"]=$id_prog; - sqlInsert("int_maj_auto", $enreg); + (new Class_IntMajAuto)->updateAttributes($enreg)->save(); // abonnés echo '<tr><td class="blank"> </td><td class="blank">Import des abonnés</td></tr>'; @@ -253,7 +255,7 @@ if($_REQUEST["action"]=="CONTROLE") $enreg["type_operation"]=2; $enreg["nom_fichier"]=$path_fichier."site".$id_bib."/abonnes.txt"; $enreg["rang"]=$id_prog; - sqlInsert("int_maj_auto", $enreg); + (new Class_IntMajAuto)->updateAttributes($enreg)->save(); // prêts echo '<tr><td class="blank"> </td><td class="blank">Import des prêts</td></tr>'; @@ -264,7 +266,7 @@ if($_REQUEST["action"]=="CONTROLE") $enreg["type_operation"]=2; $enreg["nom_fichier"]=$path_fichier."site".$id_bib."/prets.txt"; $enreg["rang"]=$id_prog; - sqlInsert("int_maj_auto", $enreg); + (new Class_IntMajAuto)->updateAttributes($enreg)->save(); // réservations (pergame uniquement) if($type_sigb==1) @@ -277,7 +279,7 @@ if($_REQUEST["action"]=="CONTROLE") $enreg["type_operation"]=2; $enreg["nom_fichier"]=$path_fichier."site".$id_bib."/reservations.txt"; $enreg["rang"]=$id_prog; - sqlInsert("int_maj_auto", $enreg); + (new Class_IntMajAuto)->updateAttributes($enreg)->save(); } } print('</table></div>'); diff --git a/library/Class/IntMajAuto.php b/library/Class/IntMajAuto.php new file mode 100644 index 0000000000000000000000000000000000000000..2b6da0f462e664ca9af7a8d0bb6d0d6dae79c2d4 --- /dev/null +++ b/library/Class/IntMajAuto.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * AFI-OPAC 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class Class_IntMajAuto extends Storm_Model_Abstract { + protected $_table_name = 'int_maj_auto'; + protected $_table_primary = 'id_prog'; +} + +?> \ No newline at end of file