Skip to content

Commit

Permalink
Work on ticket module integration
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 13, 2018
1 parent cd71e49 commit 8048259
Show file tree
Hide file tree
Showing 20 changed files with 127 additions and 76 deletions.
6 changes: 6 additions & 0 deletions .tx/config
Expand Up @@ -356,6 +356,12 @@ source_file = htdocs/langs/en_US/supplier_proposal.lang
source_lang = en_US
type = MOZILLAPROPERTIES

[dolibarr.ticketsup]
file_filter = htdocs/langs/<lang>/ticketsup.lang
source_file = htdocs/langs/en_US/ticketsup.lang
source_lang = en_US
type = MOZILLAPROPERTIES

[dolibarr.trips]
file_filter = htdocs/langs/<lang>/trips.lang
source_file = htdocs/langs/en_US/trips.lang
Expand Down
26 changes: 14 additions & 12 deletions htdocs/core/lib/admin.lib.php
Expand Up @@ -1031,7 +1031,8 @@ function unActivateModule($value, $requiredby=1)


/**
* Add external modules to list of dictionaries
* Add external modules to list of dictionaries.
* Addition is done into var $taborder, $tabname, etc... that are passed with pointers.
*
* @param array $taborder Taborder
* @param array $tabname Tabname
Expand Down Expand Up @@ -1097,23 +1098,20 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
if ($modulequalified)
{
// Load languages files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}

// Complete arrays
//&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
foreach ($objMod->langfiles as $langfile) {
$langs->load($langfile);
}
}

// Complete the arrays &$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
if (empty($objMod->dictionaries) && ! empty($objMod->dictionnaries)) $objMod->dictionaries=$objMod->dictionnaries; // For backward compatibility

if (! empty($objMod->dictionaries))
{
//var_dump($objMod->dictionaries['tabname']);
$nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0;
foreach($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = max($taborder)+1; $tabname[] = $val; }
foreach($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = max($taborder)+1; $tabname[] = $val; } // Position
foreach($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; }
foreach($objMod->dictionaries['tabsql'] as $val) { $nbtabsql++; $tabsql[] = $val; }
foreach($objMod->dictionaries['tabsqlsort'] as $val) { $nbtabsqlsort++; $tabsqlsort[] = $val; }
Expand All @@ -1130,6 +1128,10 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
//print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n";
}
else
{
$taborder[] = 0; // Add an empty line
}
}

$j++;
Expand Down
15 changes: 0 additions & 15 deletions htdocs/core/modules/modApi.class.php
Expand Up @@ -125,21 +125,6 @@ function __construct($db)
$conf->api->enabled=0;
}
$this->dictionaries=array();
/* Example:
if (! isset($conf->api->enabled)) $conf->api->enabled=0; // This is to avoid warnings
$this->dictionaries=array(
'langs'=>'mylangfile@api',
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor
'tablib'=>array("Table1","Table2","Table3"), // Label of tables
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields
'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order
'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary)
'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record)
'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert)
'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid')
'tabcond'=>array($conf->api->enabled,$conf->api->enabled,$conf->api->enabled) // Condition to show each dictionary
);
*/

// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
Expand Down
5 changes: 2 additions & 3 deletions htdocs/core/modules/modTicketsup.class.php
Expand Up @@ -311,8 +311,7 @@ public function init($options = '')
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110121, 'ticketsup', 'internal', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110122, 'ticketsup', 'external', 'SUPPORTCLI', 'Contact client suivi incident', 1);", "ignoreerror" => 1),
array("sql" => "insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) values (110123, 'ticketsup', 'external', 'CONTRIBUTOR', 'Intervenant', 1);", "ignoreerror" => 1),
array("sql" => "insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values ('','TICKETMESSAGE_SENTBYMAIL','Envoi message de réponse par mail','Executed when a response is made on a ticket','ticketsup','');", "ignoreerror" => 1),

array("sql" => "insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values ('','TICKETMESSAGE_SENTBYMAIL','Send email for ticket','Executed when a response is made on a ticket','ticketsup','');", "ignoreerror" => 1),
);

$result = $this->loadTables();
Expand Down Expand Up @@ -345,6 +344,6 @@ public function remove($options = '')
*/
private function loadTables()
{
return $this->_load_tables('/ticketsup/sql/');
return $this->_load_tables();
}
}
20 changes: 20 additions & 0 deletions htdocs/install/mysql/data/llx_c_ticketsup_category.sql
@@ -0,0 +1,20 @@
-- Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- Contenu de la table llx_c_ticketsup_category
--

