2
0
forked from Wavyzz/dolibarr

Debug module ticket

This commit is contained in:
Laurent Destailleur
2018-04-30 10:33:36 +02:00
parent 19c12f3103
commit 4c12369a26
6 changed files with 87 additions and 108 deletions

View File

@@ -443,7 +443,7 @@ class FormTicketsup
$ticketstat->loadCacheTypesTickets();
print '<select id="select' . $htmlname . '" class="flat minwidth200'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
print '<select id="select' . $htmlname . '" class="flat minwidth100'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
@@ -543,7 +543,7 @@ class FormTicketsup
$ticketstat->loadCacheCategoriesTickets();
print '<select id="select' . $htmlname . '" class="flat minwidth150'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
print '<select id="select' . $htmlname . '" class="flat minwidth100'.($morecss?' '.$morecss:'').'" name="' . $htmlname . '">';
if ($empty) {
print '<option value="">&nbsp;</option>';
}
@@ -612,7 +612,7 @@ class FormTicketsup
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print ajax_combobox('select'.$htmlname,'',0,0,'off');
print ajax_combobox('select'.$htmlname);
}
/**

View File

@@ -135,8 +135,11 @@ print '
/* If page_y set, we set scollbar with it */
page_y=getParameterByName(\'page_y\', 0); /* search in GET parameter */
if (page_y == 0) page_y = jQuery("#page_y").text(); /* search in POST parameter that is filed at bottom of page */
if (page_y > 0)
{
console.log("page_y found is "+page_y);
if (page_y > 0) $(\'html, body\').scrollTop(page_y);
$(\'html, body\').scrollTop(page_y);
}
/* Set handler to add page_y param on output (click on href links or submit button) */
jQuery(".reposition").click(function() {

View File

@@ -171,7 +171,6 @@ TicketChangeType=Change type
TicketChangeCategory=Change category
TicketChangeSeverity=Change severity
TicketAddMessage=Add a message
TicketEditProperties=Edit properties
AddMessage=Add a message
MessageSuccessfullyAdded=Ticket added
TicketMessageSuccessfullyAdded=Message successfully added

View File

@@ -63,7 +63,7 @@ if (!$action) {
$action = 'view';
}
//Select mail models is same action as add_message
if (GETPOST('modelselected')) {
if (GETPOST('modelselected','alpha')) {
$action = 'add_message';
}
@@ -121,6 +121,25 @@ if ($action == "update_extras" && ! empty($permissiontoadd))
}
}
if ($action == "change_property" && GETPOST('btn_update_ticket_prop','alpha') && $user->rights->ticketsup->write)
{
$object->fetch(GETPOST('id','int'), '', GETPOST('track_id','alpha'));
$object->type_code = GETPOST('update_value_type','az09');
$object->category_code = GETPOST('update_value_category','az09');
$object->severity_code = GETPOST('update_value_severity','az09');
$ret = $object->update($user);
if ($ret > 0) {
$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
}
}
$action = 'view';
}
$permissiondellink = $user->rights->ticketsup->write;
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@@ -471,91 +490,81 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
* Classification and actions on ticket
*
***************************************************/
/*
* Ticket properties
*/
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="border centpercent margintable">';
print '<tr class="liste_titre">';
print '<td colspan="2">';
print $langs->trans('Properties');
print '</td>';
print '</tr>';
if (GETPOST('set') == 'properties' && $user->rights->ticketsup->write) {
/*
* Form to change ticket properties
*/
$j = 0;
$ticketprop[$j] = array(
'dict' => 'type',
'list_function' => 'selectTypesTickets',
'label' => 'TicketChangeType',
);
$j++;
$ticketprop[$j] = array(
'dict' => 'category',
'list_function' => 'selectCategoriesTickets',
'label' => 'TicketChangeCategory',
);
$j++;
$ticketprop[$j] = array(
'dict' => 'severity',
'list_function' => 'selectSeveritiesTickets',
'label' => 'TicketChangeSeverity',
);
foreach ($ticketprop as $property) {
print '<tr>';
print '<td>';
print '<form method="post" name="ticketsup" action="' . $url_page_current . '">';
print '<form method="post" name="formticketsupproperties" action="' . $url_page_current . '">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="change_property">';
print '<input type="hidden" name="property" value="' . $property['dict'] . '">';
print '<input type="hidden" name="track_id" value="' . $track_id . '">';
print '<table class="nobordernopadding" style="width:100%;">';
print '<tr>';
print '<td width="40%">';
print '<label for="type_code">' . $langs->trans($property['label']) . '</label> ';
print '</td><td width="50%">';
print $formticket->{$property['list_function']}($object->type_code, 'update_value', '', 0);
print '</td><td>';
print ' <input class="button" type="submit" name="btn_update_ticket_prop" value="' . $langs->trans("Modify") . '" />';
print '</td>';
print '</tr></table>';
print '</form>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="border centpercent margintable">';
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans('Properties');
print '</td>';
print '<td>';
if (GETPOST('set','alpha') == 'properties' && $user->rights->ticketsup->write) {
print '<input class="button" type="submit" name="btn_update_ticket_prop" value="' . $langs->trans("Modify") . '" />';
}
else {
// Button to edit Properties
if ($object->fk_statut < 5 && $user->rights->ticketsup->write) {
print '<a href="card.php?track_id=' . $object->track_id . '&action=view&set=properties">' . img_edit($langs->trans('Modify')) . '</a>';
}
}
print '</td>';
print '</tr>';
if (GETPOST('set','alpha') == 'properties' && $user->rights->ticketsup->write) {
print '<tr>';
print '<td class="titlefield">';
print $langs->trans('TicketChangeType');
print '</td><td>';
print $formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('TicketChangeCategory');
print '</td><td>';
print $formticket->selectCategoriesTickets($object->category_code, 'update_value_category', '', 2);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('TicketChangeSeverity');
print '</td><td>';
print $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2);
print '</td>';
print '</tr>';
}
} else {
// Type
print '<tr><td width="40%">' . $langs->trans("Type") . '</td><td>';
print $object->type_label;
print '<tr><td class="titlefield">' . $langs->trans("Type") . '</td><td>';
print $langs->getLabelFromKey($db, $object->type_code, 'c_ticketsup_type', 'code', 'label');
/*if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}*/
print '</td></tr>';
// Category
print '<tr><td>' . $langs->trans("Category") . '</td><td>';
print $object->category_label;
print $langs->getLabelFromKey($db, $object->category_code, 'c_ticketsup_category', 'code', 'label');
/*if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}*/
print '</td></tr>';
// Severity
print '<tr><td>' . $langs->trans("TicketSeverity") . '</td><td>';
print $object->severity_label;
print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticketsup_severity', 'code', 'label');
/*if ($user->admin && !$noadmininfo) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}*/
print '</td></tr>';
}
print '</table>'; // End table actions
print '</form>';
print '</div>';
// Display navbar with links to change ticket status
@@ -718,11 +727,6 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti
print '<div class="inline-block divButAction"><a class="butAction" href="' . dol_buildpath('/fichinter/card.php', 1) . '?action=create&socid=' . $object->fk_soc . '&origin=ticketsup_ticketsup&originid=' . $object->id . '">' . $langs->trans('TicketAddIntervention') . '</a></div>';
}
// Button to edit Properties
if ($object->fk_statut < 5 && $user->rights->ticketsup->write) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=view&set=properties">' . $langs->trans('TicketEditProperties') . '</a></div>';
}
// Button to link to a contract
if ($user->rights->ticketsup->write && $object->fk_statut < 5 && $user->rights->contrat->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id=' . $object->track_id . '&action=sel_contract">' . $langs->trans('LinkToAContract') . '</a></div>';

View File

@@ -383,31 +383,6 @@ class ActionsTicketsup
$action = 'view';
}
if ($action == "change_property" && GETPOST('btn_update_ticket_prop') && $user->rights->ticketsup->write) {
$this->fetch('', '', GETPOST('track_id','alpha'));
$fieldtomodify = GETPOST('property') . '_code';
$fieldtomodify_label = GETPOST('property') . '_label';
$oldvalue_code = $object->$fieldtomodify;
$newvalue_code = $object->getValueFrom('c_ticketsup_' . GETPOST('property'), GETPOST('update_value'), 'code');
$oldvalue_label = $object->$fieldtomodify_label;
$newvalue_label = $object->getValueFrom('c_ticketsup_' . GETPOST('property'), GETPOST('update_value'), 'label');
$object->$fieldtomodify = $newvalue_code;
$ret = $object->update($user);
if ($ret > 0) {
$log_action = $langs->trans('TicketLogPropertyChanged', $oldvalue_label, $newvalue_label);
$ret = $object->createTicketLog($user, $log_action);
if ($ret > 0) {
setEventMessages($langs->trans('TicketUpdated'), null, 'mesgs');
}
}
$action = 'view';
}
if ($action == "new_message" && GETPOST('btn_add_message') && $user->rights->ticketsup->read) {
$ret = $this->newMessage($user, $action);
if ($ret) {
@@ -1152,16 +1127,16 @@ class ActionsTicketsup
print '<div class="underbanner clearboth"></div>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="border centpercent margintable">';
print '<tr class="liste_titre"><td class="nowrap" colspan="2">';
print '<strong>' . $langs->trans("InitialMessage") . '</strong> ';
print '<tr class="liste_titre"><td class="nowrap titlefield">';
print $langs->trans("InitialMessage");
print '</td><td>';
if ($user->rights->ticketsup->manage) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=edit_message_init&amp;track_id=' . $object->track_id . '">' . img_edit($langs->trans('Modify')) . ' ' . $langs->trans('Modify') . '</a>';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=edit_message_init&amp;track_id=' . $object->track_id . '">' . img_edit($langs->trans('Modify')) . '</a>';
}
print '</td></tr>';
print '<tr>';
print '<td>';
print '<td colspan="2">';
if (!empty($user->rights->ticketsup->manage) && $action == 'edit_message_init') {
// MESSAGE
$msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message;
@@ -1470,7 +1445,7 @@ class ActionsTicketsup
global $langs;
print '<div class="div-table-responsive-no-min">';
print '<div class="tagtable noborder ">';
print '<div class="tagtable centpercent">';
print '<div class="tagtr liste_titre">';
print '<div class="tagtd">';
print '<strong>' . $langs->trans('TicketChangeStatus') . '</strong>';

View File

@@ -181,7 +181,7 @@ class Ticketsup extends CommonObject
'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>1, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"),
'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>""),
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
'category_code' => array('type'=>'varchar(32)', 'label'=>'Category', 'visible'=>1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>""),
'category_code' => array('type'=>'varchar(32)', 'label'=>'Category', 'visible'=>1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty"),
'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-2, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1),
@@ -815,12 +815,10 @@ class Ticketsup extends CommonObject
$sql .= " datec=" . (dol_strlen($this->datec) != 0 ? "'" . $this->db->idate($this->datec) . "'" : 'null') . ",";
$sql .= " date_read=" . (dol_strlen($this->date_read) != 0 ? "'" . $this->db->idate($this->date_read) . "'" : 'null') . ",";
$sql .= " date_close=" . (dol_strlen($this->date_close) != 0 ? "'" . $this->db->idate($this->date_close) . "'" : 'null') . "";
$sql .= " WHERE rowid=" . $this->id;
$this->db->begin();
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;