From f5eb8b0108ef77d10a66f8896e8208729456cf82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Sep 2020 04:21:35 +0200 Subject: [PATCH] Look and feel v13 --- htdocs/langs/en_US/ticket.lang | 2 +- htdocs/societe/class/societe.class.php | 3 +-- htdocs/ticket/class/ticket.class.php | 4 ++-- htdocs/ticket/list.php | 26 ++++++++++++++++++++++++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 59519282c80..e6f9e612a59 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -44,7 +44,7 @@ TicketTypeShortOTHER=Other TicketSeverityShortLOW=Low TicketSeverityShortNORMAL=Normal TicketSeverityShortHIGH=High -TicketSeverityShortBLOCKING=Critical/Blocking +TicketSeverityShortBLOCKING=Critical, Blocking ErrorBadEmailAddress=Field '%s' incorrect MenuTicketMyAssign=My tickets diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index de02c5a595a..b208135121b 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1472,7 +1472,7 @@ class Societe extends CommonObject if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($barcode) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6) && empty($email)) return -1; - $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; + $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; $sql .= ', s.price_level'; $sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif'; @@ -1546,7 +1546,6 @@ class Societe extends CommonObject $this->nom = $obj->name; // deprecated $this->name_alias = $obj->name_alias; $this->ref_ext = $obj->ref_ext; - $this->ref_int = $obj->ref_int; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 8404eef74d0..6b3b1ea8fd4 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -228,9 +228,9 @@ class Ticket extends CommonObject 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200', 'autofocusoncreate'=>1), - 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth150'), + 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth150 tdoverflowmax50'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), + 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index ebab0b6566d..184216ea47e 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -721,6 +721,7 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co // -------------------------------------------------------------------- $i = 0; $totalarray = array(); +$cacheofoutputfield = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -753,9 +754,14 @@ while ($i < min($num, $limit)) if ($cssforfield || $val['css']) print '"'; print '>'; if ($key == 'fk_statut') print $object->getLibStatut(5); + elseif ($key == 'type_code') { + $s = $langs->getLabelFromKey($db, 'TicketTypeShort' . $object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); + print ''; + print $s; + print ''; + } elseif ($key == 'category_code') print $langs->getLabelFromKey($db, 'TicketCategoryShort' . $object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); elseif ($key == 'severity_code') print $langs->getLabelFromKey($db, 'TicketSeverityShort' . $object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code); - elseif ($key == 'type_code') print $langs->getLabelFromKey($db, 'TicketTypeShort' . $object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code); elseif ($key == 'tms') print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser'); elseif ($key == 'fk_user_create') { if ($object->fk_user_create > 0) { @@ -763,7 +769,23 @@ while ($i < min($num, $limit)) print $user_create->getNomUrl(-1); } } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); - else print $object->showOutputField($val, $key, $obj->$key, ''); + else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ... + $tmp = explode(':', $val['type']); + if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) { + // It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making. + //var_dump('eeee-'.$key.'-'.$obj->$key.'-'.$val['type']); + if ($key && $obj->$key && $val['type'] && array_key_exists($key.'-'.$obj->$key.'-'.$val['type'], $cacheofoutputfield)) { + $result = $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']]; + } else { + $result = $object->showOutputField($val, $key, $obj->$key, ''); + $cacheofoutputfield[$key.'-'.$obj->$key.'-'.$val['type']] = $result; + } + } else { + $result = $object->showOutputField($val, $key, $obj->$key, ''); + } + print $result; + } + print ''; if (!$i) $totalarray['nbfield']++; if (!empty($val['isameasure']))