Merge branch '16.0' into 16p1

This commit is contained in:
Alexandre SPANGARO 2022-08-24 10:29:57 +02:00
commit 151c46bcc8
26 changed files with 73 additions and 67 deletions

View File

@ -863,7 +863,7 @@ class AccountingAccount extends CommonObject
if (!empty($buyer->code_compta_product)) {
$code_t = $buyer->code_compta_product;
$suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thridparty';
$suggestedaccountingaccountfor = 'thirdparty';
}
}

View File

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

View File

@ -183,8 +183,8 @@ if ($action == 'testtemplate' && $user->admin) {
// test
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$object = new Facture($db);
//$object->initAsSpecimen();
$object->fetch(18);
$object->initAsSpecimen();
//$object->fetch(18);
//var_dump($object->lines);
$ret = $printer->sendToPrinter($object, $templateid, 1);
if ($ret == 0) {

View File

@ -883,8 +883,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//Default language
if (!empty($conf->global->MAIN_MULTILANGS)) {
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 '</tr>';
}
@ -1171,8 +1170,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//Default language
if (!empty($conf->global->MAIN_MULTILANGS)) {
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 '</tr>';
}
@ -1403,7 +1401,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//$s=picto_from_langcode($object->default_lang);
//print ($s?$s.' ':'');
$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 '</td></tr>';
}

View File

@ -73,7 +73,7 @@ if ($type == 'proposal') {
$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);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1);

View File

@ -1583,7 +1583,7 @@ class ExtraFields
if (!empty($value)) {
//$value=price($value);
$sizeparts = explode(",", $size);
$number_decimals = $sizeparts[1];
$number_decimals = array_key_exists(1, $sizeparts) ? $sizeparts[1] : 0;
$value = price($value, 0, $langs, 0, 0, $number_decimals, '');
}
} elseif ($type == 'boolean') {

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)
$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;
}
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;
}
//If module is not activated disqualified

View File

@ -3302,8 +3302,8 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$newphone = substr($newphone, 0, 5).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4);
}
} elseif (strtoupper($countrycode) == "MG") {//Madagascar
if (dol_strlen($phone) == 13) {//ex: +261_AB_CD_EF_GHI
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3);
if (dol_strlen($phone) == 13) {//ex: +261_AB_CD_EFG_HI
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 2);
}
} elseif (strtoupper($countrycode) == "GB") {//Royaume uni
if (dol_strlen($phone) == 13) {//ex: +44_ABCD_EFG_HIJ

View File

@ -90,7 +90,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
if ($mode == 1) {
$out .= "hash('".$securekeyseed."' + '".$type."' + proposal_ref)";
} 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) {

View File

@ -54,7 +54,7 @@ class modFTP extends DolibarrModules
// Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value)
$this->description = "FTP Client";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
$this->version = 'dolibarr_deprecated';
// Key used in llx_const table to save module status enabled/disabled (XXX is id value)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Name of png file (without png) used for this module

View File

@ -123,7 +123,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$texte .= '<input type="hidden" name="page_y" value="">';
$texte .= '<input type="hidden" name="action" value="setModuleOptions">';
$texte .= '<input type="hidden" name="param1" value="USERGROUP_ADDON_PDF_ODT_PATH">';
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) {
if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) {
$texte .= '<input type="hidden" name="param2" value="USERGROUP_ADDON_PDF_ODT_DEFAULT">';
$texte .= '<input type="hidden" name="param3" value="USERGROUP_ADDON_PDF_ODT_TOBILL">';
$texte .= '<input type="hidden" name="param4" value="USERGROUP_ADDON_PDF_ODT_CLOSED">';
@ -169,7 +169,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
if (count($listofdir)) {
$texte .= $langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) {
if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) {
// Model for creation
$list = ModelePDFUserGroup::liste_modeles($this->db);
$texte .= '<table width="50%;">';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2020 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2022 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2019 Nicolas Zabouri <info@inovea-conseil.com>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
@ -1535,6 +1535,7 @@ if ($resql) {
$totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
$totalarray['val']['cf.total_ht'] = 0;
$totalarray['val']['cf.total_ttc'] = 0;
$totalarray['val']['cf.total_tva'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {

View File

@ -199,7 +199,7 @@ if (empty($reshook)) {
if ($result <= 0) {
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]) {
// Check amount
if ($multicurrency_amounts[$cursorfacid] && (abs($multicurrency_amounts[$cursorfacid]) > abs($multicurrency_amountsresttopay[$cursorfacid]))) {

View File

@ -13,9 +13,11 @@
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
--
-- ========================================================================
-- This table contains the contacts by default of a thirdparty
-- Such contacts will be added to document automatiall if their role match the one expected by the document.
create table llx_societe_contacts
(

View File

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

View File

@ -80,7 +80,7 @@ ConfirmDeleteContractLine=Are you sure you want to delete this contract line?
MoveToAnotherContract=Move service into another contract.
ConfirmMoveToAnotherContract=I choosed new target contract and confirm I want to move this service into this contract.
ConfirmMoveToAnotherContractQuestion=Choose in which existing contract (of same third party), you want to move this service to?
PaymentRenewContractId=Renew contract line (number %s)
PaymentRenewContractId=Renew contract %s (service %s)
ExpiredSince=Expiration date
NoExpiredServices=No expired active services
ListOfServicesToExpireWithDuration=List of Services to expire in %s days

View File

@ -345,7 +345,7 @@ PossibleValues=Possible values
GoOnMenuToCreateVairants=Go on menu %s - %s to prepare attribute variants (like colors, size, ...)
UseProductFournDesc=Add a feature to define the product description defined by the vendors (for each vendor reference) in addition to the description for customers
ProductSupplierDescription=Vendor description for the product
UseProductSupplierPackaging=Use packaging on supplier prices (recalculate quantities according to packaging set on supplier price when adding/updating line in supplier documents)
UseProductSupplierPackaging=Use packaging for prices rounded to multiples for purchase prices (recalculate quantities according to multiples set on purchase prices when adding/updating line in a vendor documents)
PackagingForThisProduct=Packaging
PackagingForThisProductDesc=You will automaticaly purchase a multiple of this quantity.
QtyRecalculatedWithPackaging=The quantity of the line were recalculated according to supplier packaging

View File

@ -596,9 +596,10 @@ print $form->selectPriceBaseType($conf->global->PRODUCT_PRICE_BASE_TYPE, "price_
print '</td>';
print '</tr>';
// Use conditionnement in buying
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseProductSupplierPackaging").'</td>';
print '<td>'.$form->textwithpicto($langs->trans("UseProductSupplierPackaging"), $langs->trans("PackagingForThisProductDesc")).'</td>';
print '<td align="right">';
print ajax_constantonoff("PRODUCT_USE_SUPPLIER_PACKAGING", array(), $conf->entity, 0, 0, 0, 0);
//print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1);

View File

@ -4791,9 +4791,10 @@ class Product extends CommonObject
* @param int $id Id of product to search childs of
* @param int $firstlevelonly Return only direct child
* @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)
*/
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1)
public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array())
{
global $alreadyfound;
@ -4811,7 +4812,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.= " 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) {
$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
@ -4827,7 +4828,9 @@ class Product extends CommonObject
while ($rec = $this->db->fetch_array($res)) {
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);
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;
$prods[$rec['rowid']] = array(
@ -4843,7 +4846,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']);
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) {
$prods[$rec['rowid']]['childs'][$keyChild] = $valueChild;
}

View File

@ -549,7 +549,7 @@ if ($id > 0 || $ref) {
print '</td></tr>';
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
// Packaging
// Packaging/Conditionnement
print '<tr>';
print '<td class="fieldrequired">'.$form->textwithpicto($langs->trans("PackagingForThisProduct"), $langs->trans("PackagingForThisProductDesc")).'</td>';

View File

@ -139,7 +139,7 @@ if ($source == 'proposal') {
$securekeyseed = $conf->global->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);
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
exit(-1);
@ -293,7 +293,6 @@ if ($source == 'proposal') {
$result = $object->fetch_thirdparty($object->socid);
// Creditor
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Creditor");
print '</td><td class="CTableRow2">';
print img_picto('', 'company', 'class="pictofixedwidth"');
@ -302,7 +301,6 @@ if ($source == 'proposal') {
print '</td></tr>'."\n";
// Debitor
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("ThirdParty");
print '</td><td class="CTableRow2">';
print img_picto('', 'company', 'class="pictofixedwidth"');
@ -310,14 +308,12 @@ if ($source == 'proposal') {
print '</td></tr>'."\n";
// Amount
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Amount");
print '</td><td class="CTableRow2">';
print '<b>'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</b>';
print '</td></tr>'."\n";
// Object
$text = '<b>'.$langs->trans("SignatureProposalRef", $object->ref).'</b>';
print '<tr class="CTableRow2"><td class="CTableRow2">'.$langs->trans("Designation");
print '</td><td class="CTableRow2">'.$text;

View File

@ -1353,7 +1353,7 @@ if ($source == 'contractline') {
// Object
$text = '<b>'.$langs->trans("PaymentRenewContractId", $contract->ref, $contractline->ref).'</b>';
if ($contractline->fk_product) {
if ($contractline->fk_product > 0) {
$contractline->fetch_product();
$text .= '<br>'.$contractline->product->ref.($contractline->product->label ? ' - '.$contractline->product->label : '');
}
@ -1364,8 +1364,8 @@ if ($source == 'contractline') {
// $text.='<br>'.$langs->trans("DateEndPlanned").': ';
// $text.=dol_print_date($contractline->date_fin_validite);
//}
if ($contractline->date_fin_validite) {
$text .= '<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_fin_validite);
if ($contractline->date_end) {
$text .= '<br>'.$langs->trans("ExpiredSince").': '.dol_print_date($contractline->date_end);
}
if (GETPOST('desc', 'alpha')) {
$text = '<b>'.$langs->trans(GETPOST('desc', 'alpha')).'</b>';

View File

@ -3144,7 +3144,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Subsidiaries list
if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) {
if (!empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY) && empty($conf->global->SOCIETE_DISABLE_SHOW_SUBSIDIARIES)) {
$result = show_subsidiaries($conf, $langs, $db, $object);
}

View File

@ -4,6 +4,7 @@
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Frédéric France <frederic.france@netlogic.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
* it under the terms of the GNU General Public License as published by
@ -206,7 +207,7 @@ if (empty($reshook)) {
$fk_user_assign = GETPOST("fk_user_assign", 'int');
if ($fk_user_assign > 0) {
$object->fk_user_assign = $fk_user_assign;
$object->fk_status = $object::STATUS_ASSIGNED;
$object->status = $object::STATUS_ASSIGNED;
}
$object->fk_project = $projectid;
@ -286,7 +287,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;
$ret = $object->fetch(GETPOST('id', 'int'), GETPOST('ref', 'alpha'), GETPOST('track_id', 'alpha'));
@ -548,7 +549,7 @@ if (empty($reshook)) {
if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
// 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);
if ($res) {
// Log action in ticket logs table
@ -607,7 +608,7 @@ if (empty($reshook)) {
// Reopen ticket
if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) {
$new_status = GETPOST('new_status', 'int');
$old_status = $object->fk_status;
$old_status = $object->status;
$res = $object->setStatut($new_status);
if ($res) {
// Log action in ticket logs table
@ -726,7 +727,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->withcancel = 1;
$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);
$head = ticket_prepare_head($object);
@ -941,7 +942,7 @@ if ($action == 'create' || $action == 'presend') {
// Thirdparty
if (!empty($conf->societe->enabled)) {
$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> : ';
}
if ($action == 'editcustomer') {
@ -1058,7 +1059,7 @@ if ($action == 'create' || $action == 'presend') {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
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></tr></table>';
@ -1069,7 +1070,7 @@ if ($action == 'create' || $action == 'presend') {
}
// 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 '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="assign_user">';
@ -1086,7 +1087,7 @@ if ($action == 'create' || $action == 'presend') {
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('Progression').'</td><td class="left">';
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 '</tr></table>';
@ -1204,7 +1205,7 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} else {
// 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>';
}
}
@ -1263,7 +1264,7 @@ if ($action == 'create' || $action == 'presend') {
// Display navbar with links to change ticket 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);
}
@ -1350,7 +1351,7 @@ if ($action == 'create' || $action == 'presend') {
print '</div>';
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'].'">';
}
@ -1366,7 +1367,7 @@ if ($action == 'create' || $action == 'presend') {
$contactstatic->firstname = $tab[$i]['firstname'];
echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
}
if ($object->statut >= 0) {
if ($object->status >= 0) {
echo '</a>';
}
@ -1399,7 +1400,7 @@ if ($action == 'create' || $action == 'presend') {
if (empty($reshook)) {
// 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, '');
}
@ -1408,28 +1409,28 @@ if ($action == 'create' || $action == 'presend') {
if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
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, '');
}
/* 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>';
}
*/
// 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, '');
}
// 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, '');
}
// 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, '');
}
@ -1533,12 +1534,12 @@ if ($action == 'create' || $action == 'presend') {
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1);
// 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';
$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)
$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);
$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');
$search_societe = GETPOST('search_societe', 'alpha');
$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_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'));

View File

@ -2293,6 +2293,12 @@ if ($action == 'create' || $action == 'adduserldap') {
print ' ('.$langs->trans("DomainUser").')';
}
} elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact
print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', '&nbsp;'); // We keep thirdparty empty, contact is already set
print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1);
if ($object->ldap_sid) {
print ' ('.$langs->trans("DomainUser").')';
}
} elseif (!($object->socid > 0) && $object->contact_id > 0) { // internal user with a link to a contact
print img_picto('', 'company').$form->select_company(0, 'socid', '', '&nbsp;'); // We keep thirdparty empty, contact is already set
print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1);
if ($object->ldap_sid) {