Skip to content
Snippets Groups Projects
Commit bba06b74 authored by SNA's avatar SNA
Browse files

FEAT #1313 add filter entity

parent e5477a67
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,10 @@ $graph = new graphics(); ...@@ -13,6 +13,10 @@ $graph = new graphics();
$req = new request(); $req = new request();
$db = new dbquery(); $db = new dbquery();
$sec = new security(); $sec = new security();
$entities_chosen=explode("#",$_POST['entities_chosen']);
$entities_chosen=join(",",$entities_chosen);
$period_type = $_REQUEST['period_type']; $period_type = $_REQUEST['period_type'];
$status_obj = new manage_status(); $status_obj = new manage_status();
$ind_coll = $sec->get_ind_collection('letterbox_coll'); $ind_coll = $sec->get_ind_collection('letterbox_coll');
...@@ -24,6 +28,7 @@ $report_type = $_REQUEST['report_type']; ...@@ -24,6 +28,7 @@ $report_type = $_REQUEST['report_type'];
$core_tools = new core_tools(); $core_tools = new core_tools();
$core_tools->load_lang(); $core_tools->load_lang();
//Limitation aux documents pouvant être recherchés //Limitation aux documents pouvant être recherchés
$str_status = '('; $str_status = '(';
for($i=0;$i<count($search_status);$i++) for($i=0;$i<count($search_status);$i++)
...@@ -33,13 +38,20 @@ for($i=0;$i<count($search_status);$i++) ...@@ -33,13 +38,20 @@ for($i=0;$i<count($search_status);$i++)
$str_status = preg_replace('/,$/', ')', $str_status); $str_status = preg_replace('/,$/', ')', $str_status);
//Récupération de l'ensemble des types de documents //Récupération de l'ensemble des types de documents
$db->query("select entity_id, short_label from ".ENT_ENTITIES." where enabled = 'Y' order by short_label"); if (!$_REQUEST['entities_chosen']){
$db->query("select entity_id, short_label from ".ENT_ENTITIES." where enabled = 'Y' order by short_label");
}else{
$db->query("select entity_id, short_label from ".ENT_ENTITIES." where enabled = 'Y' and entity_id IN (".$entities_chosen.") order by short_label");
}
// $db->show();
$entities = array(); $entities = array();
while($res = $db->fetch_object()) while($res = $db->fetch_object())
{ {
array_push($entities, array('ID' => $res->entity_id, 'LABEL' => $res->short_label)); array_push($entities, array('ID' => $res->entity_id, 'LABEL' => $res->short_label));
} }
//var_dump($entities);
if($period_type == 'period_year') if($period_type == 'period_year')
{ {
if(empty($_REQUEST['the_year']) || !isset($_REQUEST['the_year'])) if(empty($_REQUEST['the_year']) || !isset($_REQUEST['the_year']))
...@@ -59,6 +71,7 @@ if($period_type == 'period_year') ...@@ -59,6 +71,7 @@ if($period_type == 'period_year')
$where_date = " and ".$req->extract_date('creation_date', 'year')." = '".$_REQUEST['the_year']."'"; $where_date = " and ".$req->extract_date('creation_date', 'year')." = '".$_REQUEST['the_year']."'";
$date_title = _FOR_YEAR.' '.$_REQUEST['the_year']; $date_title = _FOR_YEAR.' '.$_REQUEST['the_year'];
} }
else if($period_type == 'period_month') else if($period_type == 'period_month')
{ {
$arr_month = array('01','02','03','04','05','06','07','08','09','10','11','12'); $arr_month = array('01','02','03','04','05','06','07','08','09','10','11','12');
...@@ -212,7 +225,10 @@ for($i=0; $i<count($entities);$i++) ...@@ -212,7 +225,10 @@ for($i=0; $i<count($entities);$i++)
array_push($totalCourrier, $res->total); array_push($totalCourrier, $res->total);
} }
if ($res->total<>0){
$has_data = true; $has_data = true;
}
} }
if($report_type == 'array'){ if($report_type == 'array'){
...@@ -228,7 +244,7 @@ if($report_type == 'graph') ...@@ -228,7 +244,7 @@ if($report_type == 'graph')
$largeur=1000; $largeur=1000;
} }
$src1 = $_SESSION['config']['businessappurl']."index.php?display=true&module=reports&page=graphs&type=histo&largeur=$largeur&hauteur=600&marge_bas=250&title=".$title; $src1 = $_SESSION['config']['businessappurl']."index.php?display=true&module=reports&page=graphs&type=histo&largeur=$largeur&hauteur=600&marge_bas=300&title=".$title;
$_SESSION['GRAPH']['VALUES']=''; $_SESSION['GRAPH']['VALUES']='';
for($i=0;$i<count($vol_an);$i++) for($i=0;$i<count($vol_an);$i++)
{ {
...@@ -240,13 +256,14 @@ elseif($report_type == 'array') ...@@ -240,13 +256,14 @@ elseif($report_type == 'array')
{ {
array_unshift($data, array('LABEL' => _ENTITY, 'VALUE' => _NB_MAILS1)); array_unshift($data, array('LABEL' => _ENTITY, 'VALUE' => _NB_MAILS1));
} }
//echo $src1;
if($has_data) if($has_data)
{ {
if($report_type == 'graph') if($report_type == 'graph')
{ {
?> ?>
<div style="overflow:auto"><img src="<?php echo $src1;?>" alt=""/></div><br/><br/> <div style="overflow:auto"><img src="<?php echo $src1;?>" alt="" id="src1" /></div><br/><br/>
<?php <?php
} }
elseif($report_type == 'array') elseif($report_type == 'array')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment