id_tache = $id_tache; } //formulaire spécifique au type de tâche function show_form ($param='') { global $dbh, $PMBuserid; //paramètres pré-enregistré if ($param['mailtpl_id']) { $id_sel = $param['mailtpl_id']; } else { $id_sel=0; } if ($param['empr_caddie']) { $idemprcaddie_sel = $param['empr_caddie']; } else { $idemprcaddie_sel = 0; } $mailtpl = new mailtpls(); //Choix du template de mail $form_task .= "
".$mailtpl->get_sel('mailtpl_id',$id_sel)."
 
"; $liste = empr_caddie::get_cart_list(); $gen_select_empr_caddie = ""; //Choix du panier d'emprunteurs $form_task .= "
".$gen_select_empr_caddie."
"; return $form_task; } function task_execution() { global $dbh,$msg, $PMBusername; if (SESSrights & CIRCULATION_AUTH) { $parameters = $this->unserialize_task_params(); if ($parameters['empr_caddie'] && $parameters['mailtpl_id']) { $percent = 0; if($this->statut == WAITING) { $this->send_command(RUNNING); } if($this->statut == RUNNING) { if (method_exists($this->proxy, 'pmbesMailing_sendMailingCaddie')) { $result = $this->proxy->pmbesMailing_sendMailingCaddie($parameters['empr_caddie'], $parameters['mailtpl_id']); if ($result) { $this->report[] = "

$msg[empr_mailing_titre_resultat]

$msg[admin_mailtpl_sel] ".htmlentities($result["name"],ENT_QUOTES,$charset)."
$msg[empr_mailing_form_obj_mail] ".htmlentities($result["object_mail"],ENT_QUOTES,$charset)." "; $tpl_report = " $msg[empr_mailing_resultat_envoi]"; $msg[empr_mailing_recap_comptes] = str_replace("!!total_envoyes!!", $result["nb_mail_sended"], $msg[empr_mailing_recap_comptes]) ; $msg[empr_mailing_recap_comptes] = str_replace("!!total!!", $result["nb_mail"], $msg[empr_mailing_recap_comptes]) ; $tpl_report .= $msg[empr_mailing_recap_comptes] ; $sql = "select id_empr, empr_mail, empr_nom, empr_prenom from empr, empr_caddie_content where flag='2' and empr_caddie_id=".$parameters['empr_caddie']." and object_id=id_empr "; $sql_result = mysql_query($sql) ; if (mysql_num_rows($sql_result)) { $tpl_report .= "
$msg[empr_mailing_liste_erreurs]
"; while ($obj_erreur=mysql_fetch_object($sql_result)) { $tpl_report .= "
".$obj_erreur->empr_nom." ".$obj_erreur->empr_prenom." (".$obj_erreur->empr_mail.")
"; } } $tpl_report .= ""; $this->report[] = $tpl_report; $this->update_progression(100); } } else { $this->report[] = "".sprintf($msg["planificateur_function_rights"],"sendMailingCaddie","pmbesMailing",$PMBusername).""; } } } else { $this->report[] = "".$this->msg["mailing_unknown"].""; } } else { $this->report[] = "".sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername).""; } } function make_serialized_task_params() { global $empr_caddie, $mailtpl_id; $t = parent::make_serialized_task_params(); $t["empr_caddie"] = $empr_caddie; $t["mailtpl_id"] = $mailtpl_id; return serialize($t); } function unserialize_task_params() { $params = $this->get_task_params(); return $params; } }