diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 2a6b5f33a27..fa21c37649f 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -173,6 +173,7 @@ class DolibarrApi unset($object->stats_mrptoproduce); unset($object->element); + unset($object->element_for_permission); unset($object->fk_element); unset($object->table_element); unset($object->table_element_line); diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 15a29c0e18b..c1735d56e50 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -209,7 +209,7 @@ class Setup extends DolibarrApi if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -272,7 +272,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -373,7 +373,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -665,7 +665,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -729,7 +729,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -797,7 +797,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -860,7 +860,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -933,7 +933,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1004,7 +1004,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1078,7 +1078,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1143,9 +1143,9 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1202,9 +1202,9 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } - $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; } @@ -1261,7 +1261,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1324,7 +1324,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1383,7 +1383,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1449,7 +1449,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1508,7 +1508,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1567,7 +1567,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; @@ -1628,7 +1628,7 @@ class Setup extends DolibarrApi if ($sqlfilters) { $errormessage = ''; if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index b2c9543453b..fb064a317fd 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2591,6 +2591,12 @@ class ContratLigne extends CommonObjectLine */ public $table_element = 'contratdet'; + + /** + * @var string Name to use for 'features' parameter to check module permissions with restrictedArea() + */ + public $element_for_permission = 'contrat'; + /** * @var int ID */ @@ -2723,6 +2729,34 @@ class ContratLigne extends CommonObjectLine const STATUS_CLOSED = 5; + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields = array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>30, 'index'=>1), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35), + 'qty' =>array('type'=>'integer', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35, 'isameasure'=>1), + 'total_ht' =>array('type'=>'integer', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>36, 'isameasure'=>1), + 'total_tva' =>array('type'=>'integer', 'label'=>'AmountVAT', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>37, 'isameasure'=>1), + 'total_ttc' =>array('type'=>'integer', 'label'=>'AmountTTC', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>38, 'isameasure'=>1), + //'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + //'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), + 'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), + 'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + //'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), + 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), + //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), + //'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), + 'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserOpen', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), + 'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCloture', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135), + 'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed')) + ); + // END MODULEBUILDER PROPERTIES + /** * Constructor diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 87f6ba693fc..ab4d40456b4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -83,6 +83,11 @@ abstract class CommonObject */ public $element; + /** + * @var string Name to use for 'features' parameter to check module permissions with restrictedArea(). Undefined means same value than $element. + */ + public $element_for_permission; + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 09225f97158..70bf1eeb2df 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9744,24 +9744,45 @@ class Form $ret = ''; - $ret .= '
'; + $ret .= '
'; //$ret .= ''; $ret .= ''; - $ret .= ''; - $ret .= $langs->trans("Filters"); + $ret .= ''; + //$ret .= $langs->trans("Filters"); $ret .= ''; - //$ret .= ''; - $ret .= '
'; - $texttoshow = '
'.$langs->trans("Search").'
'; - $ret .= '
'.$texttoshow.'
'; - $ret .= '
'; - $ret .= "\n"; - if (GETPOST('show_search_component_params_hidden', 'int')) { + $ret .= '
'; + + // Show select fields as tags. + $ret .= '
'; + + if ($search_component_params_hidden) { + if (!preg_match('/^\(.*\)$/', $search_component_params_hidden)) { // If $search_component_params_hidden does not start and end with () + $search_component_params_hidden .= '('.$search_component_params_hidden.')'; + } + $errormessage = ''; + if (!dolCheckFilters($search_component_params_hidden, $errormessage)) { + print 'ERROR in parsing search string'; + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; + //var_dump($search_component_params_hidden); + $htmltags = preg_replace_callback('/'.$regexstring.'/', 'dolForgeCriteriaCallback', $search_component_params_hidden); + //var_dump($htmltags); + $ret .= 'x '.$htmltags.''; + } + + //$ret .= ''; + + //$ret .= search_component_params + //$texttoshow = '
'.$langs->trans("Search").'
'; + //$ret .= '
'.$texttoshow.'
'; + + $show_search_component_params_hidden = 1; + if ($show_search_component_params_hidden) { $ret .= ''; } - $ret .= ''; - + $ret .= ""; + $ret .= ''; // For compatibility with forms that show themself the search criteria in addition of this component, we output the fields foreach ($arrayofcriterias as $criterias) { foreach ($criterias as $criteriafamilykey => $criteriafamilyval) { @@ -9785,8 +9806,14 @@ class Form } } } + $ret .= '
'; + $ret .= "\n"; + $ret .= ''; + + $ret .= '
'; + $ret .= '
'; return $ret; } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 22cdde32b1b..ad0c74ab9a8 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1479,9 +1479,10 @@ class FormOther * @param array $search_groupby Array of preselected fields * @param array $arrayofgroupby Array of groupby to fill * @param string $morecss More CSS + * @param string $showempty '1' or 'text' * @return string HTML string component */ - public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250') + public function selectGroupByField($object, $search_groupby, &$arrayofgroupby, $morecss = 'minwidth200 maxwidth250', $showempty = '1') { global $langs, $extrafields, $form; @@ -1493,7 +1494,7 @@ class FormOther $SS = substr($langs->trans("Second"), 0, 1).substr($langs->trans("Second"), 0, 1); foreach ($object->fields as $key => $val) { - if (!$val['measure']) { + if (!$val['isameasure']) { if (in_array($key, array( 'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams', 'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) { @@ -1541,7 +1542,7 @@ class FormOther foreach ($arrayofgroupby as $key => $val) { $arrayofgroupbylabel[$key] = $val['label']; } - $result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, 1, 0, 0, '', 0, 0, 0, '', $morecss, 1); + $result = $form->selectarray('search_groupby', $arrayofgroupbylabel, $search_groupby, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); return $result; } @@ -1552,9 +1553,10 @@ class FormOther * @param mixed $object Object analyzed * @param array $search_xaxis Array of preselected fields * @param array $arrayofxaxis Array of groupby to fill - * @return string HTML string component + * @param string $showempty '1' or 'text' + * @return string HTML string component */ - public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis) + public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1') { global $langs, $extrafields, $form; @@ -1589,9 +1591,9 @@ class FormOther continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y'); - $arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m'); - $arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d'); + $arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.')', 'position' => $val['position'].'-y'); + $arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => $val['position'].'-m'); + $arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => $val['position'].'-d'); } else { $arrayofxaxis['t.'.$key] = array('label' => $langs->trans($val['label']), 'position' => (int) $val['position']); } @@ -1617,7 +1619,7 @@ class FormOther foreach ($arrayofxaxis as $key => $val) { $arrayofxaxislabel[$key] = $val['label']; } - $result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 1, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1); + $result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250', 1); return $result; } diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index fafd1c015e8..dcedf1405f8 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -99,7 +99,8 @@ $arrayoftype = array( 'order' => array('label' => 'Orders', 'ObjectClassName' => 'Commande', 'enabled' => $conf->commande->enabled, 'ClassPath' => "/commande/class/commande.class.php"), 'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/facture/class/facture.class.php"), 'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => "/compta/class/facturerec.class.php", 'langs'=>'bills'), - 'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contract'), + 'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contracts'), + 'contractdet' => array('label' => 'ContractLines', 'ObjectClassName' => 'ContratLigne', 'enabled' => $conf->contrat->enabled, 'ClassPath' => "/contrat/class/contrat.class.php", 'langs'=>'contracts'), 'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled), 'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mrp->enabled, 'ClassPath' => "/mrp/class/mo.class.php"), 'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled), @@ -159,6 +160,11 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $search_component_params = array(''); $search_component_params_hidden = GETPOST('search_component_params_hidden', 'alphanohtml'); +// For the case we enter a criteria manually, the search_component_params_input will be defined and must be used in priority +if (GETPOST('search_component_params_input', 'alphanohtml')) { + $search_component_params_hidden = GETPOST('search_component_params_input', 'alphanohtml'); +} + $MAXUNIQUEVALFORGROUP = 20; $MAXMEASURESINBARGRAPH = 20; @@ -175,7 +181,12 @@ $arrayofgroupby = array(); $arrayofyaxis = array(); $arrayofvaluesforgroupby = array(); -restrictedArea($user, $object->element, 0, ''); +$features = $object->element; +if (!empty($object->element_for_permission)) { + $features = $object->element_for_permission; +} + +restrictedArea($user, $features, 0, ''); $error = 0; @@ -420,22 +431,22 @@ if ($object->isextrafieldmanaged) { } } } -print '
'.$langs->trans("Measures").'
'; -print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1); +print '
'.$langs->trans("Measures").'
'; +print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth400', 1); // Fill the array $arrayofmeasures with possible fields print '
'; // XAxis print '
'; -print '
'.$langs->trans("XAxis").'
'; -print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis); +print '
'; +print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields print '
'; // Group by print '
'; -print '
'.$langs->trans("GroupBy").'
'; -print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby); +print '
'; +print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields print '
'; @@ -561,7 +572,7 @@ if (!empty($search_measures) && !empty($search_xaxis)) { $sql .= ' AND entity IN ('.getEntity($object->element).')'; } // Add the where here - $sqlfilters = GETPOST('search_component_params_hidden', 'alphanohtml'); + $sqlfilters = $search_component_params_hidden; if ($sqlfilters) { $errormessage = ''; if (dolCheckFilters($sqlfilters, $errormessage)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ea8c5f41f61..c1a4dbedc39 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10801,7 +10801,7 @@ function dolForgeCriteriaCallback($matches) { global $db; - //dol_syslog("Convert matches ".$matches[1]); + dol_syslog("Convert matches ".$matches[1]); if (empty($matches[1])) { return ''; } diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index 937c5a7397b..746c7fdfeb6 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -20,6 +20,7 @@ ContractsSubscriptions=Contracts/Subscriptions ContractsAndLine=Contracts and line of contracts Contract=Contract ContractLine=Contract line +ContractLines=Contract lines Closing=Closing NoContracts=No contracts MenuServices=Services diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 3d750cbcc38..2890d29e0e8 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -189,7 +189,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla borderglobal->THEME_SHOW_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px var(--inputbordercolor); /* padding: 5px; */ } -.pageplusone, +.pageplusone, .divadvancedsearchfieldcompinput, div.tabBar input, div.tabBar input.flat, div.tabBar textarea, div.tabBar textarea.flat, div.tabBar form.flat select, div.tabBar select, div.tabBar select.flat, div.tabBar .dataTables_length label select { borderglobal->THEME_SHOW_BORDER_ON_INPUT) ? '-bottom' : ''; ?>: solid 1px var(--inputbordercolor); @@ -202,6 +202,10 @@ div.tabBar input, div.tabBar input.flat, div.tabBar textarea, div.tabBar textare } ?> } +.divadvancedsearchfieldcompinput { + background: #fff; + border-bottom: solid 1px var(--inputbordercolor); +} input[name=duration_value], input[name=durationhour] { margin-right: 4px !important; @@ -269,7 +273,7 @@ section.setupsection { div.tabBar textarea:focus { border: 1px solid #aaa !important; } -input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input), select:focus, .select2-container--open .select2-selection--single { +input:focus:not(.button):not(.select2-search__field):not(#top-bookmark-search-input):not(.search_component_input), select:focus, .select2-container--open .select2-selection--single { /* div.tabBar input:focus, div.tabBar select:focus { */ border-bottom: 1px solid #666 !important; border-bottom-left-radius: 0 !important; @@ -1032,8 +1036,8 @@ div.divsearchfield { background: #fff; padding-top: 3px; padding-bottom: 3px; - padding-left: 10px; - padding-right: 10px; + padding-: 0; + padding-: 0; border-bottom: solid 1px var(--inputbordercolor); height: 24px; } @@ -1046,6 +1050,32 @@ div.divsearchfield { margin: 0 !important; padding: 3px; } +.tagsearch { + padding: 2px; + padding-right: 4px; + padding-bottom: 3px; + background: #ddd; + border-radius: 4px; +} +.tagsearchdelete { + color: #999; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 2px; + padding-left: 4px; +} + +.caretleftaxis { + margin-left: -13px; + margin-top: -1px; + position: absolute; +} +.caretdownaxis { + margin-left: -12px; + margin-top: 0; + position: absolute; +} .a-filter, .a-mesure { border-radius: 50px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index cd6f04b43fb..7879368eee3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -623,12 +623,12 @@ td.amount, span.amount, div.amount, b.amount { td.actionbuttons a { padding-left: 6px; } -select.flat, form.flat select, .pageplusone { +select.flat, form.flat select, .pageplusone, .divadvancedsearchfieldcompinput, { font-weight: normal; font-size: unset; height: 2em; } -input.pageplusone { +input.pageplusone, .divadvancedsearchfieldcompinput, { padding-bottom: 4px; padding-top: 4px; } @@ -1155,6 +1155,48 @@ div.divsearchfield { .divadvancedsearchfield span.select2.select2-container.select2-container--default { padding-bottom: 4px; } +.divadvancedsearchfieldcompinput { + background: #fff; + border-bottom: solid 1px var(--inputbordercolor); +} + +.search_component_params { + /*display: flex; */ + -webkit-flex-flow: row wrap; + flex-flow: row wrap; + background: #fff; + padding-top: 3px; + padding-bottom: 3px; + padding-: 0; + padding-: 0; + border-bottom: solid 1px var(--inputbordercolor); + height: 24px; +} +.search_component_searchtext { + padding-top: 2px; +} +.search_component_params_text, .search_component_params_text:focus { + border-bottom: none; + width: auto; + margin: 0 !important; + padding: 3px; +} +.tagsearch { + padding: 2px; + padding-right: 4px; + padding-bottom: 3px; + background: #ddd; + border-radius: 4px; +} +.tagsearchdelete { + color: #999; + cursor: pointer; + display: inline-block; + font-weight: bold; + margin-right: 2px; + padding-left: 4px; +} + browser->layout == 'phone') {