function alert_mail_users_pmb($id_notice = 0, $id_bulletin = 0, $id_empr, $annul = 0) { global $dbh; global $msg, $charset; global $opac_biblio_name, $opac_biblio_email; global $opac_url_base; // paramétrage OPAC: choix du nom de la bibliothèque comme expéditeur $requete = "select location_libelle, email from empr, docs_location where empr_location=idlocation and id_empr='{$id_empr}' "; $res = mysql_query($requete, $dbh); $loc = mysql_fetch_object($res); $PMBusernom = $loc->location_libelle; $PMBuserprenom = ''; $PMBuseremail = $loc->email; if ($PMBuseremail) { $query = "select distinct empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_tel2, empr_ville, location_libelle, nom, prenom, user_email, date_format(sysdate(), '" . $msg["format_date_heure"] . "') as aff_quand from empr, docs_location, users where id_empr='{$id_empr}' and empr_location=idlocation and user_email like('%@%') and user_alert_resamail=1"; $result = @mysql_query($query, $dbh); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $output_final = ''; while ($empr = @mysql_fetch_object($result)) { if (!$output_final) { $output_final = "<html><body>"; if ($annul == 1) { $output_final .= "<a href='" . $opac_url_base . "'><font color=red><strong>" . $msg["mail_obj_resa_canceled"]; $sujet = $msg["mail_obj_resa_canceled"]; } elseif ($annul == 2) { $output_final .= "<a href='" . $opac_url_base . "'><font color=blue><strong>" . $msg["mail_obj_resa_reaffected"]; $sujet = $msg["mail_obj_resa_reaffected"]; } else { $output_final .= "<a href='" . $opac_url_base . "'><font color=green><strong>" . $msg["mail_obj_resa_added"]; $sujet = $msg["mail_obj_resa_added"]; } $output_final .= "</strong></font></a> " . $empr->aff_quand . "\n\t\t\t\t\t\t\t\t\t<br /><strong>" . $empr->empr_prenom . " " . $empr->empr_nom . "</strong>\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t<br /><i>" . $empr->empr_mail . " / " . $empr->empr_tel1 . " / " . $empr->empr_tel2 . "</i>"; if ($empr->empr_cp || $empr->empr_ville) { $output_final .= "<br /><u>" . $empr->empr_cp . " " . $empr->empr_ville . "</u>"; } $output_final .= "<hr />" . $msg[situation] . ": " . $empr->location_libelle . "<hr />"; if ($id_notice) { $current = new notice_affichage($id_notice, array(), 0, 1); $current->do_header(); $current->do_isbd(1, 1); $output_final .= "<h3>" . $current->notice_header . "</h3>"; $output_final .= $current->notice_isbd; $output_final .= $current->affichage_expl; } else { $output_final .= bulletin_affichage_reduit($id_bulletin); $output_final .= notice_affichage::expl_list("m", 0, $id_bulletin); } $output_final .= "<hr /></body></html> "; } $res_envoi = mailpmb($empr->nom . " " . $empr->prenom, $empr->user_email, $sujet . " " . $empr->aff_quand, $output_final, $PMBusernom, $PMBuseremail, $headers, "", "", 1); } } }
function resa_planning($deb = TRUE) { global $dbh, $msg, $charset; global $id_notice, $id_bulletin; global $liens_opac; global $form_resa_dates, $form_resa_ok; global $popup_resa, $opac_max_resa; global $resa_deb, $resa_fin; print "<h3><span>" . $msg['resa_resa_titre_add'] . "</span></h3>"; if ($deb) { // test au cas où tentative de passer une résa hors URL de résa autorisée... $requete_resa = "SELECT count(1) FROM resa_planning WHERE resa_idnotice='{$id_notice}' and resa_idbulletin='{$id_bulletin}'"; $result_resa = pmb_mysql_query($requete_resa, $dbh); if ($result_resa) { $nb_resa_encours = pmb_mysql_result($result_resa, 0, 0); } else { $nb_resa_encours = 0; } if ($opac_max_resa && $nb_resa_encours >= $opac_max_resa) { $id_notice = 0; $id_bulletin = 0; } } if (!$id_notice && !$id_bulletin) { return $msg['resa_planning_unknown_record']; } $tab_loc_retrait = resa_planning::get_available_locations($_SESSION['id_empr_session'], $id_notice, $id_bulletin); if (count($tab_loc_retrait) >= 1) { $form_loc_retrait = '<table ><tbody><tr><th>' . $msg['resa_planning_loc_retrait'] . '</th><th>' . $msg['resa_planning_qty_requested'] . '</th></tr>'; foreach ($tab_loc_retrait as $k => $v) { $form_loc_retrait .= '<tr><td width="50%">' . htmlentities($v['location_libelle'], ENT_QUOTES, $charset) . '</td>'; $form_loc_retrait .= '<td><select name="location[' . $v['location_id'] . ']">'; for ($i = 0; $i < $v['location_nb'] * 1 + 1; $i++) { $form_loc_retrait .= '<option value=' . $i . '>' . $i . '</option>'; } $form_loc_retrait .= '</select></td>'; $form_loc_retrait .= '</tr>'; } $form_loc_retrait .= '</tbody></table>'; } else { return $msg['resa_planning_no_item_available']; } $form_resa_dates = str_replace('!!resa_loc_retrait!!', $form_loc_retrait, $form_resa_dates); print $form_resa_dates; if ($id_notice) { $opac_notices_depliable = 0; $liens_opac = array(); $ouvrage_resa = aff_notice($id_notice, 1); } else { $ouvrage_resa = bulletin_affichage_reduit($id_bulletin, 1); } if (!$deb) { $form_resa_ok = str_replace('!!date_deb!!', formatdate($resa_deb), $form_resa_ok); $form_resa_ok = str_replace('!!date_fin!!', formatdate($resa_fin), $form_resa_ok); print $form_resa_ok; } print $ouvrage_resa; //Affichage des previsions sur le document courant par le lecteur courant $q3 = "SELECT id_resa, resa_idnotice, resa_idbulletin, resa_date_debut, resa_date_fin, "; $q3 .= "if(resa_date_fin < sysdate() or resa_date_fin='0000-00-00',1,0) as resa_perimee, resa_validee, resa_confirmee, "; $q3 .= "resa_qty, resa_loc_retrait, location_libelle "; $q3 .= "FROM resa_planning left join docs_location on resa_loc_retrait=idlocation "; $q3 .= "WHERE id_resa not in (select resa_planning_id_resa from resa where resa_idempr=" . $_SESSION['id_empr_session'] . ") "; $q3 .= "and resa_idempr='" . $_SESSION['id_empr_session'] . "' and resa_idnotice={$id_notice} and resa_idbulletin={$id_bulletin} "; $q3 .= "ORDER by resa_date_debut asc, resa_date_fin asc"; $r3 = @pmb_mysql_query($q3, $dbh); if (pmb_mysql_num_rows($r3)) { $tableau_resa = '<h3>' . $msg['resa_planning_current'] . '</h3>'; $tableau_resa .= '<table class="tab_resa_planning">'; $tableau_resa .= '<tr><th>' . $msg['resa_planning_dates'] . '</th> <th>' . $msg['resa_planning_qty'] . '</th><th>' . $msg['resa_planning_loc_retrait'] . '</th></tr>'; while ($resa = pmb_mysql_fetch_array($r3)) { $id_resa = $resa['id_resa']; $resa_idnotice = $resa['resa_idnotice']; $resa_idbulletin = $resa['resa_idbulletin']; $resa_date_debut = formatdate($resa['resa_date_debut']); $resa_date_fin = formatdate($resa['resa_date_fin']); $resa_qty = $resa['resa_qty']; $resa_loc_retrait = $resa['location_libelle']; $txt_dates = $msg['resa_planning_date_debut'] . $resa_date_debut . '<br />'; $txt_dates .= $msg['resa_planning_date_fin'] . $resa_date_fin . '<br />'; if ($resa['resa_perimee']) { $txt_dates .= $msg['resa_planning_overtime']; } else { $txt_dates .= $msg['resa_planning_attente_validation']; } if ($parity++ % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $tableau_resa .= "<tr class='{$pair_impair}'>\n\t\t\t\t<td>{$txt_dates}</td><td>{$resa_qty}</td>\n\t\t\t\t<td>" . htmlentities($resa_loc_retrait, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t</tr>"; } $tableau_resa .= "</table>"; print $tableau_resa; } }
} else { // test au cas où tentative de passer une résa hors URL de résa autorisée... $requete_resa = "SELECT count(1) FROM resa WHERE resa_idnotice='{$id_notice}' and resa_idbulletin='{$id_bulletin}'"; $nb_resa_encours = pmb_mysql_result(pmb_mysql_query($requete_resa, $dbh), 0, 0); if ($opac_max_resa && $nb_resa_encours >= $opac_max_resa) { $id_notice = 0; $id_bulletin = 0; } if ($id_notice || $id_bulletin) { // c'est une pose de résa if ($id_notice) { $opac_notices_depliable = 0; $liens_opac = array(); $ouvrage_resa = aff_notice($id_notice, 1); } else { $ouvrage_resa = bulletin_affichage_reduit($id_bulletin, 1); } $message_resa = ""; $resa_check = check_statut($id_notice, $id_bulletin); $already = allready_loaned($id_notice, $id_bulletin, $_SESSION["id_empr_session"]); if ($resa_check == 1 && !$already) { // document sélectionné -> création de la réservation $res_resa_OK = check_quota_resa($_SESSION["id_empr_session"], $id_notice, $id_bulletin); if ($res_resa_OK['ERROR']) { $message_resa = $msg["resa_failed"] . " : " . $res_resa_OK['MESSAGE']; } else { $id_resa_ajoutee = 0; $requete2 = "SELECT COUNT(1) FROM resa WHERE resa_idempr=" . $_SESSION["id_empr_session"] . " AND resa_idnotice='" . $id_notice . "' and resa_idbulletin='" . $id_bulletin . "' "; $result2 = @pmb_mysql_query($requete2, $dbh); $nb = pmb_mysql_result($result2, 0, 0); if ($nb) {