idlocation."\" style=\"display:block\">\r\n";
else $selector .= "
idlocation."\" style=\"display:none\">\r\n";
$selector .= "
';
$this->ajax_cote_fields .= ($this->ajax_cote_fields != '' ? ",f_ex_section".$loc->idlocation : "f_ex_section".$loc->idlocation);
}
}
return $selector;
}
// ---------------------------------------------------------------
// import() : import d'un exemplaire
// ---------------------------------------------------------------
// fonction d'import d'exemplaire (membre de la classe 'exemplaire');
public static function import($data) {
global $msg;
// cette méthode prend en entrée un tableau constitué des informations exemplaires suivantes :
// $data['cb']
// $data['notice']
// $data['bulletin']
// $data['typdoc']
// $data['cote']
// $data['section']
// $data['statut']
// $data['location']
// $data['codestat']
// $data['creation']
// $data['modif']
// $data['note']
// $data['prix']
// $data['expl_owner']
// $data['expl_pnb_flag']
// $data['cote_mandatory'] cote obligatoire = 1, non obligatoire = 0
// $data['quoi_faire'] que faire de cet exemplaire :
// 0 : supprimer, 1 ou vide : Mettre à jour ou ajouter, 2 : ajouter si possible, sinon rien.
if(!defined('SESSid')) {
define('SESSid', 0);
}
// check sur le type de la variable passée en paramètre
if (!is_array($data) || empty($data)) {
// si ce n'est pas un tableau ou un tableau vide, on retourne 0
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '$msg[544]') ") ;
return 0;
}
if (!isset($data['quoi_faire']) || $data['quoi_faire']=="") {
$data['quoi_faire']="2" ;
}
if(!isset($data['cb'])) {
$data['cb'] = '';
}
if ((string)$data['quoi_faire']=="0") {
$sql_del = "delete from exemplaires where expl_cb='".addslashes($data['cb'])."' " ;
pmb_mysql_query($sql_del) ;
return -1 ;
}
// check sur les éléments du tableau (cb, cote, notice, typdoc, section, statut, location, codestat, owner sont requis).
if(!isset(static::$long_maxi_cb)) {
static::$long_maxi_cb = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_cb FROM exemplaires limit 1"),0);
}
$data['cb'] = rtrim(substr(trim($data['cb']),0,static::$long_maxi_cb));
if(!isset(static::$long_maxi_cote)) {
static::$long_maxi_cote = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_cote FROM exemplaires limit 1"),0);
}
if (!isset($data['cote'])) {
$data['cote'] = "";
}
$data['cote'] = rtrim(substr(trim($data['cote']),0,static::$long_maxi_cote));
if(!isset(static::$long_maxi_prix)) {
static::$long_maxi_prix = pmb_mysql_field_len(pmb_mysql_query("SELECT expl_prix FROM exemplaires limit 1"),0);
}
if (!isset($data['prix'])) {
$data['prix'] = "";
}
$data['prix'] = rtrim(substr(trim($data['prix']),0,static::$long_maxi_prix));
if (!isset($data['expl_owner'])) {
$data['expl_owner'] = "";
}
if ($data['expl_owner']=="") {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', 'No lender given') ") ;
return 0;
}
if($data['cb']=="") {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[545]."') ") ;
return 0;
}
if (!isset($data['cote_mandatory'])) {
$data['cote_mandatory'] = 0;
}
if ($data['cote']=="") {
if ($data['cote_mandatory']==1) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[546]."') ") ;
return 0;
} else {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[567]."') ") ;
}
}
if(!isset($data['notice'])) {
$data['notice'] = 0;
}
if(!isset($data['bulletin'])) {
$data['bulletin'] = 0;
}
if($data['notice']==0) {
if ($data['bulletin']==0) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[547]."') ") ;
return 0;
}
}
if(!isset($data['typdoc'])) {
$data['typdoc'] = 0;
}
if($data['typdoc']==0) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[548]."') ") ;
return 0;
}
if(!isset($data['section'])) {
$data['section'] = 0;
}
if($data['section']==0) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[549]."') ") ;
return 0;
}
if(!isset($data['statut'])) {
$data['statut'] = 0;
}
if($data['statut']==0) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[550]."') ") ;
return 0;
}
if(!isset($data['location'])) {
$data['location'] = 0;
}
if($data['location']==0) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[551]."') ") ;
return 0;
}
if(!isset($data['codestat'])) {
$data['codestat'] = 0;
}
if($data['codestat']==0) {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[552]."') ") ;
return 0;
}
if (!isset($data['type_antivol'])) {
$data['type_antivol'] = "";
}
if($data['type_antivol']=="") {
$data['type_antivol']="1";
}
// préparation de la requête
$key0 = addslashes($data['cb']);
$key1 = addslashes($data['cote']);
/* vérification que l'exemplaire existe ou pas */
$exe = new stdClass();
$query = "SELECT expl_id FROM exemplaires WHERE expl_cb='${key0}' LIMIT 1 ";
$result = @pmb_mysql_query($query);
if(!$result) {
die("can't SELECT exemplaires ".$query);
}
if(pmb_mysql_num_rows($result)) {
$exe = pmb_mysql_fetch_object($result);
}
if (!isset($data['date_depot'])) {
$data['date_depot'] = "";
}
if (!$data['date_depot']) {
$data['date_depot']="sysdate()";
} else {
$data['date_depot']="'".$data['date_depot']."'" ;
}
if (!isset($data['date_retour'])) {
$data['date_retour'] = "";
}
if (!$data['date_retour']) {
$data['date_retour']="sysdate()";
} else {
$data['date_retour']="'".$data['date_retour']."'" ;
}
// l'exemplaire existe et on ne pouvait que l'ajouter, on retourne l'ID
if ($exe->expl_id!="" && $data['quoi_faire']=="2") {
pmb_mysql_query("insert into error_log (error_origin, error_text) values ('expl_".addslashes(SESSid).".class', '".$msg[553].$data['cb']."') ") ;
return $exe->expl_id;
}
// l'exemplaire existe et on doit le mettre à jour
if ($exe->expl_id!="" && $data['quoi_faire']=="1") {
$sql_a_faire = "update exemplaires SET " ;
$sql_a_faire_suite = " where expl_cb='".addslashes($data['cb'])."' " ;
}
// l'exemplaire n'existe pas : on doit le créer
if ($exe->expl_id=="") {
$sql_a_faire = "insert into exemplaires SET " ;
$sql_a_faire_suite = "" ;
}
if (empty($data['expl_pnb_flag'])) {
$data['expl_pnb_flag'] = 0;
}
$query = $sql_a_faire ;
$query .= "expl_cb='".$key0."', ";
$query .= "expl_notice='".$data['notice']."', ";
$query .= "expl_bulletin='".$data['bulletin']."', ";
$query .= "expl_typdoc='".$data['typdoc']."', ";
$query .= "expl_cote=trim('".$key1."'), ";
$query .= "expl_section='".$data['section']."', ";
$query .= "expl_statut='".$data['statut']."', ";
$query .= "expl_location='".$data['location']."', ";
$query .= "expl_codestat='".$data['codestat']."', ";
$query .= "expl_note='".addslashes($data['note'])."', ";
$query .= "expl_comment='".addslashes($data['comment'])."', ";
$query .= "expl_prix='".addslashes($data['prix'])."', ";
$query .= "expl_owner='".$data['expl_owner']."', ";
$query .= "expl_date_depot=".$data['date_depot'].", ";
$query .= "expl_date_retour=".$data['date_retour'].", ";
$query .= "transfert_location_origine = ".$data['location'].", ";
$query .= "transfert_statut_origine=".$data['statut'].", ";
$query .= "transfert_section_origine=".$data['section'].", ";
$query .= "expl_pnb_flag='".$data['expl_pnb_flag']."', ";
//$query .= "type_antivol=".$data['type_antivol'].", ";
if(isset($data['creation']) && $data['creation']) {
$query .= "create_date='".$data['creation']."'";
}else{
$query .= "create_date=sysdate() ";
}
$query .= $sql_a_faire_suite ;
$result = @pmb_mysql_query($query);
if(!$result) {
die("can't INSERT into exemplaires ".$query);
}
if ($exe->expl_id="") {
audit::insert_creation(AUDIT_EXPL,pmb_mysql_insert_id());
$exe->expl_id = pmb_mysql_insert_id();
} else {
$sql_id = pmb_mysql_query("select expl_id from exemplaires where expl_cb='".addslashes($data['cb'])."' ") ;
$exe = pmb_mysql_fetch_object($sql_id);
audit::insert_modif(AUDIT_EXPL,$exe->expl_id);
}
// Imports > Exemplaires UNIMARC
global $import_explajtEXPL, $import_expl_caddie_EXPL;
if(!empty($import_explajtEXPL) && !empty($import_expl_caddie_EXPL)) {
import_expl::add_object_caddie($exe->expl_id, 'EXPL', $import_expl_caddie_EXPL);
}
return $exe->expl_id;
}
// Suppression
public static function del_expl($id=0) {
global $explr_visible_mod, $pmb_droits_explr_localises;
global $pmb_archive_warehouse;
$id += 0;
$sql_pret = pmb_mysql_query("select 1 from pret where pret_idexpl ='$id' ") ;
if (pmb_mysql_num_rows($sql_pret)) return 0 ;
// visibilite de l'exemplaire
if ($pmb_droits_explr_localises) {
$query = "select expl_location from exemplaires where expl_id='".$id."'";
$result = pmb_mysql_query($query);
$location_id = pmb_mysql_result($result,0,0);
$tab_mod=explode(",",$explr_visible_mod);
$as_modif = array_search($location_id,$tab_mod);
if ($as_modif===false) return 0 ;
}
$requete = "select idcaddie FROM caddie where type='EXPL' ";
$result = pmb_mysql_query($requete);
for($i=0;$i
delete_values($id);
// nettoyage transfert
$requete_suppr = "delete from transferts_demande where num_expl='$id'";
pmb_mysql_query($requete_suppr);
// nettoyage circulation des périodiques
serialcirc::delete_expl($id);
//archivage
if ($pmb_archive_warehouse) {
static::save_to_agnostic_warehouse(array(0=>$id),$pmb_archive_warehouse);
}
// nettoyage doc. à ranger
$requete_suppr = "delete from resa_ranger where resa_cb in (select expl_cb from exemplaires where expl_id='".$id."') ";
pmb_mysql_query($requete_suppr);
// nettoyage indexation concepts
$index_concept = new index_concept($id, TYPE_EXPL);
$index_concept->delete();
// Suppression exemplaire prêt numérique
pmb_mysql_query("DELETE FROM pnb_orders_expl WHERE pnb_order_expl_num='$id' ") ;
pmb_mysql_query("delete from exemplaires where expl_id='$id' ") ;
return 1 ;
}
//sauvegarde un ensemble de notices dans un entrepot agnostique a partir d'un tableau d'ids d'exemplaires
public static function save_to_agnostic_warehouse($expl_ids=array(),$source_id=0,$keep_expl=1) {
global $base_path,$class_path,$include_path,$dbh;
if (is_array($expl_ids) && count($expl_ids) && $source_id*1) {
$export_params=array(
'genere_lien'=>1,
'notice_mere'=>1,
'notice_fille'=>1,
'mere'=>0,
'fille'=>0,
'bull_link'=>1,
'perio_link'=>1,
'art_link'=>0,
'bulletinage'=>0,
'notice_perio'=>0,
'notice_art'=>0,
'export_only_expl_ids'=> $expl_ids
);
$notice_ids=array();
$bulletin_ids=array();
$perio_ids=array();
$q='select expl_notice,expl_bulletin,bulletin_notice from exemplaires left join bulletins on expl_bulletin=bulletin_id and expl_bulletin!=0 where expl_id in ('.implode(',',$expl_ids).')';
$r=pmb_mysql_query($q,$dbh);
if (pmb_mysql_num_rows($r)) {
while($row=pmb_mysql_fetch_object($r)){
if($row->expl_notice) $notice_ids[]=$row->expl_notice;
if($row->expl_bulletin) $bulletin_ids[]=$row->expl_bulletin;
if($row->bulletin_notice) $perio_ids[]=$row->bulletin_notice;
}
}
if (count($notice_ids) || count($bulletin_ids)) {
require_once($base_path."/admin/connecteurs/in/agnostic/agnostic.class.php");
$conn=new agnostic($base_path.'/admin/connecteurs/in/agnostic');
$source_params = $conn->get_source_params($source_id);
$export_params['docnum']=1;
$export_params['docnum_rep']=$source_params['REP_UPLOAD'];
}
if (count($notice_ids)) {
$notice_ids=array_unique($notice_ids);
$e=new export($notice_ids);
$records=array();
do{
$nn = $e->get_next_notice('',array(),array(),$keep_expl,$export_params);
if ($e->notice) $records[] = $e->xml_array;
} while($nn);
$conn->rec_records_from_xml_array($records,$source_id);
}
if (count($bulletin_ids)) {
$bulletin_ids=array_unique($bulletin_ids);
$perio_ids=array_unique($perio_ids);
$e=new export($perio_ids);
$e->expl_bulletin_a_exporter=$bulletin_ids;
$records=array();
do{
$nn = $e->get_next_bulletin('',array(),array(),$keep_expl,$export_params);
if ($e->notice) $records[] = $e->xml_array;
} while($nn);
$conn->rec_records_from_xml_array($records,$source_id);
}
}
}
/**
* Fonction de purge des exemplaires fantomes (appelée en fin de transfert)
* @param int $expl_id Id de l'exemplaire à tester
* @return boolean
*/
public static function purge_ghost($expl_id){
global $dbh;
$rqt = "select expl_ref_num from exemplaires where expl_id = ".$expl_id." ;";
$result = pmb_mysql_query($rqt, $dbh);
if($result){
$parent_id = pmb_mysql_fetch_object($result);
//Il s'agit d'un exemplaire fantome
if($parent_id->expl_ref_num != 0){
self::del_expl($expl_id);
return true;
}
return false;
}
return false;
}
/**
* Fonction de mise à jour du code-barres de l'exemplaire (avec tests)
* @param string $old_cb Ancien code-barres
* @param string $new_cb Nouveau code-barres
* @return int Retourne un entier correspondant aux différents cas d'erreurs/réussite
*/
public static function update_cb($old_cb, $new_cb){
global $dbh;
if(SESSrights & (CATALOGAGE_AUTH + CATAL_MODIF_CB_EXPL_AUTH)){
$requete="select expl_cb from exemplaires WHERE expl_cb='".$new_cb."'";
$result = pmb_mysql_query($requete,$dbh);
$requete="select cb from exemplaires_temp WHERE cb='".$new_cb."' AND sess <>'".SESSid."'";
$result_tempo = pmb_mysql_query($requete,$dbh);
if(!pmb_mysql_num_rows($result) && !pmb_mysql_num_rows($result_tempo)){//Code-barres non existant en base
$requete = "update exemplaires set expl_cb = '".$new_cb."' where expl_cb='".$old_cb."'";
$result = pmb_mysql_query($requete, $dbh);
if($result){ //La requete de mise à jour a réussi
return 1;
}
return 2;
}
//Le code-barres existe déjà en base
return 0;
}
return 3;
}
public function get_notice_title() {
$title = '';
if($this->id_bulletin) {
if($this->id_bulletin_notice) {
$title .= notice::get_notice_title($this->id_bulletin_notice);
} else {
$title .= notice::get_notice_title($this->id_num_notice);
}
} else {
$title .= notice::get_notice_title($this->id_notice);
}
return $title;
}
//renvoi le no d'exemplaire pour le tableau avec ou sans lien
public static function get_cb_link($cb_expl) {
global $base_path;
$des_expl = "";
if (SESSrights & CIRCULATION_AUTH) {
$des_expl .= "";
$des_expl .= $cb_expl;
$des_expl .= "";
} else {
$des_expl .= $cb_expl;
}
return $des_expl;
}
public static function is_digital($id){
if(!isset(static::$digital_ids[$id])){
$id=intval($id);
$query = "select pnb_order_expl_num from pnb_orders_expl where pnb_order_expl_num =".$id;
$result = pmb_mysql_query($query);
if(pmb_mysql_num_rows($result)){
static::$digital_ids[$id] = true;
}else{
static::$digital_ids[$id] = false;
}
}
return static::$digital_ids[$id];
}
public static function is_currently_borrowed($id) {
$query = "select pret_idempr from pret where pret_idexpl=".$id." limit 1";
$result = pmb_mysql_query($query);
if (pmb_mysql_num_rows($result)) {
return true;
}
return false;
}
// récupère l'id d'un exemplaire d'après son code barre
public static function get_expl_id_from_cb($cb) {
if (!$cb) return FALSE;
$query = "select expl_id as id from exemplaires where expl_cb='".$cb."' limit 1";
$result = pmb_mysql_query($query);
return pmb_mysql_result($result, '0', 'id');
}
/**
* Définition du type de support par défaut
*/
protected function set_deflt_typdoc_id() {
if ($this->typdoc_id) {
return;
}
if ($this->id_bulletin) {
global $deflt_serials_docs_type;
$this->typdoc_id = $deflt_serials_docs_type;
return;
}
if ($this->id_notice) {
$notice = notice::get_notice($this->id_notice);
switch ($notice->biblio_level) {
case 's' :
case 'b' :
global $deflt_serials_docs_type;
$this->typdoc_id = $deflt_serials_docs_type;
break;
default :
global $deflt_docs_type;
$this->typdoc_id = $deflt_docs_type;
break;
}
}
return;
}
// Donne l'id de la notice par son identifiant d'expl
public static function get_expl_notice_from_id($expl_id=0) {
$expl_id += 0;
$query = "select expl_notice, expl_bulletin from exemplaires where expl_id = ".$expl_id;
$result = pmb_mysql_query($query);
$row = pmb_mysql_fetch_object($result);
if($row->expl_notice) {
return $row->expl_notice;
} else {
$query = "select num_notice from bulletins where bulletin_id = ".$row->expl_bulletin;
$result = pmb_mysql_query($query);
return pmb_mysql_result($result, 0, 'num_notice');
}
}
// Donne l'id du bulletin par son identifiant d'expl
public static function get_expl_bulletin_from_id($expl_id=0) {
$expl_id += 0;
$query = "select expl_bulletin from exemplaires where expl_id = ".$expl_id;
$result = pmb_mysql_query($query);
return pmb_mysql_result($result, 0, 'expl_bulletin');
}
public static function get_nb_prets_from_id($expl_id=0) {
$nb_prets = 0;
$expl_id += 0;
$query = "select count(arc_expl_id) as nb_prets from pret_archive where arc_expl_id = ".$expl_id;
$result = pmb_mysql_query($query);
if(pmb_mysql_num_rows($result)){
$row = pmb_mysql_fetch_object($result);
$nb_prets = $row->nb_prets ;
}
return $nb_prets;
}
public static function self_renew($expl_cb, $is_self_renew_asked = 0) {
global $opac_pret_prolongation, $opac_pret_duree_prolongation,$pmb_pret_restriction_prolongation,$pmb_pret_nombre_prolongation, $opac_pret_prolongation_blocage, $dbh,$msg;
global $selfservice_pret_prolonge_non_msg, $charset, $pmb_utiliser_calendrier;
$ret = array();
$struct = array();
$titre=$expl_cb;
$error_message="";
$due_date=date("Ymd His",time());
$ok=1;
$is_self_renew = 0;
$ret["status"]="";
$ret["cb"] = $expl_cb;
if($opac_pret_prolongation){
$prolongation=true;
$requete="select expl_id, id_empr, expl_bulletin,expl_notice, type_antivol, empr_cb, expl_location, cpt_prolongation, retour_initial, niveau_relance, pret_date, pret_retour from exemplaires join pret on (expl_id=pret_idexpl) join empr on (pret_idempr=id_empr) where expl_cb='".addslashes($expl_cb)."'";
$resultat=pmb_mysql_query($requete);
if (!$resultat) {
$error_message=$msg["54"];
} else {
$expl=pmb_mysql_fetch_object($resultat);
$remind = $expl->niveau_relance;
$expl_id=$expl->expl_id;
$id_empr=$expl->id_empr;
$cpt_prolongation = $expl->cpt_prolongation;
$retour_initial = $expl->retour_initial;
$cpt_prolongation++;
$duree_prolongation=$opac_pret_duree_prolongation;
$today=exemplaire::sql_value_("SELECT CURRENT_DATE()");
if ($pmb_pret_restriction_prolongation==0) {
// Aucune limitation des prolongations
$prolongation=true;
$duree_prolongation=$opac_pret_duree_prolongation;
} else if($opac_pret_prolongation_blocage > 0 && $remind > 0){
//vérification du blocage des prolongations
$prolongation = false;
} else if ($pmb_pret_restriction_prolongation>0) {
$pret_nombre_prolongation=$pmb_pret_nombre_prolongation;
if(($pmb_pret_restriction_prolongation==1) && ($cpt_prolongation>$pret_nombre_prolongation)) {
// Limitation simple de la prolongation
$prolongation=FALSE;
} else if($pmb_pret_restriction_prolongation==2) {
// Limitation du pret par les quotas
//Initialisation des quotas pour nombre de prolongations
$qt = new quota("PROLONG_NMBR_QUOTA");
//Tableau de passage des paramètres
$struct["READER"] = $id_empr;
$struct["EXPL"] = $expl_id;
$struct["NOTI"] = $expl->expl_notice;
$struct["BULL"] = $expl->expl_bulletin;
$pret_nombre_prolongation=$qt->get_quota_value($struct);
if($cpt_prolongation>$pret_nombre_prolongation) {
$prolongation=FALSE;
} else {
//Initialisation des quotas la durée de prolongations
$qt = new quota("PROLONG_TIME_QUOTA");
$struct["READER"] = $id_empr;
$struct["EXPL"] = $expl_id;
$struct["NOTI"] = $expl->expl_notice;
$struct["BULL"] = $expl->expl_bulletin;
$duree_prolongation=$qt->get_quota_value($struct);
}
} // fin if gestion par quotas
}
if ($prolongation == true) {
$date_prolongation=exemplaire::sql_value_("SELECT DATE_ADD('$retour_initial', INTERVAL $duree_prolongation DAY)");
$diff=exemplaire::sql_value_("SELECT DATEDIFF('$retour_initial','$today')");
if($diff<-$duree_prolongation || $diff>$duree_prolongation) {
$prolongation=FALSE;
}
}
if ($prolongation == true && $pmb_utiliser_calendrier) {
// Recherche de la nouvelle date de retour
$req_date_calendrier = "select date_ouverture from ouvertures where ouvert=1 and num_location='" . $expl->expl_location . "' and date_ouverture>=$date_prolongation order by date_ouverture asc";
$res_date_calendrier = pmb_mysql_query($req_date_calendrier);
while(($date_calendrier = pmb_mysql_fetch_object($res_date_calendrier))){
$ecart = exemplaire::sql_value_("SELECT DATEDIFF('$date_calendrier->date_ouverture','$date_prolongation')");
if($ecart >= 0 ){
$date_prolongation = $date_calendrier->date_ouverture;
break;
}
}
if($expl->pret_retour == $date_prolongation) {
$prolongation=false;
}
}
if($prolongation==true) {
$is_self_renew = true;
$due_date=exemplaire::sql_value_("select date_format('".$date_prolongation."', '".$msg["format_date"]."')");
if (empty($is_self_renew_asked)) {
// Memorisation de la nouvelle date de prolongation
$query = "update pret set cpt_prolongation='".$cpt_prolongation."', pret_retour='".$date_prolongation."' where pret_idexpl=".$expl_id;
$result = pmb_mysql_query($query, $dbh);
$error_message = $msg['prolongation_ok'];
// Memorisation de la nouvelle date de prolongation dans la table d'archive
$res_arc=pmb_mysql_query("select pret_arc_id from pret where pret_idexpl=".$expl_id."",$dbh);
if($res_arc && pmb_mysql_num_rows($res_arc)){
$query = "update pret_archive set arc_cpt_prolongation='".$cpt_prolongation."', arc_fin='".$date_prolongation."' where arc_id = ".pmb_mysql_result($res_arc,0,0);
pmb_mysql_query($query,$dbh);
}
}
} else {
$ok=0;
$error_message="Prolongation impossible";
}
}
} else{
$error_message="$selfservice_pret_prolonge_non_msg";
}
if ($charset!= "utf-8") $error_message = utf8_encode($error_message);
$ret["status"]=$ok;
$ret["message"]=$error_message;
$ret["is_self_renew"] = $is_self_renew;
$ret["transaction_date"]=date("Ymd His",time());
if($charset != "utf-8")$ret["title"]=utf8_encode($titre);
else $ret["title"]=$titre;
$ret["due_date"]=$due_date;
return $ret;
}
private static function sql_value_($rqt) {
if(($result=pmb_mysql_query($rqt))) {
if(($row = pmb_mysql_fetch_row($result))) return $row[0];
}
return '';
}
// Donne l'id de l'exemplaire par l'identifiant de concep
public static function get_expl_from_concept($concept = 0) {
$tab_id = array();
$concept_id = $concept->get_num_object();
$query = "select num_object from index_concept where num_concept = ".$concept_id ." AND type_object=". TYPE_EXPL;
$result = pmb_mysql_query($query);
if (pmb_mysql_num_rows($result)) {
while ($rows = pmb_mysql_fetch_assoc($result)) {
$tab_id[] = $rows['num_object'];
}
}
return $tab_id;
}
public static function get_pattern_link() {
global $base_path;
return $base_path.'/catalog.php?categ=edit_expl&id=!!notice_id!!&cb=!!expl_cb!!&expl_id=!!expl_id!!';
}
} # fin de la classe exemplaire
} # fin de définition