idempr = $id_empr;
$this->type_lettre = $type_lettre;
$this->id_groupe = $id_groupe;
$this->entete = "\n";
$this->biblio_info();
if($id_groupe){
$this->groupe_info($this->id_groupe);
$this->entete .= $this->biblio_info.$this->groupe_info.$this->lecteur_info;
} else {
$this->lecteur_info($this->idempr);
$this->entete .= $this->biblio_info.$this->lecteur_info;
}
$this->entete .= "\n";
$this->construire_xml($this->type_lettre);
}
/*
* Retourne le Xml bien formé
*/
function getXml(){
return $this->lettreXml;
}
function construire_xml($type_lettre){
$this->lettreXml .= "\n";
$this->lettreXml .= $this->entete;
$this->lettreXml .= "\n";
}
/*
* Bloc d'info de la biblio
*/
function biblio_info() {
global $biblio_name, $biblio_logo, $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_state, $biblio_country, $biblio_phone, $biblio_email, $biblio_website ;
global $msg, $charset ;
$this->biblio_info="\t\n";
// afin de ne générer qu'une fois l'adr et compagnie
if ($this->biblio_info) {
if ($biblio_name != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_name,ENT_QUOTES,$charset)."\n";
if ($biblio_adr1 != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_adr1,ENT_QUOTES,$charset)."\n";
if ($biblio_cp != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_cp,ENT_QUOTES,$charset)."\n";
if ($biblio_adr2 != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_adr2,ENT_QUOTES,$charset)."\n";
if ($biblio_state != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_state,ENT_QUOTES,$charset)."\n";
if ($biblio_town != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_town,ENT_QUOTES,$charset)."\n";
if ($biblio_phone != "") $this->biblio_info .= "\t\t".htmlspecialchars($msg['lettre_titre_tel'].$biblio_phone,ENT_QUOTES,$charset)."\n ";
if ($biblio_email != "") $this->biblio_info .= "\t\t@ : ".htmlspecialchars($biblio_email,ENT_QUOTES,$charset)."\n ";
if ($biblio_website != "") $this->biblio_info .= "\t\tWeb : ".htmlspecialchars($biblio_website,ENT_QUOTES,$charset)."\n";
if ($biblio_country != "") $this->biblio_info .= "\t\t".htmlspecialchars($biblio_country,ENT_QUOTES,$charset)."\n";
}
if ($biblio_logo) $this->biblio_info .= "\t\t./images/".htmlspecialchars($biblio_logo,ENT_QUOTES,$charset)."\n";
$this->biblio_info .= "\t\n";
}
/*
* Bloc info du lecteur
*/
function lecteur_info($id_empr){
global $msg, $dbh,$charset,$niveau, $forcename;
$requete = "SELECT group_concat(libelle_groupe SEPARATOR ', ') as_all_groupes, 1 as rien from groupe join empr_groupe on groupe_id=id_groupe WHERE lettre_rappel_show_nomgroup=1 and empr_id='$id_empr' group by rien ";
$lib_all_groupes=pmb_sql_value($requete);
if ($lib_all_groupes)
$lib_all_groupes = "\t\t".htmlspecialchars($lib_all_groupes,ENT_QUOTES,$charset)."\n";
$concerne="";
$temp_id_empr=$id_empr;
if(!$forcename){
//Recherche du groupe d'appartenance
$requete="select id_groupe,resp_groupe from groupe,empr_groupe where id_groupe=groupe_id and empr_id=$id_empr and resp_groupe and lettre_rappel limit 1";
$res=mysql_query($requete);
if(mysql_num_rows($res)) {
$temp_id_empr=mysql_result($res,0,1);
} else $temp_id_empr=$id_empr;
//Si le responsable n'est pas l'emprunteur, on précise qui est relancé
if ($temp_id_empr!=$id_empr) {
$requete="select concat(empr_prenom,' ',empr_nom) from empr where id_empr=$id_empr"; //Idée de Quentin
$res=mysql_query($requete);
$concerne="\t\t".htmlspecialchars(sprintf($msg["adresse_retard_concerne"],mysql_result($res,0,0)),ENT_QUOTES,$charset)."\n";
}
}
$requete = "SELECT id_empr, empr_cb, empr_nom, empr_prenom, empr_adr1, empr_adr2, empr_cp, empr_ville, empr_pays, empr_mail, empr_tel1, empr_tel2, empr_date_adhesion, empr_date_expiration, date_format(empr_date_adhesion, '".$msg["format_date"]."') as aff_empr_date_adhesion, date_format(empr_date_expiration, '".$msg["format_date"]."') as aff_empr_date_expiration FROM empr WHERE id_empr='$temp_id_empr' ";
$res = mysql_query($requete, $dbh);
$empr = mysql_fetch_object($res);
$this->lecteur_info = "\t\n";
$this->lecteur_info .= "\t\t".htmlspecialchars($id_empr,ENT_QUOTES,$charset)."\n";
$this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_prenom,ENT_QUOTES,$charset)."\n";
$this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_nom,ENT_QUOTES,$charset)."\n";
if ($empr->empr_adr1 != "") $this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_adr1,ENT_QUOTES,$charset)."\n" ;
if ($empr->empr_adr2 != "") $this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_adr2,ENT_QUOTES,$charset)."\n" ;
if ($empr->empr_cp != "") $this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_cp,ENT_QUOTES,$charset)."\n";
if ($empr->empr_ville != "") $this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_ville,ENT_QUOTES,$charset)."\n" ;
if ($empr->empr_pays != "") $this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_pays,ENT_QUOTES,$charset)."\n" ;
if ($empr->empr_tel1 != "")
$this->lecteur_info .= "\t\t".htmlspecialchars($msg['fpdf_tel1']." ".$empr->empr_tel1,ENT_QUOTES,$charset)."\n" ;
if ($empr->empr_tel2 != "")
$this->lecteur_info .= "\t\t".htmlspecialchars($msg['fpdf_tel2']." ".$empr->empr_tel2,ENT_QUOTES,$charset)."\n";
if ($empr->empr_mail != "")
$this->lecteur_info .= "\t\t".htmlspecialchars($empr->empr_mail,ENT_QUOTES,$charset)."\n";
if($empr->empr_cb)
$this->lecteur_info .= "\t\t".htmlspecialchars($msg['fpdf_carte']." ".$empr->empr_cb,ENT_QUOTES,$charset)."\n";
if($empr->aff_empr_date_adhesion)
$this->lecteur_info .= "\t\t".htmlspecialchars($empr->aff_empr_date_adhesion,ENT_QUOTES,$charset)."\n";
if($empr->aff_empr_date_expiration)
$this->lecteur_info .= "\t\t".htmlspecialchars($empr->aff_empr_date_expiration,ENT_QUOTES,$charset)."\n";
$this->lecteur_info .= $lib_all_groupes;
$this->lecteur_info .= $concerne;
$this->lecteur_info .= "\t\t".$niveau."";
$this->lecteur_info .= "\t\n";
}
/*
* Info du groupe
*/
function groupe_info($id_groupe,$no_cb=false) {
global $dbh, $charset;
global $pmb_pdf_font;
global $pmb_afficher_numero_lecteur_lettres;
$requete = "SELECT libelle_groupe, resp_groupe FROM groupe WHERE id_groupe='$id_groupe' ";
$res = mysql_query($requete, $dbh);
$groupe = mysql_fetch_object($res);
$this->groupe_info = "\t\n";
$this->groupe_info .= "\t\t".htmlspecialchars($groupe->libelle_groupe,ENT_QUOTES,$charset)."\n";
$this->groupe_info .= "\t\n";
if ($groupe->resp_groupe) {
$this->lecteur_info($groupe->resp_groupe,0, $no_cb || !$pmb_afficher_numero_lecteur_lettres) ;
}
}
/*
* Bloc des amendes
*/
function print_amendes($valeur,$frais_relance) {
$this->amendes_info = "\t\n";
$this->amendes_info .= "\t\t".htmlspecialchars(comptes::format_simple($valeur),ENT_QUOTES,$charset)."\n";
$this->amendes_info .= "\t\t".htmlspecialchars(comptes::format_simple($frais_relance),ENT_QUOTES,$charset)."\n";
$this->amendes_info .= "\t\t".htmlspecialchars(comptes::format_simple($valeur+$frais_relance),ENT_QUOTES,$charset)."\n";
$this->amendes_info .= "\t\n";
}
}
/*
* Récupération des données de la lettre de relance
*/
class lettre_relance extends lettre {
function lettre_relance($id_empr=0,$type_lettre,$id_groupe=0){
$this->lettre($id_empr,$type_lettre,$id_groupe);
}
function construire_xml($type_lettre){
$this->lettreXml .= "\n";
$this->lettreXml .= $this->entete;
$this->lettreXml .= "\n";
switch($type_lettre){
case 'liste_pret':
case 'lettre_retard':
$this->lettreXml .= $this->lettre_retard_par_lecteur($this->idempr);
$this->lettreXml .= $this->amendes_info;
break;
case 'liste_pret_groupe':
case 'lettre_retard_groupe':
$this->lettreXml .= $this->lettre_retard_par_groupe($this->id_groupe);
$this->lettreXml .= $this->amendes_info;
break;
}
$this->lettreXml .= "\n";
$this->lettreXml .= "\n";
}
function lettre_retard_par_lecteur($id_empr) {
global $dbh, $msg ,$pmb_gestion_financiere, $pmb_gestion_amende, $niveau;
//Pour les amendes
$valeur=0;
//Calcul des frais de relance
if (($pmb_gestion_financiere)&&($pmb_gestion_amende)) {
$id_compte=comptes::get_compte_id_from_empr($id_empr,2);
if ($id_compte) {
$cpte=new comptes($id_compte);
$frais_relance=$cpte->summarize_transactions("","",0,$realisee=-1);
if ($frais_relance<0) $frais_relance=-$frais_relance; else $frais_relance=0;
}
}
if($niveau!=3) {
$rqt = "select expl_cb from pret, exemplaires where pret_idempr='".$id_empr."' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date " ;
$req = mysql_query($rqt, $dbh) or die($msg['err_sql'].'
'.$rqt.'
'.mysql_error());
while ($data = mysql_fetch_array($req)) {
$valeur += $this->expl_retard ($data['expl_cb']);
}
$this->print_amendes($valeur,$frais_relance);
$retards = "\t\n".$this->expl_info."\t\n";
} else {
$requete="select expl_cb from exemplaires, pret where pret_idempr=$id_empr and pret_idexpl=expl_id and niveau_relance=3";
$res_recouvre=mysql_query($requete);
while ($rrc=mysql_fetch_object($res_recouvre)) {
$liste_r3[]=$rrc->expl_cb;
}
$rqt = "select expl_cb from pret, exemplaires where pret_idempr='".$id_empr."' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date " ;
$req = mysql_query($rqt, $dbh) or die($msg['err_sql'].'
'.$rqt.'
'.mysql_error());
while ($data = mysql_fetch_object($req)) {
// Pas répéter les retard si déjà en niveau 3
if(in_array($data->expl_cb,$liste_r3)===false){
$liste_r[] = $data->expl_cb;
}
}
if($liste_r) {
// Il y a des retard simple: on affiche d'abord les retards simples
foreach($liste_r as $cb_expl) {
$valeur += $this->expl_retard ($cb_expl);
}
// affiche retards niveau 3
foreach($liste_r3 as $cb_expl) {
$valeur += $this->expl_retard ($cb_expl,3);
}
$this->print_amendes($valeur,$frais_relance);
$retards = "\t\n".$this->expl_info."\t\n";
} else {
// il n'y a que des retards niveau 3
foreach($liste_r3 as $cb_expl) {
$valeur += $this->expl_retard ($cb_expl,3);
$retards .= $this->expl_info;
}
$this->print_amendes($valeur,$frais_relance);
$retards = "\t\n".$this->expl_info."\t\n";
}
}
return $retards;
}
function expl_retard($cb_doc,$niveau=0,$id_empr=0) {
global $msg, $dbh, $charset;
global $pmb_gestion_financiere, $pmb_gestion_amende;
$valeur=0;
$dates_resa_sql = " date_format(pret_date, '".$msg["format_date"]."') as aff_pret_date, date_format(pret_retour, '".$msg["format_date"]."') as aff_pret_retour " ;
$requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, pret_idempr, expl_id, expl_cb,expl_cote, pret_date, pret_retour, tdoc_libelle, section_libelle, location_libelle, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date!='', concat(' (',mention_date,')') ,''))) as tit, ".$dates_resa_sql.", " ;
$requete.= " notices_m.tparent_id, notices_m.tnvol " ;
$requete.= " FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), docs_type, docs_section, docs_location, pret ";
$requete.= " WHERE expl_cb='".$cb_doc."' and expl_typdoc = idtyp_doc and expl_section = idsection and expl_location = idlocation and pret_idexpl = expl_id ";
$res = mysql_query($requete, $dbh) or die (mysql_error()." $requete");
$expl = mysql_fetch_object($res);
// récupération du titre de série
if ($expl->tparent_id && $expl->m_id) {
$parent = new serie($expl->tparent_id);
$tit_serie = $parent->name;
if($expl->tnvol)
$tit_serie .= ', '.$expl->tnvol;
}
if($tit_serie) {
$expl->tit = $tit_serie.'. '.$expl->tit;
}
$libelle=$expl->tdoc_libelle;
$responsabilites=get_notice_authors($expl->m_id) ;
//print_r($responsabilites);
$as = array_keys ($responsabilites["responsabilites"], "0" ) ;
for ($i = 0 ; $i < count($as) ; $i++) {
$indice = $as[$i] ;
$auteur_1 = $responsabilites["auteurs"][$indice] ;
$auteur = new auteur($auteur_1["id"]);
$aut1_libelle[]= $auteur->isbd_entry;
}
if ($aut1_libelle) {
$auteurs_liste = implode ("; ",$aut1_libelle) ;
if ($auteurs_liste) $libelle .= ' / '. $auteurs_liste;
}
$libelle=$expl->tit." (".$libelle.")" ;
$this->expl_info .= " \t\n";
$this->expl_info .= "\t\t\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->aff_pret_date,ENT_QUOTES,$charset)."\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->aff_pret_retour,ENT_QUOTES,$charset)."\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->location_libelle,ENT_QUOTES,$charset)."\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->section_libelle,ENT_QUOTES,$charset)."\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->expl_cb,ENT_QUOTES,$charset)."\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->expl_cote,ENT_QUOTES,$charset)."\n";
$this->expl_info .= "\t\t".htmlspecialchars($expl->tdoc_libelle,ENT_QUOTES,$charset)."\n";
if (($pmb_gestion_financiere)&&($pmb_gestion_amende)) {
$amende=new amende($expl->pret_idempr);
$amd=$amende->get_amende($expl->expl_id);
if ($amd["valeur"]) {
$this->expl_info .= "\t\t".htmlspecialchars(comptes::format_simple($amd["valeur"]),ENT_QUOTES,$charset)."\n";
$valeur=$amd["valeur"];
}
}
if($niveau) $this->expl_info .= "\t\t3\n";
if($id_empr){
$req_empr = "select empr_nom as nom, empr_prenom as prenom from empr where id_empr=$id_empr";
$res = mysql_query($req_empr,$dbh);
$empr = mysql_fetch_object($res);
$this->expl_info .= "".htmlspecialchars($empr->nom,ENT_QUOTES,$charset)."";
$this->expl_info .= "".htmlspecialchars($empr->prenom,ENT_QUOTES,$charset)."";
}
$this->expl_info .= " \t\n";
return $valeur;
}
function lettre_retard_par_groupe($id_groupe, $lecteurs_ids=array()) {
global $dbh, $msg;
global $pmb_hide_biblioinfo_letter;
if ($lecteurs_ids)
$lecteur_ids_text = " AND id_empr in (".implode(",",$lecteurs_ids).")";
else
$lecteur_ids_text = "";
$rqt = "select empr_id, expl_cb from pret, exemplaires, empr_groupe, empr where groupe_id='".$id_groupe."' and pret_retour < curdate() and pret_idexpl=expl_id and empr_id=pret_idempr and empr_id=id_empr $lecteur_ids_text order by empr_nom, empr_prenom, pret_date " ;
$req = mysql_query($rqt, $dbh) or die ($msg['err_sql'].'
'.$rqt.'
'.mysql_error());
while ($data = mysql_fetch_array($req)) {
$this->expl_retard($data['expl_cb'],0,$data['empr_id']);
}
$retards = "\t".$this->expl_info."";
return $retards;
}
}
/*
* Récupération des données de la lettre de reservation
*/
class lettre_reservation extends lettre{
var $id_empr_tmp = array();
var $notice_resa = "";
var $notice_resa_planning = "";
function lettre_reservation($ids_resa=array(),$type_lettre){
global $dbh;
if($type_lettre=='lettre_resa_planning'){
$rqt = "select resa_idempr from resa_planning where id_resa in ('".implode("','",$ids_resa)."') ";
$res = mysql_query ($rqt, $dbh) ;
} else {
$rqt = "select resa_idempr from resa where id_resa in ('".implode("','",$ids_resa)."') ";
$res = mysql_query ($rqt, $dbh) ;
}
while (($resa_validee=mysql_fetch_object($res))){
if(array_search($resa_validee->resa_idempr,$this->id_empr_tmp) === false){
$this->lettre($resa_validee->resa_idempr,$type_lettre);
$this->id_empr_tmp[]=$resa_validee->resa_idempr;
}
}
}
function construire_xml($type_lettre){
$this->notice_resa = "";
$this->lettreXml .= "\n";
$this->lettreXml .= $this->entete;
$this->lettreXml .= "\n";
switch($type_lettre){
case 'lettre_resa':
$this->lettre_resa($this->idempr,$type_lettre);
$this->lettreXml .= "".$this->notice_resa."";
break;
case 'lettre_resa_planning':
$this->lettre_resa($this->idempr,$type_lettre);
$this->lettreXml .= "".$this->notice_resa_planning."";
break;
}
$this->lettreXml .= "\n";
$this->lettreXml .= "\n";
}
function lettre_resa($id_empr,$type_lettre=""){
global $dbh;
if($type_lettre == 'lettre_resa_planning'){
$rqt = "select id_resa from resa_planning where resa_idempr='$id_empr' order by resa_date_debut " ;
$req = mysql_query($rqt, $dbh) or die('Erreur SQL !
'.$rqt.'
'.mysql_error());
while($resa = mysql_fetch_object($req)){
$this->notice_resa_planning($resa->id_resa);
}
} else {
$rqt = "select id_resa from resa where resa_idempr='$id_empr' and resa_cb is not null and resa_cb!='' order by resa_date_debut " ;
$req = mysql_query($rqt, $dbh) or die('Erreur SQL !
'.$rqt.'
'.mysql_error());
while($resa = mysql_fetch_object($req)){
$this->notice_resa($resa->id_resa);
}
}
}
/*
* Info de la ligne de resa pour une notice sur la lettre de confirmation de réservation
*/
function notice_resa($id_resa_print) {
global $msg, $dbh, $charset;
global $pmb_transferts_actif,$transferts_choix_lieu_opac;
$dates_resa_sql = " date_format(resa_date_debut, '".$msg["format_date"]."') as aff_resa_date_debut, date_format(resa_date_fin, '".$msg["format_date"]."') as aff_resa_date_fin " ;
$requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, resa_date_debut, resa_date_fin, resa_cb, resa_loc_retrait, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, ".$dates_resa_sql ;
$requete.= "FROM (((resa LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ) LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id) ";
$requete.= "WHERE id_resa='".$id_resa_print."' ";
$res = mysql_query($requete, $dbh) or die (mysql_error()." $requete");
$expl = mysql_fetch_object($res);
$responsabilites = get_notice_authors(($expl->m_id+$expl->s_id)) ;
$as = array_search ("0", $responsabilites["responsabilites"]) ;
if ($as!== FALSE && $as!== NULL) {
$auteur_0 = $responsabilites["auteurs"][$as] ;
$auteur = new auteur($auteur_0["id"]);
$header_aut .= $auteur->isbd_entry;
} else {
$aut1_libelle=array();
$as = array_keys ($responsabilites["responsabilites"], "1" ) ;
for ($i = 0 ; $i < count($as) ; $i++) {
$indice = $as[$i] ;
$auteur_1 = $responsabilites["auteurs"][$indice] ;
$auteur = new auteur($auteur_1["id"]);
$aut1_libelle[]= $auteur->isbd_entry;
}
$header_aut .= implode (", ",$aut1_libelle) ;
}
$header_aut ? $auteur=" / ".$header_aut : $auteur="";
$rqt_detail = "select resa_confirmee, resa_cb,location_libelle, expl_cote from resa
left join exemplaires on expl_cb=resa_cb
left join docs_location on idlocation=expl_location
where id_resa =$id_resa_print and resa_cb is not null and resa_cb!='' ";
$res_detail = mysql_query ($rqt_detail) ;
$expl_detail = mysql_fetch_object($res_detail);
$this->notice_resa .= "\t\t\n";
$this->notice_resa .= "\t".htmlspecialchars($expl->tit.$auteur,ENT_QUOTES,$charset)."\n";
$this->notice_resa .= "\t".htmlspecialchars($auteur,ENT_QUOTES,$charset)."\n";
$this->notice_resa .= "\t".htmlspecialchars($expl->resa_cb,ENT_QUOTES,$charset)."\n";
$this->notice_resa .= "\t".htmlspecialchars($expl->expl_cote,ENT_QUOTES,$charset)."\n";
$this->notice_resa .= "\t".htmlspecialchars($expl->aff_resa_date_debut,ENT_QUOTES,$charset)."\n";
$this->notice_resa .= "\t".htmlspecialchars($expl->aff_resa_date_fin,ENT_QUOTES,$charset)."\n";
if($pmb_transferts_actif && $transferts_choix_lieu_opac==3) {
$rqt = "select resa_confirmee, resa_cb,resa_loc_retrait from resa where id_resa =$id_resa_print and resa_cb is not null and resa_cb!='' ";
$res = mysql_query ($rqt) ;
if(($resa_lue = mysql_fetch_object($res))) {
if ($resa_lue->resa_confirmee) {
if ($resa_lue->resa_loc_retrait) {
$loc_retait=$resa_lue->resa_loc_retrait;
} else {
$rqt = "select expl_location from exemplaires where expl_cb='".$resa_lue->resa_cb."' ";
$res = mysql_query ($rqt) ;
if(($res_expl = mysql_fetch_object($res))) {
$loc_retait=$res_expl->expl_location;
}
}
$rqt = "select location_libelle from docs_location where idlocation=".$loc_retait;
$res = mysql_query ($rqt) ;
if(($res_expl = mysql_fetch_object($res))) {
$lieu_retrait=str_replace("!!location!!",$res_expl->location_libelle,$msg["resa_lettre_lieu_retrait"]);
}
$this->notice_resa .= "\t\t".htmlspecialchars($lieu_retrait,ENT_QUOTES,$charset)."\n";
}
}
} else {
$lieu_retrait=str_replace("!!location!!",$expl_detail->location_libelle,$msg["resa_lettre_lieu_retrait"]);
$this->notice_resa .= "\t\t".htmlspecialchars($lieu_retrait,ENT_QUOTES,$charset)."\n";
}
$this->notice_resa .="\t\n";
} /* fin notice_resa */
/*
* Bloc d'info notice_resa_planning
*/
function notice_resa_planning($id_resa_print) {
global $msg, $dbh, $charset;
$dates_resa_sql = " date_format(resa_date_debut, '".$msg["format_date"]."') as aff_resa_date_debut, date_format(resa_date_fin, '".$msg["format_date"]."') as aff_resa_date_fin " ;
$requete = "SELECT notice_id, resa_date_debut, resa_date_fin, trim(tit1) as tit, ".$dates_resa_sql ;
$requete.= "FROM resa_planning LEFT JOIN notices ON resa_idnotice = notice_id ";
$requete.= "WHERE id_resa='".$id_resa_print."' ";
$res = mysql_query($requete, $dbh) or die (mysql_error()." $requete");
$expl = mysql_fetch_object($res);
$responsabilites = get_notice_authors($expl->notice_id) ;
$as = array_search ("0", $responsabilites["responsabilites"]) ;
if ($as!== FALSE && $as!== NULL) {
$auteur_0 = $responsabilites["auteurs"][$as] ;
$auteur = new auteur($auteur_0["id"]);
$header_aut .= $auteur->isbd_entry;
} else {
$aut1_libelle=array();
$as = array_keys ($responsabilites["responsabilites"], "1" ) ;
for ($i = 0 ; $i < count($as) ; $i++) {
$indice = $as[$i] ;
$auteur_1 = $responsabilites["auteurs"][$indice] ;
$auteur = new auteur($auteur_1["id"]);
$aut1_libelle[]= $auteur->isbd_entry;
}
$header_aut .= implode (", ",$aut1_libelle) ;
}
$header_aut ? $auteur=" / ".$header_aut : $auteur="";
$this->notice_resa_planning .= "\t\n";
$this->notice_resa_planning .= "\t\t".htmlspecialchars($expl->tit,ENT_QUOTES,$charset)."\n";
$this->notice_resa_planning .= "\t\t".htmlspecialchars($auteur,ENT_QUOTES,$charset)."\n";
$this->notice_resa_planning .= "\t\t".htmlspecialchars($expl->aff_resa_date_debut,ENT_QUOTES,$charset)."\n";
$this->notice_resa_planning .= "\t\t".htmlspecialchars($expl->aff_resa_date_fin,ENT_QUOTES,$charset)."\n";
$this->notice_resa_planning .= "\t\n";
}
}