INSERT INTO llx_c_ticketsup_category (code, pos, label, active, use_default, description) VALUES('OTHER', '10', 'Other', 1, 1, NULL);
24 changes: 19 additions & 5 deletions htdocs/install/mysql/data/llx_c_ticketsup_severity.sql
@@ -1,9 +1,23 @@

-- Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- Contenu de la table llx_c_ticketsup_severity
--

INSERT INTO llx_c_ticketsup_severity (rowid, code, pos, label, color, active, use_default, description) VALUES(1, 'LOW', '10', 'Bas', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (rowid, code, pos, label, color, active, use_default, description) VALUES(2, 'NORMAL', '20', 'Normal', '', 1, 1, NULL);
INSERT INTO llx_c_ticketsup_severity (rowid, code, pos, label, color, active, use_default, description) VALUES(3, 'LOWHIGH', '30', 'Important', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (rowid, code, pos, label, color, active, use_default, description) VALUES(4, 'HIGH', '40', 'Critique / bloquant', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('LOW', '10', 'Low', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('NORMAL', '20', 'Normal', '', 1, 1, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('HIGH', '30', 'High', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('BLOCKING', '40', 'Critical / blocking', '', 1, 0, NULL);
26 changes: 21 additions & 5 deletions htdocs/install/mysql/data/llx_c_ticketsup_type.sql
@@ -1,8 +1,24 @@

-- Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- Contenu de la table llx_c_ticketsup_type
--
INSERT INTO llx_c_ticketsup_type (rowid, code, pos, label, active, use_default, description) VALUES(1, 'COM', '10', 'Question commerciale', 1, 1, NULL);
INSERT INTO llx_c_ticketsup_type (rowid, code, pos, label, active, use_default, description) VALUES(2, 'INCIDENT', '20', 'Demande d''assistance', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_type (rowid, code, pos, label, active, use_default, description) VALUES(3, 'PROJET', '30', 'Suivi projet', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_type (rowid, code, pos, label, active, use_default, description) VALUES(4, 'OTHER', '40', 'Autre', 1, 0, NULL);

INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('COM', '10', 'Commercial question', 1, 1, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('ISSUE', '20', 'Issue or problem' , 1, 0, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('REQUEST', '25', 'Change or enhancement request', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('PROJECT', '30', 'Project', 0, 0, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 0, NULL);
17 changes: 0 additions & 17 deletions htdocs/install/mysql/data/llx_ticketsup.sql

This file was deleted.

41 changes: 32 additions & 9 deletions htdocs/install/mysql/migration/7.0.0-8.0.0.sql
Expand Up @@ -185,38 +185,38 @@ CREATE TABLE llx_ticketsup_extrafields
import_key varchar(14)
)ENGINE=innodb;

ALTER TABLE llx_c_ticketsup_category ADD INDEX idx_code (code);

CREATE TABLE llx_c_ticketsup_category

-- Create dictionaries tables for ticket
create table llx_c_ticketsup_severity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
color varchar(10) NOT NULL,
active integer DEFAULT 1,
use_default integer DEFAULT 1,
description varchar(255)
)ENGINE=innodb;

ALTER TABLE llx_c_ticketsup_severity ADD INDEX idx_code (code);

CREATE TABLE llx_c_ticketsup_severity
create table llx_c_ticketsup_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
color varchar(10) NOT NULL,
active integer DEFAULT 1,
use_default integer DEFAULT 1,
description varchar(255)
)ENGINE=innodb;

ALTER TABLE llx_c_ticketsup_type ADD INDEX idx_code (code);

CREATE TABLE llx_c_ticketsup_type
create table llx_c_ticketsup_category
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
Expand All @@ -225,6 +225,29 @@ CREATE TABLE llx_c_ticketsup_type
description varchar(255)
)ENGINE=innodb;

ALTER TABLE llx_c_ticketsup_category ADD UNIQUE INDEX uk_code (code, entity);
ALTER TABLE llx_c_ticketsup_severity ADD UNIQUE INDEX uk_code (code, entity);
ALTER TABLE llx_c_ticketsup_type ADD UNIQUE INDEX uk_code (code, entity);



-- Load data
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('LOW', '10', 'Low', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('NORMAL', '20', 'Normal', '', 1, 1, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('HIGH', '30', 'High', '', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_severity (code, pos, label, color, active, use_default, description) VALUES('BLOCKING', '40', 'Critical / blocking', '', 1, 0, NULL);

INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('COM', '10', 'Commercial question', 1, 1, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('ISSUE', '20', 'Issue or problem' , 1, 0, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('REQUEST', '25', 'Change or enhancement request', 1, 0, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('PROJECT', '30', 'Project', 0, 0, NULL);
INSERT INTO llx_c_ticketsup_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 0, NULL);

INSERT INTO llx_c_ticketsup_category (code, pos, label, active, use_default, description) VALUES('OTHER', '10', 'Other', 1, 1, NULL);





ALTER TABLE llx_facturedet_rec ADD COLUMN date_start_fill integer DEFAULT 0;
ALTER TABLE llx_facturedet_rec ADD COLUMN date_end_fill integer DEFAULT 0;
Expand Down
Expand Up @@ -15,4 +15,4 @@
--
--

ALTER TABLE llx_c_ticketsup_category ADD INDEX idx_code (code);
ALTER TABLE llx_c_ticketsup_category ADD UNIQUE INDEX uk_code (code, entity);
1 change: 1 addition & 0 deletions htdocs/install/mysql/tables/llx_c_ticketsup_category.sql
Expand Up @@ -18,6 +18,7 @@
create table llx_c_ticketsup_category
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
Expand Down
Expand Up @@ -15,4 +15,4 @@
--
--

ALTER TABLE llx_c_ticketsup_severity ADD INDEX idx_code (code);
ALTER TABLE llx_c_ticketsup_severity ADD UNIQUE INDEX uk_code (code, entity);
1 change: 1 addition & 0 deletions htdocs/install/mysql/tables/llx_c_ticketsup_severity.sql
Expand Up @@ -18,6 +18,7 @@
create table llx_c_ticketsup_severity
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/mysql/tables/llx_c_ticketsup_type.key.sql
Expand Up @@ -15,4 +15,4 @@
--
--

ALTER TABLE llx_c_ticketsup_type ADD INDEX idx_code (code);
ALTER TABLE llx_c_ticketsup_type ADD UNIQUE INDEX uk_code (code, entity);
1 change: 1 addition & 0 deletions htdocs/install/mysql/tables/llx_c_ticketsup_type.sql
Expand Up @@ -18,6 +18,7 @@
create table llx_c_ticketsup_type
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1,
code varchar(32) NOT NULL,
pos varchar(32) NOT NULL,
label varchar(128) NOT NULL,
Expand Down
6 changes: 3 additions & 3 deletions htdocs/langs/en_US/ticketsup.lang
Expand Up @@ -29,7 +29,7 @@ Permission56005=See tickets of all thirdparties (not effective for external user

TicketsupDictType=Tickets type
TicketsupDictCategory=Tickets categories
TicketsupDictSeverity=Severity classifications
TicketsupDictSeverity=Tickets severity
TicketTypeShortBUGSOFT=Dysfonctionnement logiciel
TicketTypeShortBUGHARD=Dysfonctionnement matériel
TicketTypeShortCOM=Commercial question
Expand All @@ -39,8 +39,8 @@ TicketTypeShortOTHER=Other

TicketSeverityShortLOW=Low
TicketSeverityShortNORMAL=Normal
TicketSeverityShortLOWHIGH=Important
TicketSeverityShortHIGH=Critical
TicketSeverityShortHIGH=High
TicketSeverityShortBLOCKING=Critical/Blocking

ErrorBadEmailAddress=Field '%s' incorrect
MenuTicketsupMyAssign=My tickets
Expand Down
4 changes: 2 additions & 2 deletions htdocs/theme/eldy/img/menus/README.md
Expand Up @@ -2,8 +2,8 @@
Tutorial to create a new image for menu:

1) First find an image.
2) With Gimp, open image and check there is a alpha channel. If not add one.
3) Convert image into back and white (Menu Image - Mode - Grey levels).
2) With Gimp, open image and check there is a alpha channel. If not add one (Menu Color - Convert to alpha).
3) Convert image into black and white (Menu Image - Mode - Grey levels).
4) Use the degrade tool with option (Menu Tools - Paint - Degrade - CTRL+L):
* Mode: Erase color (you can also try "Clear only")
* Opacity: 50 +/-
Expand Down
Binary file removed htdocs/ticketsup/img/ticketsup-32.png
Binary file not shown.
2 changes: 1 addition & 1 deletion htdocs/ticketsup/list.php
Expand Up @@ -439,7 +439,7 @@
print '<input type="hidden" name="mode" value="' . $mode . '" >';


print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'img/ticketsup-32.png', 1);
print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'title_ticketsup');

if ($mode == 'my_assign') {
print '<div class="opacitymedium">' . $langs->trans('TicketAssignedToMeInfos') . '</div><br>';
Expand Down

0 comments on commit 8048259

Please sign in to comment.