diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 5a5e520d455..1004986ffe5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -58,8 +58,8 @@ $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_author=GETPOST('search_author','alpha'); $search_product_category=GETPOST('search_product_category','int'); $search_town=GETPOST('search_town','alpha'); -$viewstatut=$db->escape(GETPOST('viewstatut')); -$object_statut=$db->escape(GETPOST('propal_statut')); +$viewstatut=GETPOST('viewstatut'); +$object_statut=GETPOST('propal_statut'); $sall=GETPOST("sall"); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 291d4b4557f..898f228fdb2 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,10 +28,13 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php'; $WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); +$object_statut=GETPOST('propal_statut'); + $userid=GETPOST('userid','int'); $socid=GETPOST('socid','int'); // Security check @@ -55,11 +58,12 @@ $mode=GETPOST('mode'); */ $form=new Form($db); +$formpropal=new FormPropal($db); $langs->load('propal'); $langs->load('other'); -llxHeader(); +llxHeader('', $langs->trans("ProposalsStatistics")); print_fiche_titre($langs->trans("ProposalsStatistics"),'','title_commercial.png'); @@ -67,7 +71,9 @@ $dir=$conf->propal->dir_temp; dol_mkdir($dir); + $stats = new PropaleStats($db, $socid, ($userid>0?$userid:0)); +if ($object_statut != '' && $object_statut >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_statut.')'; // Build graphic number of object $data = $stats->getNbByMonthWithPrevYear($endyear,$startyear); @@ -113,7 +119,7 @@ if (! $mesg) } // Build graphic amount of object -$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear); +$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,0); // $data = array(array('Lib',val1,val2,val3),...) if (!$user->rights->societe->client->voir || $user->societe_id) @@ -154,7 +160,7 @@ if (! $mesg) $px2->draw($filenameamount,$fileurlamount); } -$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); +$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear, $filter); $fileurl_avg=''; if (!$user->rights->societe->client->voir || $user->societe_id) @@ -239,6 +245,10 @@ print '
'; print ''.$langs->trans("CreatedBy").''; print $form->select_dolusers($userid,'userid',1); print ''; + // Status + print ''.$langs->trans("Status").''; + $formpropal->selectProposalStatus($object_statut,0,1); + print ''; // Year print ''.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php index 987d5d76682..e3f21212e8b 100644 --- a/htdocs/core/class/html.formpropal.class.php +++ b/htdocs/core/class/html.formpropal.class.php @@ -45,11 +45,13 @@ class FormPropal * Return combo list of differents status of a proposal * Values are id of table c_propalst * - * @param string $selected Preselected value - * @param int $short Use short labels + * @param string $selected Preselected value + * @param int $short Use short labels + * @param int $excludedraft 0=All status, 1=Exclude draft status + * @param int $showempty 1=Add empty line * @return void */ - function selectProposalStatus($selected='',$short=0) + function selectProposalStatus($selected='',$short=0, $excludedraft=0, $showempty=1) { global $langs; @@ -61,7 +63,7 @@ class FormPropal if ($resql) { print '