function alert_mail_users_pmb($id_empr) { global $dbh; global $msg, $charset; global $opac_biblio_name, $opac_biblio_email; global $opac_url_base; global $titre, $sujet, $idtheme, $idtype, $date_fin; // 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; // libellé du thème de la demande $requete = "select libelle_theme from demandes_theme where id_theme='" . $idtheme . "'"; $res = mysql_query($requete, $dbh); $theme = mysql_fetch_object($res); $libelle_theme = $theme->libelle_theme; // libellé du type de la demande $requete = "select libelle_type from demandes_type where id_type='" . $idtype . "'"; $res = mysql_query($requete, $dbh); $typ = mysql_fetch_object($res); $libelle_type = $typ->libelle_type; $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_alert_demandesmail=1"; $result = @mysql_query($query, $dbh); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; while ($empr = @mysql_fetch_object($result)) { $output_final = "<html><body>"; $output_final .= "<a href='" . $opac_url_base . "'><font color=green><strong>" . $msg["mail_obj_demande_added"]; $sujet = $msg["mail_obj_demande_added"]; $output_final .= "</strong></font></a> " . $empr->aff_quand . "\n\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<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 />"; $output_final .= $msg["mail_content_demande_theme"] . " " . $libelle_theme . "<br />"; $output_final .= $msg["mail_content_demande_type"] . " " . $libelle_type . "<br />"; $output_final .= $titre . "<br /><br />"; $output_final .= $sujet . "<br /><br />"; $output_final .= $msg["mail_content_demande_date_fin"] . " " . formatdate($date_fin) . "<br />"; $output_final .= "<hr /></body></html> "; $res_envoi = mailpmb($empr->nom . " " . $empr->prenom, $empr->user_email, $sujet . " " . $empr->aff_quand, $output_final, $opac_biblio_email, $opac_biblio_email, $headers, "", "", 1); } }
function electronic_ticket($id_empr, $cb_doc = "") { global $dbh, $msg, $charset; global $PMBusernom; global $PMBuserprenom; global $PMBuseremail, $PMBuseremailbcc; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; // info site global $biblio_name, $biblio_logo, $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_state, $biblio_country, $biblio_phone, $biblio_email, $biblio_website, $biblio_commentaire; global $empr_electronic_loan_ticket_obj, $empr_electronic_loan_ticket_msg; $empr_electronic_loan_ticket_obj = str_replace("!!biblio_name!!", $biblio_name, $empr_electronic_loan_ticket_obj); $empr_electronic_loan_ticket_obj = str_replace("!!date!!", formatdate(today()), $empr_electronic_loan_ticket_obj); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_name!!", $biblio_name, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!date!!", formatdate(today()), $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_website!!", $biblio_website, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_phone!!", $biblio_phone, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_adr1!!", $biblio_adr1, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_adr2!!", $biblio_adr2, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_cp!!", $biblio_cp, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_town!!", $biblio_town, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_email!!", $biblio_email, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!biblio_commentaire!!", $biblio_commentaire, $empr_electronic_loan_ticket_msg); $message_resas = ""; $message_prets = ""; if ($cb_doc == "") { $rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_idexpl=expl_id order by pret_date "; $req = mysql_query($rqt) or die($msg['err_sql'] . '<br />' . $rqt . '<br />' . mysql_error()); $message_prets = $msg["prets_en_cours"]; while ($data = mysql_fetch_array($req)) { $message_prets .= electronic_loan_ticket_expl_info($data['expl_cb']); } // Impression des réservations en cours $rqt = "select resa_idnotice, resa_idbulletin from resa where resa_idempr='" . $id_empr . "' "; $req = mysql_query($rqt) or die($msg['err_sql'] . '<br />' . $rqt . '<br />' . mysql_error()); if (mysql_num_rows($req) > 0) { $message_resas = $msg["documents_reserves"]; while ($data = mysql_fetch_array($req)) { $message_resas .= electronic_loan_ticket_not_bull_info_resa($id_empr, $data['resa_idnotice'], $data['resa_idbulletin']); } } // fin if résas } else { $message_prets = $msg["prets_en_cours"]; $message_prets .= electronic_loan_ticket_expl_info($cb_doc); } $empr_electronic_loan_ticket_msg = str_replace("!!all_reservations!!", $message_resas, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!all_loans!!", $message_prets, $empr_electronic_loan_ticket_msg); $requete = "select id_empr, empr_mail, empr_nom, empr_prenom from empr where id_empr='{$id_empr}' "; $res = mysql_query($requete, $dbh); $empr = mysql_fetch_object($res); //remplacement nom et prenom $empr_electronic_loan_ticket_msg = str_replace("!!empr_name!!", $empr->empr_nom, $empr_electronic_loan_ticket_msg); $empr_electronic_loan_ticket_msg = str_replace("!!empr_first_name!!", $empr->empr_prenom, $empr_electronic_loan_ticket_msg); if ($empr->empr_mail) { // function mailpmb($to_nom="", $to_mail, $obj="", $corps="", $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array()) { $res_envoi = @mailpmb($empr->empr_prenom . " " . $empr->empr_nom, $empr->empr_mail, $empr_electronic_loan_ticket_obj, $empr_electronic_loan_ticket_msg, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, "", $PMBuseremailbcc, 1, ""); } }
function checkTasks() { global $dbh, $base_path, $include_path, $class_path, $javascript_path, $lang; global $charset; global $PMBusernom, $PMBuserprenom, $PMBuseremail; //Récupération de l'OS pour la vérification des processus $os = $this->getOS(); $sql = "SELECT id_tache, start_at, id_process FROM taches WHERE id_process <> 0"; $res = pmb_mysql_query($sql, $dbh); if ($res && pmb_mysql_num_rows($res)) { while ($row = pmb_mysql_fetch_assoc($res)) { if ($os == "Linux") { $command = 'ps -p ' . $row['id_process']; } else { if ($os == "Windows") { $command = 'tasklist /FI "PID eq ' . $row['id_process'] . '" '; } else { if ($os == "Mac") { $command = 'ps -p ' . $row['id_process']; } else { $command = 'ps -p ' . $row['id_process']; } } } $output = array(); exec($command, $output); if (!isset($output[1])) { // 5 = STOPPED $sql_stop_task = "update taches set status=5, "; if ($row['start_at'] == '0000-00-00 00:00:00') { $sql_stop_task .= "start_at=CURRENT_TIMESTAMP, "; } $sql_stop_task .= "end_at=CURRENT_TIMESTAMP, id_process=0, commande=0 where id_tache=" . $row["id_tache"]; pmb_mysql_query($sql_stop_task); //En fonction du paramétrage de la tâche... //Replanifier / Envoi de mail $query = "select num_type_tache, libelle_tache, param, num_planificateur, indicat_progress from planificateur join taches on id_planificateur=num_planificateur where id_tache=" . $row["id_tache"]; $result = pmb_mysql_query($query); if ($result && pmb_mysql_num_rows($result)) { $task_info = pmb_mysql_fetch_object($result); $params = unserialize($task_info->param); if ($params["alert_mail_on_failure"] != "") { $params_alert_mail = explode(",", $params["alert_mail_on_failure"]); if ($params_alert_mail[0]) { $mails = explode(";", $params_alert_mail[1]); if (preg_match("#.*@.*#", $PMBuseremail)) { if (count($mails)) { //Allons chercher les messages if (file_exists("{$include_path}/messages/" . $lang . ".xml")) { //Allons chercher les messages require_once "{$class_path}/XMLlist.class.php"; $messages = new XMLlist("{$include_path}/messages/" . $lang . ".xml", 0); $messages->analyser(); $msg = $messages->table; $objet = $msg["task_alert_user_mail_obj"]; $corps = str_replace("!!task_name!!", $task_info->libelle_tache, $msg["task_alert_user_mail_corps"]); $corps = str_replace("!!percent!!", $task_info->indicat_progress, $corps); foreach ($mails as $mail) { if (preg_match("#.*@.*#", $mail)) { @mailpmb("", $mail, $objet, $corps, $PMBusernom . " " . $PMBuserprenom, $PMBuseremail, "Content-Type: text/plain; charset=\"{$charset}\"", '', '', 0, ''); } } } } } } } if ($params["restart_on_failure"]) { $this->createNewTask($row["id_tache"], $task_info->num_type_tache, $task_info->num_planificateur); } } } } } }
function diffuser() { global $dbh; global $msg, $charset, $base_path, $opac_connexion_phrase, $pmb_mail_delay; global $PMBusernom; global $PMBuserprenom; global $PMBuseremail; if (!$this->id_bannette) { return $msg['dsi_ban_no_access'] . "<br />"; } // impossible d'accéder à cette bannette if (!$this->nb_notices && $this->diffusion_email) { return $msg['dsi_ban_empty'] . "<br />"; } // On demande à diffuser le contenu et la bannette vide : pas question d'envoyer du vide mysql_set_wait_timeout(3600); $this->construit_diff(); $texte_base = $this->texte_diffuse; if ($this->export_contenu) { $fic_params = $base_path . "/admin/convert/imports/" . $this->typeexport . "/params.xml"; $temppar = file_get_contents($fic_params); $params = _parser_text_no_function_($temppar, "PARAMS"); if ($params["OUTPUT"][0]["SUFFIX"]) { $ext = $params["OUTPUT"][0]["SUFFIX"]; } else { $ext = "fic"; } $pieces_jointes[0]["nomfichier"] = $this->prefixe_fichier . today() . "." . $ext; $pieces_jointes[0]["contenu"] = $this->export_contenu; } $nb_dest = 0; $nb_echec = 0; $nb_no_email = 0; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $requete = "select id_empr, empr_cb, empr_mail, empr_nom, empr_prenom, empr_login, empr_password, if(empr_sexe=2,'" . $msg["civilite_madame"] . "',"; $requete .= "if(empr_sexe=1,'" . $msg["civilite_monsieur"] . "','" . $msg["civilite_unknown"] . "')) as empr_sexe, empr_adr1, empr_adr2, empr_cp, empr_ville,"; $requete .= "empr_pays, empr_tel1, empr_tel2, 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,"; $requete .= "statut_libelle, allow_dsi, allow_dsi_priv, proprio_bannette, bannette_mail from empr, empr_statut, bannette_abon, bannettes "; $requete .= "where num_bannette='" . $this->id_bannette . "' and num_empr=id_empr and empr_statut=idstatut and num_bannette=id_bannette "; $requete .= "order by empr_nom, empr_prenom "; $res = pmb_mysql_query($requete, $dbh); while ($empr = pmb_mysql_fetch_object($res)) { $emaildest = $empr->empr_mail; if ($empr->bannette_mail && $emaildest) { $destinataires = explode(";", $emaildest); $found = 0; foreach ($destinataires as $mail) { if ($mail == $empr->bannette_mail) { $found = 1; break; } } if ($found) { $emaildest = $empr->bannette_mail; } } $texte = $texte_base; if ($emaildest) { if (!$empr->allow_dsi && !$empr->proprio_bannette || !$empr->allow_dsi_priv && $empr->proprio_bannette) { //si la dsi n'est pas autorisée pour ce lecteur, affichage de l'info mais pas d'envoi $nb_echec++; $echec_email .= "- " . $empr->empr_nom . " " . $empr->empr_prenom . " (" . $msg["statut_empr"] . "' " . $empr->statut_libelle . "')<br />"; } else { //function mailpmb($to_nom="", $to_mail, $obj="", $corps="", $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array()) { $dates = time(); $login = $empr->empr_login; $code = md5($opac_connexion_phrase . $login . $dates); $texte = str_replace('!!code!!', $code, $texte); $texte = str_replace('!!login!!', $login, $texte); $texte = str_replace('!!empr_login!!', $login, $texte); $texte = str_replace('!!date_conex!!', $dates, $texte); $texte = str_replace('!!empr_name!!', $empr->empr_nom, $texte); $texte = str_replace('!!empr_first_name!!', $empr->empr_prenom, $texte); $texte = str_replace('!!empr_sexe!!', $empr->empr_sexe, $texte); $texte = str_replace('!!empr_cb!!', $empr->empr_cb, $texte); $texte = str_replace('!!empr_mail!!', $empr->empr_mail, $texte); if (strpos($texte, "!!empr_name_and_adress!!")) { $texte = str_replace("!!empr_name_and_adress!!", nl2br($this->m_lecteur_adresse($empr)), $texte); } if (strpos($texte, "!!empr_all_information!!")) { $texte = str_replace("!!empr_all_information!!", nl2br($this->m_lecteur_info($empr)), $texte); } $res_envoi = @mailpmb($empr->empr_prenom . " " . $empr->empr_nom, $emaildest, $this->comment_public, $texte, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, "", "", 0, $pieces_jointes); if ($pmb_mail_delay * 1) { sleep((int) $pmb_mail_delay * 1 / 1000); } if ($res_envoi) { $nb_dest++; } else { $nb_echec++; $echec_email .= "- " . $empr->empr_nom . " " . $empr->empr_prenom . "<br />"; } } } else { $nb_no_email++; $no_email .= "- " . $empr->empr_nom . " " . $empr->empr_prenom . "<br />"; } } // remplissage du panier avec le contenu de la bannette if ($this->num_panier) { $temp_requete = "delete from caddie_content where caddie_id='" . $this->num_panier . "'"; pmb_mysql_query($temp_requete, $dbh); $temp_requete = "insert into caddie_content (caddie_id, object_id) (select " . $this->num_panier . ", num_notice from bannette_contenu where num_bannette=" . $this->id_bannette . ")"; pmb_mysql_query($temp_requete, $dbh) or die(pmb_mysql_error() . $temp_requete); } /* A commenter pour tests */ $temp_requete = "update bannettes set date_last_envoi=sysdate() where id_bannette='" . $this->id_bannette . "' "; $res = pmb_mysql_query($temp_requete, $dbh); $res_envoi = $msg["dsi_dif_res_dif"] . "<ul><li>" . $msg["dsi_dif_res_dif_mail_ok"] . ": {$nb_dest} </li>"; if ($nb_echec) { $res_envoi .= "<li>" . $msg["dsi_dif_res_dif_mail_echec"] . ": {$nb_echec} <blockquote>{$echec_email}</blockquote></li>"; } if ($nb_no_email) { $res_envoi .= "<li>" . $msg["dsi_dif_res_dif_no_mail"] . ": {$nb_no_email} <blockquote>{$no_email}</blockquote></li>"; } $res_envoi .= "</ul>"; if ($nb_echec || $nb_no_email) { $res_envoi .= "<script>openPopUp('./print_dsi.php?id_bannette={$this->id_bannette}', 'Impression de DSI', 500, 400, -2, -2, 'toolbar=no, infobar=no, resizable=yes, scrollbars=yes')</script>"; } return $res_envoi; }
function alert_empr_resa($id_resa = 0, $id_empr_concerne = 0, $print_mode = 0) { global $dbh; global $msg, $charset; global $PMBuserid, $PMBuseremailbcc; global $pdflettreresa_priorite_email; global $pdflettreresa_before_list, $pdflettreresa_madame_monsieur, $pdflettreresa_after_list, $pdflettreresa_fdp; global $biblio_name, $biblio_email; global $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_phone; global $bouton_impr_conf, $pdflettreresa_priorite_email_manuel; global $pmb_transferts_actif, $transferts_choix_lieu_opac; global $empr_sms_activation; global $empr_sms_msg_resa_dispo; global $use_opac_url_base; $use_opac_url_base = 1; // si c'est une impression à partir du bouton, on prend le paramètre ad hoc if ($bouton_impr_conf) { $pdflettreresa_priorite_email = $pdflettreresa_priorite_email_manuel; } if ($pdflettreresa_priorite_email == 3) { return; } $query = "select distinct "; $query .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, "; $query .= "date_format(resa_date_fin, '" . $msg["format_date"] . "') as aff_resa_date_fin, "; $query .= "date_format(resa_date_debut, '" . $msg["format_date"] . "') as aff_resa_date_debut, "; $query .= "empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_sms, id_resa, "; $query .= "trim(concat(ifnull(notices_m.niveau_biblio,''), ifnull(notices_s.niveau_biblio,''))) as niveau_biblio, "; $query .= "trim(concat(ifnull(notices_m.notice_id,''), ifnull(notices_s.notice_id,''))) as id_notice "; $query .= "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), empr "; $query .= "where id_resa in (" . $id_resa . ") and resa_idempr=id_empr"; if ($id_empr_concerne) { $query .= " and id_empr={$id_empr_concerne} "; } $result = mysql_query($query, $dbh); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $var = "pdflettreresa_fdp"; eval("\$pdflettreresa_fdp=\"" . ${$var} . "\";"); // le texte après la liste des ouvrages en résa $var = "pdflettreresa_after_list"; eval("\$pdflettreresa_after_list=\"" . ${$var} . "\";"); // le texte avant la liste des ouvrges en réservation $var = "pdflettreresa_before_list"; eval("\$pdflettreresa_before_list=\"" . ${$var} . "\";"); // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent," $var = "pdflettreresa_madame_monsieur"; eval("\$pdflettreresa_madame_monsieur=\"" . ${$var} . "\";"); $tab_resa = array(); while ($empr = mysql_fetch_object($result)) { $id_empr = $empr->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 = "<html><body>"; $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} <br />" . $pdflettreresa_before_list; if ($empr->niveau_biblio == 'm' || $empr->niveau_biblio == 'b') { $affichage = new mono_display($empr->id_notice, 0, '', '', '', '', '', '', '', '', '', '', '', true, '', ''); $output_final .= "<hr /><strong>" . $affichage->header . "</strong>"; } elseif ($empr->niveau_biblio == 's' || $empr->niveau_biblio == 'a') { $affichage_perio = new serial_display($empr->id_notice, 0); $output_final .= "<hr /><strong>" . $affichage_perio->header . "</strong>"; } $rqt_detail = "select resa_confirmee, resa_cb,location_libelle, expl_cote from resa\n\t\t\tleft join exemplaires on expl_cb=resa_cb\n\t\t\tleft join docs_location on idlocation=expl_location\n\t\t\twhere 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 .= "<br />"; $output_final .= strip_tags($msg[291] . " : " . $expl_detail->resa_cb . " {$msg['296']} : " . $expl_detail->expl_cote); $output_final .= "<br />"; $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 .= "<br />{$lieu_retrait}<br /><hr />{$pdflettreresa_after_list} <br />" . $pdflettreresa_fdp; $output_final .= "<br /><br />" . mail_bloc_adresse(); $output_final .= "</body></html> "; 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 "<script type='text/javascript'>openPopUp('./pdf.php?pdfdoc=lettre_resa&id_resa={$valeur_tab}', 'lettre_confirm_resa" . $id_resa . "', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');</script>"; } }
} if ($charset != 'utf-8') { $output_final = cp1252Toiso88591($output_final); } switch ($environement['output']) { case 'email': $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $f_objet_mail = $msg['print_emailobj'] . " - {$biblio_name} - {$date_today} "; $f_message_to_send = ""; if ($environement["emailcontent"]) { $f_message_to_send .= $msg["523"] . $environement["emailcontent"] . "<br />"; } $f_message_to_send .= $output_final . '<br /><br />' . mail_bloc_adresse() . "</body></html> "; $emaildest = $_SESSION["PRINT"]["emaildest"]; $res_envoi = mailpmb("", $emaildest, $f_objet_mail, $f_message_to_send, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, "", $PMBuseremailbcc); if ($res_envoi) { print "{$pheader}\n<br /><br /><center><h3>" . sprintf($msg["print_emailsucceed"], $emaildest) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["print_emailclose"] . "</a></center></body></html>"; } else { print "{$pheader}\n<br /><br /><center><h3>" . sprintf($msg["print_emailfailed"], $emaildest) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["print_emailclose"] . "</a></center></body></html>"; } break; case 'printer': $output_final .= '<script type="text/javascript">self.print();</script>'; $output_final .= '</body></html>'; print pmb_bidi($output_final); break; case 'tt': $output_final .= '</body></html>'; print pmb_bidi($output_final); break;
$res_envoi = mailpmb($coords->prenom . " " . $coords->nom, $coords->mail, $objet, $texte_mail, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1); if ($res_envoi) { echo "<center><h3>" . sprintf($msg["mail_retard_succeed"], $coords->mail) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["mail_retard_close"] . "</a></center><br /><br />" . nl2br($texte_relance); } else { echo "<center><h3>" . sprintf($msg["mail_retard_failed"], $coords->mail) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["mail_retard_close"] . "</a></center>"; } } mysql_free_result($res); } else { // mettre ici le texte $coords = new emprunteur($id_empr, '', FALSE, 0); if ($madame_monsieur) { $texte_mail = $madame_monsieur . "\r\n\r\n"; } $texte = str_replace("!!date_fin_adhesion!!", $coords->aff_date_expiration, $texte); $texte_mail .= $texte . "\r\n"; if ($fdp) { $texte_mail .= $fdp . "\r\n\r\n"; } $texte_mail .= mail_bloc_adresse(); //remplacement nom et prenom $texte_mail = str_replace("!!empr_name!!", $coords->nom, $texte_mail); $texte_mail = str_replace("!!empr_first_name!!", $coords->prenom, $texte_mail); $headers .= "Content-type: text/plain; charset=" . $charset . "\n"; $res_envoi = mailpmb($coords->prenom . " " . $coords->nom, $coords->mail, $objet, $texte_mail, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1); if ($res_envoi) { echo "<center><h3>" . sprintf($msg["mail_retard_succeed"], $coords->mail) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["mail_retard_close"] . "</a></center><br /><br />" . nl2br($texte); } else { echo "<center><h3>" . sprintf($msg["mail_retard_failed"], $coords->mail) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["mail_retard_close"] . "</a></center>"; } }
function diffuser($texte = "") { global $dbh; global $msg, $charset, $base_path; global $PMBusernom, $opac_biblio_email, $opac_biblio_name; global $PMBuserprenom; global $PMBuseremail; global $id_empr; // 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 = pmb_mysql_query($requete, $dbh); $loc = pmb_mysql_fetch_object($res); $PMBusernom = $loc->location_libelle; $PMBuserprenom = ""; $PMBuseremail = $loc->email; $this->construit_diff($texte); $texte_base = $this->texte_diffuse; $res_envoi = false; if ($this->nb_notices > 0) { if ($this->export_contenu) { $fic_params = $base_path . "/admin/convert/imports/" . $this->typeexport . "/params.xml"; $temppar = file_get_contents($fic_params); $params = _parser_text_no_function_($temppar, "PARAMS"); if ($params["OUTPUT"][0]["SUFFIX"]) { $ext = $params["OUTPUT"][0]["SUFFIX"]; } else { $ext = "fic"; } $pieces_jointes[0][nomfichier] = $this->prefixe_fichier . today() . "." . $ext; $pieces_jointes[0][contenu] = $this->export_contenu; } $nb_dest = 0; $nb_echec = 0; $nb_no_email = 0; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $requete = "select id_empr, empr_mail, empr_nom, empr_prenom, empr_login, empr_password from empr, bannette_abon "; $requete .= "where num_bannette='" . $this->id_bannette . "' and empr_date_expiration>=sysdate() and num_empr=id_empr "; $requete .= "order by empr_nom, empr_prenom "; $res = pmb_mysql_query($requete, $dbh); while ($empr = pmb_mysql_fetch_object($res)) { $emaildest = $empr->empr_mail; $texte = $texte_base; if ($emaildest) { // $res_envoi=@mail("$emaildest",$this->comment_public,$texte." ","From: ".$PMBuserprenom." ".$PMBusernom." <".$PMBuseremail.">\r\n".$headers); $res_envoi = @mailpmb($empr->empr_prenom . " " . $empr->empr_nom, $emaildest, $this->comment_public, $texte, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, "", "", 0, $pieces_jointes); } } /* A commenter pour tests */ $temp_requete = "update bannettes set date_last_envoi=sysdate() where id_bannette='" . $this->id_bannette . "' "; $res = pmb_mysql_query($temp_requete, $dbh); } return $res_envoi; }
/** * * Envoi de mail auto * @param $type_send READER=1,GROUP=2 * @param $ident */ function sendMailLoansRunning($type_send, $ident, $location_biblio) { global $dbh, $msg, $pmb_lecteurs_localises; global $mailretard_1fdp, $biblio_name, $biblio_email, $PMBuseremailbcc; $this->infos_biblio($location_biblio); if (!$relance) { $relance = 1; } // l'objet du mail $objet = $msg["prets_en_cours"]; //Date de l'édition $date_edition = $msg['fpdf_edite'] . " " . formatdate(date("Y-m-d", time())); // la formule de politesse du bas (le signataire) $formule = $mailretard_1fdp; $texte_mail = $objet . "\r\n"; $texte_mail .= $date_edition . "\r\n\r\n"; // if ($id_groupe) { // //requete par rapport à un groupe d'emprunteurs // $rqt1 = "select id_empr, empr_nom, empr_prenom from empr_groupe, empr, pret where groupe_id='".$id_groupe."' and empr_groupe.empr_id=empr.id_empr and pret.pret_idempr=empr_groupe.empr_id group by empr_id order by empr_nom, empr_prenom"; // $req1 = pmb_mysql_query($rqt1) or die($msg['err_sql'].'<br />'.$rqt1.'<br />'.pmb_mysql_error()); // } // // if ($id_empr) { // //requete par rapport à un emprunteur // $rqt1 = "select id_empr, empr_nom, empr_prenom from empr_groupe, empr, pret where id_empr='".$id_empr."' and empr_groupe.empr_id=empr.id_empr and pret.pret_idempr=empr_groupe.empr_id group by empr_id order by empr_nom, empr_prenom"; // $req1 = pmb_mysql_query($rqt1) or die($msg['err_sql'].'<br />'.$rqt1.'<br />'.pmb_mysql_error()); // } if ($ident) { if ($type_send == 1) { //requete par rapport à un emprunteur $rqt1 = "select id_empr, empr_nom, empr_prenom from empr_groupe, empr, pret where id_empr='" . $ident . "' and empr_groupe.empr_id=empr.id_empr and pret.pret_idempr=empr_groupe.empr_id group by empr_id order by empr_nom, empr_prenom"; $req1 = pmb_mysql_query($rqt1); } else { if ($type_send == 2) { //requete par rapport à un groupe d'emprunteurs $rqt1 = "select id_empr, empr_nom, empr_prenom from empr_groupe, empr, pret where groupe_id='" . $ident . "' and empr_groupe.empr_id=empr.id_empr and pret.pret_idempr=empr_groupe.empr_id group by empr_id order by empr_nom, empr_prenom"; $req1 = pmb_mysql_query($rqt1); } } } while ($data1 = pmb_mysql_fetch_array($req1)) { $id_empr = $data1['id_empr']; $texte_mail .= $data1['empr_nom'] . " " . $data1['empr_prenom'] . "\r\n\r\n"; //Récupération des exemplaires $rqt = "select expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_idexpl=expl_id order by pret_date "; $req = pmb_mysql_query($rqt); $i = 0; while ($data = pmb_mysql_fetch_array($req)) { /* Récupération des infos exemplaires et prêt */ $requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, expl_cb, 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, "; $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, "; $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, "; $requete .= " IF(pret_retour>sysdate(),0,1) as retard, 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='" . $data['expl_cb'] . "' and expl_typdoc = idtyp_doc and expl_section = idsection and expl_location = idlocation and pret_idexpl = expl_id "; $res = pmb_mysql_query($requete, $dbh); $expl = pmb_mysql_fetch_object($res); $responsabilites = array(); $header_aut = ""; $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 = ""); // 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; } $texte_mail .= $expl->tit . $auteur . "\r\n"; $texte_mail .= " -" . $msg[fpdf_date_pret] . " : " . $expl->aff_pret_date . " " . $msg[fpdf_retour_prevu] . " : " . $expl->aff_pret_retour . "\r\n"; $texte_mail .= " -" . $expl->location_libelle . ": " . $expl->section_libelle . " (" . $expl->expl_cb . ")\r\n\r\n"; $i++; } } $texte_mail .= $formule . "\r\n\r\n" . mail_bloc_adresse(); /* Récupération du nom, prénom et mail de l'utilisateur */ $requete = "select id_empr, empr_mail, empr_nom, empr_prenom from empr where id_empr={$id_empr}"; $res = pmb_mysql_query($requete); $coords = pmb_mysql_fetch_object($res); $headers .= "Content-type: text/plain; charset=" . $charset . "\n"; $res_envoi = mailpmb($coords->empr_prenom . " " . $coords->empr_nom, $coords->empr_mail, $objet, $texte_mail, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1); if ($res_envoi) { return sprintf($msg["mail_retard_succeed"], $coords->empr_mail); } else { return sprintf($msg["mail_retard_failed"], $coords->empr_mail); } }
function send_alert($expl_id) { global $serialcirc_send_alert_mail; global $biblio_name, $biblio_email, $PMBuseremailbcc; $req = " delete from serialcirc_circ where num_serialcirc_circ_expl=" . $expl_id; mysql_query($req); foreach ($this->info_expl[$expl_id]['serialcirc_diff']->diffusion as $diff_id => $diffusion) { $diff_list[] = $diff_id; if ($diffusion["empr_type"] == SERIALCIRC_EMPR_TYPE_group) { foreach ($diffusion['group'] as $empr_group) { $empr_list[$empr_group["num_empr"]] = $diff_id; } } else { $empr_list[$diffusion["num_empr"]] = $diff_id; } } $req = "UPDATE serialcirc_expl SET \n\t\tserialcirc_expl_state_circ=0,\n\t\tserialcirc_expl_start_date=CURDATE()\n\t\twhere num_serialcirc_expl_id= {$expl_id}"; mysql_query($req); $order = 0; foreach ($empr_list as $empr_id => $diff_id) { $req = " insert into serialcirc_circ SET \n\t\t\tnum_serialcirc_circ_diff=" . $diff_id . ",\n\t\t\tnum_serialcirc_circ_expl=" . $expl_id . ",\n\t\t\tnum_serialcirc_circ_empr=" . $empr_id . ",\n\t\t\tserialcirc_circ_subscription=0,\n\t\t\tserialcirc_circ_order=" . $order . ",\n\t\t\tnum_serialcirc_circ_serialcirc=" . $this->info_expl[$expl_id]['num_serialcirc']; mysql_query($req); $order++; // envoit mail alert $texte_mail = $serialcirc_send_alert_mail; $expl_info = $this->expl_info($expl_id); $empr_info = $this->empr_info($empr_id); $texte_mail = str_replace("!!issue!!", $expl_info['perio'] . "-" . $expl_info['numero'], $texte_mail); mailpmb($empr_info["prenom"] . " " . $empr_info["nom"], $empr_info["mail"], $objet, $texte_mail, $biblio_name, $biblio_email, "", "", $PMBuseremailbcc, 1); } }
function generateMailReadersSubscription($id_empr, $empr_location_id) { global $mailrelanceadhesion_objet, $mailrelanceadhesion_fdp, $mailrelanceadhesion_madame_monsieur, $mailrelanceadhesion_texte; $this->infos_biblio($empr_location_id); // l'objet du mail $var = "mailrelanceadhesion_objet"; eval("\$objet=\"" . ${$var} . "\";"); // la formule de politesse du bas (le signataire) $var = "mailrelanceadhesion_fdp"; eval("\$fdp=\"" . ${$var} . "\";"); // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent," $var = "mailrelanceadhesion_madame_monsieur"; eval("\$madame_monsieur=\"" . ${$var} . "\";"); // le texte $var = "mailrelanceadhesion_texte"; eval("\$texte=\"" . ${$var} . "\";"); // mettre ici le texte $coords = new emprunteur($id_empr, '', FALSE, 0); if ($madame_monsieur) { $texte_mail = $madame_monsieur . "\r\n\r\n"; } $texte_mail .= $texte . "\r\n"; if ($fdp) { $texte_mail .= $fdp . "\r\n\r\n"; } $texte_mail .= mail_bloc_adresse(); $texte_mail = str_replace("!!date_fin_adhesion!!", $coords->aff_empr_date_expiration, $texte_mail); //remplacement nom et prenom $texte_mail = str_replace("!!empr_name!!", $coords->nom, $texte_mail); $texte_mail = str_replace("!!empr_first_name!!", $coords->prenom, $texte_mail); $headers .= "Content-type: text/plain; charset=" . $charset . "\n"; $res_envoi = mailpmb($coords->prenom . " " . $coords->nom, $coords->mail, $objet, $texte_mail, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1); return $res_envoi; }
function send_alert_by_mail($idsender, $idparent = 0) { global $msg, $PMBusernom, $PMBuserprenom, $PMBuseremail, $dbh; if ($idparent) { $nots = new demandes_notes($idparent); $titre = strlen($nots->contenu) < 30 ? substr($nots->contenu, 0, 30) : substr($nots->contenu, 0, 30) . "..."; $objet = sprintf($msg['demandes_note_mail_reponse_object'], $titre); $contenu = $PMBuserprenom . " " . $PMBusernom . " " . sprintf($msg['demandes_note_mail_reponse'], $titre, $nots->libelle_action, $nots->libelle_demande); } else { $contenu = $PMBuserprenom . " " . $PMBusernom . " " . sprintf($msg['demandes_note_mail_new'], $this->libelle_action, $this->libelle_demande); $objet = $msg['demandes_note_mail_new_object']; } $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1"; //Envoi du mail aux autres documentalistes concernés par la demande $req = "select user_email, concat(prenom,' ',nom) as nom from users\n\t\t\tjoin demandes_users on num_user=userid\n\t\t\twhere num_demande='" . $this->num_demande . "' and num_user !='" . $idsender . "'"; $res = mysql_query($req, $dbh); while ($user = mysql_fetch_object($res)) { if ($user->user_email) { $envoi_OK = mailpmb($user->nom, $user->user_email, $objet, $contenu, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, ""); } } //Envoi du mail au demandeur $req = "select concat(empr_nom,' ',empr_prenom) as nom, empr_mail\n\t\t\tfrom empr\n\t\t\tjoin demandes on id_empr=num_demandeur\n\t\t\twhere id_demande='" . $this->num_demande . "'"; $res = mysql_query($req, $dbh); $empr = mysql_fetch_object($res); if ($empr->empr_mail) { $envoi_OK = mailpmb($empr->nom, $empr->empr_mail, $objet, $contenu, $PMBuserprenom . " " . $PMBusernom, $PMBuseremail, $headers, ""); } }
function sendMail($sug) { global $dbh, $msg, $charset; global $biblio_name, $biblio_email, $biblio_phone; global $acquisition_mel_rej_obj, $acquisition_mel_rej_cor; global $acquisition_mel_con_obj, $acquisition_mel_con_cor; global $acquisition_mel_aba_obj, $acquisition_mel_aba_cor; global $acquisition_mel_cde_obj, $acquisition_mel_cde_cor; global $acquisition_mel_rec_obj, $acquisition_mel_rec_cor; $mask = $this->getMask_FILED(); if (($sug->statut & $mask) == 0) { $state = $sug->statut; } else { $state = $mask; } $state_name = $this->id_to_name[$state]; switch ($state_name) { case 'REJECTED': //Rejet $objet = $acquisition_mel_rej_obj; $corps = $acquisition_mel_rej_cor; break; case 'CONFIRMED': //Confirmation $objet = $acquisition_mel_con_obj; $corps = $acquisition_mel_con_cor; break; case 'GIVENUP': //Abandon $objet = $acquisition_mel_aba_obj; $corps = $acquisition_mel_aba_cor; break; case 'ORDERED': //Commande $objet = $acquisition_mel_cde_obj; $corps = $acquisition_mel_cde_cor; break; case 'RECEIVED': //Réception $objet = $acquisition_mel_rec_obj; $corps = $acquisition_mel_rec_cor; break; default: return; break; } $corps .= "\n\n " . $msg['acquisition_sug_tit'] . " :\t " . $sug->titre . "\n"; if ($sug->auteur) { $corps .= $msg['acquisition_sug_aut'] . " :\t " . $sug->auteur . "\n"; } if ($sug->editeur) { $corps .= $msg['acquisition_sug_edi'] . " :\t " . $sug->editeur . "\n"; } if ($sug->code) { $corps .= $msg['acquisition_sug_cod'] . " :\t " . $sug->code . "\n"; } if ($sug->prix) { $corps .= $msg['acquisition_sug_pri'] . " :\t " . $sug->prix . "\n"; } if ($sug->commentaires) { $corps .= $msg['acquisition_sug_com'] . " :\t " . $sug->commentaires . "\n"; } $corps .= "\n\n"; $corps = str_replace('!!date!!', formatdate($sug->date_creation), $corps); $q = suggestions_origine::listOccurences($sug->id_suggestion); $list_orig = mysql_query($q, $dbh); while ($row = mysql_fetch_object($list_orig)) { switch ($row->type_origine) { default: case '0': $q = "SELECT nom, prenom, user_email FROM users where userid = '" . $row->origine . "' limit 1 "; $r = mysql_fetch_object(mysql_query($q, $dbh)); $tonom = $r->prenom . " " . $r->nom; $tomail = $r->user_email; break; case '1': $q = "SELECT empr_nom, empr_prenom, empr_mail FROM empr where id_empr = '" . $row->origine . "' limit 1 "; $r = mysql_fetch_object(mysql_query($q, $dbh)); $tonom = $r->empr_prenom . " " . $r->empr_nom; $tomail = $r->empr_mail; break; case '2': $tonom = $row->origine; $tomail = $row->origine; break; } if ($tomail != '') { $res_envoi = mailpmb($tonom, $tomail, $objet, $corps, $biblio_name, $biblio_email, "Content-Type: text/plain; charset=\"{$charset}\"\n", "", ""); } } }
// Bonjour,<br /><br />Pour faire suite à votre demande de réinitialisation de mot de passe à <b>!!biblioname!!</b>, veuillez trouver ci-dessous le lien qui vous permettra d'effectuer ce changement : <br /><br />!!lien_mdp!!<br /><br /> - Pour rappel, votre identifiant est : !!login!!<br /><br />Si vous rencontrez des difficultés, adressez un mail à !!biblioemail!!.<br /><br /> $messagemail = $msg[mdp_mail_body]; $messagemail = str_replace("!!login!!", $row->empr_login, $messagemail); $messagemail = str_replace("!!biblioname!!", "<a href=\"{$opac_url_base}\">" . $biblio_name_temp . "</a>", $messagemail); $lien_mdp = "<a href='" . $opac_url_base . "empr.php?lvl=change_password&emprlogin="******"&password_key=" . $password_key . "'>" . $opac_url_base . "empr.php?lvl=change_password&emprlogin="******"&password_key=" . $password_key . "</a>"; $messagemail = str_replace("!!lien_mdp!!", $lien_mdp, $messagemail); $messagemail = str_replace("!!biblioemail!!", "<a href=mailto:{$opac_biblio_email}>{$biblio_email_temp}</a>", $messagemail); $objetemail = str_replace("!!biblioname!!", $biblio_name_temp, $msg[mdp_mail_obj]); print "<hr />"; if ($opac_parse_html) { $objetemail = parseHTML($objetemail); $messagemail = parseHTML($messagemail); $biblio_name_temp = parseHTML($biblio_name_temp); $biblio_email_temp = parseHTML($biblio_email_temp); } $res_envoi = @mailpmb(trim($row->nom_prenom), $emails_empr[$i], $objetemail, $messagemail, $biblio_name_temp, $biblio_email_temp, $headers); if (!$res_envoi) { print "<p class='texte'>Could not send information to {$emails_empr[$i]}.</p><br />"; } else { print "<p class='texte'>" . $msg[mdp_sent_ok] . " {$emails_empr[$i]}.</p><br />"; } } } } if (!$res_envoi) { print "<hr /><p class='texte'>" . str_replace("!!biblioemail!!", "<a href=mailto:{$opac_biblio_email}>{$opac_biblio_email}</a>", $msg[mdp_no_email]) . "</p>"; print $demandeemail; } } else { print "<hr /><p class='texte'>" . str_replace("!!biblioemail!!", "<a href=mailto:{$opac_biblio_email}>{$opac_biblio_email}</a>", $msg[mdp_no_email]) . "</p>"; print $demandeemail;
function delete_empr($id_liste, $id_empr) { global $dbh, $msg, $opac_url_base, $opac_connexion_phrase, $empr_nom, $empr_prenom, $empr_mail; //envoi du mail de désinscription $req = "select empr_login, empr_mail, concat(empr_prenom,' ',empr_nom) as nom, nom_liste \n\tfrom abo_liste_lecture abo, opac_liste_lecture, empr \n\twhere abo.num_empr=id_empr and id_liste=num_liste\n\tand num_liste='" . $id_liste . "' and abo.num_empr='" . $id_empr . "'"; $res = pmb_mysql_query($req, $dbh); $inscrit = pmb_mysql_fetch_object($res); $objet = sprintf($msg['list_lecture_objet_unsubscribe_mail'], $inscrit->nom_liste); $date = time(); $login = $inscrit->empr_login; $code = md5($opac_connexion_phrase . $login . $date); $corps = sprintf($msg['list_lecture_intro_mail'], $inscrit->nom, $inscrit->nom_liste) . ", <br />" . sprintf($msg['list_lecture_unsubscribe_mail'], $empr_prenom . " " . $empr_nom, $inscrit->nom_liste); if ($com) { $corps .= sprintf("<br />" . $msg['list_lecture_corps_com_mail'], $empr_prenom . " " . $empr_nom, "<br />" . $com . "<br />"); } $corps .= "<br /><br /><a href='" . $opac_url_base . "empr.php?code={$code}&emprlogin={$login}&date_conex={$date}&tab=lecture&lvl=private_list&sub=my_list' >" . $msg['redirection_mail_link'] . "</a>"; mailpmb($inscrit->nom, $inscrit->empr_mail, $objet, stripslashes($corps), $empr_prenom . " " . $empr_nom, $empr_mail); //désinscripiton $requete = "delete from abo_liste_lecture where num_liste='" . $id_liste . "' and num_empr='" . $id_empr . "'"; pmb_mysql_query($requete, $dbh); //réaffichage de la liste $req = "select id_empr, trim(concat(empr_prenom,' ',empr_nom)) as nom, confidential \n\tfrom empr e, abo_liste_lecture abo, opac_liste_lecture oll \n\twhere abo.num_empr=e.id_empr and oll.id_liste=abo.num_liste \n\tand etat=2 and num_liste='" . $id_liste . "'\n\torder by nom"; $res = pmb_mysql_query($req, $dbh); if (!pmb_mysql_num_rows($res)) { $display = $msg[list_lecture_no_user_inscrit]; print $display; return; } $display = ""; while ($empr = pmb_mysql_fetch_object($res)) { if ($empr->confidential) { $display .= "<img border=0 align='top' src='" . $opac_url_base . "images/cross.png' onclick=\"delete_from_liste('" . $id_liste . "','" . $empr->id_empr . "');\">"; } $display .= $empr->nom . "<br />"; } print $display; }
$corps .= htmlentities($msg["command_phototeque_name"], ENT_QUOTES, $charset) . " : " . $nom . "<br />"; $corps .= htmlentities($msg["command_phototeque_phone"], ENT_QUOTES, $charset) . " : " . $telephone . "<br />"; $corps .= htmlentities($msg["command_phototeque_email"], ENT_QUOTES, $charset) . " : " . $mail . "<br />"; $corps .= htmlentities($msg["command_phototeque_nbre"], ENT_QUOTES, $charset) . " : " . $nbre . "<br />"; $corps .= htmlentities($msg["command_phototeque_comment"], ENT_QUOTES, $charset) . " : " . $commentaire . "<br />"; //Envoi du mail $mails = explode(" ", $opac_photo_email_form); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; if (count($mails)) { $ret = 1; } else { $ret = 0; } for ($i = 0; $i < count($mails); $i++) { $ret *= @mailpmb($mail, $mail, $msg["command_phototeque_command"], $corps, $opac_biblio_name, $opac_biblio_email, $headers); } print "<script>\n\t\n alert('" . ($ret ? htmlentities($msg["command_phototeque_command_transmited"], ENT_QUOTES, $charset) : htmlentities($msg["command_phototeque_command_no_transmited"], ENT_QUOTES, $charset)) . "');\n\tdocument.location='index.php?lvl=notice_display&id={$id}&mode_phototeque=1';\n</script>"; } else { $flag = false; if ($id_empr) { $requete = "select empr_login,concat(empr_prenom,' ',empr_nom) as nom, empr_tel1,empr_mail from empr where id_empr={$id_empr}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $flag = true; $r = mysql_fetch_object($resultat); $form_mailing = str_replace("!!nom!!", htmlentities($r->nom, ENT_QUOTES, $charset), $form_mailing); $form_mailing = str_replace("!!telephone!!", htmlentities($r->empr_tel1, ENT_QUOTES, $charset), $form_mailing); $form_mailing = str_replace("!!mail!!", htmlentities($r->empr_mail, ENT_QUOTES, $charset), $form_mailing); } }
} } //print "</table>"; if ($output == "printer") { $output_final .= "<script>self.print();</script>"; } } if ($opac_parse_html) { $output_final = parseHTML($output_final); } if ($output != "email") { print pmb_bidi($output_final . "</body></html>"); } else { $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $res_envoi = mailpmb("", $emaildest, $msg["print_emailobj"] . " {$opac_biblio_name} - {$date_today} ", ($emailcontent ? $msg["print_emailcontent"] . $emailcontent . "<br />" : '') . $output_final . "<br /><br />" . mail_bloc_adresse() . "</body></html> ", $opac_biblio_name, $opac_biblio_email, $headers); $vide_cache = filemtime("./styles/" . $css . "/" . $css . ".css"); if ($res_envoi) { print "<html><head><meta http-equiv=Content-Type content=\"text/html; charset=" . $charset . "\" /><title>" . $msg["print_title"] . "</title></head><body><link rel=\"stylesheet\" href=\"./styles/" . $css . "/{$css}.css?" . $vide_cache . "\" />\n<br /><br /><center><h3>" . sprintf($msg["print_emailsucceed"], $emaildest) . "</h3><br />\n\t\t<a href=\"\" onClick=\"self.close(); return false;\">" . $msg["print_emailclose"] . "</a></center></body></html>"; } else { echo "<html><head><meta http-equiv=Content-Type content=\"text/html; charset=" . $charset . "\" /><title>" . $msg["print_title"] . "</title></head><body><link rel=\"stylesheet\" href=\"./styles/" . $css . "/{$css}.css?" . $vide_cache . "\" />\n<br /><br /><center><h3>" . sprintf($msg["print_emailfailed"], $emaildest) . "</h3><br />\n\t\t<a href=\"\" onClick=\"self.close(); return false;\">" . $msg["print_emailclose"] . "</a></center></body></html>"; } } global $pmb_logs_activate; if ($pmb_logs_activate) { global $log, $infos_notice, $infos_expl; $rqt = " select empr_prof,empr_cp, empr_ville as ville, empr_year, empr_sexe, empr_date_adhesion, empr_date_expiration, count(pret_idexpl) as nbprets, count(resa.id_resa) as nbresa, code.libelle as codestat, es.statut_libelle as statut, categ.libelle as categ, gr.libelle_groupe as groupe,dl.location_libelle as location \n\t\t\tfrom empr e\n\t\t\tleft join empr_codestat code on code.idcode=e.empr_codestat\n\t\t\tleft join empr_statut es on e.empr_statut=es.idstatut\n\t\t\tleft join empr_categ categ on categ.id_categ_empr=e.empr_categ\n\t\t\tleft join empr_groupe eg on eg.empr_id=e.id_empr\n\t\t\tleft join groupe gr on eg.groupe_id=gr.id_groupe\n\t\t\tleft join docs_location dl on e.empr_location=dl.idlocation\n\t\t\tleft join resa on e.id_empr=resa_idempr\n\t\t\tleft join pret on e.id_empr=pret_idempr\n\t\t\twhere e.empr_login='******'\n\t\t\tgroup by resa_idempr, pret_idempr"; $res = mysql_query($rqt); if ($res) { $empr_carac = mysql_fetch_array($res); $log->add_log('empr', $empr_carac);
function verif_validite_compte() { global $dbh, $msg, $opac_default_lang; global $f_nom, $f_prenom, $f_email, $f_login, $f_password; global $f_msg, $f_adr1, $f_adr2, $f_cp, $f_ville, $f_pays, $f_tel1; global $base_path, $opac_websubscribe_num_carte_auto; global $opac_websubscribe_show, $lvl; $ret = array(); $rqt = "select id_empr from empr where empr_mail like '%" . $f_email . "%' "; $res = pmb_mysql_query($rqt, $dbh); if (pmb_mysql_num_rows($res) > 0) { $ret[0] = PBINSC_MAIL; $ret[1] = str_replace("!!email!!", urlencode($f_email), $msg[subs_pb_email]); return $ret; } $rqt = "select id_empr from empr where empr_login ='******' "; $res = pmb_mysql_query($rqt, $dbh); if (pmb_mysql_num_rows($res) > 0) { $ret[0] = PBINSC_LOGIN; $ret[1] = str_replace("!!f_login!!", $f_login, $msg[subs_pb_login]) . generate_form_inscription(); return $ret; } // préparation des données: // langue: if ($_COOKIE['PhpMyBibli-LANG']) { $lang = $_COOKIE['PhpMyBibli-LANG']; } if (!$lang) { if ($opac_default_lang) { $lang = $opac_default_lang; } else { $lang = "fr_FR"; } } // paramétrage : global $opac_websubscribe_empr_status, $opac_websubscribe_empr_categ, $opac_websubscribe_empr_stat, $opac_websubscribe_valid_limit; $opac_websubscribe_empr_status_array = explode(",", $opac_websubscribe_empr_status); if (!$opac_websubscribe_empr_categ) { $ret[0] = PBINSC_PARAM; $ret[1] = $msg[subs_pb_empr_categ]; return $ret; } if (!$opac_websubscribe_empr_stat) { $ret[0] = PBINSC_PARAM; $ret[1] = $msg[subs_pb_empr_codestat]; return $ret; } // codes-barres emprunteur bidon : $pe_emprcb = 'wwwtmp' . rand(0, 100000); // durée d'adhésion de la categ web $rqt = "select duree_adhesion from empr_categ where id_categ_empr='" . $opac_websubscribe_empr_categ . "' "; $res = pmb_mysql_query($rqt, $dbh); $obj = pmb_mysql_fetch_object($res); $duree_adhesion = $obj->duree_adhesion; global $pmb_lecteurs_localises, $opac_websubscribe_show_location; if ($pmb_lecteurs_localises && $opac_websubscribe_show_location) { global $empr_location_id; $websubscribe_empr_location = $empr_location_id ? $empr_location_id : 0; } else { global $opac_websubscribe_empr_location; $websubscribe_empr_location = $opac_websubscribe_empr_location; } // clé de validation : $alphanum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; $cle_validation = substr(str_shuffle($alphanum), 0, 20); $subscription_action = get_others_informations_from_globals(); $rqt = "insert into empr set "; $rqt .= "id_empr=0, "; $rqt .= "empr_cb ='" . $pe_emprcb . "', "; $rqt .= "empr_login ='******', "; $rqt .= "empr_mail='" . $f_email . "', "; $rqt .= "empr_nom='" . $f_nom . "', "; $rqt .= "empr_prenom='" . $f_prenom . "', "; $rqt .= "empr_password='******', "; $rqt .= "empr_creation=sysdate(), "; $rqt .= "empr_modif=sysdate(), "; $rqt .= "empr_date_adhesion=sysdate(), "; $rqt .= "empr_date_expiration=date_add(sysdate(), INTERVAL {$duree_adhesion} DAY), "; $rqt .= "empr_lang='" . $lang . "', "; $rqt .= "empr_statut='" . $opac_websubscribe_empr_status_array[0] . "', "; $rqt .= "empr_location='" . $websubscribe_empr_location . "', "; $rqt .= "empr_categ='" . $opac_websubscribe_empr_categ . "', "; $rqt .= "empr_codestat='" . $opac_websubscribe_empr_stat . "', "; $rqt .= "empr_msg='" . $f_msg . "', "; $rqt .= "empr_adr1='" . $f_adr1 . "', "; $rqt .= "empr_adr2='" . $f_adr2 . "', "; $rqt .= "empr_cp='" . $f_cp . "', "; $rqt .= "empr_ville='" . $f_ville . "', "; $rqt .= "empr_pays='" . $f_pays . "', "; $rqt .= "empr_tel1='" . $f_tel1 . "', "; $rqt .= "cle_validation='" . $cle_validation . "' "; if (count($subscription_action)) { $rqt .= ",empr_subscription_action = '" . addslashes(serialize($subscription_action)) . "'"; } else { $rqt .= ",empr_subscription_action = '" . addslashes(serialize(array())) . "'"; } $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . "<br /><br />{$rqt}"); $id_empr = pmb_mysql_insert_id(); emprunteur::update_digest($f_login, $f_password); emprunteur::hash_password($f_login, $f_password); if ($id_empr) { //redefine empr.empr_cb $pe_emprcb = 'www' . $id_empr; $opac_websubscribe_num_carte_auto_array = array(); $opac_websubscribe_num_carte_auto_array = explode(",", $opac_websubscribe_num_carte_auto); if ($opac_websubscribe_num_carte_auto_array[0] == "2") { $long_prefixe = $opac_websubscribe_num_carte_auto_array[1]; $nb_chiffres = $opac_websubscribe_num_carte_auto_array[2]; $prefix = $opac_websubscribe_num_carte_auto_array[3]; $rqt = "SELECT CAST(SUBSTRING(empr_cb," . ($long_prefixe + 1) . ") AS UNSIGNED) AS max_cb, SUBSTRING(empr_cb,1," . $long_prefixe * 1 . ") AS prefixdb FROM empr ORDER BY max_cb DESC limit 0,1"; // modif f cerovetti pour sortir dernier code barre tri par ASCII $res = pmb_mysql_query($rqt, $dbh); $cb_initial = pmb_mysql_fetch_object($res); $pe_emprcb = $cb_initial->max_cb * 1 + 1; if (!$nb_chiffres) { $nb_chiffres = strlen($pe_emprcb); } if (!$prefix) { $prefix = $cb_initial->prefixdb; } $pe_emprcb = $prefix . substr((string) str_pad($pe_emprcb, $nb_chiffres, "0", STR_PAD_LEFT), -$nb_chiffres); } elseif ($opac_websubscribe_num_carte_auto_array[0] == '3') { $num_carte_auto_filename = $base_path . '/circ/empr/' . trim($opac_websubscribe_num_carte_auto_array[1]) . '.inc.php'; $num_carte_auto_fctname = trim($opac_websubscribe_num_carte_auto_array[1]); if (file_exists($num_carte_auto_filename)) { require_once $num_carte_auto_filename; if (function_exists($num_carte_auto_fctname)) { $pe_emprcb = $num_carte_auto_fctname(); } } } $rqt = "UPDATE empr SET empr_cb='{$pe_emprcb}' WHERE id_empr='{$id_empr}'"; $res = pmb_mysql_query($rqt, $dbh) or die(pmb_mysql_error() . "<br /><br />{$rqt}"); // envoyer le mail de demande de confirmation global $opac_biblio_name, $opac_biblio_email, $opac_url_base; $obj = str_replace("!!biblio_name!!", $opac_biblio_name, $msg[subs_mail_obj]); $corps = str_replace("!!biblio_name!!", $opac_biblio_name, $msg[subs_mail_corps]); $lien_validation = "<a href='" . $opac_url_base . "subscribe.php?subsact=validation&login={$f_login}&cle_validation={$cle_validation}'>" . $opac_url_base . "subscribe.php?subsact=validation&login={$f_login}&cle_validation={$cle_validation}</a>"; $corps = str_replace("!!lien_validation!!", $lien_validation, $corps); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\n"; $res_envoi = @mailpmb(trim(stripslashes($f_prenom . " " . $f_nom)), stripslashes($f_email), $obj, $corps, $opac_biblio_name, $opac_biblio_email, $headers); if (!$res_envoi) { $ret[0] = PBINSC_MAIL; $ret[1] = str_replace("!!f_email!!", $f_email, $msg[subs_pb_mail]); return $ret; } $ret[0] = PBINSC_OK; $ret[1] = str_replace("!!f_email!!", $f_email, $msg[subs_ok_inscrit]); $ret[1] = str_replace("!!nb_h_valid!!", $opac_websubscribe_valid_limit, $ret[1]); //alerte pour les utilisateurs $query_users = "select nom, prenom, user_email from users where user_email like('%@%') and user_alert_subscribemail=1"; $result_users = @pmb_mysql_query($query_users, $dbh); if ($result_users) { if (pmb_mysql_num_rows($result_users) > 0) { global $pmb_url_base; $obj = str_replace("!!biblio_name!!", $opac_biblio_name, $msg[subs_alert_user_mail_obj]); $obj = str_replace("!!empr_name!!", stripslashes($f_nom), $obj); $obj = str_replace("!!empr_first_name!!", stripslashes($f_prenom), $obj); $corps = str_replace("!!biblio_name!!", $opac_biblio_name, $msg[subs_alert_user_mail_corps]); $corps = str_replace("!!empr_name!!", stripslashes($f_nom), $corps); $corps = str_replace("!!empr_first_name!!", stripslashes($f_prenom), $corps); $empr_link = str_replace("!!pmb_url_base!!", $pmb_url_base, $msg[subs_alert_user_mail_empr_link]); $empr_link = str_replace("!!empr_cb!!", $pe_emprcb, $empr_link); $corps = str_replace("!!empr_link!!", $empr_link, $corps); while ($user = @pmb_mysql_fetch_object($result_users)) { @mailpmb(trim($user->prenom . " " . $user->nom), $user->user_email, $obj, $corps, $opac_biblio_name, $opac_biblio_email, $headers); } } } return $ret; } else { $ret[0] = PBINSC_BDD; $ret[1] = $msg[subs_pb_bdd]; return $ret; } }
function send_alert_by_mail($idsender, $note) { global $msg, $empr_nom, $empr_prenom, $empr_mail, $dbh, $opac_url_base, $pmb_url_base, $demandes_email_generic; $contenu = $msg['demandes_mail_new_demande']; $contenu = str_replace("!!nom!!", $empr_prenom . " " . $empr_nom . " ", $contenu); $contenu = str_replace("!!titre_demande!!", $note->titre_demande, $contenu); $contenu .= '<br />' . $note->sujet_demande . '<br />'; $lien_gestion = '<a href="' . $pmb_url_base . 'demandes.php?categ=gestion&act=see_dmde&iddemande=' . $note->id_demande . '">' . $msg['demandes_see_last_note'] . '</a>'; $objet = $msg['demandes_mail_new_demande_object']; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1"; // Envoi au mail générique if ($demandes_email_generic) { $param = explode(",", $demandes_email_generic); if (($param[0] == 1 || $param[0] == 3) && $param[1]) { $envoi_OK = mailpmb("", $param[1], $objet, $contenu . $lien_gestion, $empr_prenom . " " . $empr_nom, $empr_mail, $headers, "", $param[2]); } } }
function alert_empr_resa_planning($id_resa = 0, $id_empr_concerne = 0) { global $dbh; global $msg, $charset; global $PMBuserid, $PMBuseremail, $PMBuseremailbcc; global $pdflettreresa_priorite_email; global $pdflettreresa_before_list, $pdflettreresa_madame_monsieur, $pdflettreresa_after_list, $pdflettreresa_fdp; global $biblio_name, $biblio_email; global $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_phone; global $pdflettreresa_priorite_email_manuel; if ($pdflettreresa_priorite_email_manuel == 3) { return; } if (!count($id_resa)) { return; } $tmp_id_resa = implode(",", $id_resa); $query = "select distinct "; $query .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, "; $query .= "date_format(resa_date_fin, '" . $msg["format_date"] . "') as aff_resa_date_fin, "; $query .= "date_format(resa_date_debut, '" . $msg["format_date"] . "') as aff_resa_date_debut, "; $query .= "empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_sms, id_resa, "; $query .= "trim(concat(ifnull(notices_m.niveau_biblio,''), ifnull(notices_s.niveau_biblio,''))) as niveau_biblio, "; $query .= "trim(concat(ifnull(notices_m.notice_id,''), ifnull(notices_s.notice_id,''))) as id_notice "; $query .= "from (((resa_planning 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), empr "; $query .= "where id_resa in (" . $tmp_id_resa . ") and resa_validee=1 and resa_idempr=id_empr"; if ($id_empr_concerne) { $query .= "and id_empr={$id_empr_concerne} "; } $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $var = "pdflettreresa_fdp"; eval("\$pdflettreresa_fdp=\"" . ${$var} . "\";"); // le texte après la liste des ouvrages en résa $var = "pdflettreresa_after_list"; eval("\$pdflettreresa_after_list=\"" . ${$var} . "\";"); // le texte avant la liste des ouvrages en réservation $var = "pdflettreresa_before_list"; eval("\$pdflettreresa_before_list=\"" . ${$var} . "\";"); // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent," $var = "pdflettreresa_madame_monsieur"; eval("\$pdflettreresa_madame_monsieur=\"" . ${$var} . "\";"); while ($o = pmb_mysql_fetch_object($result)) { if (($pdflettreresa_priorite_email_manuel == 1 || $pdflettreresa_priorite_email_manuel == 2) && $o->empr_mail) { $to = $o->empr_prenom . " " . $o->empr_nom . " <" . $o->empr_mail . ">"; $output_final = "<html><body>"; $texte_madame_monsieur = str_replace("!!empr_name!!", $o->empr_nom, $pdflettreresa_madame_monsieur); $texte_madame_monsieur = str_replace("!!empr_first_name!!", $o->empr_prenom, $texte_madame_monsieur); $output_final .= $texte_madame_monsieur . ' <br />' . $pdflettreresa_before_list; $output_final .= '<hr /><strong>' . $o->tit . '</strong>'; $output_final .= '<br />'; $output_final .= $msg['resa_planning_date_debut'] . ' ' . $o->aff_resa_date_debut . ' ' . $msg['resa_planning_date_fin'] . ' ' . $o->aff_resa_date_fin; $output_final .= '<hr />' . $pdflettreresa_after_list . ' <br />' . $pdflettreresa_fdp . "<br /><br />" . mail_bloc_adresse(); $output_final .= '</body></html>'; $res_envoi = mailpmb($o->empr_prenom . ' ' . $o->empr_nom, $o->empr_mail, $msg['mail_obj_resa_validee'], $output_final, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc); if (!$res_envoi || $pdflettreresa_priorite_email_manuel == 2) { print "<script type='text/javascript'>openPopUp('./pdf.php?pdfdoc=lettre_resa_planning&id_resa={$tmp_id_resa}', 'lettre_confirm_resa" . $tmp_id_resa . "', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');</script>"; } } elseif ($pdflettreresa_priorite_email_manuel != 3) { print "<script type='text/javascript'>openPopUp('./pdf.php?pdfdoc=lettre_resa_planning&id_resa={$tmp_id_resa}', 'lettre_confirm_resa" . $tmp_id_resa . "', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');</script>"; } $rqt_maj = "update resa_planning set resa_confirmee=1 where id_resa in (" . $tmp_id_resa . ") and resa_validee=1 "; pmb_mysql_query($rqt_maj, $dbh); } } }
function print_dev($id_bibli = 0, $id_dev = 0, $by_mail = FALSE) { global $dbh, $charset, $base_path, $acquisition_pdfdev_print; global $acquisition_pdfdev_obj_mail, $acquisition_pdfdev_text_mail; global $acquisition_pdfdev_by_mail, $PMBuseremailbcc; if (!($id_bibli && $id_dev)) { return; } $bib = new entites($id_bibli); $bib_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_bibli, 1)); $dev = new actes($id_dev); $id_fou = $dev->num_fournisseur; $fou = new entites($id_fou); $fou_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_fou, 1)); $no_mail = FALSE; if ($by_mail == FALSE || !($acquisition_pdfdev_by_mail && strpos($bib_coord->email, '@') && strpos($fou_coord->email, '@'))) { $no_mail = TRUE; } else { $dest_name = ''; if ($fou_coord->libelle) { $dest_name = $fou_coord->libelle; } else { $dest_name = $fou->raison_sociale; } if ($fou_coord->contact) { $dest_name .= " " . $fou_coord->contact; } $dest_mail = $fou_coord->email; $obj_mail = $acquisition_pdfdev_obj_mail; $text_mail = $acquisition_pdfdev_text_mail; $bib_name = $bib_coord->raison_sociale; $bib_mail = $bib_coord->email; $lettre = lettreDevis_factory::make(); $lettre->doLettre($id_bibli, $id_dev); $piece_jointe = array(); $piece_jointe[0]['contenu'] = $lettre->getLettre('S'); $piece_jointe[0]['nomfichier'] = $lettre->getFileName(); // mailpmb($to_nom="", $to_mail, $obj="", $corps="", $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array()) $res_envoi = mailpmb($dest_name, $dest_mail, $obj_mail, $text_mail, $bib_name, $bib_mail, "Content-Type: text/plain; charset=\"{$charset}\"", '', $PMBuseremailbcc, 1, $piece_jointe); if (!$res_envoi) { $no_mail = TRUE; } } if ($no_mail) { print "\t\n\t\t\t<form name='print_dev' action='pdf.php?pdfdoc=devi' target='lettre' method='post'>\t\t\n\t\t\t\t<input type='hidden' name='id_bibli' value='" . $id_bibli . "'/>\n\t\t\t\t<input type='hidden' name='id_dev' value='" . $id_dev . "'/>\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\topenPopUp('','lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\n\t\t\t\t\tdocument.print_dev.submit();\n\t\t\t\t</script>\n\t\t\t</form>"; } }
/** * Refuse l'accès aux listes confidentielles */ function refuser_acces_confidentiel() { global $cb_demande, $dbh, $msg, $com, $opac_url_base, $opac_connexion_phrase; for ($i = 0; $i < sizeof($cb_demande); $i++) { $info = explode('-', $cb_demande[$i]); $req = " update abo_liste_lecture set etat=0 where num_empr='" . $info[1] . "' and num_liste='" . $info[0] . "'"; pmb_mysql_query($req, $dbh); $req = "select concat(empr_prenom,' ',empr_nom) as nom, empr_mail, empr_login from empr where id_empr='" . $info[1] . "'"; $res = pmb_mysql_query($req, $dbh); $destinataire = pmb_mysql_fetch_object($res); $req = "select concat(empr_prenom,' ',empr_nom) as nom, empr_mail, nom_liste from empr e, opac_liste_lecture oll where oll.num_empr=e.id_empr and id_liste='" . $info[0] . "'"; $res = pmb_mysql_query($req, $dbh); $sender = pmb_mysql_fetch_object($res); $date = time(); $login = $destinataire->empr_login; $code = md5($opac_connexion_phrase . $login . $date); $corps = sprintf($msg['list_lecture_intro_mail'], $destinataire->nom, $sender->nom_liste) . ", <br />" . sprintf($msg['list_lecture_refus_corps_mail'], $sender->nom, $sender->nom_liste); if ($com) { $corps .= sprintf("<br />" . $msg['list_lecture_corps_com_mail'], $sender->nom, " <br />" . $com); } $corps .= "<br /><br /><a href='" . $opac_url_base . "empr.php?code={$code}&emprlogin={$login}&date_conex={$date}&tab=lecture&lvl=private_list&sub=my_list' >" . $msg['redirection_mail_link'] . "</a>"; mailpmb($destinataire->nom, $destinataire->empr_mail, sprintf($msg['list_lecture_refus_mail'], $sender->nom_liste), stripslashes($corps), $sender->nom, $sender->empr_mail); } }
function send_alert_by_mail($idsender, $note) { global $msg, $empr_nom, $empr_prenom, $empr_mail, $dbh, $opac_url_base, $pmb_url_base, $demandes_email_generic; if ($demandes_email_generic) { $deg = explode(",", $demandes_email_generic); if ($deg[0] == 2 || $deg[0] == 3) { $bcc = $deg[1]; } else { $bcc = ""; } } $contenu = sprintf($msg['demandes_note_mail_new'], $empr_prenom . " " . $empr_nom . " ", $note->libelle_action, $note->libelle_demande) . '<br />'; $contenu .= $note->contenu . '<br />'; $lien_opac = '<a href="' . $opac_url_base . 'empr.php?tab=request&lvl=list_dmde&sub=open_demande&iddemande=' . $note->num_demande . '&last_modified=' . $note->num_action . '#fin">' . $msg['demandes_see_last_note'] . '</a>'; $lien_gestion = '<a href="' . $pmb_url_base . 'demandes.php?categ=gestion&act=see_dmde&iddemande=' . $note->num_demande . '&last_modified=' . $note->num_action . '#fin">' . $msg['demandes_see_last_note'] . '</a>'; $objet = $msg['demandes_note_mail_new_object']; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1"; //Envoi du mail aux autres documentalistes concernés par la demande $req = "SELECT user_email, prenom,nom FROM users\n\t\tJOIN demandes_users ON num_user=userid\n\t\tWHERE num_demande='" . $note->num_demande . "' AND num_user !='" . $idsender . "'"; $res = pmb_mysql_query($req, $dbh); while ($user = pmb_mysql_fetch_object($res)) { if ($user->user_email) { if ($user->prenom) { $user->nom = $user->prenom . ' ' . $user->nom; } $envoi_OK = mailpmb($user->nom, $user->user_email, $objet, $contenu . $lien_gestion, $empr_prenom . " " . $empr_nom, $empr_mail, $headers, "", $bcc); } } }
function send_mail($id_empr, $relance) { global $pmb_gestion_devise, $msg, $charset; global $biblio_name, $biblio_email, $biblio_phone, $PMBuseremailbcc; // l'objet du mail $var = "mailretard_" . $relance . "objet"; global ${$var}; eval("\$objet=\"" . ${$var} . "\";"); // la formule de politesse du bas (le signataire) $var = "mailretard_" . $relance . "fdp"; global ${$var}; eval("\$fdp=\"" . ${$var} . "\";"); // le texte après la liste des ouvrages en retard $var = "mailretard_" . $relance . "after_list"; global ${$var}; eval("\$after_list=\"" . ${$var} . "\";"); // le texte avant la liste des ouvrges en retard $var = "mailretard_" . $relance . "before_list"; global ${$var}; eval("\$before_list=\"" . ${$var} . "\";"); // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent," $var = "mailretard_" . $relance . "madame_monsieur"; global ${$var}; eval("\$madame_monsieur=\"" . ${$var} . "\";"); if ($madame_monsieur) { $texte_mail .= $madame_monsieur . "\r\n\r\n"; } if ($before_list) { $texte_mail .= $before_list . "\r\n\r\n"; } //Récupération des exemplaires $rqt = "select pret_idempr, expl_id, expl_cb from pret, exemplaires where pret_idempr='" . $id_empr . "' and pret_retour < curdate() and pret_idexpl=expl_id order by pret_date "; $req = pmb_mysql_query($rqt) or die('Erreur SQL !<br />' . $rqt . '<br />' . pmb_mysql_error()); $i = 0; $total_amendes = 0; //Calcul des frais de relance $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; } } while ($data = pmb_mysql_fetch_array($req)) { //Calcul des amendes $valeur = 0; $amende = new amende($data["pret_idempr"]); $amd = $amende->get_amende($data["expl_id"]); if ($amd["valeur"]) { $valeur = $amd["valeur"]; $total_amendes += $valeur; } /* Récupération des infos exemplaires et prêt */ $requete = "SELECT notices_m.notice_id as m_id, notices_s.notice_id as s_id, expl_cb, pret_date, pret_retour, tdoc_libelle, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, "; $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, "; $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, "; $requete .= " IF(pret_retour>sysdate(),0,1) as retard, 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 , pret "; $requete .= "WHERE expl_cb='" . addslashes($data['expl_cb']) . "' and expl_typdoc = idtyp_doc and pret_idexpl = expl_id "; $res = pmb_mysql_query($requete); $expl = pmb_mysql_fetch_object($res); $responsabilites = array(); $header_aut = ""; $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 = ""); // récupération du titre de série $tit_serie = ""; 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; } $texte_mail .= $expl->tit . $auteur . "\r\n"; $texte_mail .= " -" . sprintf($msg["relance_mail_retard_dates"], $expl->aff_pret_date, $expl->aff_pret_retour); if ($valeur) { $texte_mail .= " " . sprintf($msg["relance_mail_retard_amende"], comptes::format_simple($valeur)); } $texte_mail .= "\r\n"; $i++; } if ($total_amendes) { $texte_mail .= "\r\n" . sprintf($msg["relance_mail_retard_total_amendes"], comptes::format_simple($total_amendes)); } if ($frais_relance) { $texte_mail .= "\r\n" . $msg["relance_lettre_retard_frais_relance"] . comptes::format_simple($frais_relance); } if ($frais_relance && $total_amendes) { $texte_mail .= "\r\n" . $msg["relance_lettre_retard_total_du"] . comptes::format_simple($total_amendes + $frais_relance); } $texte_mail .= "\r\n\r\n"; if ($after_list) { $texte_mail .= $after_list . "\r\n\r\n"; } if ($fdp) { $texte_mail .= $fdp . "\r\n\r\n"; } $texte_mail .= mail_bloc_adresse(); //Si mail de rappel affecté au responsable du groupe $requete = "select id_groupe,resp_groupe from groupe,empr_groupe where id_groupe=groupe_id and empr_id={$id_empr} and resp_groupe and mail_rappel limit 1"; $res = pmb_mysql_query($requete); /* Récupération du nom, prénom et mail du lecteur destinataire */ if (pmb_mysql_num_rows($res) > 0) { $requete = "select id_empr, empr_mail, empr_nom, empr_prenom from empr where id_empr='" . pmb_mysql_result($res, 0, 1) . "'"; $result = pmb_mysql_query($requete); $coords_dest = pmb_mysql_fetch_object($result); } else { $requete = "select id_empr, empr_mail, empr_nom, empr_prenom from empr where id_empr={$id_empr}"; $res = pmb_mysql_query($requete); $coords_dest = pmb_mysql_fetch_object($res); } /* Récupération du nom, prénom et mail du lecteur concerné */ $requete = "select id_empr, empr_mail, empr_nom, empr_prenom, empr_cb from empr where id_empr={$id_empr}"; $res = pmb_mysql_query($requete); $coords = pmb_mysql_fetch_object($res); //remplacement nom et prenom $texte_mail = str_replace("!!empr_name!!", $coords->empr_nom, $texte_mail); $texte_mail = str_replace("!!empr_first_name!!", $coords->empr_prenom, $texte_mail); // function mailpmb($to_nom="", $to_mail, $obj="", $corps="", $from_name="", $from_mail, $headers, $copie_CC="", $copie_BCC="", $faire_nl2br=0, $pieces_jointes=array()) { $res_envoi = mailpmb($coords_dest->empr_prenom . " " . $coords_dest->empr_nom, $coords_dest->empr_mail, $objet . " : " . $coords->empr_prenom . " " . mb_strtoupper($coords->empr_nom, $charset) . " (" . $coords->empr_cb . ")", $texte_mail, $biblio_name, $biblio_email, "Content-Type: text/plain; charset=\"{$charset}\"\n", "", $PMBuseremailbcc, 1); return $res_envoi; }
function confirmResaReader($id_resa = 0, $id_empr_concerne = 0, $f_loc = 0) { global $dbh; global $msg, $charset; global $PMBuserid, $PMBuseremailbcc; global $pdflettreresa_priorite_email; global $pdflettreresa_before_list, $pdflettreresa_madame_monsieur, $pdflettreresa_after_list, $pdflettreresa_fdp; global $biblio_name, $biblio_email; global $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_phone; global $pmb_transferts_actif, $transferts_choix_lieu_opac; global $empr_sms_activation; global $empr_sms_msg_resa_dispo; // global $deflt2docs_location; if (SESSrights & CIRCULATION_AUTH) { if ($pdflettreresa_priorite_email == 3) { return; } $this->infos_biblio(); // $this->infos_biblio($deflt2docs_location); $query = "select distinct "; $query .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, "; $query .= "date_format(resa_date_fin, '" . $msg["format_date"] . "') as aff_resa_date_fin, "; $query .= "date_format(resa_date_debut, '" . $msg["format_date"] . "') as aff_resa_date_debut, "; $query .= "empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_sms, id_resa, "; $query .= "trim(concat(ifnull(notices_m.niveau_biblio,''), ifnull(notices_s.niveau_biblio,''))) as niveau_biblio, "; $query .= "trim(concat(ifnull(notices_m.notice_id,''), ifnull(notices_s.notice_id,''))) as id_notice "; $query .= "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), empr "; $query .= "where id_resa in (" . $id_resa . ") and resa_idempr=id_empr "; $query .= "and resa_confirmee=0"; if ($id_empr_concerne) { $query .= " and id_empr={$id_empr_concerne} "; } if ($f_loc) { $query .= " and empr_location={$f_loc} "; } $result = mysql_query($query, $dbh); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $var = "pdflettreresa_fdp"; eval("\$pdflettreresa_fdp=\"" . ${$var} . "\";"); // le texte après la liste des ouvrages en résa $var = "pdflettreresa_after_list"; eval("\$pdflettreresa_after_list=\"" . ${$var} . "\";"); // le texte avant la liste des ouvrges en réservation $var = "pdflettreresa_before_list"; eval("\$pdflettreresa_before_list=\"" . ${$var} . "\";"); // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent," $var = "pdflettreresa_madame_monsieur"; eval("\$pdflettreresa_madame_monsieur=\"" . ${$var} . "\";"); $tab_resa = array(); while ($empr = mysql_fetch_object($result)) { $id_empr = $empr->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 = "<html><body>"; $pdflettreresa_madame_monsieur = str_replace("!!empr_first_name!!", $empr->empr_prenom, $pdflettreresa_madame_monsieur); $output_final .= "{$pdflettreresa_madame_monsieur} <br />" . $pdflettreresa_before_list; if ($empr->niveau_biblio == 'm' || $empr->niveau_biblio == 'b') { $affichage = new mono_display($empr->id_notice, 0, '', '', '', '', '', '', '', '', '', '', '', true, '', ''); $output_final .= "<hr /><strong>" . $affichage->header . "</strong>"; } elseif ($empr->niveau_biblio == 's' || $empr->niveau_biblio == 'a') { $affichage_perio = new serial_display($empr->id_notice, 0); $output_final .= "<hr /><strong>" . $affichage_perio->header . "</strong>"; } $output_final .= "<br />"; $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"]); } } } } $output_final .= "<br />{$lieu_retrait}<br /><hr />{$pdflettreresa_after_list} <br />" . $pdflettreresa_fdp; $output_final .= "<br /><br />" . mail_bloc_adresse(); $output_final .= "</body></html> "; 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_sms_activation && $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) { return $valeur_tab; } else { return ""; } } else { return; } }
private function _send_mail($dest, $cc = "", $subject, $content, $from_name = "", $from_mail = "") { global $charset; global $opac_biblio_name; global $opac_biblio_email; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $content = str_replace("!!issue!!", $this->get_issue_title() . " in " . $this->get_serial_title(), $content); if ($from_name == "") { $from_name = $opac_biblio_name; } if ($from_mail == "") { $from_mail = $opac_biblio_email; } if ($dest['mail'] != "") { return mailpmb($dest['name'], $dest['mail'], $subject, $content, $from_name, $from_mail, $headers, $cc); } else { return true; } }
if ($fdp) { $texte_mail .= $fdp . "\r\n\r\n"; } $texte_mail .= mail_bloc_adresse(); //Si mail de rappel affecté au responsable du groupe $requete = "select id_groupe,resp_groupe from groupe,empr_groupe where id_groupe=groupe_id and empr_id={$id_empr} and resp_groupe and mail_rappel limit 1"; $res = pmb_mysql_query($requete); /* Récupération du nom, prénom et mail du lecteur destinataire */ if (pmb_mysql_num_rows($res) > 0) { $requete = "select id_empr, empr_mail, empr_nom, empr_prenom from empr where id_empr='" . pmb_mysql_result($res, 0, 1) . "'"; $result = pmb_mysql_query($requete); $coords_dest = pmb_mysql_fetch_object($result); } else { $requete = "select id_empr, empr_mail, empr_nom, empr_prenom from empr where id_empr={$id_empr}"; $result = pmb_mysql_query($requete); $coords_dest = pmb_mysql_fetch_object($result); } /* Récupération du nom, prénom et mail du lecteur concerné */ $requete = "select id_empr, empr_mail, empr_nom, empr_prenom, empr_cb from empr where id_empr={$id_empr}"; $res = pmb_mysql_query($requete); $coords = pmb_mysql_fetch_object($res); //remplacement nom et prenom $texte_mail = str_replace("!!empr_name!!", $coords->empr_nom, $texte_mail); $texte_mail = str_replace("!!empr_first_name!!", $coords->empr_prenom, $texte_mail); $headers .= "Content-type: text/plain; charset=" . $charset . "\n"; $res_envoi = mailpmb($coords_dest->empr_prenom . " " . $coords_dest->empr_nom, $coords_dest->empr_mail, $objet . " : " . $coords->empr_prenom . " " . mb_strtoupper($coords->empr_nom, $charset) . " (" . $coords->empr_cb . ")", $texte_mail, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1); if ($res_envoi) { echo "<center><h3>" . sprintf($msg["mail_retard_succeed"], $coords_dest->empr_mail) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["mail_retard_close"] . "</a></center><br /><br />" . nl2br($texte_mail); } else { echo "<center><h3>" . sprintf($msg["mail_retard_failed"], $coords_dest->empr_mail) . "</h3><br /><a href=\"\" onClick=\"self.close(); return false;\">" . $msg["mail_retard_close"] . "</a></center>"; }
static function alert_mail_sugg_users_pmb($typeEmpr = 2, $userIdOrEmail = "", $tableHtml = "", $sugg_location_id = 0) { global $dbh; global $include_path; global $msg, $charset; require_once $include_path . "/mail.inc.php"; //Informations emprunteur $empr = ""; if ($typeEmpr == 1) { //Abonné $query = "SELECT empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_tel2, empr_cp, empr_ville, location_libelle FROM empr, docs_location WHERE id_empr='{$userIdOrEmail}' and empr_location=idlocation"; $result = @pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $empr .= "<strong>" . $row->empr_prenom . " " . $row->empr_nom . "</strong>\n\t\t\t\t\t<br /><i>" . $row->empr_mail . " / " . $row->empr_tel1 . " / " . $row->empr_tel2 . "</i>"; if ($row->empr_cp || $row->empr_ville) { $empr .= "<br /><u>" . $row->empr_cp . " " . $row->empr_ville . "</u>"; } $empr .= "<hr />" . $msg[situation] . ": " . $row->location_libelle . "<hr />"; } } else { //Visiteur non authentifié $empr .= "<strong>" . $msg["mail_sugg_non_empr"] . "</strong>\n\t\t\t\t\t<br /><i>" . $userIdOrEmail . "</i><hr />"; } //Biblios destinataires selon paramétrage et localisation de la suggestion $query = "SELECT DISTINCT location_libelle, email, nom, prenom, user_email, date_format(sysdate(), '" . $msg["format_date_heure"] . "') AS aff_quand \n\t\t\t\tFROM docs_location, users WHERE idlocation=deflt_docs_location AND user_email like('%@%') and user_alert_suggmail=1"; if ($sugg_location_id) { $query .= " AND idlocation=" . $sugg_location_id; } $result = @pmb_mysql_query($query, $dbh); if ($result && pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $PMBuseremail = ""; $PMBusernom = $row->location_libelle; $PMBuserprenom = ''; $PMBuseremail = $row->email; if (trim($PMBuseremail)) { $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=" . $charset . "\n"; $output_final = "<html><body>"; //infos visiteur $output_final .= $empr; $output_final .= $tableHtml; $output_final .= "<hr /></body></html> "; $res_envoi = mailpmb($row->nom . " " . $row->prenom, $row->user_email, $msg["mail_sugg_obj"] . " " . $row->aff_quand, $output_final, $PMBusernom, $PMBuseremail, $headers, "", "", 0); } } } }
function ask_send_mail($empr_id, $objet, $texte_mail) { global $biblio_name, $biblio_email, $PMBuseremailbcc; $empr_info = $this->empr_info($empr_id); $texte_mail = str_replace("!!issue!!", $this->ask_info['perio']['header'], $texte_mail); return mailpmb($empr_info["prenom"] . " " . $empr_info["nom"], $empr_info["mail"], $objet, $texte_mail, $biblio_name, $biblio_email, "", "", $PMBuseremailbcc, 1); }
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); } } }