diff --git a/bureau/admin/mail_list.php b/bureau/admin/mail_list.php index 0eba53d1..e8003d3d 100644 --- a/bureau/admin/mail_list.php +++ b/bureau/admin/mail_list.php @@ -29,6 +29,7 @@ include_once("head.php"); $fields = array ( "mail_arg" => array ("request", "integer", ""), // from mail_add.php in case of error "domain_id" => array ("request", "integer", ""), + "show_systemmails" => array ("request", "integer", ""), "search" => array ("request", "string", ""), "offset" => array ("request", "integer", 0), "count" => array ("request", "integer", 50), @@ -46,7 +47,7 @@ if(!$domain_id ) { $fatal=false; if ($domain=$dom->get_domain_byid($domain_id)) { - if(!($mails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count))) { + if(!($mails_list = $mail->enum_domain_mails($domain_id,$search,$offset,$count,$show_systemmails))) { $error=$err->errstr(); } } else { @@ -54,7 +55,6 @@ if ($domain=$dom->get_domain_byid($domain_id)) { $fatal=true; } - if ($fatal) { echo "
$error
"; } else { @@ -92,10 +92,14 @@ if (isset($error) && !empty($error)) { <?php __(" title="" src="/images/search.png" style="vertical-align: middle"/> - total,"mail_list.php?domain_id=".$domain_id."&count=".$count."&search=".urlencode($search)."&offset=%%offset%%"); ?> - + + + value="1"> + + +
@@ -138,14 +142,14 @@ while (list($key,$val)=each($mails_list)){ - + 60chars, use "..." + js close/open */ ?> - - "> + query("SELECT domaines.id,domaines.domaine, IFNULL(mail, 0) as nb_mail FROM domaines LEFT JOIN - (SELECT address.id, COUNT(*) AS mail - FROM address - WHERE type='' - GROUP BY address.domain_id) lol - USING (id) - WHERE COMPTE={$uid}"); + (SELECT address.id, COUNT(*) AS mail + FROM address + WHERE type='' + GROUP BY address.domain_id) subreq + USING (id) + WHERE COMPTE={$uid} + order by domaines.domaine"); $this->enum_domains=array(); while($db->next_record()){ $this->enum_domains[]=$db->Record; @@ -182,7 +183,7 @@ class m_mail { * @param $count integer return no more than THAT much emails. -1 for ALL. Offset is ignored then. * @result an array of each mail hosted under the domain. */ - function enum_domain_mails($dom_id = null, $search="", $offset=0, $count=30){ + function enum_domain_mails($dom_id = null, $search="", $offset=0, $count=30, $show_systemmails=false){ global $db,$err,$cuid,$hooks; $err->log("mail","enum_domains_mail"); @@ -190,6 +191,7 @@ class m_mail { $where="a.domain_id=$dom_id"; if ($search) $where.=" AND (a.address LIKE '%".addslashes($search)."%' OR r.recipients LIKE '%".addslashes($search)."%')"; + if (!$show_systemmails) $where.=" AND type='' "; $db->query("SELECT count(a.id) AS total FROM address a LEFT JOIN recipient r ON r.address_id=a.id WHERE $where;"); $db->next_record(); $this->total=$db->f("total"); @@ -206,8 +208,8 @@ class m_mail { $details=$db->Record; // if necessary, fill the typedata with data from hooks ... if ($details["type"]) { - $result=$hooks->invoke("hook_mail_get_details",array($details["id"])); // Will fill typedata if necessary - $details["typedata"]=implode("
",$result); + $result=$hooks->invoke("hook_mail_get_details",array($details["id"])); // Will fill typedata if necessary + $details["typedata"]=implode("
",$result); } $res[]=$details; } while ($db->next_record());