Skip to content
Snippets Groups Projects
Commit c9ce9555 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Finish work "Can filter on status on objects on the "statistics" pages"

parent 5c6ecf9a
Branches
No related tags found
No related merge requests found
...@@ -61,6 +61,7 @@ class FichinterStats extends Stats ...@@ -61,6 +61,7 @@ class FichinterStats extends Stats
$this->userid = $userid; $this->userid = $userid;
$this->cachefilesuffix = $mode; $this->cachefilesuffix = $mode;
$this->where.= " c.entity = ".$conf->entity;
if ($mode == 'customer') if ($mode == 'customer')
{ {
$object=new Fichinter($this->db); $object=new Fichinter($this->db);
...@@ -68,10 +69,8 @@ class FichinterStats extends Stats ...@@ -68,10 +69,8 @@ class FichinterStats extends Stats
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl"; $this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
$this->field='0'; $this->field='0';
$this->field_line='0'; $this->field_line='0';
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled //$this->where.= " AND c.fk_statut > 0"; // Not draft and not cancelled
} }
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where.= " AND c.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($this->socid) if ($this->socid)
{ {
......
...@@ -47,6 +47,8 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear; ...@@ -47,6 +47,8 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear;
$startyear=$year-1; $startyear=$year-1;
$endyear=$year; $endyear=$year;
$object_status=GETPOST('object_status');
$langs->load('interventions'); $langs->load('interventions');
$langs->load('companies'); $langs->load('companies');
$langs->load('other'); $langs->load('other');
...@@ -58,6 +60,7 @@ $langs->load('suppliers'); ...@@ -58,6 +60,7 @@ $langs->load('suppliers');
*/ */
$form=new Form($db); $form=new Form($db);
$objectstatic=new FichInter($db);
if ($mode == 'customer') if ($mode == 'customer')
{ {
...@@ -72,6 +75,7 @@ print load_fiche_titre($title,'','title_commercial.png'); ...@@ -72,6 +75,7 @@ print load_fiche_titre($title,'','title_commercial.png');
dol_mkdir($dir); dol_mkdir($dir);
$stats = new FichinterStats($db, $socid, $mode, ($userid>0?$userid:0)); $stats = new FichinterStats($db, $socid, $mode, ($userid>0?$userid:0));
if ($object_status != '' && $object_status > -1) $stats->where .= ' AND c.fk_statut IN ('.$object_status.')';
// Build graphic number of object // Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
...@@ -249,6 +253,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">'; ...@@ -249,6 +253,12 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// User // User
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">'; print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
// Status
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
$liststatus=$objectstatic->statuts_short;
if (empty($conf->global->FICHINTER_CLASSIFY_BILLED)) unset($liststatus[2]); // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
print $form->selectarray('object_status', $liststatus, $object_status, 1, 0, 0, '', 1);
print '</td></tr>';
// Year // Year
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">'; print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment