Merge branch '14.0' of github.com:Dolibarr/dolibarr into 14_deveventorg
This commit is contained in:
commit
510cf36bbd
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("install", "other", "admin"));
|
||||
$langs->loadLangs(array("install", "other", "admin", "errors"));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@ -198,6 +198,7 @@ if (empty($fileswithwritepermission)) {
|
||||
}
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<strong>'.$langs->trans("PermissionsOnFile", $conffile).'</strong>: '; // $conffile is defined into filefunc.inc.php
|
||||
$perms = fileperms($dolibarr_main_document_root.'/'.$conffile);
|
||||
@ -219,6 +220,16 @@ if ($perms) {
|
||||
print img_warning().' '.$langs->trans("FailedToReadFile", $conffile);
|
||||
}
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
$installlock = DOL_DATA_ROOT.'/install.lock';
|
||||
print '<strong>'.$langs->trans("DolibarrSetup").'</strong>: ';
|
||||
if (file_exists($installlock)) {
|
||||
print img_picto('', 'tick').' '.$langs->trans("InstallAndUpgradeLockedBy", $installlock);
|
||||
} else {
|
||||
print img_warning().' '.$langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT);
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
// File conf.php
|
||||
|
||||
@ -680,9 +680,7 @@ class dolReceiptPrinter extends Printer
|
||||
foreach ($object->lines as $line) {
|
||||
$total_localtax1 += $line->total_localtax1;
|
||||
}
|
||||
foreach ($vatarray as $vatkey => $vatvalue) {
|
||||
$this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
}
|
||||
$this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
break;
|
||||
case 'DOL_PRINT_OBJECT_TAX2':
|
||||
//var_dump($object);
|
||||
@ -690,9 +688,7 @@ class dolReceiptPrinter extends Printer
|
||||
foreach ($object->lines as $line) {
|
||||
$total_localtax2 += $line->total_localtax2;
|
||||
}
|
||||
foreach ($vatarray as $vatkey => $vatvalue) {
|
||||
$this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
}
|
||||
$this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
break;
|
||||
case 'DOL_PRINT_OBJECT_TOTAL':
|
||||
$title = $langs->trans('TotalHT');
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
/* Copyright (C) 2014 delcroip <delcroip@gmail.com>
|
||||
* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
*
|
||||
* 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
|
||||
@ -257,7 +258,7 @@ function updateTotal(days,mode)
|
||||
result=parseTime(jQuery('.totalDay'+stringdays).text(),taskTime);
|
||||
if (result >= 0)
|
||||
{
|
||||
totalhour = totalhour + taskTime.getHours();
|
||||
totalhour = totalhour + taskTime.getHours() + result*24;
|
||||
totalmin = totalmin + taskTime.getMinutes();
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,8 +122,18 @@ class modTicket extends DolibarrModules
|
||||
}
|
||||
$this->dictionaries = array(
|
||||
'langs' => 'ticket',
|
||||
'tabname' => array(MAIN_DB_PREFIX."c_ticket_type", MAIN_DB_PREFIX."c_ticket_severity", MAIN_DB_PREFIX."c_ticket_category", MAIN_DB_PREFIX."c_ticket_resolution"),
|
||||
'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory", "TicketDictResolution"),
|
||||
'tabname' => array(
|
||||
MAIN_DB_PREFIX."c_ticket_type",
|
||||
MAIN_DB_PREFIX."c_ticket_severity",
|
||||
MAIN_DB_PREFIX."c_ticket_category",
|
||||
MAIN_DB_PREFIX."c_ticket_resolution"
|
||||
),
|
||||
'tablib' => array(
|
||||
"TicketDictType",
|
||||
"TicketDictSeverity",
|
||||
"TicketDictCategory",
|
||||
"TicketDictResolution"
|
||||
),
|
||||
'tabsql' => array(
|
||||
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f',
|
||||
'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f',
|
||||
@ -135,7 +145,7 @@ class modTicket extends DolibarrModules
|
||||
'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
|
||||
'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public", "code,label,pos,use_default"),
|
||||
'tabrowid' => array("rowid", "rowid", "rowid", "rowid"),
|
||||
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled),
|
||||
'tabcond' => array($conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled, $conf->ticket->enabled && !empty($conf->global->TICKET_ENABLE_RESOLUTION)),
|
||||
'tabhelp' => array(
|
||||
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
|
||||
array('code'=>$langs->trans("EnterAnyCode"), 'use_default'=>$langs->trans("Enter0or1")),
|
||||
|
||||
@ -936,7 +936,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
}
|
||||
|
||||
$object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg);
|
||||
if (!empty($user->login)) {
|
||||
$object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg);
|
||||
} elseif (isset($object->origin_email)) {
|
||||
$object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$object->origin_email, $object->actionmsg);
|
||||
}
|
||||
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
|
||||
@ -2148,4 +2148,5 @@ RandomlySelectedIfSeveral=Randomly selected if several pictures are available
|
||||
DatabasePasswordObfuscated=Database password is obfuscated in conf file
|
||||
DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file
|
||||
APIsAreNotEnabled=APIs modules are not enabled
|
||||
YouShouldSetThisToOff=You should set this to 0 or off
|
||||
YouShouldSetThisToOff=You should set this to 0 or off
|
||||
InstallAndUpgradeLockedBy=Install and upgrades are locked by the file <b>%s</b>
|
||||
@ -66,7 +66,7 @@ NeedMoreInformation=Waiting for reporter feedback
|
||||
NeedMoreInformationShort=Waiting for feedback
|
||||
Answered=Answered
|
||||
Waiting=Waiting
|
||||
Closed=Closed
|
||||
SolvedClosed=Solved
|
||||
Deleted=Deleted
|
||||
|
||||
# Dict
|
||||
@ -186,9 +186,11 @@ TicketSeverity=Severity
|
||||
ShowTicket=See ticket
|
||||
RelatedTickets=Related tickets
|
||||
TicketAddIntervention=Create intervention
|
||||
CloseTicket=Close ticket
|
||||
CloseATicket=Close a ticket
|
||||
CloseTicket=Close|Solve ticket
|
||||
AbandonTicket=Abandon ticket
|
||||
CloseATicket=Close|Solve a ticket
|
||||
ConfirmCloseAticket=Confirm ticket closing
|
||||
ConfirmAbandonTicket=Do you confirm the closing of the ticket to status 'Abandonned'
|
||||
ConfirmDeleteTicket=Please confirm ticket deleting
|
||||
TicketDeletedSuccess=Ticket deleted with success
|
||||
TicketMarkedAsClosed=Ticket marked as closed
|
||||
|
||||
@ -258,7 +258,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
|
||||
$sendto = GETPOST('email', 'alpha');
|
||||
|
||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||
$replyto = $from;
|
||||
$sendtocc = '';
|
||||
$deliveryreceipt = 0;
|
||||
@ -298,7 +298,6 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
}
|
||||
$message_admin .= '</ul>';
|
||||
|
||||
$message_admin .= '</ul>';
|
||||
$message_admin .= '<p>'.$langs->trans('Message').' : <br>'.$object->message.'</p>';
|
||||
$message_admin .= '<p><a href="'.dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id.'" rel="nofollow noopener">'.$langs->trans('SeeThisTicketIntomanagementInterface').'</a></p>';
|
||||
|
||||
@ -390,7 +389,7 @@ if ($action != "infos_success") {
|
||||
print '<div class="error">';
|
||||
print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'<br>';
|
||||
print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket"));
|
||||
print '<div>';
|
||||
print '</div>';
|
||||
} else {
|
||||
print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
|
||||
$formticket->showForm(0, 'edit', 1);
|
||||
|
||||
@ -262,8 +262,10 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
|
||||
|
||||
// Category
|
||||
print '<tr><td>'.$langs->trans("Category").'</td><td>';
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||
print dol_escape_htmltag($object->dao->category_label);
|
||||
if ($object->dao->category_label) {
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||
print dol_escape_htmltag($object->dao->category_label);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity
|
||||
|
||||
@ -426,10 +426,10 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) {
|
||||
if (($action == "confirm_close" || $action == "confirm_abandon") && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) {
|
||||
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
||||
|
||||
if ($object->close($user)) {
|
||||
if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) {
|
||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||
|
||||
$url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha');
|
||||
@ -749,7 +749,7 @@ if ($action == 'create' || $action == 'presend') {
|
||||
print '</div>';
|
||||
|
||||
print '</form>'; */
|
||||
} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|
||||
} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'abandon' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen'
|
||||
|| $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
|
||||
if ($res > 0) {
|
||||
// or for unauthorized internals users
|
||||
@ -764,6 +764,13 @@ if ($action == 'create' || $action == 'presend') {
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
// Confirmation abandon
|
||||
if ($action == 'abandon') {
|
||||
print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("AbandonTicket"), $langs->trans("ConfirmAbandonTicket"), "confirm_abandon", '', '', 1);
|
||||
if ($ret == 'html') {
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
// Confirmation delete
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1);
|
||||
@ -1119,15 +1126,21 @@ if ($action == 'create' || $action == 'presend') {
|
||||
} else {
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
|
||||
print $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
|
||||
if (!empty($object->type_code)) {
|
||||
print $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Group
|
||||
print '<tr><td>'.$langs->trans("TicketCategory").'</td><td>';
|
||||
print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
|
||||
if (!empty($object->category_code)) {
|
||||
print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Severity
|
||||
print '<tr><td>'.$langs->trans("TicketSeverity").'</td><td>';
|
||||
print $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
|
||||
if (!empty($object->severity_code)) {
|
||||
print $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>'; // End table actions
|
||||
@ -1296,8 +1309,13 @@ if ($action == 'create' || $action == 'presend') {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id='.$object->track_id.'&action=close">'.$langs->trans('CloseTicket').'</a></div>';
|
||||
}
|
||||
|
||||
// Abadon ticket if statut is read
|
||||
if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id='.$object->track_id.'&action=abandon">'.$langs->trans('AbandonTicket').'</a></div>';
|
||||
}
|
||||
|
||||
// Re-open ticket
|
||||
if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) {
|
||||
if (!$user->socid && ($object->fk_statut == Ticket::STATUS_CLOSED || $object->fk_statut == Ticket::STATUS_CANCELED) && !$user->socid) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?track_id='.$object->track_id.'&action=reopen">'.$langs->trans('ReOpen').'</a></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -408,7 +408,7 @@ class ActionsTicket
|
||||
if ($status == 1) {
|
||||
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action
|
||||
} else {
|
||||
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&token='.newToken().'&new_status='.$status;
|
||||
$urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=confirm_set_status&token='.newToken().'&new_status='.$status;
|
||||
}
|
||||
|
||||
print '<a class="butAction butStatus marginbottomonly" href="'.$urlforbutton.'">';
|
||||
|
||||
@ -218,8 +218,8 @@ class Ticket extends CommonObject
|
||||
const STATUS_IN_PROGRESS = 3;
|
||||
const STATUS_NEED_MORE_INFO = 5;
|
||||
const STATUS_WAITING = 7; // on hold
|
||||
const STATUS_CLOSED = 8;
|
||||
const STATUS_CANCELED = 9;
|
||||
const STATUS_CLOSED = 8; // Closed - Solved
|
||||
const STATUS_CANCELED = 9; // Closed - Not solved
|
||||
|
||||
|
||||
/**
|
||||
@ -272,8 +272,8 @@ class Ticket extends CommonObject
|
||||
'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,),
|
||||
'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'),
|
||||
'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1),
|
||||
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1),
|
||||
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')),
|
||||
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'$conf->global->TICKET_ENABLE_RESOLUTION', 'position'=>550, 'notnull'=>1),
|
||||
'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
@ -286,6 +286,8 @@ class Ticket extends CommonObject
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->statuts_short = array(
|
||||
@ -295,7 +297,7 @@ class Ticket extends CommonObject
|
||||
self::STATUS_IN_PROGRESS => 'InProgress',
|
||||
self::STATUS_WAITING => 'OnHold',
|
||||
self::STATUS_NEED_MORE_INFO => 'NeedMoreInformationShort',
|
||||
self::STATUS_CLOSED => 'Closed',
|
||||
self::STATUS_CLOSED => 'SolvedClosed',
|
||||
self::STATUS_CANCELED => 'Canceled'
|
||||
);
|
||||
$this->statuts = array(
|
||||
@ -305,7 +307,7 @@ class Ticket extends CommonObject
|
||||
self::STATUS_IN_PROGRESS => 'InProgress',
|
||||
self::STATUS_WAITING => 'OnHold',
|
||||
self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation',
|
||||
self::STATUS_CLOSED => 'Closed',
|
||||
self::STATUS_CLOSED => 'SolvedClosed',
|
||||
self::STATUS_CANCELED => 'Canceled'
|
||||
);
|
||||
}
|
||||
@ -459,7 +461,7 @@ class Ticket extends CommonObject
|
||||
$sql .= " ".(!isset($this->progress) ? '0' : "'".$this->db->escape($this->progress)."'").",";
|
||||
$sql .= " ".(!isset($this->timing) ? 'NULL' : "'".$this->db->escape($this->timing)."'").",";
|
||||
$sql .= " ".(!isset($this->type_code) ? 'NULL' : "'".$this->db->escape($this->type_code)."'").",";
|
||||
$sql .= " ".(!isset($this->category_code) ? 'NULL' : "'".$this->db->escape($this->category_code)."'").",";
|
||||
$sql .= " ".(empty($this->category_code) || $this->category_code == '-1' ? 'NULL' : "'".$this->db->escape($this->category_code)."'").",";
|
||||
$sql .= " ".(!isset($this->severity_code) ? 'NULL' : "'".$this->db->escape($this->severity_code)."'").",";
|
||||
$sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").",";
|
||||
$sql .= " ".(!isset($this->date_read) || dol_strlen($this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").",";
|
||||
@ -1747,21 +1749,22 @@ class Ticket extends CommonObject
|
||||
/**
|
||||
* Close a ticket
|
||||
*
|
||||
* @param User $user User that close
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User that close
|
||||
* @param int $mode 0=Close solved, 1=Close abandonned
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function close(User $user)
|
||||
public function close(User $user, $mode = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($this->fk_statut != Ticket::STATUS_CLOSED) { // not closed
|
||||
if ($this->fk_statut != Ticket::STATUS_CLOSED && $this->fk_statut != Ticket::STATUS_CANCELED) { // not closed
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ticket";
|
||||
$sql .= " SET fk_statut=".Ticket::STATUS_CLOSED.", progress=100, date_close='".$this->db->idate(dol_now())."'";
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$sql .= " SET fk_statut=".($mode ? Ticket::STATUS_CANCELED : Ticket::STATUS_CLOSED).", progress=100, date_close='".$this->db->idate(dol_now())."'";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::close sql=".$sql);
|
||||
dol_syslog(get_class($this)."::close mode=".$mode);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$error = 0;
|
||||
|
||||
@ -45,9 +45,9 @@ $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'tickep#selectedfieldstlist'; // To manage different context of search
|
||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$msg_id = GETPOST('msg_id', 'int');
|
||||
@ -73,8 +73,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
@ -107,12 +108,16 @@ if (GETPOST('search_fk_status', 'alpha') == 'non_closed') {
|
||||
}
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall'));
|
||||
$search_all = (GETPOSTISSET("search_all") ? GETPOST("search_all", 'alpha') : GETPOST('sall'));
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
|
||||
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
|
||||
}
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -126,12 +131,19 @@ $fieldstosearchall['s.name_alias'] = "AliasNameShort";
|
||||
$fieldstosearchall['s.zip'] = "Zip";
|
||||
$fieldstosearchall['s.town'] = "Town";
|
||||
|
||||
// Definition of fields for list
|
||||
// Definition of array of fields for columns
|
||||
$arrayfields = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (!empty($val['visible'])) {
|
||||
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
@ -139,8 +151,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
//if ($socid > 0) $arrayfields['t.fk_soc']['enabled']=0;
|
||||
//if ($projectid > 0) $arrayfields['t.fk_project']['enabled']=0;
|
||||
|
||||
|
||||
// Security check
|
||||
|
||||
Loading…
Reference in New Issue
Block a user