diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php
index 8e4334c6214..1f0ada4a6f3 100644
--- a/htdocs/admin/defaultvalues.php
+++ b/htdocs/admin/defaultvalues.php
@@ -251,6 +251,7 @@ print '
';
$texthelp=$langs->trans("PageUrlForDefaultValues");
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
+$texthelp.='
'.$langs->trans("AlsoDefaultValuesAreEffectiveForActionCreate");
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param, '', $sortfield, $sortorder);
// Field
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index f6cf1c33e9f..1d681d2672b 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -852,19 +852,7 @@ class FormTicket
print '';
}
- // Substitution array
- if ($this->withsubstit) {
- print '
| ';
- $help="";
- foreach ($this->substit as $key => $val) {
- $help.=$key.' -> '.$langs->trans($val).' ';
- }
- print $form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
- print " |
";
- }
-
- // Private message or not. TODO What does this means ?
- /*
+ // Private message (not visible by customer/external user)
if (! $user->socid) {
print ' | ';
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
@@ -873,7 +861,7 @@ class FormTicket
print ' | ';
print $form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
print ' |
';
- }*/
+ }
print '| ' . $langs->trans('Subject') . ' | ';
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 90abbe90fc6..daba22fe660 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -470,6 +470,7 @@ TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. Technical knowled
PageUrlForDefaultValues=You must enter the relative path of the page URL. If you include parameters in URL, the default values will be effective if all parameters are set to same value.
PageUrlForDefaultValuesCreate=
Example:
For the form to create a new third party, it is %s.
For URL of external modules installed into custom directory, do not include the "custom/", so use path like mymodule/mypage.php and not custom/mymodule/mypage.php.
If you want default value only if url has some parameter, you can use %s
PageUrlForDefaultValuesList=
Example:
For the page that lists third parties, it is %s.
For URL of external modules installed into custom directory, do not include the "custom/" so use a path like mymodule/mypagelist.php and not custom/mymodule/mypagelist.php.
If you want default value only if url has some parameter, you can use %s
+AlsoDefaultValuesAreEffectiveForActionCreate=Also note that overwritting default values for form creation works only for pages that were correctly designed (so with parameter action=create...)
EnableDefaultValues=Enable customization of default values
EnableOverwriteTranslation=Enable usage of overwritten translation
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code. To change this value, you must edit it from Home-Setup-translation.
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 299607c9cde..dab1b896a67 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -369,8 +369,9 @@ if ($action == "assign_user" && GETPOST('btn_assign_user', 'aplha') && $user->ri
$action = 'view';
}
-if ($action == "add_message" && GETPOST('btn_create_message') && $user->rights->ticket->read) {
+if ($action == "add_message" && GETPOST('btn_add_message') && $user->rights->ticket->read) {
$ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0));
+
if ($ret > 0) {
if (!empty($backtopage)) {
$url = $backtopage;
@@ -1228,11 +1229,43 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
else
{
- $action='add_message';
+ $action='add_message'; // action to use to post the message
$modelmail='ticket_send';
+ // Substitution array
+ $morehtmlright='';
+ $help="";
+ $substitutionarray=array();
+ if ($object->fk_soc > 0) {
+ $object->fetch_thirdparty();
+ $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
+ }
+ $substitutionarray['__SIGNATURE__'] = $user->signature;
+ $substitutionarray['__TICKETSUP_TRACKID__'] = $object->track_id;
+ $substitutionarray['__TICKETSUP_REF__'] = $object->ref;
+ $substitutionarray['__TICKETSUP_SUBJECT__'] = $object->subject;
+ $substitutionarray['__TICKETSUP_TYPE__'] = $object->type_code;
+ $substitutionarray['__TICKETSUP_SEVERITY__'] = $object->severity_code;
+ $substitutionarray['__TICKETSUP_CATEGORY__'] = $object->category_code; // For backward compatibility
+ $substitutionarray['__TICKETSUP_ANALYTIC_CODE__'] = $object->category_code;
+ $substitutionarray['__TICKETSUP_MESSAGE__'] = $object->message;
+ $substitutionarray['__TICKETSUP_PROGRESSION__'] = $object->progress;
+ if ($object->fk_user_assign > 0) {
+ $userstat->fetch($object->fk_user_assign);
+ $substitutionarray['__TICKETSUP_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
+ }
+
+ if ($object->fk_user_create > 0) {
+ $userstat->fetch($object->fk_user_create);
+ $substitutionarray['__TICKETSUP_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
+ }
+ foreach ($substitutionarray as $key => $val) {
+ $help.=$key.' -> '.$langs->trans($val).'
';
+ }
+ $morehtmlright.=$form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
+
print '';
- print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket');
+ print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket');
print '
';
@@ -1265,30 +1298,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$formticket->withsubstit = 1;
-
- if ($object->fk_soc > 0) {
- $object->fetch_thirdparty();
- $formticket->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
- }
- $formticket->substit['__SIGNATURE__'] = $user->signature;
- $formticket->substit['__TICKETSUP_TRACKID__'] = $object->track_id;
- $formticket->substit['__TICKETSUP_REF__'] = $object->ref;
- $formticket->substit['__TICKETSUP_SUBJECT__'] = $object->subject;
- $formticket->substit['__TICKETSUP_TYPE__'] = $object->type_code;
- $formticket->substit['__TICKETSUP_SEVERITY__'] = $object->severity_code;
- $formticket->substit['__TICKETSUP_CATEGORY__'] = $object->category_code; // For backward compatibility
- $formticket->substit['__TICKETSUP_ANALYTIC_CODE__'] = $object->category_code;
- $formticket->substit['__TICKETSUP_MESSAGE__'] = $object->message;
- $formticket->substit['__TICKETSUP_PROGRESSION__'] = $object->progress;
- if ($object->fk_user_assign > 0) {
- $userstat->fetch($object->fk_user_assign);
- $formticket->substit['__TICKETSUP_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
- }
-
- if ($object->fk_user_create > 0) {
- $userstat->fetch($object->fk_user_create);
- $formticket->substit['__TICKETSUP_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
- }
+ $formticket->substit = $substitutionarray;
$formticket->showMessageForm('100%');
print '';
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 15dd77cf64f..b68628d0c9b 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -1654,21 +1654,9 @@ class Ticket extends CommonObject
$this->message = trim($this->message);
}
- // Insert request
- $sql = "INSERT INTO " . MAIN_DB_PREFIX . "ticket_msg(";
+ // Insert entry into agenda with code 'TICKET_MSG'
+ $sql.='...';
- $sql .= "fk_track_id,";
- $sql .= "fk_user_action,";
- $sql .= "datec,";
- $sql .= "message,";
- $sql .= "private";
- $sql .= ") VALUES (";
- $sql .= " " . (!isset($this->fk_track_id) ? "'" . $this->db->escape($this->track_id) . "'" : "'" . $this->db->escape($this->fk_track_id) . "'") . ",";
- $sql .= " " . ($this->fk_user_action > 0 ? $this->fk_user_action : $user->id) . ",";
- $sql .= " '" . $this->db->idate(dol_now()) . "',";
- $sql .= " " . (!isset($this->message) ? 'NULL' : "'" . $this->db->escape($this->message) . "'") . ",";
- $sql .= " " . (empty($this->private) ? '0' : "'" . $this->db->escape($this->private) . "'") . "";
- $sql .= ")";
$this->db->begin();
@@ -2520,8 +2508,8 @@ class Ticket extends CommonObject
}
if (!$error) {
- $object->message = GETPOST("message");
- $object->private = GETPOST("private_message");
+ $object->message = GETPOST("message", "none");
+ $object->private = GETPOST("private_message", "alpha");
$send_email = GETPOST('send_email', 'int');
$id = $object->createTicketMessage($user);