Debug module workstation

This commit is contained in:
Laurent Destailleur
2021-04-05 14:56:47 +02:00
parent 6c521073ea
commit 685c880e6c
9 changed files with 71 additions and 52 deletions

View File

@@ -3525,7 +3525,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_recruitmentjobposition', 'object_recruitmentcandidature', 'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_movement', 'object_workstation',
'off', 'on', 'order', 'off', 'on', 'order',
'paiment', 'play', 'pdf', 'phone', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip', 'paiment', 'play', 'pdf', 'phone', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip',
'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
@@ -3537,7 +3537,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recruitmentcandidature', 'recruitmentjobposition', 'resource',
'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
'user-cog', 'website', 'user-cog', 'website', 'workstation',
'conferenceorbooth', 'eventorganization' 'conferenceorbooth', 'eventorganization'
))) { ))) {
$pictowithouttext = str_replace('object_', '', $pictowithouttext); $pictowithouttext = str_replace('object_', '', $pictowithouttext);
@@ -3585,7 +3585,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'title_agenda'=>'calendar-alt', 'title_agenda'=>'calendar-alt',
'uparrow'=>'share', 'vcard'=>'address-card', 'uparrow'=>'share', 'vcard'=>'address-card',
'jabber'=>'comment-o', 'jabber'=>'comment-o',
'website'=>'globe-americas', 'website'=>'globe-americas', 'workstation'=>'pallet',
'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram'
); );
if ($pictowithouttext == 'off') { if ($pictowithouttext == 'off') {
@@ -3619,7 +3619,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
if (in_array($pictowithouttext, array('dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment'))) { if (in_array($pictowithouttext, array('dollyrevert', 'member', 'members', 'contract', 'group', 'resource', 'shipment'))) {
$morecss = 'em092'; $morecss = 'em092';
} }
if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'project'))) { if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'project', 'workstation'))) {
$morecss = 'em088'; $morecss = 'em088';
} }
if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'stock', 'technic'))) { if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'stock', 'technic'))) {
@@ -3676,7 +3676,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'other'=>'#ddd', 'other'=>'#ddd',
'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba',
'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa',
'website'=>'#304' 'website'=>'#304', 'workstation'=>'#a69944'
); );
if (isset($arrayconvpictotocolor[$pictowithouttext])) { if (isset($arrayconvpictotocolor[$pictowithouttext])) {
$facolor = $arrayconvpictotocolor[$pictowithouttext]; $facolor = $arrayconvpictotocolor[$pictowithouttext];

View File

@@ -50,7 +50,7 @@ class modWorkstation extends DolibarrModules
$this->rights_class = 'workstation'; $this->rights_class = 'workstation';
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...' // Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
// It is used to group modules by family in module setup page // It is used to group modules by family in module setup page
$this->family = "other"; $this->family = "products";
// Module position in the family on 2 digits ('01', '10', '20', ...) // Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '90'; $this->module_position = '90';
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
@@ -71,7 +71,7 @@ class modWorkstation extends DolibarrModules
// Name of image file used for this module. // Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto = 'mrp'; $this->picto = 'workstation';
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...) // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array( $this->module_parts = array(
// Set this to 1 if module has its own trigger directory (core/triggers) // Set this to 1 if module has its own trigger directory (core/triggers)

View File

@@ -456,6 +456,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$listofmodule = array( $listofmodule = array(
'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly', 'MAIN_MODULE_ACCOUNTING'=>'newboxdefonly',
'MAIN_MODULE_AGENDA'=>'newboxdefonly', 'MAIN_MODULE_AGENDA'=>'newboxdefonly',
'MAIN_MODULE_BOM'=>'menuonly',
'MAIN_MODULE_BANQUE'=>'menuonly', 'MAIN_MODULE_BANQUE'=>'menuonly',
'MAIN_MODULE_BARCODE'=>'newboxdefonly', 'MAIN_MODULE_BARCODE'=>'newboxdefonly',
'MAIN_MODULE_CRON'=>'newboxdefonly', 'MAIN_MODULE_CRON'=>'newboxdefonly',
@@ -470,6 +471,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly', 'MAIN_MODULE_FOURNISSEUR'=>'newboxdefonly',
'MAIN_MODULE_HOLIDAY'=>'newboxdefonly', 'MAIN_MODULE_HOLIDAY'=>'newboxdefonly',
'MAIN_MODULE_MARGIN'=>'menuonly', 'MAIN_MODULE_MARGIN'=>'menuonly',
'MAIN_MODULE_MRP'=>'menuonly',
'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly', 'MAIN_MODULE_OPENSURVEY'=>'newboxdefonly',
'MAIN_MODULE_PAYBOX'=>'newboxdefonly', 'MAIN_MODULE_PAYBOX'=>'newboxdefonly',
'MAIN_MODULE_PRINTING'=>'newboxdefonly', 'MAIN_MODULE_PRINTING'=>'newboxdefonly',

View File

@@ -61,7 +61,7 @@ class Workstation extends CommonObject
/** /**
* @var string String with name of icon for workstation. Must be the part after the 'object_' into object_workstation.png * @var string String with name of icon for workstation. Must be the part after the 'object_' into object_workstation.png
*/ */
public $picto = 'mrp'; public $picto = 'workstation';
const STATUS_DISABLED = 0; const STATUS_DISABLED = 0;
@@ -100,7 +100,7 @@ class Workstation extends CommonObject
*/ */
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'picto'=>'mrp', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'showoncombobox'=>'1',),
'type' => array('type'=>'select', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),), 'type' => array('type'=>'select', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),

View File

@@ -85,7 +85,7 @@ if ($id > 0 || !empty($ref)) {
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
// Security check // Security check
restrictedArea($user, $object->element, $object->id); restrictedArea($user, $object->element, $object->id, '', 'workstation');
/* /*

View File

@@ -83,7 +83,7 @@ $permissiondellink = $user->rights->workstation->workstation->write; // Used by
$upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1]; $upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check // Security check
restrictedArea($user, $object->element, $object->id); restrictedArea($user, $object->element, $object->id, '', 'workstation');
/* /*
@@ -212,7 +212,7 @@ if ($action == 'create') {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print img_picto('', 'group'); print img_picto('', 'group');
print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $object->entity, true); print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $object->entity, true, 'minwidth200');
print '</td></tr>'; print '</td></tr>';
print '<tr id="wsresources"><td>'; print '<tr id="wsresources"><td>';
@@ -220,7 +220,7 @@ if ($action == 'create') {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print img_picto('', 'resource'); print img_picto('', 'resource');
print $formresource->select_resource_list($resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, '', true); print $formresource->select_resource_list($resources, 'resources', '', '', 0, '', '', $object->entity, true, 0, 'minwidth200', true);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes

View File

@@ -77,7 +77,7 @@ if ($id > 0 || !empty($ref)) {
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
// Security check // Security check
restrictedArea($user, $object->element, $object->id); restrictedArea($user, $object->element, $object->id, '', 'workstation');
/* /*

View File

@@ -28,9 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php';
// load workstation libraries
require_once __DIR__.'/class/workstation.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("workstation", "other")); $langs->loadLangs(array("workstation", "other"));
@@ -87,8 +85,9 @@ foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') { if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha'); $search[$key] = GETPOST('search_'.$key, 'alpha');
} }
if (in_array($key, array('type', 'status')) && GETPOST('search_'.$key, 'alpha') == -1) { if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key] = ''; $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
} }
} }
@@ -108,7 +107,7 @@ $arrayfields = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
// If $val['visible']==0, then we never show the field // If $val['visible']==0, then we never show the field
if (!empty($val['visible'])) { if (!empty($val['visible'])) {
$visible = dol_eval($val['visible'], 1); $visible = (int) dol_eval($val['visible'], 1);
$arrayfields['t.'.$key] = array( $arrayfields['t.'.$key] = array(
'label'=>$val['label'], 'label'=>$val['label'],
'checked'=>(($visible < 0) ? 0 : 1), 'checked'=>(($visible < 0) ? 0 : 1),
@@ -146,7 +145,7 @@ $permissiontoadd = $user->rights->workstation->workstation->write;
$permissiontodelete = $user->rights->workstation->workstation->delete; $permissiontodelete = $user->rights->workstation->workstation->delete;
// Security check // Security check
restrictedArea($user, $object->element, 0); restrictedArea($user, $object->element, 0, '', 'workstation');
/* /*
@@ -154,7 +153,8 @@ restrictedArea($user, $object->element, 0);
*/ */
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = ''; $action = 'list';
$massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = ''; $massaction = '';
@@ -174,6 +174,10 @@ if (empty($reshook)) {
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$search[$key] = ''; $search[$key] = '';
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = '';
$search[$key.'_dtend'] = '';
}
} }
$groups=$resources=array(); $groups=$resources=array();
$toselect = ''; $toselect = '';
@@ -203,19 +207,15 @@ $formresource = new FormResource($db);
$now = dol_now(); $now = dol_now();
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Workstations")); $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Workstations"));
//$help_url="EN:Module_Workstation|FR:Module_Workstation_FR|ES:Módulo_Workstation";
$help_url = 'EN:Module_Workstation'; $help_url = 'EN:Module_Workstation';
$morejs = array();
llxHeader('', $title, $help_url); $morecss = array();
// Build and execute select // Build and execute select
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$sql = 'SELECT '; $sql = 'SELECT ';
foreach ($object->fields as $key => $val) { $sql .= $object->getFieldList('t');
$sql .= 't.'.$key.', ';
}
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
@@ -247,12 +247,13 @@ if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE 1 = 1"; $sql .= " WHERE 1 = 1";
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) { if ($key == 'status' && $search[$key] == -1) {
continue; continue;
} }
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) { if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
if ($search[$key] == '-1') { if ($search[$key] == '-1' || $search[$key] === '0') {
$search[$key] = ''; $search[$key] = '';
} }
$mode_search = 2; $mode_search = 2;
@@ -260,6 +261,19 @@ foreach ($search as $key => $val) {
if ($search[$key] != '') { if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
} }
} else {
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
if (preg_match('/_dtstart$/', $key)) {
$sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'";
}
if (preg_match('/_dtend$/', $key)) {
$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
}
}
}
}
} }
if ($search_all) { if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all); $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
@@ -283,10 +297,8 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
/* If a group by is required
$sql.= " GROUP BY "; $sql.= " GROUP BY ";
foreach($object->fields as $key => $val) foreach ($object->fields as $key => $val) {
{
$sql.='t.'.$key.', '; $sql.='t.'.$key.', ';
} }
// Add fields from extrafields // Add fields from extrafields
@@ -295,11 +307,9 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) {
} }
// Add where from hooks // Add where from hooks
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql=preg_replace('/,\s*$/','', $sql); $sql=preg_replace('/,\s*$/', '', $sql);
*/
$sql.= ' GROUP BY t.rowid';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
@@ -341,7 +351,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
// Output page // Output page
// -------------------------------------------------------------------- // --------------------------------------------------------------------
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs');
// Example : Adding jquery code // Example : Adding jquery code
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
@@ -476,10 +486,17 @@ foreach ($object->fields as $key => $val) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) { } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) { } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">'; print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
} }
print '</td>'; print '</td>';
} }
@@ -583,7 +600,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; print '<tr class="oddeven">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif ($key == 'status') { } elseif ($key == 'status') {

View File

@@ -61,7 +61,7 @@ $permissionnote = $user->rights->workstation->workstation->write; // Used by the
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php $permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
// Security check // Security check
restrictedArea($user, $object->element, $object->id); restrictedArea($user, $object->element, $object->id, '', 'workstation');
/* /*