Fix field resolution
This commit is contained in:
parent
9954a0e4bb
commit
0c3bf536f2
@ -122,8 +122,18 @@ class modTicket extends DolibarrModules
|
|||||||
}
|
}
|
||||||
$this->dictionaries = array(
|
$this->dictionaries = array(
|
||||||
'langs' => 'ticket',
|
'langs' => 'ticket',
|
||||||
'tabname' => array(MAIN_DB_PREFIX."c_ticket_type", MAIN_DB_PREFIX."c_ticket_severity", MAIN_DB_PREFIX."c_ticket_category", MAIN_DB_PREFIX."c_ticket_resolution"),
|
'tabname' => array(
|
||||||
'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory", "TicketDictResolution"),
|
MAIN_DB_PREFIX."c_ticket_type",
|
||||||
|
MAIN_DB_PREFIX."c_ticket_severity",
|
||||||
|
MAIN_DB_PREFIX."c_ticket_category",
|
||||||
|
MAIN_DB_PREFIX."c_ticket_resolution"
|
||||||
|
),
|
||||||
|
'tablib' => array(
|
||||||
|
"TicketDictType",
|
||||||
|
"TicketDictSeverity",
|
||||||
|
"TicketDictCategory",
|
||||||
|
"TicketDictResolution"
|
||||||
|
),
|
||||||
'tabsql' => array(
|
'tabsql' => array(
|
||||||
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f',
|
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f',
|
||||||
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f',
|
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f',
|
||||||
@ -135,7 +145,7 @@ class modTicket extends DolibarrModules
|
|||||||
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
|
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
|
||||||
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
|
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
|
||||||
'tabrowid' => array("rowid", "rowid", "rowid", "rowid"),
|
'tabrowid' => array("rowid", "rowid", "rowid", "rowid"),
|
||||||
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled),
|
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled && !empty($conf->global->TICKET_ENABLE_RESOLUTION)),
|
||||||
'tabhelp' => array(
|
'tabhelp' => array(
|
||||||
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
|
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
|
||||||
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
|
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
|
||||||
|
|||||||
@ -272,7 +272,7 @@ class Ticket extends CommonObject
|
|||||||
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
|
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
|
||||||
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
|
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
|
||||||
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1),
|
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1),
|
||||||
//'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1),
|
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1),
|
||||||
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')),
|
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')),
|
||||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||||
);
|
);
|
||||||
@ -286,6 +286,8 @@ class Ticket extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function __construct($db)
|
public function __construct($db)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->statuts_short = array(
|
$this->statuts_short = array(
|
||||||
|
|||||||
@ -45,7 +45,7 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
|
|||||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||||
|
|
||||||
@ -73,8 +73,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
|
|||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||||
|
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||||
$page = 0;
|
$page = 0;
|
||||||
} // If $page is not defined, or '' or -1 or if we click on clear filters
|
}
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -107,12 +108,16 @@ if (GETPOST('search_fk_status', 'alpha') == 'non_closed') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initialize array of search criterias
|
// Initialize array of search criterias
|
||||||
$search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall'));
|
$search_all = (GETPOSTISSET("search_all") ? GETPOST("search_all", 'alpha') : GETPOST('sall'));
|
||||||
$search = array();
|
$search = array();
|
||||||
foreach ($object->fields as $key => $val) {
|
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 (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||||
|
$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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
@ -126,12 +131,19 @@ $fieldstosearchall['s.name_alias'] = "AliasNameShort";
|
|||||||
$fieldstosearchall['s.zip'] = "Zip";
|
$fieldstosearchall['s.zip'] = "Zip";
|
||||||
$fieldstosearchall['s.town'] = "Town";
|
$fieldstosearchall['s.town'] = "Town";
|
||||||
|
|
||||||
// Definition of fields for list
|
// Definition of array of fields for columns
|
||||||
$arrayfields = array();
|
$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'])) {
|
||||||
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
$visible = (int) dol_eval($val['visible'], 1);
|
||||||
|
$arrayfields['t.'.$key] = array(
|
||||||
|
'label'=>$val['label'],
|
||||||
|
'checked'=>(($visible < 0) ? 0 : 1),
|
||||||
|
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||||
|
'position'=>$val['position'],
|
||||||
|
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
@ -139,8 +151,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
|||||||
|
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
//if ($socid > 0) $arrayfields['t.fk_soc']['enabled']=0;
|
|
||||||
//if ($projectid > 0) $arrayfields['t.fk_project']['enabled']=0;
|
|
||||||
|
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user