An error occurred while loading the file. Please try again.
-
Ghislain Loas authoredbb6e4aac
majNoticesPanier.php 1.98 KiB
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH 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).
*
* BOKEH 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 BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
define("BASE_URL", "/");
set_include_path('.' . PATH_SEPARATOR . './library'
. PATH_SEPARATOR . '../ZendFramework-1.6.2/library'
. PATH_SEPARATOR . get_include_path());
include_once "local.php";
include_once "fonctions/fonctions.php";
require_once "Zend/Loader.php";
require_once "startup.php";
setupOpac();
$mysql_file = tempnam("/tmp", "paniersupdate");
$handle=fopen($mysql_file,'w');
$paniers = Class_PanierNotice::findAllBy(['where' => 'id<234']);
foreach($paniers as $panier) {
$cles = [];
$ids_origine=$panier->getIdsOrigine();
if ($ids_origine=='')
continue;
$ids=explode(';',$ids_origine);
foreach ($ids as $id) {
$exemplaire=Class_Exemplaire::findFirstBy(['id_origine'=>$id]);
if (!$exemplaire) {
echo "id not found=".$id;
continue;
}
$notice = $exemplaire->getNotice();
if (!$notice)
echo "notice non trouvee ";
$cles[]=$notice->getClefAlpha();
}
fwrite($handle,'update notices_paniers set notices="'.$panier->getNotices().'" where id = '.$panier->getId().";"."\n");
if ($cles && sizeof($cles)>0) {
$panier->setNotices(implode(';',$cles));
$panier->save();
}
}
fclose($handle);
?>