Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-08-22 13:05:22 +02:00
commit 2b5205b639
11 changed files with 44 additions and 48 deletions

View File

@ -218,7 +218,6 @@ if ($mode == 'setup' && $user->admin) {
$tokenobj = null; $tokenobj = null;
// Token // Token
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
// Dolibarr storage // Dolibarr storage
$storage = new DoliStorage($db, $conf); $storage = new DoliStorage($db, $conf);
try { try {

View File

@ -883,8 +883,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//Default language //Default language
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n"; print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone', 0, 0, 0, null, 1); print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -1171,8 +1170,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//Default language //Default language
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n"; print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1); print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -1403,7 +1401,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//$s=picto_from_langcode($object->default_lang); //$s=picto_from_langcode($object->default_lang);
//print ($s?$s.' ':''); //print ($s?$s.' ':'');
$langs->load("languages"); $langs->load("languages");
$labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang.'_'.strtoupper($object->default_lang)) : ''); $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
print $labellang; print $labellang;
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -73,7 +73,7 @@ if ($type == 'proposal') {
$securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
} }
if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $entity), $SECUREKEY, '0')) {
http_response_code(403); http_response_code(403);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1); exit(-1);

View File

@ -1552,10 +1552,10 @@ function complete_elementList_with_modules(&$elementList)
// We discard modules according to features level (PS: if module is activated we always show it) // We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && !$conf->global->$const_name) { if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && getDolGlobalString($const_name)) {
$modulequalified = 0; $modulequalified = 0;
} }
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && !$conf->global->$const_name) { if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && getDolGlobalString($const_name)) {
$modulequalified = 0; $modulequalified = 0;
} }
//If module is not activated disqualified //If module is not activated disqualified

View File

