id_empr); $level=$amende->get_max_level(); $niveau_min=$level["level_min"]; $printed=$level["printed"]; if ((!$printed)&&($niveau_min)) { $relances[] = array( 'id_empr' => $r->id_empr, 'niveau_min' => $niveau_min, ); } } return $relances; } public static function get_print_form($empr_ids=array()) { $form = "
"; return $form; } public static function proceed($id=0) { global $act; switch ($act) { case 'solo': relance::do_action(static::$id_empr); break; case 'solo_print': print_relance(static::$id_empr,false); break; case 'solo_mail': print_relance(static::$id_empr); break; case 'valid': foreach (static::$empr as $id_empr) { relance::do_action($id_empr); } break; case 'print': static::proceed_print(); break; case 'export': static::proceed_export(); break; case 'print_not_sended': //static::proceed_print_not_sended(); break; case 'send_not_sended': //static::proceed_send_not_sended(); break; case 'export_csv': static::proceed_export_csv(); break; case 'raz_printed': static::proceed_raz_printed(); break; default: parent::proceed($id); $list_readers_relances_ui = static::get_list_ui_instance(); $nb_relances = count($list_readers_relances_ui->get_objects()); print ""; break; } } public static function proceed_print() { global $mailretard_priorite_email; global $mail_sended; $not_all_mail = array(); if (is_array(static::$empr) && count(static::$empr)) { $not_mail = 0; $mail_sended = 0; $relances = static::get_relances_not_printed(); foreach ($relances as $relance) { $not_mail = print_relance($relance['id_empr']); if (($not_mail == 1) || (!$mail_sended) ||($mailretard_priorite_email==2 && $relance['niveau_min'] < 3)) { //mail_sended <=> globale $not_all_mail[] = $relance['id_empr']; } } } if (count($not_all_mail) > 0) { print static::get_print_form($not_all_mail); } //Fermeture de la fenêtre d'impression si tout est parti par mail } public static function proceed_export() { $not_all_mail = array(); if (is_array(static::$empr) && count(static::$empr)) { $req="TRUNCATE TABLE cache_amendes"; pmb_mysql_query($req); $requete = static::get_query(); $resultat=pmb_mysql_query($requete); while ($r=pmb_mysql_fetch_object($resultat)) { $amende=new amende($r->id_empr); $level=$amende->get_max_level(); $niveau_min=$level["level_min"]; $printed=$level["printed"]; if ((!$printed)&&($niveau_min)) { $not_mail = print_relance($r->id_empr); if ($not_mail == 1) { $not_all_mail[] = $r->id_empr; } } } } if (count($not_all_mail) > 0) { static::set_empr($not_all_mail); static::proceed_export_csv(); } //Fermeture de la fenêtre d'impression si tout est parti par mail } public static function proceed_export_csv() { if (is_array(static::$empr) && count(static::$empr)) { print ""; } } public static function proceed_print_not_sended() { if (is_array(static::$empr) && count(static::$empr)) { $empr_ids = array(); $relances = static::get_relances_not_printed(); foreach ($relances as $relance) { print_relance($relance['id_empr'], false); $empr_ids[] = $relance['id_empr']; } if(count($empr_ids)) { print static::get_print_form($empr_ids); } } } public static function proceed_send_not_sended() { static::proceed_print(); } public static function proceed_raz_printed() { global $printed_cd; $req="TRUNCATE TABLE cache_amendes"; pmb_mysql_query($req); $requete="update pret set printed=0 where printed!=0"; if ($printed_cd) { $requete.=" and date_relance='".stripslashes($printed_cd)."'"; } pmb_mysql_query($requete); } public static function set_empr($empr) { static::$empr = $empr; } }