From d8ce744e4c4dc70c897775203f56f1c28c1ce588 Mon Sep 17 00:00:00 2001 From: hystepik Date: Wed, 25 Jan 2023 16:56:27 +0100 Subject: [PATCH] New : Export for module ticket --- htdocs/core/modules/modTicket.class.php | 28 +++++++++++++++++++++++++ htdocs/langs/en_US/ticket.lang | 3 +++ 2 files changed, 31 insertions(+) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 37e6552af2f..ff80385235f 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -208,6 +208,13 @@ class modTicket extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'manage'; + $r++; + $this->rights[$r][0] = 56006; // id de la permission + $this->rights[$r][1] = "Export ticket"; // 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] = 'export'; + /* Seems not used and in conflict with societe->client->voir (see all thirdparties) $r++; $this->rights[$r][0] = 56005; // id de la permission @@ -318,6 +325,27 @@ class modTicket extends DolibarrModules 'target' => '', 'user' => 0); $r++; + + // Exports + //-------- + $r = 1; + + // Export list of tickets and attributes + $langs->load("ticket"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ExportDataset_ticket_1'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r] = array(array("ticket", "export")); + $this->export_icon[$r]='ticket'; + $keyforclass = 'Ticket';$keyforclassfile='/ticket/class/ticket.class.php';$keyforelement='ticket'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $keyforselect='ticket'; $keyforaliasextra='extra'; $keyforelement='ticket'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'ticket as t'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'ticket_extrafields as extra on (t.rowid = extra.fk_object)'; + $this->export_sql_end[$r] .=' WHERE 1 = 1'; + $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('ticket').')'; + $r++; } /** diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index ea560012afc..de54d475591 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -26,6 +26,7 @@ Permission56002=Modify tickets Permission56003=Delete tickets Permission56004=Manage tickets Permission56005=See tickets of all third parties (not effective for external users, always be limited to the third party they depend on) +Permission56006=Export tickets Tickets=Tickets TicketDictType=Ticket - Types @@ -61,6 +62,8 @@ TypeContact_ticket_external_CONTRIBUTOR=External contributor OriginEmail=Reporter Email Notify_TICKET_SENTBYMAIL=Send ticket message by email +ExportDataset_ticket_1=Tickets + # Status Read=Read Assigned=Assigned