@ -90,7 +90,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
if ($mode == 1) { if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + proposal_ref)"; $out .= "hash('".$securekeyseed."' + '".$type."' + proposal_ref)";
} else { } else {
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref, '0'); $out .= '&securekey='.dol_hash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $object->entity), '0');
} }
/* /*
if ($mode == 1) { if ($mode == 1) {

View File

@ -199,7 +199,7 @@ if (empty($reshook)) {
if ($result <= 0) { if ($result <= 0) {
dol_print_error($db); dol_print_error($db);
} }
$multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->total_ttc - $tmpinvoice->getSommePaiement(1)); $multicurrency_amountsresttopay[$cursorfacid] = price2num($tmpinvoice->multicurrency_total_ttc - $tmpinvoice->getSommePaiement(1));
if ($multicurrency_amounts[$cursorfacid]) { if ($multicurrency_amounts[$cursorfacid]) {
// Check amount // Check amount
if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) { if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) {

View File

@ -99,13 +99,12 @@ if (!$sortorder) {
$search_all = GETPOST('search_all', 'alphanohtml'); $search_all = GETPOST('search_all', 'alphanohtml');
$search = array(); $search = array();
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') { if ($key == "lang") {
if ($key == "lang") { $search[$key] = GETPOST('search_'.$key, 'alpha')!='0' ? GETPOST('search_'.$key, 'alpha') : '';
$search[$key] = GETPOST('search_'.$key, 'alpha')!='0' ? GETPOST('search_'.$key, 'alpha') : ''; } else {
} else { $search[$key] = GETPOST('search_'.$key, 'alpha');
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
} }
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int')); $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int')); $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));

View File

@ -4801,9 +4801,10 @@ class Product extends CommonObject
* @param int $id Id of product to search childs of * @param int $id Id of product to search childs of
* @param int $firstlevelonly Return only direct child * @param int $firstlevelonly Return only direct child
* @param int $level Level of recursing call (start to 1) * @param int $level Level of recursing call (start to 1)
* @param array $parents Array of all parents of $id
* @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref) * @return array Return array(prodid=>array(0=prodid, 1=>qty, 2=>product type, 3=>label, 4=>incdec, 5=>product ref)
*/ */
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1) public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array())
{ {
global $alreadyfound; global $alreadyfound;
@ -4821,7 +4822,7 @@ class Product extends CommonObject
$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
$sql.= " ORDER BY pa.rang"; $sql.= " ORDER BY pa.rang";
dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level, LOG_DEBUG); dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.$parents, LOG_DEBUG);
if ($level == 1) { if ($level == 1) {
$alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly
@ -4837,7 +4838,9 @@ class Product extends CommonObject
while ($rec = $this->db->fetch_array($res)) { while ($rec = $this->db->fetch_array($res)) {
if (!empty($alreadyfound[$rec['rowid']])) { if (!empty($alreadyfound[$rec['rowid']])) {
dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING); dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING);
continue; if (in_array($rec['id'], $parents)) {
continue; // We discard this child if it is already found at a higher level in tree in the same branch.
}
} }
$alreadyfound[$rec['rowid']] = 1; $alreadyfound[$rec['rowid']] = 1;
$prods[$rec['rowid']] = array( $prods[$rec['rowid']] = array(
@ -4853,7 +4856,7 @@ class Product extends CommonObject
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']);
//$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']);
if (empty($firstlevelonly)) { if (empty($firstlevelonly)) {
$listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1); $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, array_push($parents, $rec['rowid']));
foreach ($listofchilds as $keyChild => $valueChild) { foreach ($listofchilds as $keyChild => $valueChild) {
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild; $prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;
} }

View File

@ -139,7 +139,7 @@ if ($source == 'proposal') {
$securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
} }
if (!dol_verifyHash($securekeyseed.$type.$ref, $SECUREKEY, '0')) { if (!dol_verifyHash($securekeyseed.$type.$ref.(empty($conf->multicompany->enabled) ? '' : $entity), $SECUREKEY, '0')) {
http_response_code(403); http_response_code(403);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1); exit(-1);
@ -293,7 +293,6 @@ if ($source == 'proposal') {
$result = $object->fetch_thirdparty($object->socid); $result = $object->fetch_thirdparty($object->socid);
// Creditor // Creditor
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Creditor"); print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Creditor");
print '</td><td class="CTableRow2">'; print '</td><td class="CTableRow2">';
print img_picto('', 'company', 'class="pictofixedwidth"'); print img_picto('', 'company', 'class="pictofixedwidth"');
@ -302,7 +301,6 @@ if ($source == 'proposal') {
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Debitor // Debitor
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty"); print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow2">'; print '</td><td class="CTableRow2">';
print img_picto('', 'company', 'class="pictofixedwidth"'); print img_picto('', 'company', 'class="pictofixedwidth"');
@ -310,14 +308,12 @@ if ($source == 'proposal') {
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Amount // Amount
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount"); print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
print '</td><td class="CTableRow2">'; print '</td><td class="CTableRow2">';
print '<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</b>'; print '<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</b>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Object // Object
$text = '<b>'.$langs->trans("SignatureProposalRef", $object->ref).'</b>'; $text = '<b>'.$langs->trans("SignatureProposalRef", $object->ref).'</b>';
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation"); print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
print '</td><td class="CTableRow2">'.$text; print '</td><td class="CTableRow2">'.$text;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -218,7 +219,7 @@ if (empty($reshook)) {
$fk_user_assign = GETPOST("fk_user_assign", 'int'); $fk_user_assign = GETPOST("fk_user_assign", 'int');
if ($fk_user_assign > 0) { if ($fk_user_assign > 0) {
$object->fk_user_assign = $fk_user_assign; $object->fk_user_assign = $fk_user_assign;
$object->fk_status = $object::STATUS_ASSIGNED; $object->status = $object::STATUS_ASSIGNED;
} }
$object->fk_project = $projectid; $object->fk_project = $projectid;
@ -298,7 +299,7 @@ if (empty($reshook)) {
} }
} }
if ($action == 'update' && $user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) { if ($action == 'update' && $user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) {
$error = 0; $error = 0;
$ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha')); $ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha'));
@ -560,7 +561,7 @@ if (empty($reshook)) {
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) { if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
// prevent browser refresh from reopening ticket several times // prevent browser refresh from reopening ticket several times
if ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED) { if ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED) {
$res = $object->setStatut(Ticket::STATUS_ASSIGNED); $res = $object->setStatut(Ticket::STATUS_ASSIGNED);
if ($res) { if ($res) {
// Log action in ticket logs table // Log action in ticket logs table
@ -619,7 +620,7 @@ if (empty($reshook)) {
// Reopen ticket // Reopen ticket
if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$new_status = GETPOST('new_status', 'int'); $new_status = GETPOST('new_status', 'int');
$old_status = $object->fk_status; $old_status = $object->status;
$res = $object->setStatut($new_status); $res = $object->setStatut($new_status);
if ($res) { if ($res) {
// Log action in ticket logs table // Log action in ticket logs table
@ -738,7 +739,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->withcancel = 1; $formticket->withcancel = 1;
$formticket->showForm(1, 'create', 0); $formticket->showForm(1, 'create', 0);
/*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) { /*} elseif ($action == 'edit' && $user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) {
$formticket = new FormTicket($db); $formticket = new FormTicket($db);
$head = ticket_prepare_head($object); $head = ticket_prepare_head($object);
@ -953,7 +954,7 @@ if ($action == 'create' || $action == 'presend') {
// Thirdparty // Thirdparty
if (!empty($conf->societe->enabled)) { if (!empty($conf->societe->enabled)) {
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' '; $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' ';
if ($action != 'editcustomer' && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) { if ($action != 'editcustomer' && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
$morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 0).'</a> : '; $morehtmlref .= '<a class="editfielda" href="'.$url_page_current.'?action=editcustomer&token='.newToken().'&track_id='.$object->track_id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 0).'</a> : ';
} }
if ($action == 'editcustomer') { if ($action == 'editcustomer') {
@ -1070,7 +1071,7 @@ if ($action == 'create' || $action == 'presend') {
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans("AssignedTo"); print $langs->trans("AssignedTo");
if (isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { if (isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>'; print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
} }
print '</td></tr></table>'; print '</td></tr></table>';
@ -1081,7 +1082,7 @@ if ($action == 'create' || $action == 'presend') {
} }
// Show user list to assignate one if status is "read" // Show user list to assignate one if status is "read"
if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_status < 8 && !$user->socid && $user->rights->ticket->write) { if (GETPOST('set', 'alpha') == "assign_ticket" && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
print '<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.'">'; print '<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="assign_user">'; print '<input type="hidden" name="action" value="assign_user">';
@ -1098,7 +1099,7 @@ if ($action == 'create' || $action == 'presend') {
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">'; print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('Progression').'</td><td class="left">'; print $langs->trans('Progression').'</td><td class="left">';
print '</td>'; print '</td>';
if ($action != 'progression' && isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && !$user->socid) { if ($action != 'progression' && isset($object->status) && $object->status < $object::STATUS_CLOSED && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=progression&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=progression&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
} }
print '</tr></table>'; print '</tr></table>';
@ -1216,7 +1217,7 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />'; print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} else { } else {
// Button to edit Properties // Button to edit Properties
if (isset($object->fk_status) && $object->fk_status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) { if (isset($object->status) && $object->status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>'; print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
} }
} }
@ -1275,7 +1276,7 @@ if ($action == 'create' || $action == 'presend') {
// Display navbar with links to change ticket status // Display navbar with links to change ticket status
print '<!-- navbar with status -->'; print '<!-- navbar with status -->';
if (!$user->socid && $user->rights->ticket->write && isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') { if (!$user->socid && $user->rights->ticket->write && isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
$actionobject->viewStatusActions($object); $actionobject->viewStatusActions($object);
} }
@ -1362,7 +1363,7 @@ if ($action == 'create' || $action == 'presend') {
print '</div>'; print '</div>';
print '<div class="tagtd center">'; print '<div class="tagtd center">';
if ($object->statut >= 0) { if ($object->status >= 0) {
echo '<a href="contact.php?track_id='.$object->track_id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; echo '<a href="contact.php?track_id='.$object->track_id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">';
} }
@ -1378,7 +1379,7 @@ if ($action == 'create' || $action == 'presend') {
$contactstatic->firstname = $tab[$i]['firstname']; $contactstatic->firstname = $tab[$i]['firstname'];
echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
} }
if ($object->statut >= 0) { if ($object->status >= 0) {
echo '</a>'; echo '</a>';
} }
@ -1411,7 +1412,7 @@ if ($action == 'create' || $action == 'presend') {
if (empty($reshook)) { if (empty($reshook)) {
// Show link to add a message (if read and not closed) // Show link to add a message (if read and not closed)
if (isset($object->fk_status) && $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id, ''); print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id, '');
} }
@ -1420,28 +1421,28 @@ if ($action == 'create' || $action == 'presend') {
if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) { if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false); print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
} }
if ($object->fk_soc > 0 && isset($object->fk_status) && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { if ($object->fk_soc > 0 && isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, ''); print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, '');
} }
/* This is useless. We can already modify each field individually /* This is useless. We can already modify each field individually
if ($user->rights->ticket->write && $object->fk_status < Ticket::STATUS_CLOSED) { if ($user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?track_id='.$object->track_id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?track_id='.$object->track_id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a></div>';
} }
*/ */
// Close ticket if statut is read // Close ticket if statut is read
if (isset($object->fk_status) && $object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, ''); print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, '');
} }
// Abadon ticket if statut is read // Abadon ticket if statut is read
if (isset($object->fk_status) && $object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, ''); print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, '');
} }
// Re-open ticket // Re-open ticket
if (!$user->socid && (isset($object->fk_status) && ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED)) && !$user->socid) { if (!$user->socid && (isset($object->status) && ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED)) && !$user->socid) {
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&track_id='.$object->track_id, ''); print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&track_id='.$object->track_id, '');
} }
@ -1545,12 +1546,12 @@ if ($action == 'create' || $action == 'presend') {
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
// Show link to add a message (if read and not closed) // Show link to add a message (if read and not closed)
$btnstatus = $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message";
$url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init'; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init';
$morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus);
// Show link to add event (if read and not closed) // Show link to add event (if read and not closed)
$btnstatus = $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; ; $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; ;
$url = dol_buildpath('/comm/action/card.php', 1).'?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); $url = dol_buildpath('/comm/action/card.php', 1).'?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id);
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus);

View File

@ -56,7 +56,6 @@ $projectid = GETPOST('projectid', 'int');
$project_ref = GETPOST('project_ref', 'alpha'); $project_ref = GETPOST('project_ref', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha'); $search_societe = GETPOST('search_societe', 'alpha');
$search_fk_project = GETPOST('search_fk_project', 'int') ?GETPOST('search_fk_project', 'int') : GETPOST('projectid', 'int'); $search_fk_project = GETPOST('search_fk_project', 'int') ?GETPOST('search_fk_project', 'int') : GETPOST('projectid', 'int');
$search_fk_status = GETPOST('search_fk_statut', 'array');
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
$search_dateread_start = dol_mktime(0, 0, 0, GETPOST('search_dateread_startmonth', 'int'), GETPOST('search_dateread_startday', 'int'), GETPOST('search_dateread_startyear', 'int')); $search_dateread_start = dol_mktime(0, 0, 0, GETPOST('search_dateread_startmonth', 'int'), GETPOST('search_dateread_startday', 'int'), GETPOST('search_dateread_startyear', 'int'));