// +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: liste_relances.inc.php,v 1.7 2015-04-03 11:16:26 jpermanne Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // popup d'impression PDF pour liste des relances de receptions // reçoit : tab_no_mail require_once "{$class_path}/entites.class.php"; require_once "{$class_path}/receptions_relances.class.php"; $tab_fou = unserialize(rawurldecode($tab_no_mail)); if (count($tab_fou) && $id_bibli) { switch ($acquisition_pdfrel_pdfrtf) { case '1': $lettre = new lettreRelance_RTF(); break; default: $lettre = new lettreRelance_PDF(); break; } foreach ($tab_fou as $id_fou => $tab_act) { $bib = new entites($id_bibli); $bib_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_bibli, 1)); $fou = new entites($id_fou); $fou_coord = pmb_mysql_fetch_object(entites::get_coordonnees($id_fou, 1)); $lettre->doLettre($bib, $bib_coord, $fou, $fou_coord, $tab_act); } $lettre->getLettre(); }
function do_relances() { global $dbh, $charset; global $id_bibli, $chk, $id_lig; global $acquisition_pdfrel_obj_mail, $acquisition_pdfrel_text_mail; global $acquisition_pdfrel_by_mail, $PMBuseremailbcc; //recuperation des lignes a relancer $tab_lig = array(); foreach ($chk as $v) { if ($id_lig[$v]) { $tab_lig[] = $id_lig[$v]; } } $tab_fou = array(); $q = lignes_actes::getLines($tab_lig, true); if ($q) { $r = mysql_query($q, $dbh); if (mysql_num_rows($r)) { while ($row = mysql_fetch_object($r)) { if (!array_key_exists($row->num_fournisseur, $tab_fou)) { $tab_fou[$row->num_fournisseur] = array(); } if (!array_key_exists($row->id_acte, $tab_fou[$row->num_fournisseur])) { $tab_fou[$row->num_fournisseur][$row->id_acte] = array(); } $tab_fou[$row->num_fournisseur][$row->id_acte][] = $row->id_ligne; } } } $bib = new entites($id_bibli); $bib_coord = mysql_fetch_object(entites::get_coordonnees($id_bibli, 1)); $tab_no_mail = array(); if (!($acquisition_pdfrel_by_mail && strpos($bib_coord->email, '@'))) { $tab_no_mail = $tab_fou; } else { if (count($tab_fou)) { foreach ($tab_fou as $id_fou => $tab_act) { $fou = new entites($id_fou); $fou_coord = mysql_fetch_object(entites::get_coordonnees($id_fou, 1)); //Si on peut relancer par mail if (strpos($fou_coord->email, '@')) { $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_pdfrel_obj_mail; $text_mail = $acquisition_pdfrel_text_mail; $bib_name = $bib_coord->raison_sociale; $bib_mail = $bib_coord->email; $lettre = new lettreRelance_PDF(); $lettre->doLettre($bib, $bib_coord, $fou, $fou_coord, $tab_act); $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) { $tab_no_mail[$id_fou] = $tab_act; } } else { $tab_no_mail[$id_fou] = $tab_act; } } } } if (count($tab_no_mail)) { print "\t\n\t\t<form name='print_liste_relances' action='pdf.php?pdfdoc=listrecept' target='lettre' method='post'>\t\t\n\t\t\t<input type='hidden' name='id_bibli' value='" . $id_bibli . "'/>\n\t\t\t<input type='hidden' name='tab_no_mail' value='" . rawurlencode(serialize($tab_no_mail)) . "'/>\n\t\t\t<script type='text/javascript'>\n\t\t\t\topenPopUp('','lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\n\t\t\t\tdocument.print_liste_relances.submit();\n\t\t\t</script>\n\t\t</form>"; } lignes_actes::setRelances($tab_lig); }