From e6dd312bd5cf8683488c038e13a3094f379fc364 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Mar 2018 13:56:45 +0100 Subject: [PATCH] Debug ticket module --- htdocs/core/boxes/box_last_modified_ticketsup.php | 6 +++--- htdocs/core/boxes/box_last_ticketsup.php | 6 +++--- htdocs/core/modules/modTicketsup.class.php | 5 +++++ htdocs/langs/en_US/ticketsup.lang | 8 ++++---- htdocs/modulebuilder/template/myobject_list.php | 1 + htdocs/ticketsup/class/ticketsup.class.php | 5 ++--- htdocs/ticketsup/list.php | 10 ++++------ 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/core/boxes/box_last_modified_ticketsup.php b/htdocs/core/boxes/box_last_modified_ticketsup.php index fd49653eced..c63864b0fe0 100644 --- a/htdocs/core/boxes/box_last_modified_ticketsup.php +++ b/htdocs/core/boxes/box_last_modified_ticketsup.php @@ -18,9 +18,9 @@ */ /** - * \file ticketsup/core/boxes/ticketsup_latest.php - * \ingroup ticketsup - * \brief This box shows latest UNREAD tickets + * \file core/boxes/box_last_modified_ticketsup.php + * \ingroup ticketsup + * \brief This box shows latest modified tickets */ require_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php"; diff --git a/htdocs/core/boxes/box_last_ticketsup.php b/htdocs/core/boxes/box_last_ticketsup.php index 6044bb179f5..5c39229835b 100644 --- a/htdocs/core/boxes/box_last_ticketsup.php +++ b/htdocs/core/boxes/box_last_ticketsup.php @@ -18,9 +18,9 @@ */ /** - * \file ticketsup/core/boxes/ticketsup_latest.php - * \ingroup ticketsup - * \brief This box shows latest tickets + * \file core/boxes/box_ticketsup_latest.php + * \ingroup ticketsup + * \brief This box shows latest created tickets */ require_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php"; diff --git a/htdocs/core/modules/modTicketsup.class.php b/htdocs/core/modules/modTicketsup.class.php index c6a6ada09f9..235ab092478 100644 --- a/htdocs/core/modules/modTicketsup.class.php +++ b/htdocs/core/modules/modTicketsup.class.php @@ -162,30 +162,35 @@ class modTicketsup extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module + $r=0; $this->rights[$r][0] = 56001; // id de la permission $this->rights[$r][1] = "Read ticket"; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'read'; + $r++; $this->rights[$r][0] = 56002; // id de la permission $this->rights[$r][1] = "Create les tickets"; // libelle de la permission $this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'write'; + $r++; $this->rights[$r][0] = 56003; // id de la permission $this->rights[$r][1] = "Delete les tickets"; // libelle de la permission $this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'delete'; + $r++; $this->rights[$r][0] = 56004; // id de la permission $this->rights[$r][1] = "Manage tickets"; // libelle de la permission //$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour) $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'manage'; + $r++; $this->rights[$r][0] = 56005; // id de la permission $this->rights[$r][1] = 'See all tickets, even if not assigned to (not effective for external users, always restricted to the thirdpardy they depends on)'; // libelle de la permission $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) diff --git a/htdocs/langs/en_US/ticketsup.lang b/htdocs/langs/en_US/ticketsup.lang index 9064222637a..a4e04930def 100644 --- a/htdocs/langs/en_US/ticketsup.lang +++ b/htdocs/langs/en_US/ticketsup.lang @@ -291,11 +291,11 @@ TicketNotificationNumberEmailSent=Notification email sent : %s # # Boxes # -BoxLastTicketsup=Last tickets -BoxLastTicketsupDescription=Last %s tickets saved +BoxLastTicketsup=Latest created tickets +BoxLastTicketsupDescription=Latest %s created tickets BoxLastTicketsupContent= BoxLastTicketsupNoRecordedTickets=No recent unread tickets -BoxLastModifiedTicketsup=Last modified tickets -BoxLastModifiedTicketsupDescription=Last %s tickets modified +BoxLastModifiedTicketsup=Latest modified tickets +BoxLastModifiedTicketsupDescription=Latest %s modified tickets BoxLastModifiedTicketsupContent= BoxLastModifiedTicketsupNoRecordedTickets=No recent modified tickets diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 2ef8fa97030..2ac18cb5db4 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -220,6 +220,7 @@ if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity( else $sql.=" WHERE 1 = 1"; foreach($search as $key => $val) { + if ($key == 'status' && $search[$key] == -1) continue; $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0); if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); } diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php index f35f73c33e5..a7b95bedbbe 100644 --- a/htdocs/ticketsup/class/ticketsup.class.php +++ b/htdocs/ticketsup/class/ticketsup.class.php @@ -181,7 +181,6 @@ class Ticketsup extends CommonObject 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AuthorAssign', 'visible'=>1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>12, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>60, 'notnull'=>-1,), - 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'NotRead', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')), 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-2, 'enabled'=>1, 'position'=>40, 'notnull'=>1), 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>1, 'enabled'=>1, 'position'=>41, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'help'=>""), @@ -191,8 +190,8 @@ class Ticketsup extends CommonObject 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1) - + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>501, 'notnull'=>1), + 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'NotRead', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')) ); /** diff --git a/htdocs/ticketsup/list.php b/htdocs/ticketsup/list.php index b4c208e270b..a54394522f8 100644 --- a/htdocs/ticketsup/list.php +++ b/htdocs/ticketsup/list.php @@ -214,8 +214,9 @@ if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity( else $sql.=" WHERE 1 = 1"; foreach($search as $key => $val) { + if ($key == 'fk_statut' && $search[$key] == -1) continue; $mode_search=(($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key]))?1:0); - if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search)); + if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search)); } if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); @@ -436,8 +437,9 @@ print ''; print ''; print ''; +$buttontocreate = '
' . $langs->trans('NewTicket') . '
'; -print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'title_ticketsup'); +print_barre_liste($langs->trans('TicketList'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_ticketsup', 0, $buttontocreate, '', $limit); if ($mode == 'my_assign') { print '
' . $langs->trans('TicketAssignedToMeInfos') . '

'; @@ -674,10 +676,6 @@ print ''."\n"; print ''."\n"; -print '
'; -print ''; -print '
'; - if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {