mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
code syntax ticket directory
This commit is contained in:
parent
0d7a2c1d81
commit
4c1004ea5d
|
|
@ -46,16 +46,21 @@ $sortorder = GETPOST("sortorder", 'aZ09comma');
|
|||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$page = is_numeric($page) ? $page : 0;
|
||||
$page = $page == -1 ? 0 : $page;
|
||||
if (!$sortfield) $sortfield = "a.datep,a.id";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "a.datep,a.id";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
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));
|
||||
}
|
||||
|
|
@ -83,8 +88,7 @@ if (!$user->rights->ticket->read) {
|
|||
accessforbidden();
|
||||
}
|
||||
// restrict access for externals users
|
||||
if ($user->socid > 0 && ($object->fk_soc != $user->socid))
|
||||
{
|
||||
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
|
||||
accessforbidden();
|
||||
}
|
||||
// or for unauthorized internals users
|
||||
|
|
@ -100,17 +104,17 @@ if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object-
|
|||
|
||||
$parameters = array('id'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Set view style
|
||||
$_SESSION['ticket-view-type'] = "list";
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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 = '';
|
||||
}
|
||||
|
|
@ -126,7 +130,9 @@ $userstat = new User($db);
|
|||
$formticket = new FormTicket($db);
|
||||
|
||||
$title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name;
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
|
||||
$title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
|
||||
}
|
||||
$help_url = 'FR:DocumentationModuleTicket';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
|
@ -167,8 +173,7 @@ if (!empty($object->origin_email)) {
|
|||
}
|
||||
|
||||
// Thirdparty
|
||||
if (!empty($conf->societe->enabled))
|
||||
{
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty');
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
|
|
@ -182,12 +187,10 @@ if (!empty($conf->societe->enabled))
|
|||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project');
|
||||
if ($user->rights->ticket->write)
|
||||
{
|
||||
if ($user->rights->ticket->write) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
|
|
@ -225,11 +228,14 @@ print dol_get_fiche_end();
|
|||
print '<br>';
|
||||
|
||||
|
||||
if (!empty($object->id))
|
||||
{
|
||||
if (!empty($object->id)) {
|
||||
$param = '&id='.$object->id;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.$contextpage;
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.$limit;
|
||||
}
|
||||
|
||||
$morehtmlright = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ $sortorder = GETPOST('sortorder', 'aZ09comma');
|
|||
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
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));
|
||||
}
|
||||
|
|
@ -80,12 +82,15 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||
// Initialize array of search criterias
|
||||
$search_all = GETPOST("search_all", 'alpha');
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
|
||||
if (empty($action) && empty($id) && empty($ref)) {
|
||||
$action = 'view';
|
||||
}
|
||||
|
||||
//Select mail models is same action as add_message
|
||||
if (GETPOST('modelselected', 'alpha')) {
|
||||
|
|
@ -96,8 +101,7 @@ if (GETPOST('modelselected', 'alpha')) {
|
|||
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
if ($id || $track_id || $ref) {
|
||||
$res = $object->fetch($id, $ref, $track_id);
|
||||
if ($res >= 0)
|
||||
{
|
||||
if ($res >= 0) {
|
||||
$id = $object->id;
|
||||
$track_id = $object->track_id;
|
||||
}
|
||||
|
|
@ -125,13 +129,14 @@ $now = dol_now();
|
|||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
if (empty($reshook)) {
|
||||
// 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{
|
||||
{
|
||||
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 = '';
|
||||
}
|
||||
|
|
@ -159,7 +164,9 @@ if (empty($reshook)) {
|
|||
$action = 'create';
|
||||
}
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
|
@ -289,7 +296,9 @@ if (empty($reshook)) {
|
|||
array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Subject')));
|
||||
}
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
|
@ -301,7 +310,9 @@ if (empty($reshook)) {
|
|||
$object->severity_code = GETPOST('severity_code', 'alpha');
|
||||
|
||||
$ret = $object->update($user);
|
||||
if ($ret <= 0) $error++;
|
||||
if ($ret <= 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
|
|
@ -354,11 +365,12 @@ if (empty($reshook)) {
|
|||
|
||||
if (!$error) {
|
||||
$ret = $object->assignUser($user, $usertoassign);
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) // Update list of contacts
|
||||
{
|
||||
if (!$error) { // Update list of contacts
|
||||
// Si déjà un user assigné on le supprime des contacts
|
||||
if ($useroriginassign > 0) {
|
||||
$internal_contacts = $object->listeContact(-1, 'internal');
|
||||
|
|
@ -373,7 +385,9 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
|
||||
if ($usertoassign > 0) {
|
||||
$object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
|
@ -517,16 +531,16 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} // Categorisation dans projet
|
||||
elseif ($action == 'classin' && $user->rights->ticket->write) {
|
||||
} elseif ($action == 'classin' && $user->rights->ticket->write) {
|
||||
// Categorisation dans projet
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
$url = 'card.php?action=view&track_id='.$object->track_id;
|
||||
header("Location: ".$url);
|
||||
exit();
|
||||
}
|
||||
} // Categorisation dans contrat
|
||||
elseif ($action == 'setcontract' && $user->rights->ticket->write) {
|
||||
} elseif ($action == 'setcontract' && $user->rights->ticket->write) {
|
||||
// Categorisation dans contrat
|
||||
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$object->setContract(GETPOST('contractid', 'int'));
|
||||
$url = 'card.php?action=view&track_id='.$object->track_id;
|
||||
|
|
@ -557,8 +571,8 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
$action = 'view';
|
||||
} // Reopen ticket
|
||||
elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) {
|
||||
} elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) {
|
||||
// Reopen ticket
|
||||
if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
|
||||
$new_status = GETPOST('new_status', 'int');
|
||||
$old_status = $object->fk_statut;
|
||||
|
|
@ -582,11 +596,15 @@ if (empty($reshook)) {
|
|||
$object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha'));
|
||||
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) $error++;
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
|
||||
if ($result < 0) { $error++; }
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
|
|
@ -634,7 +652,9 @@ if (empty($reshook)) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Set $action to correct value for the case we used presend action to add a message
|
||||
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
|
||||
if (GETPOSTISSET('actionbis') && $action == 'presend') {
|
||||
$action = 'presend_addmessage';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -645,15 +665,16 @@ if (empty($reshook)) {
|
|||
$userstat = new User($db);
|
||||
$form = new Form($db);
|
||||
$formticket = new FormTicket($db);
|
||||
if (!empty($conf->projet->enabled)) $formproject = new FormProjets($db);
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
}
|
||||
|
||||
$help_url = 'FR:DocumentationModuleTicket';
|
||||
$page_title = $actionobject->getTitle($action);
|
||||
|
||||
llxHeader('', $page_title, $help_url);
|
||||
|
||||
if ($action == 'create' || $action == 'presend')
|
||||
{
|
||||
if ($action == 'create' || $action == 'presend') {
|
||||
$formticket = new FormTicket($db);
|
||||
|
||||
print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket');
|
||||
|
|
@ -725,12 +746,9 @@ 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'
|
||||
|| $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)
|
||||
{
|
||||
} elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $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
|
||||
if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
|
||||
accessforbidden('', 0, 1);
|
||||
|
|
@ -774,8 +792,8 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
print dol_get_fiche_head($head, 'ticket', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project'));
|
||||
|
||||
/*
|
||||
* Projet synthese pour rappel
|
||||
*/
|
||||
* Projet synthese pour rappel
|
||||
*/
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
|
@ -878,19 +896,20 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ticket->write) {
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
$morehtmlref .= ' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
|
|
@ -1010,8 +1029,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
print '</tr>';
|
||||
|
||||
// Timing (Duration sum of linked fichinter)
|
||||
if ($conf->fichinter->enabled)
|
||||
{
|
||||
if ($conf->fichinter->enabled) {
|
||||
$object->fetchObjectLinked();
|
||||
$num = count($object->linkedObjects);
|
||||
$timing = 0;
|
||||
|
|
@ -1120,8 +1138,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
}
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||
print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
|
|
@ -1245,10 +1262,11 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
print '<div class="tabsAction">'."\n";
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Show link to add a message (if read and not closed)
|
||||
if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
|
||||
print '<div class="inline-block divButAction"><a class="butAction reposition" href="card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init">'.$langs->trans('TicketAddMessage').'</a></div>';
|
||||
|
|
@ -1292,11 +1310,12 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
$action = 'presend';
|
||||
}
|
||||
// Set $action to correct value for the case we used presend action to add a message
|
||||
if (GETPOSTISSET('actionbis') && $action == 'presend') $action = 'presend_addmessage';
|
||||
if (GETPOSTISSET('actionbis') && $action == 'presend') {
|
||||
$action = 'presend_addmessage';
|
||||
}
|
||||
|
||||
// add a message
|
||||
if ($action == 'presend' || $action == 'presend_addmessage')
|
||||
{
|
||||
if ($action == 'presend' || $action == 'presend_addmessage') {
|
||||
$action = 'add_message'; // action to use to post the message
|
||||
$modelmail = 'ticket_send';
|
||||
|
||||
|
|
@ -1375,10 +1394,18 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action =
|
|||
// Show messages on card (Note: this is a duplicate of the view Events/Agenda but on the main tab)
|
||||
if (!empty($conf->global->TICKET_SHOW_MESSAGES_ON_CARD)) {
|
||||
$param = '&id='.$object->id;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($actioncode) $param .= '&actioncode='.urlencode($actioncode);
|
||||
if ($search_agenda_label) $param .= '&search_agenda_label='.urlencode($search_agenda_label);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.$contextpage;
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.$limit;
|
||||
}
|
||||
if ($actioncode) {
|
||||
$param .= '&actioncode='.urlencode($actioncode);
|
||||
}
|
||||
if ($search_agenda_label) {
|
||||
$param .= '&search_agenda_label='.urlencode($search_agenda_label);
|
||||
}
|
||||
|
||||
$morehtmlright = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -262,14 +262,15 @@ class ActionsTicket
|
|||
|
||||
// Load logs in cache
|
||||
$ret = $this->dao->loadCacheMsgsTicket();
|
||||
if ($ret < 0) dol_print_error($this->dao->db);
|
||||
if ($ret < 0) {
|
||||
dol_print_error($this->dao->db);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$this->viewTicketOriginalMessage($user, $action, $object);
|
||||
|
||||
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0)
|
||||
{
|
||||
if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) {
|
||||
print '<table class="border" style="width:100%;">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
|
|
|||
|
|
@ -114,8 +114,7 @@ class Tickets extends DolibarrApi
|
|||
{
|
||||
try {
|
||||
return $this->getCommon(0, '', $ref);
|
||||
} catch (Exception $e)
|
||||
{
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,7 +410,9 @@ class Ticket extends CommonObject
|
|||
|
||||
// Clean parameters
|
||||
$this->datec = dol_now();
|
||||
if (empty($this->track_id)) $this->track_id = generate_random_id(16);
|
||||
if (empty($this->track_id)) {
|
||||
$this->track_id = generate_random_id(16);
|
||||
}
|
||||
|
||||
// Check more parameters
|
||||
// If error, this->errors[] is filled
|
||||
|
|
@ -581,8 +583,7 @@ class Ticket extends CommonObject
|
|||
dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
if ($this->db->num_rows($resql)) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
|
@ -991,7 +992,9 @@ class Ticket extends CommonObject
|
|||
if (!$error) {
|
||||
// Delete linked object
|
||||
$res = $this->deleteObjectLinked();
|
||||
if ($res < 0) $error++;
|
||||
if ($res < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// Removed extrafields
|
||||
|
|
@ -1319,7 +1322,9 @@ class Ticket extends CommonObject
|
|||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
|
||||
if (!empty($conf->dol_no_mouse_hover)) {
|
||||
$notooltip = 1; // Force disable tooltips
|
||||
}
|
||||
|
||||
$result = '';
|
||||
|
||||
|
|
@ -1332,33 +1337,40 @@ class Ticket extends CommonObject
|
|||
|
||||
$url = dol_buildpath('/ticket/card.php', 1).'?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink')
|
||||
{
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
$add_save_lastsearch_values = 1;
|
||||
}
|
||||
if ($add_save_lastsearch_values) {
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
}
|
||||
|
||||
$linkclose = '';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$label = $langs->trans("ShowTicket");
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
} else {
|
||||
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
|
||||
}
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= $this->ref;
|
||||
if ($withpicto) {
|
||||
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
}
|
||||
if ($withpicto != 2) {
|
||||
$result .= $this->ref;
|
||||
}
|
||||
$result .= $linkend;
|
||||
//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
|
||||
|
||||
|
|
@ -1437,8 +1449,7 @@ class Ticket extends CommonObject
|
|||
$this->oldcopy = dol_clone($this);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."ticket";
|
||||
if ($id_assign_user > 0)
|
||||
{
|
||||
if ($id_assign_user > 0) {
|
||||
$sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut = ".Ticket::STATUS_ASSIGNED;
|
||||
} else {
|
||||
$sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ;
|
||||
|
|
@ -1447,8 +1458,7 @@ class Ticket extends CommonObject
|
|||
|
||||
dol_syslog(get_class($this)."::assignUser sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$this->fk_user_assign = $id_assign_user; // May be used by trigger
|
||||
|
||||
if (!$notrigger) {
|
||||
|
|
@ -1588,29 +1598,29 @@ class Ticket extends CommonObject
|
|||
|
||||
// TODO Read the table llx_actioncomm
|
||||
/*
|
||||
$sql = "SELECT rowid, fk_user_create, datec, message";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs";
|
||||
$sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'";
|
||||
$sql .= " ORDER BY datec DESC";
|
||||
$sql = "SELECT rowid, fk_user_create, datec, message";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs";
|
||||
$sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'";
|
||||
$sql .= " ORDER BY datec DESC";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cache_logs_ticket[$i]['id'] = $obj->rowid;
|
||||
$this->cache_logs_ticket[$i]['fk_user_create'] = $obj->fk_user_create;
|
||||
$this->cache_logs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
|
||||
$this->cache_logs_ticket[$i]['message'] = $obj->message;
|
||||
$i++;
|
||||
}
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::loadCacheLogsTicket " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}*/
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cache_logs_ticket[$i]['id'] = $obj->rowid;
|
||||
$this->cache_logs_ticket[$i]['fk_user_create'] = $obj->fk_user_create;
|
||||
$this->cache_logs_ticket[$i]['datec'] = $this->db->jdate($obj->datec);
|
||||
$this->cache_logs_ticket[$i]['message'] = $obj->message;
|
||||
$i++;
|
||||
}
|
||||
return $num;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::loadCacheLogsTicket " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1669,14 +1679,12 @@ class Ticket extends CommonObject
|
|||
$actioncomm->attachedfiles = $attachedfiles;
|
||||
}
|
||||
|
||||
if (!empty($mimefilename_list) && is_array($mimefilename_list))
|
||||
{
|
||||
if (!empty($mimefilename_list) && is_array($mimefilename_list)) {
|
||||
$actioncomm->note_private = dol_concatdesc($actioncomm->note_private, "\n".$langs->transnoentities("AttachedFiles").': '.join(';', $mimefilename_list));
|
||||
}
|
||||
|
||||
$actionid = $actioncomm->create($user);
|
||||
if ($actionid <= 0)
|
||||
{
|
||||
if ($actionid <= 0) {
|
||||
$error++;
|
||||
$this->error = $actioncomm->error;
|
||||
$this->errors = $actioncomm->errors;
|
||||
|
|
@ -1760,8 +1768,7 @@ class Ticket extends CommonObject
|
|||
if (!empty($conf->ficheinter->enabled) && !empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) {
|
||||
dol_syslog("We have closed the ticket, so we close all linked interventions");
|
||||
$this->fetchObjectLinked($this->id, $this->element, null, 'fichinter');
|
||||
if ($this->linkedObjectsIds)
|
||||
{
|
||||
if ($this->linkedObjectsIds) {
|
||||
foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) {
|
||||
$fichinter = new Fichinter($this->db);
|
||||
$fichinter->fetch($fichinter_id);
|
||||
|
|
@ -2148,8 +2155,7 @@ class Ticket extends CommonObject
|
|||
$sendto = $obj->firstname." ".$obj->lastname." <".$obj->email.">";
|
||||
$actiondefid = $obj->adid;
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
if (dol_strlen($sendto)) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM');
|
||||
|
||||
|
|
@ -2465,8 +2471,7 @@ class Ticket extends CommonObject
|
|||
foreach ($filename as $i => $val) {
|
||||
$destfile = $destdir.'/'.$filename[$i];
|
||||
// If destination file already exists, we add a suffix to avoid to overwrite
|
||||
if (is_file($destfile))
|
||||
{
|
||||
if (is_file($destfile)) {
|
||||
$pathinfo = pathinfo($filename[$i]);
|
||||
$now = dol_now();
|
||||
$destfile = $destdir.'/'.$pathinfo['filename'].' - '.dol_print_date($now, 'dayhourlog').'.'.$pathinfo['extension'];
|
||||
|
|
@ -2626,11 +2631,10 @@ class Ticket extends CommonObject
|
|||
$this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Private area
|
||||
*/
|
||||
else {
|
||||
} else {
|
||||
/*
|
||||
* Private area
|
||||
*/
|
||||
/*
|
||||
* Send emails to internal users (linked contacts)
|
||||
*/
|
||||
|
|
@ -2670,7 +2674,9 @@ class Ticket extends CommonObject
|
|||
}
|
||||
|
||||
if ($info_sendto['email'] != '') {
|
||||
if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
if (!empty($info_sendto['email'])) {
|
||||
$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
}
|
||||
|
||||
//Contact type
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
|
||||
|
|
@ -2686,7 +2692,9 @@ class Ticket extends CommonObject
|
|||
|
||||
// Add global email address recipient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
}
|
||||
|
||||
// altairis: dont try to send email if no recipient
|
||||
|
|
@ -2744,7 +2752,9 @@ class Ticket extends CommonObject
|
|||
}
|
||||
|
||||
if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
|
||||
if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
if (!empty($info_sendto['email'])) {
|
||||
$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
}
|
||||
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
|
||||
$message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient.'<br>' : '');
|
||||
|
|
@ -2769,12 +2779,16 @@ class Ticket extends CommonObject
|
|||
if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if (!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email;
|
||||
if (!empty($object->thirdparty->email)) {
|
||||
$sendto[] = $object->thirdparty->email;
|
||||
}
|
||||
}
|
||||
|
||||
// altairis: Add global email address reciepient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
}
|
||||
|
||||
// altairis: dont try to send email when no recipient
|
||||
|
|
@ -2787,8 +2801,7 @@ class Ticket extends CommonObject
|
|||
}
|
||||
|
||||
// Set status to "answered" if not set yet, but only if internal user
|
||||
if ($object->fk_statut < 3 && !$user->socid)
|
||||
{
|
||||
if ($object->fk_statut < 3 && !$user->socid) {
|
||||
$object->setStatut(3);
|
||||
}
|
||||
|
||||
|
|
@ -2842,8 +2855,7 @@ class Ticket extends CommonObject
|
|||
|
||||
$from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM;
|
||||
if (is_array($array_receiver) && count($array_receiver) > 0) {
|
||||
foreach ($array_receiver as $key => $receiver)
|
||||
{
|
||||
foreach ($array_receiver as $key => $receiver) {
|
||||
$deliveryreceipt = 0;
|
||||
$filepath = $filename_list;
|
||||
$filename = $mimefilename_list;
|
||||
|
|
@ -2903,19 +2915,21 @@ class Ticket extends CommonObject
|
|||
|
||||
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid)
|
||||
{
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".$user->id;
|
||||
$clause = " AND";
|
||||
}
|
||||
$sql .= $clause." p.entity IN (".getEntity('ticket').")";
|
||||
if ($mode == 'opened') $sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
|
||||
if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid;
|
||||
if ($mode == 'opened') {
|
||||
$sql .= " AND p.fk_statut NOT IN (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")";
|
||||
}
|
||||
if ($user->socid) {
|
||||
$sql .= " AND p.fk_soc = ".$user->socid;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$label = $labelShort = '';
|
||||
$status = '';
|
||||
if ($mode == 'opened') {
|
||||
|
|
@ -2934,14 +2948,11 @@ class Ticket extends CommonObject
|
|||
$response->img = img_object('', "ticket");
|
||||
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$response->nbtodo++;
|
||||
if ($mode == 'opened')
|
||||
{
|
||||
if ($mode == 'opened') {
|
||||
$datelimit = $this->db->jdate($obj->datefin);
|
||||
if ($datelimit < ($now - $delay_warning))
|
||||
{
|
||||
if ($datelimit < ($now - $delay_warning)) {
|
||||
//$response->nbtodolate++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2970,8 +2981,7 @@ class Ticket extends CommonObject
|
|||
$sql = "SELECT count(p.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid)
|
||||
{
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".$user->id;
|
||||
$clause = "AND";
|
||||
|
|
@ -2979,11 +2989,9 @@ class Ticket extends CommonObject
|
|||
$sql .= " ".$clause." p.entity IN (".getEntity('ticket').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$this->nb["ticket"] = $obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ class Diff
|
|||
}
|
||||
|
||||
$end2 = ($compareCharacters ? strlen($sequence1) : count($sequence1));
|
||||
for ($index = $end1 + 1; $index < $end2; $index++)
|
||||
{
|
||||
for ($index = $end1 + 1; $index < $end2; $index++) {
|
||||
$diff[] = array($sequence1[$index], self::UNMODIFIED);
|
||||
}
|
||||
|
||||
|
|
@ -313,12 +312,12 @@ class Diff
|
|||
self::DELETED
|
||||
);
|
||||
$rightCell = self::getCellContent(
|
||||
$diff,
|
||||
$indentation,
|
||||
$separator,
|
||||
$index,
|
||||
self::INSERTED
|
||||
);
|
||||
$diff,
|
||||
$indentation,
|
||||
$separator,
|
||||
$index,
|
||||
self::INSERTED
|
||||
);
|
||||
break;
|
||||
|
||||
// display the inserted content on the right
|
||||
|
|
|
|||
|
|
@ -124,8 +124,7 @@ $contactstatic = new Contact($db);
|
|||
$userstatic = new User($db);
|
||||
|
||||
if ($id > 0 || !empty($track_id) || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref, $track_id) > 0)
|
||||
{
|
||||
if ($object->fetch($id, $ref, $track_id) > 0) {
|
||||
if ($socid > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
$head = societe_prepare_head($object->thirdparty);
|
||||
|
|
@ -161,12 +160,11 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
|
|||
}
|
||||
|
||||
// Thirdparty
|
||||
if (!empty($conf->societe->enabled))
|
||||
{
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty');
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
}*/
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
}*/
|
||||
$morehtmlref .= ' : ';
|
||||
if ($action == 'editcustomer') {
|
||||
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
|
||||
|
|
@ -176,12 +174,10 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
|
|||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ticket->write)
|
||||
{
|
||||
if ($user->rights->ticket->write) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
|
|
|
|||
|
|
@ -22,14 +22,26 @@
|
|||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url.
|
||||
if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations
|
||||
if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
|
||||
if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
|
||||
if (!defined('NOLOGIN')) define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', 1);
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1);
|
||||
}
|
||||
if (!defined('NOLOGIN')) {
|
||||
define('NOLOGIN', 1); // File must be accessed by logon page so without login
|
||||
}
|
||||
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content
|
||||
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
|
||||
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
|
||||
if (!defined('NOREQUIREHTML')) {
|
||||
define('NOREQUIREHTML', 1);
|
||||
}
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
|
||||
session_cache_limiter('public');
|
||||
|
||||
|
|
@ -39,13 +51,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|||
// Define css type
|
||||
top_httphead('text/css');
|
||||
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
|
||||
if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||
else header('Cache-Control: no-cache');
|
||||
if (empty($dolibarr_nocache)) {
|
||||
header('Cache-Control: max-age=3600, public, must-revalidate');
|
||||
} else {
|
||||
header('Cache-Control: no-cache');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
html {
|
||||
min-height: 100%; height: 100%;
|
||||
min-height: 100%; height: 100%;
|
||||
}
|
||||
|
||||
html {
|
||||
|
|
@ -58,49 +73,49 @@ if (!empty($conf->global->TICKET_SHOW_MODULE_LOGO)) {
|
|||
|
||||
|
||||
div.ticketform {
|
||||
font-family: arial;
|
||||
position: static;
|
||||
padding: 2em 1em;
|
||||
overflow-x: auto;
|
||||
border: 2px solid rgb(153, 153, 153);
|
||||
background-color: rgb(255, 255, 255);
|
||||
box-shadow: 2px 2px 2px rgb(245, 245, 245);
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
margin: 1.5em;
|
||||
background : #ffffff;
|
||||
font-family: arial;
|
||||
position: static;
|
||||
padding: 2em 1em;
|
||||
overflow-x: auto;
|
||||
border: 2px solid rgb(153, 153, 153);
|
||||
background-color: rgb(255, 255, 255);
|
||||
box-shadow: 2px 2px 2px rgb(245, 245, 245);
|
||||
border-radius: 10px 10px 10px 10px;
|
||||
margin: 1.5em;
|
||||
background : #ffffff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.ticketform .index_create, .index_display {
|
||||
display: inline-block;
|
||||
width: 200px;
|
||||
height: 45px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
margin: 20px;
|
||||
text-transform: uppercase;
|
||||
width: 200px;
|
||||
height: 45px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
margin: 20px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#form_create_ticket, #form_view_ticket
|
||||
{
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
padding-left:1em;
|
||||
padding-right:1em;
|
||||
padding-top:1.5em;
|
||||
padding-bottom:12px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
padding-left:1em;
|
||||
padding-right:1em;
|
||||
padding-top:1.5em;
|
||||
padding-bottom:12px;
|
||||
|
||||
border: 1px solid #C0C0C0;
|
||||
background-color: #E0E0E0;
|
||||
border: 1px solid #C0C0C0;
|
||||
background-color: #E0E0E0;
|
||||
|
||||
-moz-box-shadow: 4px 4px 4px #DDD;
|
||||
-webkit-box-shadow: 4px 4px 4px #DDD;
|
||||
box-shadow: 4px 4px 4px #DDD;
|
||||
-moz-box-shadow: 4px 4px 4px #DDD;
|
||||
-webkit-box-shadow: 4px 4px 4px #DDD;
|
||||
box-shadow: 4px 4px 4px #DDD;
|
||||
|
||||
border-radius: 8px;
|
||||
border:solid 1px rgba(168,168,168,.4);
|
||||
border-top:solid 1px f8f8f8;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 8px;
|
||||
border:solid 1px rgba(168,168,168,.4);
|
||||
border-top:solid 1px f8f8f8;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
#form_create_ticket input.text, #form_create_ticket textarea { width:450px;}
|
||||
|
|
|
|||
|
|
@ -52,12 +52,18 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
if (empty($page) || $page == -1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
if (!$sortfield) $sortfield = "position_name";
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
if (!$sortfield) {
|
||||
$sortfield = "position_name";
|
||||
}
|
||||
|
||||
$object = new Ticket($db);
|
||||
$result = $object->fetch($id, $ref, $track_id);
|
||||
|
|
@ -86,8 +92,7 @@ $form = new Form($db);
|
|||
$help_url = '';
|
||||
llxHeader('', $langs->trans("TicketDocumentsLinked").' - '.$langs->trans("Files"), $help_url);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
if ($object->id) {
|
||||
/*
|
||||
* Show tabs
|
||||
*/
|
||||
|
|
@ -126,12 +131,11 @@ if ($object->id)
|
|||
}
|
||||
|
||||
// Thirdparty
|
||||
if (!empty($conf->societe->enabled))
|
||||
{
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty');
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
}*/
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
}*/
|
||||
$morehtmlref .= ' : ';
|
||||
if ($action == 'editcustomer') {
|
||||
$morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1);
|
||||
|
|
@ -141,12 +145,10 @@ if ($object->id)
|
|||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ticket->write)
|
||||
{
|
||||
if ($user->rights->ticket->write) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
|
|
@ -190,11 +192,11 @@ if ($object->id)
|
|||
|
||||
//$object->ref = $object->track_id; // For compatibility we use track ID for directory
|
||||
$modulepart = 'ticket';
|
||||
$permission = $user->rights->ticket->write;
|
||||
$permtoedit = $user->rights->ticket->write;
|
||||
$param = '&id='.$object->id;
|
||||
$permission = $user->rights->ticket->write;
|
||||
$permtoedit = $user->rights->ticket->write;
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
} else {
|
||||
accessforbidden('', 0, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,9 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||
$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')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
$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;
|
||||
|
|
@ -81,32 +83,44 @@ $pagenext = $page + 1;
|
|||
$object = new Ticket($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$diroutputmassaction = $conf->ticket->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
if ($socid > 0) $hookmanager->initHooks(array('thirdpartyticket'));
|
||||
elseif ($projectid > 0) $hookmanager->initHooks(array('projectticket'));
|
||||
else $hookmanager->initHooks(array('ticketlist'));
|
||||
if ($socid > 0) {
|
||||
$hookmanager->initHooks(array('thirdpartyticket'));
|
||||
} elseif ($projectid > 0) {
|
||||
$hookmanager->initHooks(array('projectticket'));
|
||||
} else {
|
||||
$hookmanager->initHooks(array('ticketlist'));
|
||||
}
|
||||
// Fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// Default sort order (if not yet defined by previous GETPOST)
|
||||
if (!$sortfield) $sortfield = "t.datec";
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "t.datec";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "DESC";
|
||||
}
|
||||
|
||||
if (GETPOST('search_fk_status', 'alpha') == 'non_closed') $_GET['search_fk_statut'][] = 'openall'; // For backward compatibility
|
||||
if (GETPOST('search_fk_status', 'alpha') == 'non_closed') {
|
||||
$_GET['search_fk_statut'][] = 'openall'; // For backward compatibility
|
||||
}
|
||||
|
||||
// Initialize array of search criterias
|
||||
$search_all = trim(GETPOSTISSET("search_all") ?GETPOSTISSET("search_all", 'alpha') : GETPOST('sall'));
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha')) {
|
||||
$search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||
}
|
||||
}
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['searchall']) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
}
|
||||
$fieldstosearchall['s.name_alias'] = "AliasNameShort";
|
||||
$fieldstosearchall['s.zip'] = "Zip";
|
||||
|
|
@ -114,10 +128,11 @@ $fieldstosearchall['s.town'] = "Town";
|
|||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array();
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
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']);
|
||||
if (!empty($val['visible'])) {
|
||||
$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
|
@ -136,8 +151,7 @@ if (!$user->rights->ticket->read) {
|
|||
// Store current page url
|
||||
$url_page_current = dol_buildpath('/ticket/list.php', 1);
|
||||
|
||||
if ($project_ref)
|
||||
{
|
||||
if ($project_ref) {
|
||||
$tmpproject = new Project($db);
|
||||
$tmpproject->fetch(0, $project_ref);
|
||||
$projectid = $tmpproject->id;
|
||||
|
|
@ -155,25 +169,32 @@ $error = 0;
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
||||
if (GETPOST('cancel', 'alpha')) {
|
||||
$action = 'list'; $massaction = '';
|
||||
}
|
||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
if ($socid > 0) $parameters['socid'] = $socid;
|
||||
if ($projectid > 0) $parameters['projectid'] = $projectid;
|
||||
if ($socid > 0) {
|
||||
$parameters['socid'] = $socid;
|
||||
}
|
||||
if ($projectid > 0) {
|
||||
$parameters['projectid'] = $projectid;
|
||||
}
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Selection of new fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$toselect = '';
|
||||
|
|
@ -186,8 +207,7 @@ if (empty($reshook))
|
|||
$search_dateclose_end = '';
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
|
||||
{
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
|
||||
}
|
||||
|
||||
|
|
@ -198,26 +218,23 @@ if (empty($reshook))
|
|||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
// Close records
|
||||
if (!$error && $massaction == 'close' && $permissiontoadd)
|
||||
{
|
||||
if (!$error && $massaction == 'close' && $permissiontoadd) {
|
||||
$objecttmp = new $objectclass($db);
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid)
|
||||
{
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
$result = $objecttmp->close($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} else $nbok++;
|
||||
} else {
|
||||
$nbok++;
|
||||
}
|
||||
} else {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
|
|
@ -225,10 +242,12 @@ if (empty($reshook))
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
if (!$error) {
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
}
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
|
@ -238,27 +257,24 @@ if (empty($reshook))
|
|||
}
|
||||
|
||||
// Reopen records
|
||||
if (!$error && $massaction == 'reopen' && $permissiontoadd)
|
||||
{
|
||||
if (!$error && $massaction == 'reopen' && $permissiontoadd) {
|
||||
$objecttmp = new $objectclass($db);
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid)
|
||||
{
|
||||
foreach ($toselect as $toselectid) {
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($result > 0) {
|
||||
if ($objecttmp->status == Ticket::STATUS_CLOSED || $objecttmp->status == Ticket::STATUS_CANCELED) {
|
||||
$result = $objecttmp->setStatut(Ticket::STATUS_ASSIGNED);
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
} else $nbok++;
|
||||
} else {
|
||||
$nbok++;
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorObjectMustHaveStatusClosedToBeReOpened", $objecttmp->ref), null, 'errors');
|
||||
|
|
@ -272,10 +288,12 @@ if (empty($reshook))
|
|||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
if (!$error) {
|
||||
if ($nbok > 1) {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
}
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
|
@ -307,34 +325,37 @@ $title = $langs->trans('TicketList');
|
|||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$sql .= 't.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/, $/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
|
||||
$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||
if ($socid > 0)
|
||||
{
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND t.fk_soc = ".$socid;
|
||||
}
|
||||
|
||||
foreach ($search as $key => $val)
|
||||
{
|
||||
if ($key == 'fk_statut' && !empty($search['fk_statut']))
|
||||
{
|
||||
foreach ($search as $key => $val) {
|
||||
if ($key == 'fk_statut' && !empty($search['fk_statut'])) {
|
||||
$newarrayofstatus = array();
|
||||
foreach ($search['fk_statut'] as $key2 => $val2) {
|
||||
if (in_array($val2, array('openall', 'closeall'))) continue;
|
||||
if (in_array($val2, array('openall', 'closeall'))) {
|
||||
continue;
|
||||
}
|
||||
$newarrayofstatus[] = $val2;
|
||||
}
|
||||
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) {
|
||||
|
|
@ -349,31 +370,54 @@ foreach ($search as $key => $val)
|
|||
$newarrayofstatus[] = Ticket::STATUS_CLOSED;
|
||||
$newarrayofstatus[] = Ticket::STATUS_CANCELED;
|
||||
}
|
||||
if (count($newarrayofstatus)) $sql .= natural_search($key, join(',', $newarrayofstatus), 2);
|
||||
if (count($newarrayofstatus)) {
|
||||
$sql .= natural_search($key, join(',', $newarrayofstatus), 2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project')
|
||||
{
|
||||
if ($search[$key] > 0) $sql .= natural_search($key, $search[$key], 2);
|
||||
if ($key == 'fk_user_assign' || $key == 'fk_user_create' || $key == 'fk_project') {
|
||||
if ($search[$key] > 0) {
|
||||
$sql .= natural_search($key, $search[$key], 2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], $mode_search);
|
||||
if ($search[$key] != '') {
|
||||
$sql .= natural_search($key, $search[$key], $mode_search);
|
||||
}
|
||||
}
|
||||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
if ($search_societe) {
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2);
|
||||
if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
|
||||
if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
|
||||
if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";
|
||||
if ($search_dateread_end) $sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'";
|
||||
if ($search_dateclose_start) $sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'";
|
||||
if ($search_dateclose_end) $sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'";
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND t.datec >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND t.datec <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if ($search_dateread_start) {
|
||||
$sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'";
|
||||
}
|
||||
if ($search_dateread_end) {
|
||||
$sql .= " AND t.date_read <= '".$db->idate($search_dateread_end)."'";
|
||||
}
|
||||
if ($search_dateclose_start) {
|
||||
$sql .= " AND t.date_close >= '".$db->idate($search_dateclose_start)."'";
|
||||
}
|
||||
if ($search_dateclose_end) {
|
||||
$sql .= " AND t.date_close <= '".$db->idate($search_dateclose_end)."'";
|
||||
}
|
||||
|
||||
|
||||
if (!$user->socid && ($mode == "mine" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) {
|
||||
$sql .= " AND (t.fk_user_assign = ".$user->id;
|
||||
if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) $sql .= " OR t.fk_user_create = ".$user->id;
|
||||
if (empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) {
|
||||
$sql .= " OR t.fk_user_create = ".$user->id;
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
|
|
@ -388,26 +432,22 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
{
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
|
@ -416,8 +456,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
|||
}
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/ticket/card.php?id='.$id);
|
||||
|
|
@ -449,30 +488,30 @@ if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) {
|
|||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Customer code
|
||||
if ($socstat->client && !empty($socstat->code_client)) {
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('CustomerCode').'</td><td>';
|
||||
print $socstat->code_client;
|
||||
$tmpcheck = $socstat->check_codeclient();
|
||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Supplier code
|
||||
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('SupplierCode').'</td><td>';
|
||||
print $socstat->code_fournisseur;
|
||||
$tmpcheck = $socstat->check_codefournisseur();
|
||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Customer code
|
||||
if ($socstat->client && !empty($socstat->code_client)) {
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('CustomerCode').'</td><td>';
|
||||
print $socstat->code_client;
|
||||
$tmpcheck = $socstat->check_codeclient();
|
||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Supplier code
|
||||
if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('SupplierCode').'</td><td>';
|
||||
print $socstat->code_fournisseur;
|
||||
$tmpcheck = $socstat->check_codefournisseur();
|
||||
if ($tmpcheck != 0 && $tmpcheck != -5) {
|
||||
print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
|
@ -506,15 +545,13 @@ if ($projectid > 0 || $project_ref) {
|
|||
// Title
|
||||
$morehtmlref .= $object->title;
|
||||
// Thirdparty
|
||||
if ($object->thirdparty->id > 0)
|
||||
{
|
||||
if ($object->thirdparty->id > 0) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
if (!$user->rights->projet->all->lire)
|
||||
{
|
||||
if (!$user->rights->projet->all->lire) {
|
||||
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
|
||||
$object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
|
||||
}
|
||||
|
|
@ -549,39 +586,75 @@ if ($projectid > 0 || $project_ref) {
|
|||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
foreach ($search as $key => $val)
|
||||
{
|
||||
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.urlencode($limit);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
}
|
||||
} else {
|
||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
if ($socid) $param .= '&socid='.urlencode($socid);
|
||||
if ($projectid) $param .= '&projectid='.urlencode($projectid);
|
||||
if ($socid) {
|
||||
$param .= '&socid='.urlencode($socid);
|
||||
}
|
||||
if ($projectid) {
|
||||
$param .= '&projectid='.urlencode($projectid);
|
||||
}
|
||||
|
||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||
if ($search_dateread_start) $param .= '&search_dateread_start='.urlencode($search_dateread_start);
|
||||
if ($search_dateread_end) $param .= '&search_dateread_end='.urlencode($search_dateread_end);
|
||||
if ($search_dateclose_start) $param .= '&search_dateclose_start='.urlencode($search_dateclose_start);
|
||||
if ($search_dateclose_end) $param .= '&search_dateclose_end='.urlencode($search_dateclose_end);
|
||||
if ($search_date_start) {
|
||||
$param .= '&search_date_start='.urlencode($search_date_start);
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$param .= '&search_date_end='.urlencode($search_date_end);
|
||||
}
|
||||
if ($search_dateread_start) {
|
||||
$param .= '&search_dateread_start='.urlencode($search_dateread_start);
|
||||
}
|
||||
if ($search_dateread_end) {
|
||||
$param .= '&search_dateread_end='.urlencode($search_dateread_end);
|
||||
}
|
||||
if ($search_dateclose_start) {
|
||||
$param .= '&search_dateclose_start='.urlencode($search_dateclose_start);
|
||||
}
|
||||
if ($search_dateclose_end) {
|
||||
$param .= '&search_dateclose_end='.urlencode($search_dateclose_end);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
//'presend'=>$langs->trans("SendByMail"),
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
if ($user->rights->ticket->write) $arrayofmassactions['close'] = $langs->trans("Close");
|
||||
if ($user->rights->ticket->write) $arrayofmassactions['reopen'] = $langs->trans("ReOpen");
|
||||
if ($user->rights->ticket->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||
if ($user->rights->ticket->write) {
|
||||
$arrayofmassactions['close'] = $langs->trans("Close");
|
||||
}
|
||||
if ($user->rights->ticket->write) {
|
||||
$arrayofmassactions['reopen'] = $langs->trans("ReOpen");
|
||||
}
|
||||
if ($user->rights->ticket->delete) {
|
||||
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
}
|
||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
||||
$arrayofmassactions = array();
|
||||
}
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
if ($optioncss != '') {
|
||||
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
|
|
@ -589,15 +662,23 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'" >';
|
||||
if ($socid) print '<input type="hidden" name="socid" value="'.$socid.'" >';
|
||||
if ($projectid) print '<input type="hidden" name="projectid" value="'.$projectid.'" >';
|
||||
if ($socid) {
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'" >';
|
||||
}
|
||||
if ($projectid) {
|
||||
print '<input type="hidden" name="projectid" value="'.$projectid.'" >';
|
||||
}
|
||||
|
||||
$url = DOL_URL_ROOT.'/ticket/card.php?action=create'.($socid ? '&socid='.$socid : '').($projectid ? '&origin=projet_project&originid='.$projectid : '');
|
||||
if (!empty($socid)) $url .= '&socid='.$socid;
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.$socid;
|
||||
}
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write);
|
||||
|
||||
$picto = 'ticket';
|
||||
if ($socid > 0) $picto = '';
|
||||
if ($socid > 0) {
|
||||
$picto = '';
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
|
|
@ -611,9 +692,10 @@ $objecttmp = new Ticket($db);
|
|||
$trackid = 'tic'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($search_all)
|
||||
{
|
||||
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
||||
if ($search_all) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
|
|
@ -624,11 +706,13 @@ $moreforfilter.= '</div>';*/
|
|||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
$moreforfilter .= $hookmanager->resPrint;
|
||||
} else {
|
||||
$moreforfilter = $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (!empty($moreforfilter))
|
||||
{
|
||||
if (!empty($moreforfilter)) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
|
|
@ -645,13 +729,17 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
|||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'fk_statut') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if ($key == 'fk_statut') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
if ($key == 'type_code') {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
|
|
@ -672,23 +760,26 @@ foreach ($object->fields as $key => $val)
|
|||
} elseif ($key == 'fk_statut') {
|
||||
$arrayofstatus = array();
|
||||
$arrayofstatus['openall'] = '-- '.$langs->trans('OpenAll').' --';
|
||||
foreach ($object->statuts_short as $key2 => $val2)
|
||||
{
|
||||
if ($key2 == Ticket::STATUS_CLOSED) $arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --';
|
||||
foreach ($object->statuts_short as $key2 => $val2) {
|
||||
if ($key2 == Ticket::STATUS_CLOSED) {
|
||||
$arrayofstatus['closeall'] = '-- '.$langs->trans('ClosedAll').' --';
|
||||
}
|
||||
$arrayofstatus[$key2] = $val2;
|
||||
}
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
//var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key]));
|
||||
$selectedarray = null;
|
||||
if ($search[$key]) $selectedarray = array_values($search[$key]);
|
||||
if ($search[$key]) {
|
||||
$selectedarray = array_values($search[$key]);
|
||||
}
|
||||
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', '');
|
||||
print '</td>';
|
||||
} elseif ($key == "fk_soc") {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'"><input type="text" class="flat maxwidth75" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
} elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close'){
|
||||
} elseif ($key == "datec" || $key == 'date_read' || $key == 'date_close') {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
switch ($key){
|
||||
switch ($key) {
|
||||
case 'datec':
|
||||
print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
|
||||
break;
|
||||
|
|
@ -700,7 +791,7 @@ foreach ($object->fields as $key => $val)
|
|||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
switch ($key){
|
||||
switch ($key) {
|
||||
case 'datec':
|
||||
print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
|
||||
break;
|
||||
|
|
@ -712,13 +803,15 @@ foreach ($object->fields as $key => $val)
|
|||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
|
@ -741,15 +834,18 @@ print '</tr>'."\n";
|
|||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'fk_statut' || $key == 'severity_code') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
if ($key == 'fk_statut' || $key == 'severity_code') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -765,11 +861,11 @@ print '</tr>'."\n";
|
|||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine = 0;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) {
|
||||
$needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -779,70 +875,83 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
|||
$i = 0;
|
||||
$totalarray = array();
|
||||
$cacheofoutputfield = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
// Store properties in $object
|
||||
$object->id = $obj->rowid;
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (property_exists($obj, $key)) {
|
||||
$object->$key = $obj->$key;
|
||||
}
|
||||
}
|
||||
$langs->load("ticket");
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = '';
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
if (in_array($key, array('ref', 'fk_project'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
|
||||
if ($key == 'fk_statut' || $key == 'severity_code') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
}
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
}
|
||||
if (in_array($key, array('ref', 'fk_project'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
|
||||
}
|
||||
if ($key == 'fk_statut' || $key == 'severity_code') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td';
|
||||
if ($cssforfield || $val['css']) print ' class="';
|
||||
if ($cssforfield || $val['css']) {
|
||||
print ' class="';
|
||||
}
|
||||
print $cssforfield;
|
||||
if ($cssforfield && $val['css']) print ' ';
|
||||
if ($cssforfield && $val['css']) {
|
||||
print ' ';
|
||||
}
|
||||
print $val['css'];
|
||||
if ($cssforfield || $val['css']) print '"';
|
||||
if ($cssforfield || $val['css']) {
|
||||
print '"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'fk_statut') print $object->getLibStatut(5);
|
||||
elseif ($key == 'subject') {
|
||||
if ($key == 'fk_statut') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'subject') {
|
||||
$s = $obj->subject;
|
||||
print '<span title="'.$s.'">';
|
||||
print $s;
|
||||
print '</span>';
|
||||
}
|
||||
elseif ($key == 'type_code') {
|
||||
} elseif ($key == 'type_code') {
|
||||
$s = $langs->getLabelFromKey($db, 'TicketTypeShort'.$object->type_code, 'c_ticket_type', 'code', 'label', $object->type_code);
|
||||
print '<span title="'.$s.'">';
|
||||
print $s;
|
||||
print '</span>';
|
||||
}
|
||||
elseif ($key == 'category_code') {
|
||||
} elseif ($key == 'category_code') {
|
||||
$s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code);
|
||||
print '<span title="'.$s.'">';
|
||||
print $s;
|
||||
print '</span>';
|
||||
}
|
||||
elseif ($key == 'severity_code') {
|
||||
} elseif ($key == 'severity_code') {
|
||||
$s = $langs->getLabelFromKey($db, 'TicketSeverityShort'.$object->severity_code, 'c_ticket_severity', 'code', 'label', $object->severity_code);
|
||||
print '<span title="'.$s.'">';
|
||||
print $s;
|
||||
print '</span>';
|
||||
}
|
||||
elseif ($key == 'tms') print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
|
||||
elseif ($key == 'fk_user_create') {
|
||||
} elseif ($key == 'tms') {
|
||||
print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
|
||||
} elseif ($key == 'fk_user_create') {
|
||||
if ($object->fk_user_create > 0) {
|
||||
$user_create->fetch($object->fk_user_create);
|
||||
print $user_create->getNomUrl(-1);
|
||||
}
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
|
||||
} else { // Example: key=fk_soc, obj->key=123 val=array('type'=>'integer', ...
|
||||
$tmp = explode(':', $val['type']);
|
||||
if ($tmp[0] == 'integer' && !empty($tmp[1]) && class_exists($tmp[1])) {
|
||||
// It is a type of an foreign field. We will try to reduce the number of fetch that the showOutputField is making.
|
||||
|
|
@ -860,10 +969,13 @@ while ($i < min($num, $limit))
|
|||
}
|
||||
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!empty($val['isameasure']))
|
||||
{
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
||||
}
|
||||
}
|
||||
|
|
@ -876,14 +988,17 @@ while ($i < min($num, $limit))
|
|||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
|
|
@ -895,10 +1010,13 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|||
|
||||
|
||||
// If no record found
|
||||
if ($num == 0)
|
||||
{
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -916,10 +1034,11 @@ print '</form>'."\n";
|
|||
|
||||
|
||||
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||
{
|
||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
||||
$hidegeneratedfilelistifempty = 0;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile = new FormFile($db);
|
||||
|
|
|
|||
|
|
@ -46,16 +46,21 @@ $sortorder = GETPOST("sortorder", 'aZ09comma');
|
|||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$page = is_numeric($page) ? $page : 0;
|
||||
$page = $page == -1 ? 0 : $page;
|
||||
if (!$sortfield) $sortfield = "a.datep,a.id";
|
||||
if (!$sortorder) $sortorder = "desc";
|
||||
if (!$sortfield) {
|
||||
$sortfield = "a.datep,a.id";
|
||||
}
|
||||
if (!$sortorder) {
|
||||
$sortorder = "desc";
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
if (GETPOST('actioncode', 'array')) {
|
||||
$actioncode = GETPOST('actioncode', 'array', 3);
|
||||
if (!count($actioncode)) $actioncode = '0';
|
||||
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));
|
||||
}
|
||||
|
|
@ -82,8 +87,7 @@ if (!$user->rights->ticket->read) {
|
|||
accessforbidden();
|
||||
}
|
||||
// restrict access for externals users
|
||||
if ($user->socid > 0 && ($object->fk_soc != $user->socid))
|
||||
{
|
||||
if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
|
||||
accessforbidden();
|
||||
}
|
||||
// or for unauthorized internals users
|
||||
|
|
@ -99,17 +103,17 @@ if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object-
|
|||
|
||||
$parameters = array('id'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
// Set view style
|
||||
$_SESSION['ticket-view-type'] = "messaging";
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
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 = '';
|
||||
}
|
||||
|
|
@ -125,7 +129,9 @@ $userstat = new User($db);
|
|||
$formticket = new FormTicket($db);
|
||||
|
||||
$title = $langs->trans("Ticket").' - '.$object->ref.' '.$object->name;
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
|
||||
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
|
||||
$title = $object->ref.' '.$object->name.' - '.$langs->trans("Info");
|
||||
}
|
||||
$help_url = 'FR:DocumentationModuleTicket';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
|
@ -166,8 +172,7 @@ if (!empty($object->origin_email)) {
|
|||
}
|
||||
|
||||
// Thirdparty
|
||||
if (!empty($conf->societe->enabled))
|
||||
{
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty');
|
||||
/*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $url_page_current . '?action=editcustomer&track_id=' . $object->track_id . '">' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '</a>';
|
||||
|
|
@ -181,12 +186,10 @@ if (!empty($conf->societe->enabled))
|
|||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project');
|
||||
if ($user->rights->ticket->write)
|
||||
{
|
||||
if ($user->rights->ticket->write) {
|
||||
if ($action != 'classify') {
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
|
||||
$morehtmlref .= ' : ';
|
||||
|
|
@ -224,11 +227,14 @@ print dol_get_fiche_end();
|
|||
print '<br>';
|
||||
|
||||
|
||||
if (!empty($object->id))
|
||||
{
|
||||
if (!empty($object->id)) {
|
||||
$param = '&id='.$object->id;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.$contextpage;
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.$limit;
|
||||
}
|
||||
|
||||
$morehtmlright = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -30,15 +30,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
|||
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
if (!$user->rights->ticket->read) accessforbidden();
|
||||
if (!$user->rights->ticket->read) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$object_status = GETPOST('object_status', 'intcomma');
|
||||
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if ($user->socid > 0) {
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
|
@ -70,7 +71,9 @@ print load_fiche_titre($title, '', 'ticket');
|
|||
dol_mkdir($dir);
|
||||
|
||||
$stats = new TicketStats($db, $socid, ($userid > 0 ? $userid : 0));
|
||||
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND fk_statut IN ('.$db->sanitize($db->escape($object_status)).')';
|
||||
if ($object_status != '' && $object_status >= -1) {
|
||||
$stats->where .= ' AND fk_statut IN ('.$db->sanitize($db->escape($object_status)).')';
|
||||
}
|
||||
|
||||
|
||||
// Build graphic number of object
|
||||
|
|
@ -80,8 +83,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
|
|||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid)
|
||||
{
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
$filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
} else {
|
||||
|
|
@ -91,12 +93,10 @@ if (!$user->rights->societe->client->voir || $user->socid)
|
|||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
if (!$mesg) {
|
||||
$px1->SetData($data);
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
while ($i <= $endyear) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -119,8 +119,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
|
|||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid)
|
||||
{
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
$filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
} else {
|
||||
|
|
@ -130,12 +129,10 @@ if (!$user->rights->societe->client->voir || $user->socid)
|
|||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
if (!$mesg) {
|
||||
$px2->SetData($data);
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
while ($i <= $endyear) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -156,8 +153,7 @@ if (!$mesg)
|
|||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->socid)
|
||||
{
|
||||
if (!$user->rights->societe->client->voir || $user->socid) {
|
||||
$filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png';
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png';
|
||||
} else {
|
||||
|
|
@ -167,12 +163,10 @@ if (!$user->rights->societe->client->voir || $user->socid)
|
|||
|
||||
$px3 = new DolGraph();
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (!$mesg)
|
||||
{
|
||||
if (!$mesg) {
|
||||
$px3->SetData($data);
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
while ($i <= $endyear) {
|
||||
$legend[] = $i;
|
||||
$i++;
|
||||
}
|
||||
|
|
@ -200,7 +194,9 @@ foreach ($data as $val) {
|
|||
$arrayyears[$val['year']] = $val['year'];
|
||||
}
|
||||
}
|
||||
if (!count($arrayyears)) $arrayyears[$nowyear] = $nowyear;
|
||||
if (!count($arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
|
@ -239,8 +235,12 @@ print $form->selectarray('object_status', $liststatus, GETPOST('object_status',
|
|||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
|
||||
if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year;
|
||||
if (!in_array($nowyear, $arrayyears)) $arrayyears[$nowyear] = $nowyear;
|
||||
if (!in_array($year, $arrayyears)) {
|
||||
$arrayyears[$year] = $year;
|
||||
}
|
||||
if (!in_array($nowyear, $arrayyears)) {
|
||||
$arrayyears[$nowyear] = $nowyear;
|
||||
}
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year', $arrayyears, $year, 0);
|
||||
print '</td></tr>';
|
||||
|
|
@ -263,11 +263,9 @@ print '<td class="right">%</td>';
|
|||
print '</tr>';
|
||||
|
||||
$oldyear = 0;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
foreach ($data as $val) {
|
||||
$year = $val['year'];
|
||||
while (!empty($year) && $oldyear > $year + 1)
|
||||
{ // If we have empty year
|
||||
while (!empty($year) && $oldyear > $year + 1) { // If we have empty year
|
||||
$oldyear--;
|
||||
|
||||
print '<tr class="oddeven" height="24">';
|
||||
|
|
@ -303,7 +301,9 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
|||
|
||||
// Show graphs
|
||||
print '<table class="border centpercent"><tr class="pair nohover"><td class="center">';
|
||||
if ($mesg) { print $mesg; } else {
|
||||
if ($mesg) {
|
||||
print $mesg;
|
||||
} else {
|
||||
print $px1->show();
|
||||
print "<br>\n";
|
||||
//print $px2->show();
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
if (empty($conf) || !is_object($conf)) {
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
}
|
||||
|
|
@ -38,52 +37,54 @@ $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'datec', 'desc', 0, 0, 1
|
|||
|
||||
$total = 0;
|
||||
$ilink = 0;
|
||||
foreach ($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
$ilink++;
|
||||
|
||||
$trclass = 'oddeven';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass .= ' liste_sub_total';
|
||||
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
|
||||
$trclass .= ' liste_sub_total';
|
||||
}
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
|
||||
<?php if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a'; ?>
|
||||
</td>
|
||||
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->datec, 'day'); ?></td>
|
||||
<?php
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td class="linkedcol-element" ><?php echo $langs->trans("Ticket"); ?>
|
||||
<?php if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
|
||||
print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
|
||||
} ?>
|
||||
</td>
|
||||
<td class="linkedcol-name nowraponall" ><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td class="linkedcol-date center"><?php echo dol_print_date($objectlink->datec, 'day'); ?></td>
|
||||
<?php
|
||||
//$objectlink->socid = $objectlink->fk_soc;
|
||||
//$objectlink->fetch_thirdparty();
|
||||
?>
|
||||
<td class="linkedcol-amount right"><?php //echo $objectlink->thirdparty->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action right">
|
||||
<?php
|
||||
<td class="linkedcol-amount right"><?php //echo $objectlink->thirdparty->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-statut right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td class="linkedcol-action right">
|
||||
<?php
|
||||
// For now, shipments must stay linked to order, so link is not deletable
|
||||
if ($object->element != 'shipping') {
|
||||
?>
|
||||
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
|
||||
<?php
|
||||
<a class="reposition" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
if (count($linkedObjectBlock) > 1)
|
||||
{
|
||||
if (count($linkedObjectBlock) > 1) {
|
||||
?>
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td class="center"></td>
|
||||
<td class="center"></td>
|
||||
<td class="right"><?php echo price($total); ?></td>
|
||||
<td class="right"></td>
|
||||
<td class="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
<tr class="liste_total <?php echo (empty($noMoreLinkedObjectBlockAfter) ? 'liste_sub_total' : ''); ?>">
|
||||
<td><?php echo $langs->trans("Total"); ?></td>
|
||||
<td></td>
|
||||
<td class="center"></td>
|
||||
<td class="center"></td>
|
||||
<td class="right"><?php echo price($total); ?></td>
|
||||
<td class="right"></td>
|
||||
<td class="right"></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
print "<!-- END PHP TEMPLATE -->\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user