Debug ticket module
This commit is contained in:
parent
a75c6a81d1
commit
9955af5194
@ -251,6 +251,7 @@ print '<tr class="liste_titre">';
|
||||
$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.='<br><br>'.$langs->trans("AlsoDefaultValuesAreEffectiveForActionCreate");
|
||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||
print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param, '', $sortfield, $sortorder);
|
||||
// Field
|
||||
|
||||
@ -852,19 +852,7 @@ class FormTicket
|
||||
print '</div></td>';
|
||||
}
|
||||
|
||||
// Substitution array
|
||||
if ($this->withsubstit) {
|
||||
print '<tr class="email_line"><td></td><td colspan="2">';
|
||||
$help="";
|
||||
foreach ($this->substit as $key => $val) {
|
||||
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Private message or not. TODO What does this means ?
|
||||
/*
|
||||
// Private message (not visible by customer/external user)
|
||||
if (! $user->socid) {
|
||||
print '<tr><td width="30%"></td><td>';
|
||||
$checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : '');
|
||||
@ -873,7 +861,7 @@ class FormTicket
|
||||
print '</td><td align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
}*/
|
||||
}
|
||||
|
||||
print '<tr class="email_line"><td class="titlefieldcreate">' . $langs->trans('Subject') . '</td>';
|
||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||
|
||||
@ -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=<br>Example:<br>For the form to create a new third party, it is <strong>%s</strong>.<br>For URL of external modules installed into custom directory, do not include the "custom/", so use path like <strong>mymodule/mypage.php</strong> and not custom/mymodule/mypage.php.<br>If you want default value only if url has some parameter, you can use <strong>%s</strong>
|
||||
PageUrlForDefaultValuesList=<br>Example:<br>For the page that lists third parties, it is <strong>%s</strong>.<br>For URL of external modules installed into custom directory, do not include the "custom/" so use a path like <strong>mymodule/mypagelist.php</strong> and not custom/mymodule/mypagelist.php.<br>If you want default value only if url has some parameter, you can use <strong>%s</strong>
|
||||
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.
|
||||
|
||||
@ -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).'<br>';
|
||||
}
|
||||
$morehtmlright.=$form->textwithpicto($langs->trans("TicketMessageSubstitutionReplacedByGenericValues"), $help);
|
||||
|
||||
print '<div>';
|
||||
print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket');
|
||||
print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket');
|
||||
|
||||
print '<hr>';
|
||||
|
||||
@ -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 '</div>';
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user