Esempio n. 1
0
    case 'export':
        $req = "TRUNCATE TABLE cache_amendes";
        pmb_mysql_query($req);
        $requete = "select id_empr from empr, pret, exemplaires where 1 ";
        $requete .= " and id_empr in (" . implode(",", $empr) . ") ";
        //$requete.= $loc_filter;
        $requete .= "and pret_retour< CURDATE() and pret_idempr=id_empr and pret_idexpl=expl_id group by id_empr";
        $resultat = pmb_mysql_query($requete);
        $not_all_mail = 0;
        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_all_mail += print_relance($r->id_empr);
            }
        }
        print "\n\t\t<form name='print_empr_ids' action='./circ/relance/relance_export.php';' target='lettre' method='post'>\n\t\t\t<script>openPopUp('','lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');\n\t\t\tdocument.print_empr_ids.submit();\n\t\t\t</script>\n\t\t</form>";
        //Fermeture de la fenêtre d'impression si tout est parti par mail
        break;
    case 'raz_printed':
        $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);
        break;
}
Esempio n. 2
0
 function exportCSV($t_empr)
 {
     if (SESSrights & CIRCULATION_AUTH) {
         $req = "TRUNCATE TABLE cache_amendes";
         pmb_mysql_query($req);
         $requete = "select id_empr from empr, pret, exemplaires where 1 ";
         if (!isset($t_empr)) {
             $t_empr[] = "0";
         }
         $requete .= " and id_empr in (" . implode(",", $t_empr) . ") ";
         //$requete.= $loc_filter;
         $requete .= "and pret_retour<now() and pret_idempr=id_empr and pret_idexpl=expl_id group by id_empr";
         $resultat = pmb_mysql_query($requete);
         $not_all_mail = 0;
         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_all_mail += print_relance($r->id_empr);
             }
         }
         $req = "select id_empr  from empr, pret, exemplaires, empr_categ where 1 ";
         $req .= "and pret_retour<CURDATE() and pret_idempr=id_empr and pret_idexpl=expl_id and id_categ_empr=empr_categ group by id_empr";
         $res = pmb_mysql_query($req);
         while ($r = pmb_mysql_fetch_object($res)) {
             $relance_liste .= get_relance($r->id_empr);
         }
         //modification du template importé
         //possiblité de l'appeler sans le mot global
         //(juste pour noté qu'elle n'est pas valorisée ici)
         global $export_relance_tpl;
         $export_relance_tpl = str_replace("!!relance_liste!!", $relance_liste, $export_relance_tpl);
         return $export_relance_tpl;
     } else {
         return 0;
     }
 }