diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 35705b661d9..5bfa27eadbc 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -428,10 +428,11 @@ class Conf
$this->global->MAIN_MAIL_USE_MULTI_PART=1;
// societe
- if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
- if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
+ if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
+ if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
- if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
+ if (empty($this->global->CHEQUERECEIPTS_ADDON)) $this->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint';
+ if (empty($conf->global->TICKETSUP_ADDON)) $this->global->TICKETSUP_ADDON='mod_ticket_simple';
// Security
if (empty($this->global->USER_PASSWORD_GENERATED)) $this->global->USER_PASSWORD_GENERATED='standard'; // Default password generator
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index e06e071ee89..20c4b4f5a90 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1286,8 +1286,8 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
* @param Conf $conf Object conf
* @param Translate $langs Object langs
* @param DoliDB $db Object db
- * @param mixed $filterobj Object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource
- * @param Contact $objcon Object contact
+ * @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object
+ * @param Contact $objcon Filter on object contact to filter events on a contact
* @param int $noprint Return string but does not output it
* @param string $actioncode Filter on actioncode
* @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all).
@@ -1295,11 +1295,10 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @return mixed Return html part or void if noprint is 1
- * TODO change function to be able to list event linked to an object.
*/
function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC')
{
- global $user,$conf;
+ global $user, $conf;
global $form;
global $param;
@@ -1317,14 +1316,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if (! empty($conf->agenda->enabled))
{
// Recherche histo sur actioncomm
- if (is_object($objcon) && $objcon->id) {
- $sql = "SELECT DISTINCT a.id, a.label,";
- }
- else
- {
- $sql = "SELECT a.id, a.label,";
- }
- $sql.= " a.datep as dp,";
+ if (is_object($objcon) && $objcon->id) {
+ $sql = "SELECT DISTINCT a.id, a.label,";
+ }
+ else
+ {
+ $sql = "SELECT a.id, a.label,";
+ }
+ $sql.= " a.datep as dp,";
$sql.= " a.datep2 as dp2,";
$sql.= " a.note, a.percent,";
$sql.= " a.fk_element, a.elementtype,";
@@ -1333,8 +1332,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
- elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
- elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') $sql.= ", o.ref";
+ else $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
@@ -1353,6 +1352,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o";
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
@@ -1372,6 +1372,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
+ elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket')
+ {
+ $sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
+ if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
+ }
// Work with new table actioncomm_resources and multiple contact affectation.
if (is_object($objcon) && $objcon->id)
@@ -1403,8 +1408,8 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']);
-
- //TODO Add limit for thirdparty in contexte very all result
+
+ //TODO Add limit for thirdparty in contexte very all result
$sql.= $db->order($sortfield, $sortorder);
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
$resql=$db->query($sql);
diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index e6ce5c1bddd..735050af437 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -103,7 +103,7 @@ function ticket_prepare_head($object)
// History
- $head[$h][0] = DOL_URL_ROOT.'/ticket/history.php?track_id=' . $object->track_id;
+ $head[$h][0] = DOL_URL_ROOT.'/ticket/agenda.php?track_id=' . $object->track_id;
$head[$h][1] = $langs->trans('Events');
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index 09725355f43..e8ae0a8e6c6 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -799,7 +799,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
}
// Set societeforaction.
- if ($object->socid > 0) $societeforaction->fetch($object->socid);
+ if ($object->socid > 0) $societeforaction->fetch($object->socid);
+ elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
$projectid = isset($object->fk_project)?$object->fk_project:0;
if ($object->element == 'project') $projectid = $object->id;
@@ -811,6 +812,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$elementid = $object->fk_adherent;
$elementtype = 'member';
}
+ //var_dump($societeforaction);var_dump($contactforaction);exit;
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql
index 143e30e8fb7..601e6c2aac3 100644
--- a/htdocs/install/mysql/data/llx_c_action_trigger.sql
+++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql
@@ -105,6 +105,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Expense report approved','Executed when an expense report is approved','expensereport',203);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_VALIDATE','Project validation','Executed when a project is validated','project',141);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_DELETE','Project deleted','Executed when a project is deleted','project',143);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',164);
-- actions not enabled by default (no constant created for that) when we enable module agenda
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',41);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_MODIFY','Member modified','Executed when a member is modified','member',23);
diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
new file mode 100644
index 00000000000..101bcb6f4f8
--- /dev/null
+++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql
@@ -0,0 +1,38 @@
+--
+-- Be carefull to requests order.
+-- This file must be loaded by calling /install/index.php page
+-- when current version is 9.0.0 or higher.
+--
+-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
+-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
+-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
+-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
+-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
+-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
+-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
+-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
+-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
+-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
+-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
+-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
+-- To make pk to be auto increment (postgres):
+-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
+-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
+-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
+-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
+-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
+-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
+-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
+-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
+-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
+-- Note: fields with type BLOB/TEXT can't have default value.
+
+
+-- Missing in 9.0
+
+
+
+-- For 10.0
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_CREATE','Ticket created','Executed when a ticket is created','ticket',161);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_MODIFY','Ticket modified','Executed when a ticket is modified','ticket',163);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TICKET_DELETE','Ticket deleted','Executed when a ticket is deleted','ticket',164);
diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang
index cd39a43abe8..95fadf00b68 100644
--- a/htdocs/langs/en_US/agenda.lang
+++ b/htdocs/langs/en_US/agenda.lang
@@ -92,6 +92,9 @@ EXPENSE_REPORT_REFUSEDInDolibarr=Expense report %s refused
PROJECT_CREATEInDolibarr=Project %s created
PROJECT_MODIFYInDolibarr=Project %s modified
PROJECT_DELETEInDolibarr=Project %s deleted
+TICKET_CREATEInDolibarr=Ticket %s created
+TICKET_MODIFYInDolibarr=Ticket %s modified
+TICKET_DELETEInDolibarr=Ticket %s deleted
##### End agenda events #####
AgendaModelModule=Document templates for event
DateActionStart=Start date
diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang
index 75de962b7ce..f7140d2c6ee 100644
--- a/htdocs/langs/en_US/ticket.lang
+++ b/htdocs/langs/en_US/ticket.lang
@@ -276,6 +276,7 @@ TicketNotificationLogMessage=Log message
TicketNotificationEmailBodyInfosTrackUrlinternal=View ticket into interface
TicketNotificationNumberEmailSent=Notification email sent : %s
+ActionsOnTicket=Events on ticket
#
# Boxes
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index 1f9b35b8420..92c187ce438 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -18,8 +18,8 @@
/**
* \file htdocs/projet/info.php
- * \ingroup commande
- * \brief Page with info on project
+ * \ingroup project
+ * \brief Page with events on project
*/
require '../main.inc.php';
@@ -34,7 +34,7 @@ $langs->load("projects");
$id = GETPOST('id','int');
$ref = GETPOST('ref','alpha');
$socid = GETPOST('socid','int');
-$action = GETPOST('action','alpha');
+$action = GETPOST('action','aZ09');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield","alpha");
@@ -50,16 +50,15 @@ $pagenext = $page + 1;
if (GETPOST('actioncode','array'))
{
- $actioncode=GETPOST('actioncode','array',3);
- if (! count($actioncode)) $actioncode='0';
+ $actioncode=GETPOST('actioncode','array',3);
+ if (! count($actioncode)) $actioncode='0';
}
else
{
- $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
+ $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
}
$search_agenda_label=GETPOST('search_agenda_label');
-
// Security check
$id = GETPOST("id",'int');
$socid=0;
@@ -71,7 +70,7 @@ if (!$user->rights->projet->lire) accessforbidden();
/*
- * Actions
+ * Actions
*/
$parameters=array('id'=>$socid);
@@ -81,8 +80,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
// Purge search criteria
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
{
- $actioncode='';
- $search_agenda_label='';
+ $actioncode='';
+ $search_agenda_label='';
}
diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php
new file mode 100644
index 00000000000..cddff9d2df6
--- /dev/null
+++ b/htdocs/ticket/agenda.php
@@ -0,0 +1,239 @@
+
+ *
+ * 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