From f75255191413827a6f037a10338d585508e2bc24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 Jan 2020 14:53:47 +0100 Subject: [PATCH] WIP Generic stats page --- htdocs/core/class/html.form.class.php | 36 +++++++++++++++++++++----- htdocs/core/lib/security.lib.php | 2 +- htdocs/langs/en_US/exports.lang | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/societe/class/societe.class.php | 3 ++- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 38e18d24b8b..a072688a703 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8034,11 +8034,12 @@ class Form /** * Output the component to make advanced search criteries * - * @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...) - * @param array $search_component_params Array of selected search criterias - * @return string HTML component for advanced search + * @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...) + * @param array $search_component_params Array of selected search criterias + * @param array $arrayofinputfieldsalreadyoutput Array of input fields already inform. The component will not generate a hidden input field if it is in this list. + * @return string HTML component for advanced search */ - public function searchComponent($arrayofcriterias, $search_component_params) + public function searchComponent($arrayofcriterias, $search_component_params, $arrayofhiddenfieldstoadd = array()) { global $conf, $langs; @@ -8046,12 +8047,33 @@ class Form $ret .= '
'; //$ret .= ''; - $ret .= ''; + $ret .= ''; $ret .= ''; $ret .= $langs->trans("Filters"); $ret .= ''; - $ret .= ''; - $ret .= ''; + //$ret .= ''; + $ret .= '
'; + $ret .= ''; + $ret .= '
'; + foreach($arrayofcriterias as $criterias) { + foreach($criterias as $criteriafamilykey => $criteriafamilyval) { + if (in_array('search_'.$criteriafamilykey, $arrayofhiddenfieldstoadd)) continue; + if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) continue; + if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { + $ret .= ''; + $ret .= ''; + $ret .= ''; + $ret .= ''; + $ret .= ''; + $ret .= ''; + $ret .= ''; + $ret .= ''; + } + else { + $ret .= ''; + } + } + } $ret .= '
'; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 5a7b8342bd6..93f17422c47 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -171,7 +171,7 @@ function dol_verifyHash($chain, $hash, $type = '0') * @param string $features Features to check (it must be module name. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional). - * @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'level1|level2'. + * @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'sublevela|sublevelb'. * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param int $isdraft 1=The object with id=$objectid is a draft diff --git a/htdocs/langs/en_US/exports.lang b/htdocs/langs/en_US/exports.lang index ef5ff029c78..2dcf4317e00 100644 --- a/htdocs/langs/en_US/exports.lang +++ b/htdocs/langs/en_US/exports.lang @@ -37,7 +37,7 @@ FormatedExportDesc3=When data to export are selected, you can choose the format Sheet=Sheet NoImportableData=No importable data (no module with definitions to allow data imports) FileSuccessfullyBuilt=File generated -SQLUsedForExport=SQL Request used to build export file +SQLUsedForExport=SQL Request used to extract data LineId=Id of line LineLabel=Label of line LineDescription=Description of line diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c5c24372e06..3054b813f72 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1015,6 +1015,7 @@ ContactAddedAutomatically=Contact added from contact thirdparty roles More=More ShowDetails=Show details CustomReports=Custom reports +StatisticsOn=Statistics on SelectYourGraphOptionsFirst=Select your graph options to build a graph Measures=Measures XAxis=X-Axis diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ec4ac4182d6..f22455cea1b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -128,7 +128,7 @@ class Societe extends CommonObject public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'name_alias' =>array('type'=>'varchar(128)', 'label'=>'AliasNames', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), @@ -3779,6 +3779,7 @@ class Societe extends CommonObject /** * Check if we must use revenue stamps feature or not according to country (country of $mysocin most cases). + * Table c_revenuestamp contains the country and value of stamp per invoice. * * @return boolean true or false */