id_empr ;
$rqt_maj = "update resa set resa_confirmee=1 where id_resa in (".$id_resa.") AND resa_cb is not null and resa_cb!=''" ;
if ($id_empr_concerne) $rqt_maj .= " and resa_idempr=$id_empr_concerne ";
mysql_query($rqt_maj, $dbh);
if (($pdflettreresa_priorite_email==1 || $pdflettreresa_priorite_email==2) && $empr->empr_mail) {
$to = $empr->empr_prenom." ".$empr->empr_nom." <".$empr->empr_mail.">";
$output_final = "
" ;
$texte_madame_monsieur=str_replace("!!empr_name!!", $empr->empr_nom,$pdflettreresa_madame_monsieur);
$texte_madame_monsieur=str_replace("!!empr_first_name!!", $empr->empr_prenom,$texte_madame_monsieur);
$output_final .= "$texte_madame_monsieur
".$pdflettreresa_before_list ;
if($empr->niveau_biblio == 'm' || $empr->niveau_biblio == 'b'){
$affichage=new mono_display($empr->id_notice,0,'','','','','','','','','','','',true,'','');
$output_final .= "
".$affichage->header."";
} elseif($empr->niveau_biblio == 's' || $empr->niveau_biblio == 'a'){
$affichage_perio=new serial_display($empr->id_notice,0);
$output_final .= "
".$affichage_perio->header."";
}
$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 and resa_cb is not null and resa_cb!='' ";
$res_detail = mysql_query ($rqt_detail) ;
$expl_detail = mysql_fetch_object($res_detail);
$output_final .= "
";
$output_final .= strip_tags($msg[291]." : ".$expl_detail->resa_cb." $msg[296] : ".$expl_detail->expl_cote);
$output_final .= "
";
$output_final .= $msg['fpdf_valide']." ".$empr->aff_resa_date_debut." ".$msg['fpdf_valable']." ".$empr->aff_resa_date_fin ;
$lieu_retrait="";
if($pmb_transferts_actif && $transferts_choix_lieu_opac==3) {
$rqt = "select resa_confirmee, resa_cb,resa_loc_retrait from resa where id_resa in (".$id_resa.") and resa_cb is not null and resa_cb!='' ";
$res = mysql_query ($rqt, $dbh) ;
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, $dbh) ;
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, $dbh) ;
if(($res_expl = mysql_fetch_object($res))) {
$lieu_retrait=str_replace("!!location!!",$res_expl->location_libelle,$msg["resa_lettre_lieu_retrait"]);
}
}
}
} else {
$lieu_retrait=str_replace("!!location!!",$expl_detail->location_libelle,$msg["resa_lettre_lieu_retrait"]);
}
$output_final .= "
$lieu_retrait
$pdflettreresa_after_list
".$pdflettreresa_fdp ;
$output_final .= "
".mail_bloc_adresse() ;
$output_final .= " ";
if(is_resa_confirme($empr->id_resa)) {
$res_envoi=mailpmb($empr->empr_prenom." ".$empr->empr_nom, $empr->empr_mail,$msg["mail_obj_resa_validee"]." : ".$empr->empr_prenom." ".mb_strtoupper($empr->empr_nom,$charset)." (".$empr->empr_cb.")",$output_final,$biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1);
}
if (!$res_envoi || $pdflettreresa_priorite_email==2) {
if(is_resa_confirme($empr->id_resa)) array_push($tab_resa,$empr->id_resa);
}
} elseif ($pdflettreresa_priorite_email!=3) {
if(is_resa_confirme($empr->id_resa)) array_push($tab_resa,$empr->id_resa);
}
if(is_resa_confirme($empr->id_resa) && $empr->empr_tel1 && $empr->empr_sms && $empr_sms_msg_resa_dispo){
$res_envoi_sms=send_sms(1, 0, $empr->empr_tel1,$empr_sms_msg_resa_dispo);
}
} // end while
$valeur_tab = implode(',',$tab_resa);
if($valeur_tab && !$print_mode) print "";
}
//Fonction de test si la resa est valide ou non
function is_resa_confirme($id_resa=0){
global $dbh;
$rqt = "select * from resa where id_resa=$id_resa and resa_cb is not null and resa_cb!='' order by resa_idempr ";
$res = mysql_query ($rqt, $dbh) ;
while ($resa_lue = mysql_fetch_object($res)) {
if ($resa_lue->resa_confirmee) {
// archivage
$rqt_arch = "UPDATE resa_archive, resa, exemplaires SET
resarc_confirmee = 1,
resarc_loc_retrait = resa_loc_retrait,
resarc_cb = resa_cb,
resarc_debut = resa_date_debut,
resarc_fin = resa_date_fin,
resarc_expl_typdoc = expl_typdoc,
resarc_expl_cote = expl_cote,
resarc_expl_statut = expl_statut,
resarc_expl_location = expl_location,
resarc_expl_codestat =expl_codestat,
resarc_expl_owner = expl_owner,
resarc_expl_section = expl_section
WHERE id_resa = $id_resa AND resa_arc = resarc_id AND resa_cb = expl_cb ";
mysql_query($rqt_arch, $dbh);
return true;
}
}
return false;
}