From b7c0594ab73a51a872806c33b7848fa2a87ecdcf Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 21 Oct 2021 23:28:58 +0200 Subject: [PATCH 001/226] FIX ISSUE DB_ERROR_SYNTAX-#18921 --- htdocs/ticket/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 6991516ede8..0d0e97336cd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '') { + if ($search[$key] != '' && !empty($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } @@ -609,9 +609,9 @@ 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); + if (is_array($val) && count($val)) { + foreach ($val as $skey) { + $param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : ""; } } else { $param .= '&search_'.$key.'='.urlencode($search[$key]); From 763cb29c0c3a845d48ec8fa3b794d5b3926f6ac6 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 24 Oct 2021 00:26:28 +0200 Subject: [PATCH 002/226] Check that the value is not an array --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 0d0e97336cd..4caffd173c3 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '' && !empty($val)) { + if ($search[$key] != '' && !is_array($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } From 9e667e015597258eb2003ed067b0956017281431 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 9 Feb 2022 15:55:21 +0100 Subject: [PATCH 003/226] NEW Needed nets bom --- htdocs/bom/bom_net_needs.php | 354 +++++++++++++++++++++++++++++++++ htdocs/bom/class/bom.class.php | 55 +++++ htdocs/bom/lib/bom.lib.php | 5 + htdocs/langs/en_US/mrp.lang | 3 + 4 files changed, 417 insertions(+) create mode 100644 htdocs/bom/bom_net_needs.php diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php new file mode 100644 index 00000000000..399aa8aa739 --- /dev/null +++ b/htdocs/bom/bom_net_needs.php @@ -0,0 +1,354 @@ + + * Copyright (C) 2019 Frédéric France + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/bom/bom_net_needs.php + * \ingroup bom + * \brief Page to create/edit/view bom + */ + +// Load Dolibarr environment +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("mrp", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + + + +// Initialize technical objects +$object = new BOM($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->bom->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); + +// 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'); + } +} + +if (empty($action) && empty($id) && empty($ref)) { + $action = 'view'; +} + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +if ($object->id > 0) { + $object->calculateCosts(); +} + + + +// Security check - Protection if external user +//if ($user->socid > 0) accessforbidden(); +//if ($user->socid > 0) $socid = $user->socid; +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +$result = restrictedArea($user, 'bom', $object->id, 'bom_bom', '', '', 'rowid', $isdraft); + +$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->bom->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; + + +/* + * Actions + */ + +$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 (empty($reshook)) { + $error = 0; + + $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/bom/bom_net_needs.php?id='.($id > 0 ? $id : '__ID__'); + } + } + } + if($action == 'treeview') $object->getNetNeedsTree($TChildBom,1); + else $object->getNetNeeds($TChildBom, 1); + +} + + +/* + * View + */ + +$form = new Form($db); +$formfile = new FormFile($db); + + +$title = $langs->trans('BOM'); +$help_url ='EN:Module_BOM'; +llxHeader('', $title, $help_url); + + +// Part to edit record +if (($id || $ref) && $action == 'edit') { + print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); + + print '
'; + print ''; + print ''; + print ''; + print ''; + + print dol_get_fiche_head(); + + //$object->fields['keyfield']['disabled'] = 1; + + print ''."\n"; + + // Common attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + + print '
'; + + print dol_get_fiche_end(); + + print $form->buttonsSaveCancel("Create"); + + print '
'; +} + +// Part to show record +if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { + $head = bomPrepareHead($object); + print dol_get_fiche_head($head, 'net_needs', $langs->trans("BillOfMaterials"), -1, 'bom'); + + $formconfirm = ''; + + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + $keyforbreak = 'duration'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + print ''; + print ''; + + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + + print '
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'; + print '
'; + print '
'; + + print '
'; + + print dol_get_fiche_end(); + + + + /* + * Lines + */ + print ''; + print "\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if(! empty($TChildBom)) { + if($action == 'treeview') { + foreach($TChildBom as $fk_bom => $TProduct) { + $repeatChar = ' '; + if(! empty($TProduct['bom'])) { + if($TProduct['parentid'] != $object->id) print ''; + else print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + if(! empty($TProduct['product'])) { + foreach($TProduct['product'] as $fk_product => $TInfos) { + $prod = new Product($db); + $prod->fetch($fk_product); + $prod->load_virtual_stock(); + if(empty($prod->stock_reel)) $prod->stock_reel = 0; + if($fk_bom != $object->id) print ''; + else print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + } + } + else { + foreach($TChildBom as $fk_product => $qty) { + $prod = new Product($db); + $prod->fetch($fk_product); + $prod->load_virtual_stock(); + if(empty($prod->stock_reel)) $prod->stock_reel = 0; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + } + print ''; + print '
'.$langs->trans('Product'); + if(! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { + print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; + print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; + } + print ''.$langs->trans('Quantity').''.$langs->trans('PhysicalStock').''.$langs->trans('VirtualStock').'
'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); + print ' '; + print img_picto('', 'folder-open'); + print ''; + print ''.$TProduct['qty'].'
'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''.$TInfos['qty'].''.$prod->stock_reel.''.$prod->stock_theorique.'
'.$prod->getNomUrl(1).''.$qty.''.$prod->stock_reel.''.$prod->stock_theorique.'
'; + + + + /* + * ButAction + */ + print '
'."\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(empty($reshook)) { + if($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; + else print ''.$langs->trans("BackToStandardView").''."\n"; + } + + print '
'; + + + ?> + + + + close(); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 5f732c47300..7acc2749fad 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1085,6 +1085,7 @@ class BOM extends CommonObject $res = $bom_child->fetch($line->fk_bom_child); if ($res>0) { $bom_child->calculateCosts(); + $line->childBom[] = $bom_child; $this->total_cost += $bom_child->total_cost; } else { $this->error = $bom_child->error; @@ -1101,6 +1102,55 @@ class BOM extends CommonObject } } } + + /** + * Get Net needs by product + * + * @param array $TNetNeeds + * @param int $qty + * @return void + */ + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) { + if(! empty($this->lines)) { + foreach($this->lines as $line) { + if(! empty($line->childBom)) { + foreach($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } + else { + $TNetNeeds[$line->fk_product] += $line->qty*$qty; + } + } + } + } + + /** + * Get Net needs Tree by product or bom + * + * @param array $TNetNeeds + * @param int $qty + * @param int $level + * @return void + */ + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { + if(! empty($this->lines)) { + foreach($this->lines as $line) { + if(! empty($line->childBom)) { + foreach($line->childBom as $childBom) { + $TNetNeeds[$childBom->id]['bom'] = $childBom; + $TNetNeeds[$childBom->id]['parentid'] = $this->id; + $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; + $TNetNeeds[$childBom->id]['level'] = $level; + $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); + } + } + else { + $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; + $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; + } + } + } + } + } @@ -1227,6 +1277,11 @@ class BOMLine extends CommonObjectLine public $unit_cost = 0; + /** + * @var Bom array of Bom in line + */ + public $childBom = array(); + /** * Constructor * diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 805ba304c1d..954959d5d7a 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -84,6 +84,11 @@ function bomPrepareHead($object) $head[$h][2] = 'card'; $h++; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_net_needs.php?id=".$object->id; + $head[$h][1] = $langs->trans("BOMNetNeeds"); + $head[$h][2] = 'net_needs'; + $h++; + if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { $nbNote = 0; if (!empty($object->note_private)) { diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 74bed0d9186..ca902380935 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -107,3 +107,6 @@ THMEstimatedHelp=This rate makes it possible to define a forecast cost of the it BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines +BOMNetNeeds=Net Needs +DisplayInTreeStructure=Display in tree structure +BackToStandardView=Back to standard view \ No newline at end of file From 2260276bed0c7d02a480efa7b395daf580dd9287 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 10:09:36 +0100 Subject: [PATCH 004/226] add tooltip --- htdocs/bom/bom_net_needs.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 399aa8aa739..dcd6764d74a 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -220,6 +220,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea /* * Lines */ + $text_stock_options = $langs->trans("RealStockDesc").'
'; + $text_stock_options .= $langs->trans("RealStockWillAutomaticallyWhen").'
'; + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE) ? '- '.$langs->trans("DeStockOnShipment").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) ? '- '.$langs->trans("DeStockOnValidateOrder").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_BILL) ? '- '.$langs->trans("DeStockOnBill").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) ? '- '.$langs->trans("ReStockOnBill").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) ? '- '.$langs->trans("ReStockOnValidateOrder").'
' : ''); + $text_stock_options .= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ? '- '.$langs->trans("ReStockOnDispatchOrder").'
' : ''); + $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); + print ''; print "\n"; print ''; @@ -230,8 +240,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if(! empty($TChildBom)) { if($action == 'treeview') { From 7cf94486098fbdcedada47441e85f6eff4d20d5a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Feb 2022 09:22:53 +0000 Subject: [PATCH 005/226] Fixing style errors. --- htdocs/bom/bom_net_needs.php | 43 ++++++++++++++++------------------ htdocs/bom/class/bom.class.php | 29 +++++++++++------------ 2 files changed, 34 insertions(+), 38 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index dcd6764d74a..e9f408498f0 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -110,9 +110,8 @@ if (empty($reshook)) { } } } - if($action == 'treeview') $object->getNetNeedsTree($TChildBom,1); + if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1); else $object->getNetNeeds($TChildBom, 1); - } @@ -234,7 +233,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print "\n"; print ''; print ''; print ''; print ''; - if(! empty($TChildBom)) { - if($action == 'treeview') { - foreach($TChildBom as $fk_bom => $TProduct) { + if (! empty($TChildBom)) { + if ($action == 'treeview') { + foreach ($TChildBom as $fk_bom => $TProduct) { $repeatChar = ' '; - if(! empty($TProduct['bom'])) { - if($TProduct['parentid'] != $object->id) print ''; + if (! empty($TProduct['bom'])) { + if ($TProduct['parentid'] != $object->id) print ''; else print ''; print ''; print ''; } - if(! empty($TProduct['product'])) { - foreach($TProduct['product'] as $fk_product => $TInfos) { + if (! empty($TProduct['product'])) { + foreach ($TProduct['product'] as $fk_product => $TInfos) { $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if(empty($prod->stock_reel)) $prod->stock_reel = 0; - if($fk_bom != $object->id) print ''; + if (empty($prod->stock_reel)) $prod->stock_reel = 0; + if ($fk_bom != $object->id) print ''; else print ''; print ''; print ''; @@ -276,13 +275,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } } - } - else { - foreach($TChildBom as $fk_product => $qty) { + } else { + foreach ($TChildBom as $fk_product => $qty) { $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if(empty($prod->stock_reel)) $prod->stock_reel = 0; + if (empty($prod->stock_reel)) $prod->stock_reel = 0; print ''; print ''; print ''; @@ -297,18 +295,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea - /* - * ButAction - */ + /* + * ButAction + */ print '
'."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if($reshook < 0) { + if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if(empty($reshook)) { - if($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; + if (empty($reshook)) { + if ($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; else print ''.$langs->trans("BackToStandardView").''."\n"; } @@ -356,7 +354,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea lines)) { - foreach($this->lines as $line) { - if(! empty($line->childBom)) { - foreach($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); - } - else { + public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty); + } else { $TNetNeeds[$line->fk_product] += $line->qty*$qty; } } @@ -1131,26 +1131,25 @@ class BOM extends CommonObject * @param int $level * @return void */ - public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) { - if(! empty($this->lines)) { - foreach($this->lines as $line) { - if(! empty($line->childBom)) { - foreach($line->childBom as $childBom) { + public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) + { + if (! empty($this->lines)) { + foreach ($this->lines as $line) { + if (! empty($line->childBom)) { + foreach ($line->childBom as $childBom) { $TNetNeeds[$childBom->id]['bom'] = $childBom; $TNetNeeds[$childBom->id]['parentid'] = $this->id; $TNetNeeds[$childBom->id]['qty'] = $line->qty*$qty; $TNetNeeds[$childBom->id]['level'] = $level; $childBom->getNetNeedsTree($TNetNeeds, $line->qty*$qty, $level+1); } - } - else { + } else { $TNetNeeds[$this->id]['product'][$line->fk_product]['qty'] += $line->qty * $qty; $TNetNeeds[$this->id]['product'][$line->fk_product]['level'] = $level; } } } } - } From dd0202de47a702d9ad100c66c2250c8d7b78d9e4 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 10:46:04 +0100 Subject: [PATCH 006/226] fix comment doc --- htdocs/bom/class/bom.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 75cf0e3a65e..17d17edad8d 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1106,8 +1106,8 @@ class BOM extends CommonObject /** * Get Net needs by product * - * @param array $TNetNeeds - * @param int $qty + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed * @return void */ public function getNetNeeds(&$TNetNeeds = array(), $qty = 0) @@ -1126,9 +1126,9 @@ class BOM extends CommonObject /** * Get Net needs Tree by product or bom * - * @param array $TNetNeeds - * @param int $qty - * @param int $level + * @param array $TNetNeeds Array of ChildBom and infos linked to + * @param int $qty qty needed + * @param int $level level of recursivity * @return void */ public function getNetNeedsTree(&$TNetNeeds = array(), $qty = 0, $level = 0) From cd955930b6ead7a8bcd2e99623d6917bdd06401c Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 15:00:55 +0100 Subject: [PATCH 007/226] change bt link --- htdocs/bom/bom_net_needs.php | 39 +++--------------------------------- htdocs/langs/en_US/mrp.lang | 4 ++-- 2 files changed, 5 insertions(+), 38 deletions(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index e9f408498f0..4b2d5cdecab 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -128,36 +128,6 @@ $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); -// Part to edit record -if (($id || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes'); - - print '
'; - print ''; - print ''; - print ''; - print ''; - - print dol_get_fiche_head(); - - //$object->fields['keyfield']['disabled'] = 1; - - print '
'.$langs->trans('Quantity').''.$langs->trans('PhysicalStock').''.$langs->trans('VirtualStock').''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'
'.$langs->trans('Product'); - if(! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { + if (! empty($conf->global->BOM_SUB_BOM) && $action == 'treeview') { print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } @@ -243,12 +242,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'
'.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); print ' '; @@ -260,13 +259,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''.$TInfos['qty'].'
'.$prod->getNomUrl(1).''.$qty.'
'."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); - - print $form->buttonsSaveCancel("Create"); - - print ''; -} // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { @@ -214,7 +184,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dol_get_fiche_end(); + $viewlink = dolGetButtonTitle($langs->trans('GroupByProduct'), '', 'fa fa-list-alt imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); + $viewlink .= dolGetButtonTitle($langs->trans('TreeStructure'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); + print load_fiche_titre($langs->trans("BillOfMaterials"), $viewlink, 'cubes'); /* * Lines @@ -304,12 +277,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - - if (empty($reshook)) { - if ($action != 'treeview') print ''.$langs->trans("DisplayInTreeStructure").''."\n"; - else print ''.$langs->trans("BackToStandardView").''."\n"; - } - print ''; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index ca902380935..4dc74122ea9 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -108,5 +108,5 @@ BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines BOMNetNeeds=Net Needs -DisplayInTreeStructure=Display in tree structure -BackToStandardView=Back to standard view \ No newline at end of file +TreeStructure=Tree structure +GroupByProduct=Group by product \ No newline at end of file From d819d427c303c74b31695131a2e73045675fddba Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 10 Feb 2022 16:46:19 +0100 Subject: [PATCH 008/226] FIX sort amount ht --- htdocs/compta/stats/cabyprodserv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index ba09d7e6551..67267288b7a 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -375,7 +375,7 @@ if ($modecompta == 'CREANCES-DETTES') $_SERVER["PHP_SELF"], "amount", "", - $classslink, + $paramslink, 'class="right"', $sortfield, $sortorder From fc36849093a7dc1ac5880069d1fb0709ad5f9902 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Feb 2022 17:31:55 +0100 Subject: [PATCH 009/226] css --- htdocs/theme/eldy/global.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e1532b338b6..147cd2fe8f9 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -259,7 +259,8 @@ input:invalid, select:invalid, input.--error , select.--error { section.setupsection { padding: 20px; - background-color: var(--colorbacktitle1); + /* background-color: var(--colorbacktitle1); */ + background-color: #f0f0f0; border-radius: 5px; } From 39bd5dd6dce2b5eb8e380c6ce7724a107411515f Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 3 Feb 2022 12:08:39 +0100 Subject: [PATCH 010/226] ticket config : add TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND option to config panel --- htdocs/admin/ticket.php | 27 ++++++++++++++++++++++++--- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/ticket.lang | 3 +++ htdocs/langs/fr_FR/main.lang | 1 + htdocs/langs/fr_FR/ticket.lang | 3 +++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f4e5b4f3fad..1805f5de34d 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -178,8 +178,14 @@ if ($action == 'setvarother') { $error++; } - $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + $param_auto_assign = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_auto_read = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_read, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; } @@ -470,7 +476,7 @@ if (!$conf->use_javascript_ajax) { print ''; } -print load_fiche_titre($langs->trans("Other"), '', ''); +print load_fiche_titre($langs->trans("Workflow"), '', ''); print ''; print ''; @@ -479,6 +485,21 @@ print ''; print ''; print "\n"; +// Auto mark ticket read when created from backoffice +print ''; +print ''; +print ''; +print ''; + // Auto assign ticket at user who created it print ''; print ''; @@ -1518,20 +1536,21 @@ if ($id > 0) { // Date start - end print ''; @@ -1972,7 +1991,8 @@ if ($id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -1985,7 +2005,8 @@ if ($id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index c69d396cf26..3de00e9cb6f 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -201,7 +201,8 @@ if ($object->id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -214,7 +215,8 @@ if ($object->id > 0) { if (empty($object->fulldayevent)) { print dol_print_date($object->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($object->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 72e50d9292d..81df122f1a9 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -545,7 +545,8 @@ if ($user->rights->agenda->myactions->create || $user->rights->agenda->allaction $newparam .= '&month='.((int) $month).'&year='.((int) $tmpforcreatebutton['year']).'&mode='.urlencode($mode); //$param='month='.$monthshown.'&year='.$year; - $hourminsec = '100000'; + $hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation + $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); } @@ -812,17 +813,17 @@ if ($resql) { // event->datep and event->datef must be GMT date. if ($event->fulldayevent) { - // TODO... - $event->datep = $db->jdate($obj->datep); - $event->datef = $db->jdate($obj->datep2); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + $event->datep = $db->jdate($obj->datep, $tzforfullday ? 'tzuser' : 'tzserver'); // If saved in $tzforfullday = gmt, we must invert date to be in user tz + $event->datef = $db->jdate($obj->datep2, $tzforfullday ? 'tzuser' : 'tzserver'); } else { // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) - $event->datep = $db->jdate($obj->datep); - $event->datef = $db->jdate($obj->datep2); + $event->datep = $db->jdate($obj->datep, 'tzserver'); + $event->datef = $db->jdate($obj->datep2, 'tzserver'); } //$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt'); - //var_dump($obj->datep); - //var_dump($event->datep); + //var_dump($obj->id.' '.$obj->datep.' '.dol_print_date($obj->datep, 'dayhour', 'gmt')); + //var_dump($obj->id.' '.$event->datep.' '.dol_print_date($event->datep, 'dayhour', 'gmt')); $event->type_code = $obj->type_code; $event->type_label = $obj->type_label; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index de961b5517e..e2b412e15db 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -693,7 +693,7 @@ $tmpforcreatebutton = dol_getdate(dol_now(), true); $newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year']; //$param='month='.$monthshown.'&year='.$year; -$hourminsec = '100000'; +$hourminsec = dol_print_date(dol_mktime(10, 0, 0, 1, 1, 1970, 'gmt'), '%H', 'gmt').'0000'; // Set $hourminsec to '100000' to auto set hour to 10:00 at creation $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec; @@ -953,7 +953,12 @@ while ($i < min($num, $limit)) { // Start date if (!empty($arrayfields['a.datep']['checked'])) { print ''; } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index d0ca6416390..068dba8c50a 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -383,7 +383,8 @@ if (!$ret) { if (empty($act->fulldayevent)) { print dol_print_date($act->datep, 'dayhour', 'tzuser'); } else { - print dol_print_date($act->datep, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($act->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); @@ -396,7 +397,8 @@ if (!$ret) { if (empty($act->fulldayevent)) { print dol_print_date($act->datef, 'dayhour', 'tzuser'); } else { - print dol_print_date($act->datef, 'day', 'tzuser'); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($act->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser')); } if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now - $delay_warning)) { print img_warning($langs->trans("Late")); From c552030b69863a34404e3e00d3045ff4d7e95818 Mon Sep 17 00:00:00 2001 From: Marc GUENNEUGUES Date: Fri, 11 Feb 2022 15:18:38 +0100 Subject: [PATCH 022/226] Fix urlencode breaking links in Market Place page --- htdocs/admin/dolistore/class/dolistore.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 546ef1d57a6..f672cf05a52 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -267,9 +267,9 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { - $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.((int) $product->id).'&id_image='.((int) $product->id_default_image); - $images = ''; - $images .= ''; + $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.urlencode(((int) $product->id)).'&id_image='.urlencode(((int) $product->id_default_image)); + $images = ''; + $images .= ''; } else { $images = ''; } @@ -277,11 +277,11 @@ class Dolistore // free or pay ? if ($product->price > 0) { $price = '

'.price(price2num($product->price, 'MT'), 0, $langs, 1, -1, -1, 'EUR').' '.$langs->trans("HT").'

'; - $download_link = ''; + $download_link = ''; } else { $price = '

'.$langs->trans('Free').'

'; - $download_link = ''; - $download_link .= '

'; + $download_link = ''; + $download_link .= '

'; } // Set and check version From b623b88674a6dab395d3397e467b3084ccfd0542 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 18:06:39 +0100 Subject: [PATCH 023/226] css --- htdocs/admin/confexped.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index b218a245c99..c2ca271e5ea 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -107,7 +107,7 @@ print '
'; print ''; print ''; @@ -376,20 +437,6 @@ if ($mode == 'overwrite') { } if ($mode == 'searchkey') { - $langcode = GETPOSTISSET('langcode') ? GETPOST('langcode') : $langs->defaultlang; - - $newlang = new Translate('', $conf); - $newlang->setDefaultLang($langcode); - - $newlangfileonly = new Translate('', $conf); - $newlangfileonly->setDefaultLang($langcode); - - $recordtoshow = array(); - - // Search modules dirs - $modulesdir = dolGetModulesDirs(); - - $nbtotaloffiles = 0; $nbempty = 0; /*var_dump($langcode); var_dump($transkey); @@ -403,41 +450,10 @@ if ($mode == 'searchkey') { if (empty($transvalue)) { $nbempty++; } + if ($action == 'search' && ($nbempty > 999)) { // 999 to disable this setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings'); } else { - // Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root) - $i = 0; - foreach ($modulesdir as $keydir => $tmpsearchdir) { - $searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/' - - // Directory of translation files - $dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels - $dir_lang_osencoded = dol_osencode($dir_lang); - - $filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1); - foreach ($filearray as $file) { - $tmpfile = preg_replace('/.lang/i', '', basename($file['name'])); - $moduledirname = (basename(dirname(dirname($dir_lang)))); - - $langkey = $tmpfile; - if ($i > 0) { - $langkey .= '@'.$moduledirname; - } - //var_dump($i.' - '.$keydir.' - '.$dir_lang_osencoded.' -> '.$moduledirname . ' / ' . $tmpfile.' -> '.$langkey); - - $result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite - $result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only - if ($result < 0) { - print 'Failed to load language file '.$tmpfile.'
'."\n"; - } else { - $nbtotaloffiles++; - } - //print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records
'."\n"; - } - $i++; - } - // Now search into translation array foreach ($newlang->tab_translate as $key => $val) { if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) { @@ -532,8 +548,12 @@ if ($mode == 'searchkey') { break; } print ''; + print ''."\n"; +print 'global->MAIN_INFO_ACCOUNTANT_NAME) ? ' autofocus="autofocus"' : '').'>'."\n"; // Address print ''."\n"; + print 'global->MAIN_INFO_OPENINGHOURS_MONDAY) ? ' autofocus="autofocus"' : '').'>'."\n"; print ''; + $totalarray['nbfield'] = 0; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { From 5d90a0072823b43b9964d9a68a32c3b7871205f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 19:26:16 +0100 Subject: [PATCH 039/226] Debug v15 --- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2d46ee2a239..4bf8a0e7219 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -199,7 +199,7 @@ function societe_prepare_head(Societe $object) if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) { $nbBankAccount = 0; $foundonexternalonlinesystem = 0; - $langs->load("banks"); + $langs->load("bills"); $title = $langs->trans("PaymentModes"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fc163933b47..9fed70a1fe1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3643,7 +3643,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', - 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building', + 'bank_account', 'barcode', 'bank', 'bell', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'briefcase-medical', 'bug', 'building', 'card', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes', 'multicurrency', @@ -3669,7 +3669,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring', 'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', - 'uncheck', 'user-cog', 'vat', 'website', 'workstation', + 'uncheck', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'conferenceorbooth', 'eventorganization' ))) { $fakey = $pictowithouttext; From dce996a53f53c2a095f2a32e28d477d36e26a518 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 17:33:45 +0100 Subject: [PATCH 040/226] Reponsive --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7f09e111a23..92997b7a0e6 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -516,7 +516,7 @@ if ($result) { } print ''; - print ''; + print ''; print ''; @@ -665,7 +665,7 @@ if ($result) { print ''; // VAT Num - print ''; + print ''; // Found accounts print ''; - print ''; + print ''; + print ''; // Found accounts print ''; - print ''; + print ''; print ''; // VAT Num - print ''; + print ''; // Found accounts print ''; - print ''; print ''; // VAT Num - print ''; + print ''; // Found accounts print ''; + $cursormonth = $j; + if ($cursormonth > 12) { + $cursormonth -= 12; + } + $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); + + print ''; } print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 893f448bbf8..a44c819aa78 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -294,7 +294,7 @@ Balancing=Balancing FicheVentilation=Binding card GeneralLedgerIsWritten=Transactions are written in the Ledger GeneralLedgerSomeRecordWasNotRecorded=Some of the transactions could not be journalized. If there is no other error message, this is probably because they were already journalized. -NoNewRecordSaved=No more record to journalize +NoNewRecordSaved=No more record to transfer ListOfProductsWithoutAccountingAccount=List of products not bound to any accounting account ChangeBinding=Change the binding Accounted=Accounted in ledger From 9173eec8acb186c8683025307730fc1ea58922bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2022 23:02:43 +0100 Subject: [PATCH 049/226] Fix input lost --- htdocs/product/fournisseurs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 98ab414a8c3..3bf563c82f7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -612,7 +612,7 @@ if ($id > 0 || $ref) { $default_vat = $object->tva_tx; } } - $vattosuggest = (GETPOST("tva_tx") ?vatrate(GETPOST("tva_tx")) : ($default_vat != '' ?vatrate($default_vat) : '')); + $vattosuggest = (GETPOSTISSET("tva_tx") ? vatrate(GETPOST("tva_tx")) : ($default_vat != '' ?vatrate($default_vat) : '')); $vattosuggest = preg_replace('/\s*\(.*\)$/', '', $vattosuggest); print ''; print ''; From 34d2e0b8b406a01c103df1498a3af995550931ec Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 15 Feb 2022 10:29:42 +0100 Subject: [PATCH 050/226] FIX : Fixed sub bom costs problems --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 22 ++++++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index cbd730e5d23..6f748df22e4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - + $object->calculateCosts(); print ''; print ''; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 5f732c47300..4bdf349eae5 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1085,7 +1085,7 @@ class BOM extends CommonObject $res = $bom_child->fetch($line->fk_bom_child); if ($res>0) { $bom_child->calculateCosts(); - $this->total_cost += $bom_child->total_cost; + $this->total_cost += $bom_child->total_cost * $line->qty; } else { $this->error = $bom_child->error; return -2; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index b72ed043581..14cfd22c39e 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -180,6 +180,7 @@ if ($action == 'selectlines') { print ''; // Select of all the sub-BOM lines +// From this pont to the end of the file, we only take care of sub-BOM lines $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; $sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; $resql = $object->db->query($sql); @@ -191,7 +192,9 @@ if ($resql) { $sub_bom_product->fetch($obj->fk_product); $sub_bom = new BOM($object->db); - $sub_bom->fetch($obj->fk_bom_child); + if(!empty($obj->fk_bom_child)){ + $sub_bom->fetch($obj->fk_bom_child); + } $sub_bom_line = new BOMLine($object->db); $sub_bom_line->fetch($obj->rowid); @@ -233,20 +236,23 @@ if ($resql) { // Efficiency print ''; - // Cost price if it's defined - if ($sub_bom_product->cost_price > 0) { - print ''; - $total_cost+= $sub_bom_product->cost_price * $line->qty; + if(!empty($sub_bom->id)){ + $sub_bom->calculateCosts(); + print ''; + $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + } elseif ($sub_bom_product->cost_price > 0) { + print ''; + $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined - print ''; - $total_cost.= $sub_bom_product->pmp * $line->qty; + print ''; + $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; } else { // Minimum purchase price if cost price and PMP aren't defined $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; $sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id; $resql_supplier_price = $object->db->query($sql_supplier_price); if ($resql_supplier_price) { $obj = $object->db->fetch_object($resql_supplier_price); - $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty; + $line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty; print ''; $total_cost+= $line_cost; From 885d188be341e8187f626074b7f52535973f4847 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 15 Feb 2022 10:41:55 +0100 Subject: [PATCH 051/226] use of require_once --- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 88d7e46506d..675f6e4397f 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class // for other modules if (!empty($conf->categorie->enabled)) { - dol_include_once('/categories/class/categorie.class.php'); + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } //dol_include_once('/othermodule/class/otherobject.class.php'); From 0e664cc9694bd75af03641d148101e0d6ac011d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Feb 2022 11:12:08 +0100 Subject: [PATCH 052/226] Fix API call from ajax --- htdocs/api/index.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index d19754f9c35..869dacc5cc0 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -55,12 +55,27 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) { define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']); } +// Response for preflight requests (used by browser when into a CORS context) +if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { + header('Access-Control-Allow-Origin: *'); + header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); + header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); + http_response_code(204); + exit; +} + // When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool. if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) { header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); } +// When we request url to get an API, we accept Cross site so we can make js API call inside another website +if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) { + header('Access-Control-Allow-Origin: *'); + header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); + header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); +} $res = 0; if (!$res && file_exists("../main.inc.php")) { @@ -304,7 +319,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && foreach ($listofendpoints as $endpointrule) { $tmparray = explode(':', $endpointrule); - if ($classfile == $tmparray[0] && $tmparray[1] == 1) { + if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) { $endpointisallowed = true; break; } From 82b3d89923f1a78605dad5e83b32eda66670808b Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 15 Feb 2022 11:31:09 +0100 Subject: [PATCH 053/226] FIX wieght is loose if it's comma on combinations --- htdocs/variants/combinations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 933d379e48a..0b08bd00758 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -235,7 +235,7 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( exit(); } - $prodcomb->variation_weight = $weight_impact; + $prodcomb->variation_weight = price2num($weight_impact); // for conf PRODUIT_MULTIPRICES if ($conf->global->PRODUIT_MULTIPRICES) { From 95c0e72956ef241d18d131b87205a05593c55aee Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 15 Feb 2022 11:37:24 +0100 Subject: [PATCH 054/226] Fix barcode viewimage regression on yogosha8628 --- htdocs/viewimage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index dee62999cf4..7f34bdb6a18 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -230,7 +230,7 @@ $original_file = str_replace('..\\', '/', $original_file); $refname = basename(dirname($original_file)."/"); // Check that file is allowed for view with viewimage.php -if (!dolIsAllowedForPreview($original_file)) { +if (!empty($original_file) && !dolIsAllowedForPreview($original_file)) { accessforbidden('This file is not qualified for preview', 0, 0, 1); } From 392f468a13d58b213cec92e868b5e9f4416039c3 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Wed, 16 Feb 2022 09:59:18 +0100 Subject: [PATCH 055/226] allow to add more CSS and more params on html fields --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/doleditor.class.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 87f6ba693fc..ac6d67c3f30 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6693,7 +6693,7 @@ abstract class CommonObject if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); - $out = $doleditor->Create(1); + $out = $doleditor->Create(1, '', true, '', '', $moreparam, $morecss); } else { $out = ''; } diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index da98719d828..22300b53e9e 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -121,9 +121,11 @@ class DolEditor * @param boolean $disallowAnyContent Disallow to use any content. true=restrict to a predefined list of allowed elements. Used by CKEditor only. * @param string $titlecontent Show title content before editor area. Used by ACE editor only. * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) + * @param string $moreparams Add extra tags to the textarea + * @param string $morecss Add extra css to the textarea * @return void|string */ - public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '') + public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '', $moreparam = '', $morecss = '') { // phpcs:enable global $conf, $langs; @@ -141,7 +143,7 @@ class DolEditor //$out.= ''; From 8b0280a9d2e656549f4164d3b857b515b4956f33 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 16 Feb 2022 10:26:44 +0100 Subject: [PATCH 056/226] add missing entity check on list of withdraws on index of paymentbybanktransfert --- htdocs/compta/paymentbybanktransfer/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 78425398017..1cb47d1c1dc 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -182,6 +182,7 @@ $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " WHERE p.type = 'bank-transfer'"; +$sql .= " AND p.entity IN (".getEntity('invoice').")"; $sql .= " ORDER BY datec DESC"; $sql .= $db->plimit($limit); From ff8dcdc4b7436d3ea206f471ab27aa9224462a67 Mon Sep 17 00:00:00 2001 From: Alexis LAURIER Date: Wed, 16 Feb 2022 10:52:20 +0100 Subject: [PATCH 057/226] manage details of prelevment line for bank transfer --- htdocs/compta/prelevement/line.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index ccb60486c76..3e3ecb8e0ba 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -268,12 +268,20 @@ if ($id) $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql .= " , ".MAIN_DB_PREFIX."facture as f"; + if ($type == 'bank-transfer') { + $sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f"; + } else { + $sql .= " , ".MAIN_DB_PREFIX."facture as f"; + } $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND f.fk_soc = s.rowid"; - $sql .= " AND pf.fk_facture = f.rowid"; + if ($type == 'bank-transfer') { + $sql .= " AND pf.fk_facture_fourn = f.rowid"; + } else { + $sql .= " AND pf.fk_facture = f.rowid"; + } $sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND pl.rowid=".$id; if ($socid) $sql .= " AND s.rowid = ".$socid; From 1a41232181e9d7802f0edabe4e9285fd9f2b6c07 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 15:24:35 +0100 Subject: [PATCH 058/226] add vacant position option --- htdocs/hrm/class/position.class.php | 77 ++++++++++++++++++++++++++++- htdocs/hrm/position_list.php | 4 ++ htdocs/langs/fr_FR/hrm.lang | 2 + 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 2401791bb5f..f3cc82f92fe 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -109,7 +109,7 @@ class Position extends CommonObject 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), - 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>1,), + 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), @@ -842,7 +842,80 @@ class Position extends CommonObject return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } - /** + /** + * Return HTML string to put an input field into a page + * Code very similar with showInputField of extra fields + * + * @param array $val Array of properties for field to show + * @param string $key Key of attribute + * @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) + * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @return string + */ + public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) + { + global $langs; + + if($key == 'fk_user') + { + $vacantId = $keyprefix.$key.'vacant'.$keysuffix; + + $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + $out.= ''; + + ?> + + fk_user == 0) + { + return $langs->trans("VacantPosition"); + } + return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + } + + + /** * Load the info information in the object * * @param int $id Id of object diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index d6ed72c2612..0e0f561ebb2 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -270,6 +270,10 @@ foreach ($search as $key => $val) { } } } +$vacant = GETPOST('vacant', 'alphanohtml') === 'on'; +if($vacant) { + $sql .= ' AND t.fk_user = 0'; +} if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index d47596fe95e..fd0bddcc2eb 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -79,3 +79,5 @@ NoEval=Aucune évaluation effectuée pour cet employé HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau HighestRank=Plus haut niveau SkillComparison=Comparaison des compétences +VacantPosition=Poste vacant +VacantCheckboxHelper=Cocher cette option affichera le(s) poste(s) comme non pourvu(s) From 7868aa305b8e0cea98f4dc01101f10107b9c5d57 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 15:48:23 +0100 Subject: [PATCH 059/226] fix filter --- htdocs/hrm/position_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 0e0f561ebb2..11e6d3c9abf 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -270,7 +270,7 @@ foreach ($search as $key => $val) { } } } -$vacant = GETPOST('vacant', 'alphanohtml') === 'on'; +$vacant = GETPOST('search_fk_uservacant', 'alphanohtml') === 'on'; if($vacant) { $sql .= ' AND t.fk_user = 0'; } From dbcbda642a3531f3c115a8f0e26fef5aa725d658 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 15:53:06 +0100 Subject: [PATCH 060/226] fix sticker 1 --- htdocs/hrm/class/position.class.php | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index f3cc82f92fe..bc74f96cee9 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -855,22 +855,20 @@ class Position extends CommonObject * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. * @return string */ - public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) - { + public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) { global $langs; - if($key == 'fk_user') - { + if($key == 'fk_user') { $vacantId = $keyprefix.$key.'vacant'.$keysuffix; $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); - $out.= ''; + $out .= ''; ?> fk_user == 0) - { + if($key == 'fk_user' && $this->fk_user == 0) { return $langs->trans("VacantPosition"); } return parent::showOutputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); From 98c50f531ce0e34e3b08cd467c8a9dcbc5ad1a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Wed, 16 Feb 2022 15:57:39 +0100 Subject: [PATCH 061/226] translation string instead of error message text --- htdocs/langs/en_US/productbatch.lang | 2 ++ htdocs/langs/fr_FR/productbatch.lang | 1 + htdocs/product/stock/class/mouvementstock.class.php | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/productbatch.lang b/htdocs/langs/en_US/productbatch.lang index 763af20c6b4..a4215a1d7d4 100644 --- a/htdocs/langs/en_US/productbatch.lang +++ b/htdocs/langs/en_US/productbatch.lang @@ -41,3 +41,5 @@ QCFrequency=Quality control frequency (in days) #Traceability - qc status OutOfOrder=Out of order InWorkingOrder=In working order + +CantMoveNonExistantSerial=Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one. diff --git a/htdocs/langs/fr_FR/productbatch.lang b/htdocs/langs/fr_FR/productbatch.lang index 40c8b0be477..e0a0749e927 100644 --- a/htdocs/langs/fr_FR/productbatch.lang +++ b/htdocs/langs/fr_FR/productbatch.lang @@ -42,3 +42,4 @@ HideLots=Masquer les lots #Traceability - qc status OutOfOrder=Hors d'usage InWorkingOrder=En état de marche +CantMoveNonExistantSerial=Erreur : Vous avez demandé un mouvement sur un numéro de série qui n’existe plus. Peut-être avez-vous requis le même numéro de série plusieurs fois dans une même expédition, ou il a déjà servi dans une autre expédition. Supprimez cette expédition et préparez-en une autre. diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 8a66e535ca2..4976530eb5e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -842,7 +842,9 @@ class MouvementStock extends CommonObject */ private function createBatch($dluo, $qty) { - global $user; + global $user, $langs; + + $langs->load('productbatch'); $pdluo = new Productbatch($this->db); @@ -853,7 +855,7 @@ class MouvementStock extends CommonObject $result = $pdluo->fetch($dluo); if (empty($pdluo->id)) { // We didn't find the line. May be it was deleted before by a previous move in same transaction. - $this->error = 'Error. You ask a move on a record for a serial that does not exists anymore. May be you take the same serial on same warehouse several times in same shipment or it was used by another shipment. Remove this shipment and prepare another one.'; + $this->error = $langs->trans('CantMoveNonExistantSerial'); $this->errors[] = $this->error; $result = -2; } From 038298a638f88200d11688b1624cf987b5005de8 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:10:48 +0100 Subject: [PATCH 062/226] change button and add title --- htdocs/hrm/job_agenda.php | 13 ++++--------- htdocs/langs/fr_FR/hrm.lang | 1 + 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 6bfafcc1269..0685ccdba9a 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -189,18 +189,13 @@ if ($object->id > 0) { } - print '
'; - if (!empty($conf->agenda->enabled)) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; - } else { - print ''.$langs->trans("AddAction").''; - } + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } } - print '
'; - if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { $param = '&id='.$object->id.'&socid='.$socid; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { @@ -211,7 +206,7 @@ if ($object->id > 0) { } - //print load_fiche_titre($langs->trans("ActionsOnJob"), '', ''); + print load_fiche_titre($langs->trans("ActionsOnJob"), $newcardbutton, ''); // List of all actions $filters = array(); diff --git a/htdocs/langs/fr_FR/hrm.lang b/htdocs/langs/fr_FR/hrm.lang index d47596fe95e..cab3c7c11af 100644 --- a/htdocs/langs/fr_FR/hrm.lang +++ b/htdocs/langs/fr_FR/hrm.lang @@ -79,3 +79,4 @@ NoEval=Aucune évaluation effectuée pour cet employé HowManyUserWithThisMaxNote=Nombre d'employés avec ce niveau HighestRank=Plus haut niveau SkillComparison=Comparaison des compétences +ActionsOnJob=Événements sur cet emploi \ No newline at end of file From 1f2659d4114e6c715aa6ec0450c482bf77f5319d Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:26:57 +0100 Subject: [PATCH 063/226] insert precommit --- htdocs/hrm/job_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 0685ccdba9a..08da46fadf8 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -217,6 +217,6 @@ if ($object->id > 0) { } } -// End of page +//End of page llxFooter(); $db->close(); From 5f09ac61b2df1ac06111affeb5406ff79ae831ef Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:27:47 +0100 Subject: [PATCH 064/226] insert precommit1 --- htdocs/hrm/job_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/job_agenda.php b/htdocs/hrm/job_agenda.php index 08da46fadf8..0685ccdba9a 100644 --- a/htdocs/hrm/job_agenda.php +++ b/htdocs/hrm/job_agenda.php @@ -217,6 +217,6 @@ if ($object->id > 0) { } } -//End of page +// End of page llxFooter(); $db->close(); From 30d3a782dea288fe7dcc305e3e2cf49841e0fb64 Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Wed, 16 Feb 2022 16:30:54 +0100 Subject: [PATCH 065/226] precommit stickler --- htdocs/hrm/class/position.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index bc74f96cee9..2bba18c131a 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -1141,7 +1141,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; class PositionLine extends CommonObjectLine { // To complete with content of an object PositionLine - // We should have a field rowid, fk_position and position + // We should have a field rowid , fk_position and position /** * @var int Does object support extrafields ? 0=No, 1=Yes From 7ed6ca6ec629cea1e545d1cffb81c119a63753a0 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 21 Oct 2021 23:28:58 +0200 Subject: [PATCH 066/226] FIX ISSUE DB_ERROR_SYNTAX-#18921 --- htdocs/ticket/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 6991516ede8..0d0e97336cd 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '') { + if ($search[$key] != '' && !empty($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } @@ -609,9 +609,9 @@ 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); + if (is_array($val) && count($val)) { + foreach ($val as $skey) { + $param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : ""; } } else { $param .= '&search_'.$key.'='.urlencode($search[$key]); From aa2a57ff95404990a6494ed2f185352c91140030 Mon Sep 17 00:00:00 2001 From: Florian Date: Sun, 24 Oct 2021 00:26:28 +0200 Subject: [PATCH 067/226] Check that the value is not an array --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 0d0e97336cd..4caffd173c3 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -391,7 +391,7 @@ foreach ($search as $key => $val) { continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); - if ($search[$key] != '' && !empty($val)) { + if ($search[$key] != '' && !is_array($val)) { $sql .= natural_search($key, $search[$key], $mode_search); } } From 1ede8a30b2bc708caf3f1289cd3796b87d1cbf24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Feb 2022 17:49:05 +0100 Subject: [PATCH 068/226] Missing NOSESSION --- htdocs/modulebuilder/template/myobject_card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 180ece04fa8..bacb2f988dc 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -42,6 +42,7 @@ //if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification +//if (! defined('NOSESSION')) define('NOSESSION', '1'); // Disable session // Load Dolibarr environment $res = 0; From 690a91d54666dcb1c7a99a224039b2c60e034af8 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Mon, 14 Feb 2022 18:07:18 +0100 Subject: [PATCH 069/226] NEW automatically set totally received status in reception --- htdocs/reception/class/reception.class.php | 97 +++++++++++++++++++++- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 382cc5be9b6..7efcb2360dc 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -635,11 +635,15 @@ class Reception extends CommonObject } } - // Change status of order to "reception in process" - $ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur'); - - if (!$ret) { + // Change status of order to "reception in process" or "totally received" + $status = $this->getStatusDispatch(); + if ($status < 0) { $error++; + } else { + $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur'); + if (!$ret) { + $error++; + } } if (!$error && !$notrigger) { @@ -707,7 +711,92 @@ class Reception extends CommonObject } } + /** + * Get status from all dispatched lines + * + * @return int <0 if KO, >0 if OK + */ + public function getStatusDispatch() + { + global $conf; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; + + $status = CommandeFournisseur::STATUS_RECEIVED_PARTIALLY; + + if (!empty($this->origin) && $this->origin_id > 0 && ($this->origin == 'order_supplier' || $this->origin == 'commandeFournisseur')) { + if (empty($this->commandeFournisseur)) { + $this->commandeFournisseur = null; + $this->fetch_origin(); + if (empty($this->commandeFournisseur->lines)) { + $res = $this->commandeFournisseur->fetch_lines(); + if ($res < 0) return $res; + } + } + + $qty_received = array(); + $qty_wished = array(); + + $supplierorderdispatch = new CommandeFournisseurDispatch($this->db); + $filter = array('t.fk_commande'=>$this->origin_id); + if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) { + $filter['t.status'] = 1; // Restrict to lines with status validated + } + + $ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter); + if ($ret < 0) { + $this->error = $supplierorderdispatch->error; + $this->errors = $supplierorderdispatch->errors; + return $ret; + } else { + // build array with quantity received by product in all supplier orders (origin) + foreach ($supplierorderdispatch->lines as $dispatch_line) { + $qty_received[$dispatch_line->fk_product] += $dispatch_line->qty; + } + + // qty wished in order supplier (origin) + foreach ($this->commandeFournisseur->lines as $origin_line) { + // exclude lines not qualified for reception + if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $origin_line->product_type > 0) { + continue; + } + + $qty_wished[$origin_line->fk_product] += $origin_line->qty; + } + + // compare array + $diff_array = array_diff_assoc($qty_received, $qty_wished); // Warning: $diff_array is done only on common keys. + $keys_in_wished_not_in_received = array_diff(array_keys($qty_wished), array_keys($qty_received)); + $keys_in_received_not_in_wished = array_diff(array_keys($qty_received), array_keys($qty_wished)); + + if (count($diff_array) == 0 && count($keys_in_wished_not_in_received) == 0 && count($keys_in_received_not_in_wished) == 0) { // no diff => mean everything is received + $status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY; + } elseif (!empty($conf->global->SUPPLIER_ORDER_MORE_THAN_WISHED)) { + // set totally received if more products received than ordered + $close = 0; + + if (count($diff_array) > 0) { + // there are some difference between the two arrays + // scan the array of results + foreach ($diff_array as $key => $value) { + // if the quantity delivered is greater or equal to ordered quantity + if ($qty_received[$key] >= $qty_wished[$key]) { + $close++; + } + } + } + + if ($close == count($diff_array)) { + // all the products are received equal or more than the ordered quantity + $status = CommandeFournisseur::STATUS_RECEIVED_COMPLETELY; + } + } + } + } + + return $status; + } /** * Add an reception line. From 9b1d800311d3043552bedefbd3bc52186243e78a Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 15 Feb 2022 09:54:40 +0100 Subject: [PATCH 070/226] NEW add triiger and event on totally received status --- htdocs/reception/class/reception.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7efcb2360dc..bb54a8164cd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -640,9 +640,18 @@ class Reception extends CommonObject if ($status < 0) { $error++; } else { - $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur'); - if (!$ret) { - $error++; + $trigger_key = ''; + if ($status == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) { + $ret = $this->commandeFournisseur->Livraison($user, dol_now(), 'tot', ''); + if ($ret < 0) { + $error++; + $this->errors = array_merge($this->errors, $this->commandeFournisseur->errors); + } + } else { + $ret = $this->setStatut($status, $this->origin_id, 'commande_fournisseur', $trigger_key); + if ($ret < 0) { + $error++; + } } } From 1c8c98ac0f22b61ffcd05b4a672fa92d9329df2d Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 17 Feb 2022 09:53:36 +0100 Subject: [PATCH 071/226] fix ticket public interface: When sending an email to the customer, If a custom URL had been provided for ticket public interface, the link provided in the email did lead to the index of the public interface. We want it to lead to /view.php --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 29ec7983930..31b44f39b18 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -211,7 +211,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket', 2)).'/view.php?track_id='.$object->track_id; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; From aea9c2e4275de16ae066fd03ca77d16f7e65391a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 17 Feb 2022 10:22:58 +0100 Subject: [PATCH 072/226] Fix : fix php 8.0 warnings --- htdocs/adherents/agenda.php | 3 +++ htdocs/adherents/card.php | 1 + htdocs/adherents/subscription.php | 2 ++ htdocs/core/tpl/login.tpl.php | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index cb942ba3176..9132dae5802 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -65,6 +65,9 @@ if (GETPOST('actioncode', 'array')) { } $search_agenda_label = GETPOST('search_agenda_label'); +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$objcanvas = null; + // Security check $result = restrictedArea($user, 'adherent', $id); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index a2e3779d52b..caf2bbe61d6 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -55,6 +55,7 @@ $id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; $typeid = GETPOST('typeid', 'int'); $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); +$ref = GETPOST('ref', 'alpha'); if (!empty($conf->mailmanspip->enabled)) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ac2555b4deb..5f578869e6e 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -40,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; $langs->loadLangs(array("companies", "bills", "members", "users", "mails", 'other')); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $id = GETPOST('rowid', 'int') ?GETPOST('rowid', 'int') : GETPOST('id', 'int'); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index c07e01570c2..70f4f51290c 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) { } // DDOS protection -$size = (int) $_SERVER['CONTENT_LENGTH']; +$size = (int) !empty($_SERVER['CONTENT_LENGTH'])?$_SERVER['CONTENT_LENGTH']:0; if ($size > 10000) { http_response_code(413); $langs->loadLangs(array("errors", "install")); From 13cfe858f23d5b132597206c5ca674f5fe27a8f4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 17 Feb 2022 09:53:02 +0000 Subject: [PATCH 073/226] Fixing style errors. --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 6f748df22e4..f6e40b511f1 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes $keyforbreak = 'duration'; include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - $object->calculateCosts(); + $object->calculateCosts(); print '
'; print ''; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 14cfd22c39e..8040310ea53 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -192,9 +192,9 @@ if ($resql) { $sub_bom_product->fetch($obj->fk_product); $sub_bom = new BOM($object->db); - if(!empty($obj->fk_bom_child)){ + if (!empty($obj->fk_bom_child)) { $sub_bom->fetch($obj->fk_bom_child); - } + } $sub_bom_line = new BOMLine($object->db); $sub_bom_line->fetch($obj->rowid); @@ -236,11 +236,11 @@ if ($resql) { // Efficiency print ''; - if(!empty($sub_bom->id)){ - $sub_bom->calculateCosts(); - print ''; + if (!empty($sub_bom->id)) { + $sub_bom->calculateCosts(); + print ''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; - } elseif ($sub_bom_product->cost_price > 0) { + } elseif ($sub_bom_product->cost_price > 0) { print ''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined From 1ad8700810096cb8b5964a7cdda14881f965ce45 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 17 Feb 2022 11:08:23 +0100 Subject: [PATCH 074/226] empty commit to force travis try rebuild From 67cb2683248785499a3a4380cc13cc6f78cf918d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 11:33:34 +0100 Subject: [PATCH 075/226] Update example conf file with force_install_lockinstall --- htdocs/conf/conf.php.example | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 6bf2873b50c..8cd46352ac9 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -321,6 +321,15 @@ $dolibarr_cron_allow_cli='0'; // // $php_session_save_handler=''; +// force_install_lockinstall +// If this value is set to a value, it forces the creation of a file install.lock once an upgrade process into a new version end. +// The value is the octal value of permission to set on created file. +// The file install.lock prevents the use of the migration process another time. You will have to delete it manually for +// next upgrade. +// Default value: '0' +// Example: '444'; +// $force_install_lockinstall='440'; + //################## From bb08341dc3a5029e8cc988b5962a90e47d7a67aa Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 17 Feb 2022 18:34:23 +0800 Subject: [PATCH 076/226] to disable the default pdf generation --- htdocs/fourn/class/fournisseur.commande.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index ed978010a33..8a0e0de299e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3132,18 +3132,19 @@ class CommandeFournisseur extends CommonOrder $outputlangs->load("products"); if (!dol_strlen($modele)) { - $modele = 'muscadet'; - + $modele = ''; if ($this->model_pdf) { $modele = $this->model_pdf; } elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) { $modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF; } } - - $modelpath = "core/modules/supplier_order/doc/"; - - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + if (empty($modele)) { + return 0; + } else { + $modelpath = "core/modules/supplier_order/doc/"; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + } } /** From c529af90c66ae1271fda99c4c102c007db538b90 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 12:06:48 +0100 Subject: [PATCH 077/226] Fix trans --- htdocs/admin/tools/dolibarr_export.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 4f6977ffb41..092f3a57170 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -546,6 +546,7 @@ print ''; print ''; +$title = $langs->trans("BackupZipWizard"); print "
\n"; print "\n"; @@ -564,7 +565,7 @@ print ''; print '
'; -print load_fiche_titre($title ? $title : $langs->trans("BackupZipWizard")); +print load_fiche_titre($title); print '
'; $prefix = 'documents'; From 85327f28b0ad0cb2c1e958f461ef0d41f462f479 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:12:24 +0100 Subject: [PATCH 078/226] Update login.tpl.php --- htdocs/core/tpl/login.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 70f4f51290c..27356c96795 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -31,7 +31,7 @@ if (empty($conf) || !is_object($conf)) { } // DDOS protection -$size = (int) !empty($_SERVER['CONTENT_LENGTH'])?$_SERVER['CONTENT_LENGTH']:0; +$size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']); if ($size > 10000) { http_response_code(413); $langs->loadLangs(array("errors", "install")); From 2e744a4517cf59fd939856ac1d97e7d054511c6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:18:22 +0100 Subject: [PATCH 079/226] Update create_ticket.php --- htdocs/public/ticket/create_ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 31b44f39b18..1c9ca3aafe0 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -211,7 +211,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE : dol_buildpath('/public/ticket', 2)).'/view.php?track_id='.$object->track_id; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; From 68beafe599c0e91f5c8777d2e402eaf2a357e952 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:24:44 +0100 Subject: [PATCH 080/226] Removed useless indexes --- htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql index b82e75d85d6..c5a451e030f 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql @@ -17,9 +17,7 @@ ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity); -ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity); -ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_date_lim_reglement (date_lim_reglement); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_soc (fk_soc); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_user_author (fk_user_author); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_fk_projet (fk_projet); From c20d82499920c1c0028d681700e7b80770e884ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:30:18 +0100 Subject: [PATCH 081/226] Tables of module ticket are create only when module is enabled. --- htdocs/core/modules/modTicket.class.php | 5 +++++ .../tables/{llx_ticket.key.sql => llx_ticket-ticket.key.sql} | 0 .../mysql/tables/{llx_ticket.sql => llx_ticket-ticket.sql} | 0 ...afields.key.sql => llx_ticket_extrafields-ticket.key.sql} | 0 ...ket_extrafields.sql => llx_ticket_extrafields-ticket.sql} | 0 5 files changed, 5 insertions(+) rename htdocs/install/mysql/tables/{llx_ticket.key.sql => llx_ticket-ticket.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_ticket.sql => llx_ticket-ticket.sql} (100%) rename htdocs/install/mysql/tables/{llx_ticket_extrafields.key.sql => llx_ticket_extrafields-ticket.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_ticket_extrafields.sql => llx_ticket_extrafields-ticket.sql} (100%) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 01561b40b01..50922ed884e 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -320,6 +320,11 @@ class modTicket extends DolibarrModules { global $conf, $langs; + $result = $this->_load_tables('/install/mysql/tables/', 'ticket'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + // Permissions $this->remove($options); diff --git a/htdocs/install/mysql/tables/llx_ticket.key.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket.key.sql rename to htdocs/install/mysql/tables/llx_ticket-ticket.key.sql diff --git a/htdocs/install/mysql/tables/llx_ticket.sql b/htdocs/install/mysql/tables/llx_ticket-ticket.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket.sql rename to htdocs/install/mysql/tables/llx_ticket-ticket.sql diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.key.sql diff --git a/htdocs/install/mysql/tables/llx_ticket_extrafields.sql b/htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_ticket_extrafields.sql rename to htdocs/install/mysql/tables/llx_ticket_extrafields-ticket.sql From b393a1277fbd4c7c8661ed43008d928a343bab4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:50:21 +0100 Subject: [PATCH 082/226] Update 14.0.0-15.0.0.sql --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 69d7c93af5f..b57d995c251 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -507,8 +507,8 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); --- Delete old mexican legal forms -DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); +-- We do not delete old mexican legal forms because they may have been used. User will have to insert the new one manually not inserted because of conflict if he need them. +--DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); From 39bb854ef877d29e814a42b73899841e90851c0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 19:57:45 +0100 Subject: [PATCH 083/226] Update ticket.php --- htdocs/admin/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index e6a6208324e..fc8a5e8e0b9 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -478,7 +478,7 @@ if (!$conf->use_javascript_ajax) { print ''; } -print load_fiche_titre($langs->trans("Workflow"), '', ''); +print load_fiche_titre($langs->trans("Other"), '', ''); print '
'.$langs->trans("TicketsAutoReadTicket").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND); +} +print ''; +print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help'); +print '
'.$langs->trans("TicketsAutoAssignTicket").''; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2d850927782..2867c7b853b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -517,6 +517,7 @@ or=or Other=Other Others=Others OtherInformations=Other information +Workflow=Workflow Quantity=Quantity Qty=Qty ChangedBy=Changed by diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index d38358eb74d..222efad8ba2 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. +TicketsAutoReadTicket=Automatically mark the ticket as read +TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. + # # Index & list page # diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 63c5192a01f..12778f337dd 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -517,6 +517,7 @@ or=ou Other=Autre Others=Autres OtherInformations=Autre information +Workflow=Processus de travail Quantity=Quantité Qty=Qté ChangedBy=Modifié par diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index 91850194533..bc51a7627fd 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -136,6 +136,9 @@ TicketsPublicNotificationNewMessage=Envoyer un ou des emails lorsqu’un nouveau TicketsPublicNotificationNewMessageHelp=Envoyer un (des) courriel(s) lorsqu’un nouveau message est ajouté à partir de l’interface publique (à l’utilisateur désigné ou au courriel de notification (mise à jour) et/ou au courriel de notification) TicketPublicNotificationNewMessageDefaultEmail=Emails de notifications à (mise à jour) TicketPublicNotificationNewMessageDefaultEmailHelp=Envoyez un email à cette adresse email pour chaque nouveau message de notifications si le ticket n'a pas d'utilisateur assigné ou si l'utilisateur n'a pas d'email connu. +TicketsAutoReadTicket=Automatiquement marquer le ticket comme lu +TicketsAutoReadTicketHelp=Automatiquement marquer le ticket comme lu s'il est créé depuis le backoffice. + # # Index & list page # From c5d1310373a4a7f41806a412c66986a6e3cc84b3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 3 Feb 2022 12:23:58 +0100 Subject: [PATCH 011/226] handle workflow constants in appropriate category --- htdocs/admin/ticket.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 1805f5de34d..e6a6208324e 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -143,6 +143,20 @@ if ($action == 'updateMask') { } } +if ($action == 'setvarworkflow') { + $param_auto_read = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_read, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } +} + if ($action == 'setvarother') { $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); @@ -177,18 +191,6 @@ if ($action == 'setvarother') { if (!($res > 0)) { $error++; } - - $param_auto_assign = GETPOST('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', $param_auto_assign, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - - $param_auto_read = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_read, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } } @@ -473,7 +475,7 @@ print '
'; if (!$conf->use_javascript_ajax) { print '
'; print ''; - print ''; + print ''; } print load_fiche_titre($langs->trans("Workflow"), '', ''); From 4c5ddcf0300a59b1b50f388299e73d3014ce3f88 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 17:57:28 +0100 Subject: [PATCH 012/226] ticket config: add constant TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND to admin panel --- htdocs/core/modules/modTicket.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 01561b40b01..6091a245bfa 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -106,7 +106,8 @@ class modTicket extends DolibarrModules $this->const = array( 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), - 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0) + 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), + 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0) ); From 664860863ee4463327a146a9095f9fad5b9de5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= Date: Thu, 10 Feb 2022 17:59:12 +0100 Subject: [PATCH 013/226] correct warehouse document location --- htdocs/product/stock/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 440e082e8ff..80be3c923ec 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -944,7 +944,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { $delallowed = $usercancreate; $modulepart = 'stock'; - print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); $somethingshown = $formfile->numoffiles; print '
'; From 30d7f807e49a553673d3053b16ae759963129a2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Feb 2022 21:03:10 +0100 Subject: [PATCH 014/226] Fix url --- htdocs/comm/propal/card.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 746075ab51e..45a4d2fdb57 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2543,7 +2543,7 @@ if ($action == 'create') { if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) || ($object->statut == Propal::STATUS_DRAFT && !empty($conf->global->PROPAL_ENABLE_NEGATIVE) && count($object->lines) > 0)) { if ($usercanvalidate) { - print ''.$langs->trans('Validate').''; + print ''.$langs->trans('Validate').''; } else { print ''.$langs->trans('Validate').''; } @@ -2555,7 +2555,7 @@ if ($action == 'create') { }*/ // Edit if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } // ReOpen @@ -2578,7 +2578,7 @@ if ($action == 'create') { // Create a sale order if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateorder) { - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } } @@ -2586,7 +2586,7 @@ if ($action == 'create') { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) { if ($object->statut == Propal::STATUS_SIGNED && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) { if ($usercancreatepurchaseorder) { - print ''.$langs->trans("AddPurchaseOrder").''; + print ''.$langs->trans("AddPurchaseOrder").''; } } } @@ -2595,7 +2595,7 @@ if ($action == 'create') { if (!empty($conf->service->enabled) && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); - print ''.$langs->trans("AddIntervention").''; + print ''.$langs->trans("AddIntervention").''; } } @@ -2604,14 +2604,14 @@ if ($action == 'create') { $langs->load("contracts"); if ($usercancreatecontract) { - print ''.$langs->trans('AddContract').''; + print ''.$langs->trans('AddContract').''; } } // Create an invoice and classify billed if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''.$langs->trans("CreateBill").''; + print ''.$langs->trans("CreateBill").''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); From 88a33c730a6a977d2310a32e8c2ec2297da9a28e Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Fri, 11 Feb 2022 02:01:25 -0600 Subject: [PATCH 015/226] FIX #20042 Update Mexican legal entities --- .../mysql/data/llx_c_forme_juridique.sql | 25 ++++++++++++++----- .../install/mysql/migration/14.0.0-15.0.0.sql | 23 +++++++++++++++++ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index 7af5d28df8c..a1293084a52 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -302,12 +302,25 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (152, '15210', 'Mauritius Trusts', 1); -- Mexique -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', 'Sociedad en nombre colectivo', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', 'Sociedad en comandita simple', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', 'Sociedad de responsabilidad limitada', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', 'Sociedad anónima', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', 'Sociedad en comandita por acciones', 1); -INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', 'Sociedad cooperativa', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); -- Luxembourg INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (140, '14001', 'Entreprise individuelle', 1); diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 7be62695d50..69d7c93af5f 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -506,3 +506,26 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802); INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804); + +-- Delete old mexican legal forms +DELETE FROM llx_c_forme_juridique WHERE code IN ('15401', '15402', '15403', '15404', '15405', '15406'); + +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15401', '601 - General de Ley Personas Morales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15402', '603 - Personas Morales con Fines no Lucrativos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15403', '605 - Sueldos y Salarios e Ingresos Asimilados a Salarios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15404', '606 - Arrendamiento', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15405', '607 - Régimen de Enajenación o Adquisición de Bienes', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15406', '608 - Demás ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15407', '610 - Residentes en el Extranjero sin Establecimiento Permanente en México', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15408', '611 - Ingresos por Dividendos (socios y accionistas)', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15409', '612 - Personas Físicas con Actividades Empresariales y Profesionales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15410', '614 - Ingresos por intereses', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15411', '615 - Régimen de los ingresos por obtención de premios', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15412', '616 - Sin obligaciones fiscales', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15413', '620 - Sociedades Cooperativas de Producción que optan por diferir sus ingresos', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15414', '621 - Incorporación Fiscal', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15415', '622 - Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15416', '623 - Opcional para Grupos de Sociedades', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15417', '624 - Coordinados', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15418', '625 - Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154, '15419', '626 - Régimen Simplificado de Confianza', 1); From 27df3cc02c39de48dfa9be5ac505f38696712cab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 11:20:36 +0100 Subject: [PATCH 016/226] FIX events on several days may missing the last day in calendar view. FIX the drag and drop was not available on some events --- htdocs/comm/action/index.php | 55 ++++++++++++++++++++++++------- htdocs/core/db/DoliDB.class.php | 4 +-- htdocs/core/js/dst.js | 3 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/tpl/login.tpl.php | 2 +- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 4d6a032492f..72e50d9292d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -808,8 +808,18 @@ if ($resql) { $event->id = $obj->id; $event->ref = $event->id; - $event->datep = $db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin - $event->datef = $db->jdate($obj->datep2); + $event->fulldayevent = $obj->fulldayevent; + + // event->datep and event->datef must be GMT date. + if ($event->fulldayevent) { + // TODO... + $event->datep = $db->jdate($obj->datep); + $event->datef = $db->jdate($obj->datep2); + } else { + // Example: $obj->datep = '1970-01-01 01:00:00', jdate will return 0 if TZ of PHP server is Europe/Berlin (+1) + $event->datep = $db->jdate($obj->datep); + $event->datef = $db->jdate($obj->datep2); + } //$event->datep_formated_gmt = dol_print_date($event->datep, 'dayhour', 'gmt'); //var_dump($obj->datep); //var_dump($event->datep); @@ -829,7 +839,6 @@ if ($resql) { $event->fetch_userassigned(); // This load $event->userassigned $event->priority = $obj->priority; - $event->fulldayevent = $obj->fulldayevent; $event->location = $obj->location; $event->transparency = $obj->transparency; $event->fk_element = $obj->fk_element; @@ -869,25 +878,43 @@ if ($resql) { $annee = dol_print_date($daycursor, '%Y', 'tzuserrel'); $mois = dol_print_date($daycursor, '%m', 'tzuserrel'); $jour = dol_print_date($daycursor, '%d', 'tzuserrel'); + + $daycursorend = $event->date_end_in_calendar; + $anneeend = dol_print_date($daycursorend, '%Y', 'tzuserrel'); + $moisend = dol_print_date($daycursorend, '%m', 'tzuserrel'); + $jourend = dol_print_date($daycursorend, '%d', 'tzuserrel'); + //var_dump(dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt')); // Hour at greenwich //var_dump($annee.'-'.$mois.'-'.$jour); + //print 'annee='.$annee.' mois='.$mois.' jour='.$jour.'
'; // Loop on each day covered by action to prepare an index to show on calendar $loop = true; $j = 0; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz + $daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz + /* + print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'
'; + print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'
'; + print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'
'; + print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'
'; + print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'
'; + print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'
'; + */ do { //if ($event->id==408) - //print 'daykey='.$daykey.' '.dol_print_date($daykey, 'dayhour', 'gmt').' '.$event->datep.' '.$event->datef.'
'; + //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'
'; + //print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'tzuserrel').' - '.dol_print_date($event->datep, 'dayhour', 'tzuserrel').' '.dol_print_date($event->datef, 'dayhour', 'tzuserrel').'
'; $eventarray[$daykey][] = $event; $j++; $daykey += 60 * 60 * 24; - if ($daykey > $event->date_end_in_calendar) { + //if ($daykey > $event->date_end_in_calendar) { + if ($daykey > $daykeyend) { $loop = false; } } while ($loop); - + //var_dump($eventarray); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } @@ -1816,12 +1843,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cssclass .= " unmovable"; } elseif ($event->type_code == 'ICALEVENT') { $cssclass .= " unmovable"; - } elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { - $tmpyearend = date('Y', $event->date_end_in_calendar); - $tmpmonthend = date('m', $event->date_end_in_calendar); - $tmpdayend = date('d', $event->date_end_in_calendar); + } elseif ($event->date_start_in_calendar && $event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { + // If the event is on several days + $tmpyearend = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel'); + $tmpmonthend = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel'); + $tmpdayend = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel'); + //var_dump($tmpyearend.' '.$tmpmonthend.' '.$tmpdayend); if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour) { - $cssclass .= " unmovable"; + $cssclass .= " unmovable unmovable-mustusefirstdaytodrag"; + } else { + $cssclass .= ' movable cursormove'; } } else { if ($user->rights->agenda->allactions->create || diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 4476228d509..f23a66bbee4 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -302,8 +302,8 @@ abstract class DoliDB implements Database /** * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) - * 19700101020000 -> 3600 with TZ+1 and gmt=0 - * 19700101020000 -> 7200 whaterver is TZ if gmt=1 + * 19700101020000 -> 3600 with server TZ = +1 and $gm='tzserver' + * 19700101020000 -> 7200 whaterver is server TZ if $gm='gmt' * * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) * @param mixed $gm 'gmt'=Input informations are GMT values, 'tzserver'=Local to server TZ diff --git a/htdocs/core/js/dst.js b/htdocs/core/js/dst.js index 83d4abd5f08..8433ada72a9 100644 --- a/htdocs/core/js/dst.js +++ b/htdocs/core/js/dst.js @@ -26,7 +26,8 @@ $(document).ready(function () { var timezone = jstz.determine(); - + console.log("Timezone detected for user: "+timezone.name()); + // Detect and save TZ and DST var rightNow = new Date(); var jan1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d89fd437a2d..fc163933b47 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2560,11 +2560,11 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = 'auto', { global $conf; //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; - //print 'gm:'.$gm.' gm==auto:'.($gm == 'auto').'
'; if ($gm === 'auto') { $gm = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey); } + //print 'gm:'.$gm.' gm === auto:'.($gm === 'auto').'
';exit; // Clean parameters if ($hour == -1 || empty($hour)) { diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 338d2bd1a19..a4d38166112 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -127,7 +127,7 @@ $(document).ready(function () { - + From 455247565d68132add664def71a36fc19f418024 Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Fri, 11 Feb 2022 11:40:45 +0100 Subject: [PATCH 017/226] FIX wrong user author --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c8b381280b1..3d1637019e9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -875,8 +875,8 @@ class Societe extends CommonObject $sql .= ", name_alias"; $sql .= ", entity"; $sql .= ", datec"; - $sql .= ", fk_typent"; $sql .= ", fk_user_creat"; + $sql .= ", fk_typent"; $sql .= ", canvas"; $sql .= ", status"; $sql .= ", ref_ext"; From b84fd3ec3df42e8df698797431d03c173aa148c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 12:46:45 +0100 Subject: [PATCH 018/226] Clean code --- htdocs/admin/agenda_xcal.php | 9 ++++++++ htdocs/comm/action/class/actioncomm.class.php | 6 ++--- htdocs/core/lib/xcal.lib.php | 22 +++++++++---------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 0166769660a..ce36d97d06a 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -164,6 +164,9 @@ $urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentit $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, ''.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl1'); $message .= '
'; @@ -173,6 +176,9 @@ $urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, ''.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl2'); $message .= '
'; @@ -182,6 +188,9 @@ $urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity. $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, ''.$langs->trans("WebCalUrlForVCalExport", 'rss', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl3'); $message .= '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8dd0d9febbe..1e640f7afbe 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1952,14 +1952,14 @@ class ActionComm extends CommonObject $event = array(); $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type'] = $type; + $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // fix for -> Warning: A non-numeric value encountered if (is_numeric($this->db->jdate($obj->datep2))) { - $dateend = $this->db->jdate($obj->datep2) - - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); } else { - // use start date as fall-back to avoid import erros on empty end date + // use start date as fall-back to avoid pb with empty end date on ICS readers $dateend = $datestart; } diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index fcd1660985b..74b5f711da9 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -100,6 +100,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) $created = $event["created"]; $modified = $event["modified"]; $assignedUsers = $event["assignedUsers"]; + //print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt'); // Format $summary = format_cal($format, $summary); @@ -191,16 +192,16 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // Date must be GMT dates // Current date - fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt')."\n"); // Start date $prefix = ""; - $startdatef = dol_print_date($startdate, "dayhourxcard", true); + $startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt'); if ($fulldayevent) { // Local time $prefix = ";VALUE=DATE"; - $startdatef = dol_print_date($startdate, "dayxcard", false); + $startdatef = dol_print_date($startdate, "dayxcard", 'gmt'); } fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n"); @@ -208,7 +209,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // End date if ($fulldayevent) { if (empty($enddate)) { - $enddate = dol_time_plus_duree($startdate, 1, "d"); + $enddate = dol_time_plus_duree($startdate, 1, "d"); // We add 1 day needed for full day event (DTEND must be next day after event) } } else { if (empty($enddate)) { @@ -217,14 +218,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } $prefix = ""; - $enddatef = dol_print_date($enddate, "dayhourxcard", true); + $enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt'); if ($fulldayevent) { $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", false); - - // Local time - //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false); + $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); @@ -256,11 +254,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } if ($created) { - fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); + fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", 'gmt')."\n"); } if ($modified) { - fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); + fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt')."\n"); } fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); @@ -270,7 +268,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) fwrite($calfileh, "LOCATION:".$location."\n"); fwrite($calfileh, "TRANSP:OPAQUE\n"); fwrite($calfileh, "CLASS:CONFIDENTIAL\n"); - fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", 'gmt')."\n"); fwrite($calfileh, "END:VJOURNAL\n"); } From 32af067e1e48bd94d5aaff32d1254cde44567213 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 13:01:29 +0100 Subject: [PATCH 019/226] Code comment --- htdocs/core/lib/xcal.lib.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 74b5f711da9..97ada3e3d4f 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -209,7 +209,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // End date if ($fulldayevent) { if (empty($enddate)) { - $enddate = dol_time_plus_duree($startdate, 1, "d"); // We add 1 day needed for full day event (DTEND must be next day after event) + // We add 1 day needed for full day event (DTEND must be next day after event). + // This is mention in https://datatracker.ietf.org/doc/html/rfc5545: + // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event." + $enddate = dol_time_plus_duree($startdate, 1, "d"); } } else { if (empty($enddate)) { @@ -222,7 +225,10 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) if ($fulldayevent) { $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) + // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) + // This is mention in https://datatracker.ietf.org/doc/html/rfc5545: + // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event." + $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); From 89ffe5baba701eecdc592e67f96935768faefdc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 14:07:10 +0100 Subject: [PATCH 020/226] Clean code for param of dol_stringtotime() --- htdocs/core/lib/date.lib.php | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index d4028e2196b..237adc9447a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -357,18 +357,18 @@ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $exclu * Convert a string date into a GM Timestamps date * Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not supported. If parameter gm is 1, we will use no TZ, if not we will use TZ of server, not the one inside string. * - * @param string $string Date in a string - * YYYYMMDD - * YYYYMMDDHHMMSS - * YYYYMMDDTHHMMSSZ - * YYYY-MM-DDTHH:MM:SSZ (RFC3339) - * DD/MM/YY or DD/MM/YYYY (deprecated) - * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) - * @param int $gm 1 =Input date is GM date, - * 0 =Input date is local date using PHP server timezone - * @return int Date as a timestamp - * 19700101020000 -> 7200 with gm=1 - * 19700101000000 -> 0 with gm=1 + * @param string $string Date in a string + * YYYYMMDD + * YYYYMMDDHHMMSS + * YYYYMMDDTHHMMSSZ + * YYYY-MM-DDTHH:MM:SSZ (RFC3339) + * DD/MM/YY or DD/MM/YYYY (deprecated) + * DD/MM/YY HH:MM:SS or DD/MM/YYYY HH:MM:SS (deprecated) + * @param int|string $gm 'gmt' or 1 =Input date is GM date, + * 'tzserver' or 0 =Input date is date using PHP server timezone + * @return int Date as a timestamp + * 19700101020000 -> 7200 with gm=1 + * 19700101000000 -> 0 with gm=1 * * @see dol_print_date(), dol_mktime(), dol_getdate() */ @@ -408,7 +408,14 @@ function dol_stringtotime($string, $gm = 1) $string = preg_replace('/([^0-9])/i', '', $string); $tmp = $string.'000000'; - $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), ($gm ? 1 : 0)); + // Clean $gm + if ($gm === 1) { + $gm = 'gmt'; + } elseif (empty($gm) || $gm === 'tzserver') { + $gm = 'tzserver'; + } + + $date = dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), $gm); return $date; } From 271e9da425bfa0b4c0d731339d12b3dd1b60ac72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 15:15:50 +0100 Subject: [PATCH 021/226] Add option MAIN_STORE_FULL_EVENT_IN_GMT to fix TZ pb with full day event --- htdocs/comm/action/card.php | 65 ++++++++++++++++++---------- htdocs/comm/action/document.php | 6 ++- htdocs/comm/action/index.php | 17 ++++---- htdocs/comm/action/list.php | 16 +++++-- htdocs/resource/element_resource.php | 6 ++- 5 files changed, 73 insertions(+), 37 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 627c2f0ce51..4a00894d26b 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -76,11 +76,14 @@ if ($complete == 'na' || $complete == -2) { } if ($fulldayevent) { - $datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime('00', '00', 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + $datef = dol_mktime('23', '59', '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuserrel'); + //print $db->idate($datep); exit; } else { - $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int')); - $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int')); + $datep = dol_mktime($aphour, $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuserrel'); + $datef = dol_mktime($p2hour, $p2min, '59', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuserrel'); } // Security check @@ -252,8 +255,15 @@ if (empty($reshook) && $action == 'add') { $percentage = in_array(GETPOST('status'), array(-1, 100)) ? GETPOST('status') : (in_array($complete, array(-1, 100)) ? $complete : GETPOST("percentage", 'int')); // If status is -1 or 100, percentage is not defined and we must use status // Clean parameters - $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); - $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + if ($fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + } else { + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + } // Check parameters if (!$datef && $percentage == 100) { @@ -513,8 +523,16 @@ if (empty($reshook) && $action == 'update') { $object->fetch_userassigned(); $object->oldcopy = clone $object; - $datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); - $datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + // Clean parameters + if ($fulldayevent) { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + // For "full day" events, we must store date in GMT (It must be viewed as same moment everywhere) + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), $tzforfullday ? $tzforfullday : 'tzuser'); + } else { + $datep = dol_mktime($fulldayevent ? '00' : GETPOST("aphour", 'int'), $fulldayevent ? '00' : GETPOST("apmin", 'int'), $fulldayevent ? '00' : GETPOST("apsec", 'int'), GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'), 'tzuser'); + $datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser'); + } $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm'); $object->label = GETPOST("label", "alphanohtml"); @@ -1005,11 +1023,11 @@ if ($action == 'create') { $datep = ($datep ? $datep : (is_null($object->datep) ? '' : $object->datep)); if (GETPOST('datep', 'int', 1)) { - $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 0); + $datep = dol_stringtotime(GETPOST('datep', 'int', 1), 'tzuser'); } $datef = ($datef ? $datef : $object->datef); if (GETPOST('datef', 'int', 1)) { - $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 0); + $datef = dol_stringtotime(GETPOST('datef', 'int', 1), 'tzuser'); } if (empty($datef) && !empty($datep)) { if (GETPOST("actioncode", 'aZ09') == 'AC_RDV' || empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)) { @@ -1024,16 +1042,16 @@ if ($action == 'create') { print ''.$langs->trans("DateActionEnd").''; print '
'; if (GETPOST("afaire") == 1) { - print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart'); // Empty value not allowed for start date and hours if "todo" + print $form->selectDate($datep, 'ap', 1, 1, 0, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); // Empty value not allowed for start date and hours if "todo" } else { - print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart'); + print $form->selectDate($datep, 'ap', 1, 1, 1, "action", 1, 2, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuserrel'); } print '     -     '; //print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel'); } else { - print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend'); + print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuserrel'); } print '
'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").''; + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); if (GETPOST("afaire") == 1) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } else { - print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } print ' - '; if (GETPOST("afaire") == 1) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } elseif (GETPOST("afaire") == 2) { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } else { - print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', 'tzuser'); + print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser'); } print '
'; - print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + if (empty($obj->fulldayevent)) { + print dol_print_date($db->jdate($obj->dp), $formatToUse, 'tzuser'); + } else { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($db->jdate($obj->dp), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser')); + } $late = 0; if ($actionstatic->hasDelay() && $actionstatic->percentage >= 0 && $actionstatic->percentage < 100 ) { $late = 1; @@ -967,7 +972,12 @@ while ($i < min($num, $limit)) { // End date if (!empty($arrayfields['a.datep2']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + if (empty($obj->fulldayevent)) { + print dol_print_date($db->jdate($obj->dp2), $formatToUse, 'tzuser'); + } else { + $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT'); + print dol_print_date($db->jdate($obj->dp2), $formatToUse, ($tzforfullday ? $tzforfullday : 'tzuser')); + } print ''.$langs->trans("SendingsAbility").''; print ''; -print $langs->trans("Required"); +print ''.img_picto($langs->trans("Required"), 'switch_on').''; /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; From eff2fc1e9ef9a409022145f146e1128e4c4ad14f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 18:19:50 +0100 Subject: [PATCH 024/226] Complete option MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1e3e878dad5..692cf35c3b1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1106,13 +1106,13 @@ class Form } print '
'.$langcode.''.$key.''; + $titleforvalue = $langs->trans("Translation").' en_US for key '.$key.':
'.($langsenfileonly->tab_translate[$key] ? $langsenfileonly->trans($key) : ''.$langs->trans("None").''); + print ''; print dol_escape_htmltag($val); - print '
'; + print ''; + print ''; if (!empty($newlangfileonly->tab_translate[$key])) { if ($val != $newlangfileonly->tab_translate[$key]) { // retrieve rowid From 1097111706fda094e6ee4adffb7f9cb509245d0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 16:37:08 +0100 Subject: [PATCH 034/226] Fix autofocus --- htdocs/admin/accountant.php | 2 +- htdocs/admin/openinghours.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index e0e01cab328..693170862e9 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -119,7 +119,7 @@ print '
'.$langs-> // Name print '
'; -print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index a0f02fe99ac..b18ebd0c05f 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -97,7 +97,7 @@ if (empty($action) || $action == 'edit' || $action == 'updateedit') { print '
'; print $form->textwithpicto($langs->trans("Monday"), $langs->trans("OpeningHoursFormatDesc")); print ''; - print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; print $form->textwithpicto($langs->trans("Tuesday"), $langs->trans("OpeningHoursFormatDesc")); From d5e5e8d4363c0fb7bcfbaaac134e5ee098cc0f11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 16:49:41 +0100 Subject: [PATCH 035/226] Debug v15 --- htdocs/admin/delais.php | 20 ++++++++++--------- htdocs/admin/pdf.php | 2 +- htdocs/admin/pdf_other.php | 2 +- htdocs/core/boxes/box_members_by_type.php | 1 + .../box_members_subscriptions_by_year.php | 1 + htdocs/langs/en_US/admin.lang | 5 +++-- htdocs/langs/en_US/boxes.lang | 2 +- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 4 ++++ 9 files changed, 24 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 229fb3e2291..2ae77b03d07 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -222,7 +222,8 @@ if ($action == 'edit') { print ''; print ''; - print ''; + print ''; + print ''; foreach ($modules as $module => $delays) { if (!empty($conf->$module->enabled)) { @@ -230,7 +231,7 @@ if ($action == 'edit') { $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']}:0); print ''; print ''; - print ''; } } @@ -242,10 +243,10 @@ if ($action == 'edit') { // Show if meteo is enabled print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("LateWarningAfter").'
'.img_object('', $delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; + print ''.$langs->trans('Delays_'.$delay['code']).''; print ' '.$langs->trans("days").'
'; - print ''; + print ''; print ''; - print ''; @@ -256,7 +257,7 @@ if ($action == 'edit') { */ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Option").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").''; + print ''.$langs->trans("MAIN_DISABLE_METEO").''; print $form->selectarray('MAIN_DISABLE_METEO', $labelmeteo, (empty($conf->global->MAIN_DISABLE_METEO) ? 0 : $conf->global->MAIN_DISABLE_METEO)); print '
'; - print ''; + print ''; foreach ($modules as $module => $delays) { if (!empty($conf->$module->enabled)) { @@ -276,7 +277,7 @@ if ($action == 'edit') { // Show if meteo is enabled print '
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'.$langs->trans("DelaysOfToleranceBeforeWarning").''.$langs->trans("Value").'
'; - print ''; + print ''; print ''; print ''; print ''; // Currency @@ -471,7 +471,7 @@ if ($action == 'create') { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Option").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").''; @@ -301,7 +302,7 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE } else { $str_mode_enabled = $str_mode_percentage; } - print ''.$str_mode_enabled.''; + print '
'.$str_mode_enabled.''; print ''; print '

'; @@ -451,8 +452,9 @@ if ($action == 'edit') { print $form->buttonsSaveCancel("Save", ''); print ''; } else { - print '
'; + print '

'; + print ''.$langs->trans("Modify").''; + print '
'; } // End of page diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 18a4ca0825f..33f8f5b87f2 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -249,7 +249,7 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); $head = pdf_admin_prepare_head(); -print dol_get_fiche_head($head, 'general', $langs->trans("PDF"), -1, 'pdf'); +print dol_get_fiche_head($head, 'general', '', -1, ''); print ''.$form->textwithpicto($langs->trans("PDFDesc"), $s)."
\n"; print "
\n"; diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index f42c49a4bfe..72acf7fbf4f 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -84,7 +84,7 @@ print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); $head = pdf_admin_prepare_head(); -print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf'); +print dol_get_fiche_head($head, 'other', '', -1, ''); $tooltiptext = ''; print ''.$form->textwithpicto($langs->trans("PDFOtherDesc"), $tooltiptext)."
\n"; diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 0a5e4548e3f..d7ab444f2da 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -244,6 +244,7 @@ class box_members_by_type extends ModeleBoxes ); } else { $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total"', 'td' => 'class="liste_total"', 'text' => $langs->trans("Total") ); diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index e7bf916d236..479d2424f09 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -196,6 +196,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes ); } else { $this->info_box_contents[$line][] = array( + 'tr' => 'class="liste_total"', 'td' => 'class="liste_total"', 'text' => $langs->trans("Total"), ); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 80e40c12a1b..3506f024eea 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1187,7 +1187,7 @@ BankModuleNotActive=Bank accounts module not enabled ShowBugTrackLink=Show the link "%s" ShowBugTrackLinkDesc=Keep empty to not display this link, use value 'github' for the link to the Dolibarr project or define directly an url 'https://...' Alerts=Alerts -DelaysOfToleranceBeforeWarning=Delay before displaying a warning alert for: +DelaysOfToleranceBeforeWarning=Displaying a warning alert for... DelaysOfToleranceDesc=Set the delay before an alert icon %s is shown onscreen for the late element. Delays_MAIN_DELAY_ACTIONS_TODO=Planned events (agenda events) not completed Delays_MAIN_DELAY_PROJECT_TO_CLOSE=Project not closed in time @@ -2217,4 +2217,5 @@ NoDeployedModulesFoundWithThisSearchCriteria=No modules found for these search c API_DISABLE_COMPRESSION=Disable compression of API responses EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first -PreviousHash=Previous hash \ No newline at end of file +PreviousHash=Previous hash +LateWarningAfter="Late" warning after \ No newline at end of file diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index 710d49bfab6..2ace1eb97e1 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -23,7 +23,7 @@ BoxLastMembersSubscriptions=Latest member subscriptions BoxFicheInter=Latest interventions BoxCurrentAccounts=Open accounts balance BoxTitleMemberNextBirthdays=Birthdays of this month (members) -BoxTitleMembersByType=Members by type +BoxTitleMembersByType=Members by type and status BoxTitleMembersSubscriptionsByYear=Members Subscriptions by year BoxTitleLastRssInfos=Latest %s news from %s BoxTitleLastProducts=Products/Services: last %s modified diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 147cd2fe8f9..b7d12216c6a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5886,6 +5886,7 @@ span#select2-taskid-container[title^='--'] { } span.select2.select2-container.select2-container--default { + text-align: initial; global->THEME_SHOW_BORDER_ON_INPUT)) { ?> border-left: none; border-top: none; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a207e128cc1..37864c1562c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6039,6 +6039,10 @@ span#select2-boxbookmark-container, span#select2-boxcombo-container { overflow: hidden; } +span.select2.select2-container.select2-container--default { + text-align: initial; +} + /* ============================================================================== */ /* For categories */ From 9349e2df7cffc0fb631651655f44f8c36a57bb89 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 21:11:45 +0100 Subject: [PATCH 036/226] FIX Accountancy - Order by accounting account on summary page --- htdocs/accountancy/customer/index.php | 1 + htdocs/accountancy/expensereport/index.php | 1 + htdocs/accountancy/supplier/index.php | 1 + 3 files changed, 3 insertions(+) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index a88524ec5d4..c233134f562 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -403,6 +403,7 @@ if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { } $sql .= " AND aa.account_number IS NOT NULL"; $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('htdocs/accountancy/customer/index.php'); $resql = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 0e3bda39521..2d9c8ac4f1c 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -188,6 +188,7 @@ $sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseRepo $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('/accountancy/expensereport/index.php:: sql='.$sql); $resql = $db->query($sql); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 585121f7c36..9ea8fd0a307 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -300,6 +300,7 @@ $sql .= " AND ffd.product_type <= 2"; $sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy $sql .= " AND aa.account_number IS NULL"; $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label"; +$sql .= ' ORDER BY aa.account_number'; dol_syslog('htdocs/accountancy/supplier/index.php'); $resql = $db->query($sql); From 15b7f37027c0591a18b5c223abe8173de8ee1524 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 14 Feb 2022 09:08:58 +0100 Subject: [PATCH 037/226] FIX missing default or current value --- htdocs/compta/bank/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 73edd31755d..62b97f6d100 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -358,7 +358,7 @@ if ($action == 'create') { // Type print '
'.$langs->trans("AccountType").''; - $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'alpha') : Account::TYPE_CURRENT, 'type'); + $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type'); print '
'; print '
'; - $type = GETPOST('type'); + $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''; @@ -857,7 +857,7 @@ if ($action == 'create') { // Type print ''; print ''; // Currency @@ -1002,7 +1002,8 @@ if ($action == 'create') { print '
'.$langs->trans("AccountType").''; - $formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'alpha') : $object->type), 'type'); + $formbank->selectTypeOfBankAccount((GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type), 'type'); print '
'; - if (GETPOST("type") == Account::TYPE_SAVINGS || GETPOST("type") == Account::TYPE_CURRENT) { + $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value + if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print '
'; //print '
'; From a3c1c707a438bdfac186f2317e514cdab9fe0e06 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 14 Feb 2022 12:09:57 +0100 Subject: [PATCH 038/226] Close #19930 : tag management in KM list --- htdocs/categories/class/categorie.class.php | 3 +- .../knowledgerecord_list.php | 63 ++++++++++++++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5ffed2e5e4b..c5da89a2c49 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -185,7 +185,8 @@ class Categorie extends CommonObject 'contact' => 'socpeople', 'account' => 'bank_account', // old for bank account 'project' => 'projet', - 'warehouse'=> 'entrepot' + 'warehouse'=> 'entrepot', + 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord' ); /** diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index aed45b1db26..88d7e46506d 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -34,6 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; // for other modules +if (!empty($conf->categorie->enabled)) { + dol_include_once('/categories/class/categorie.class.php'); +} //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page @@ -51,6 +54,13 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $id = GETPOST('id', 'int'); +$searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array'); +$searchCategoryKnowledgemanagementOperator = 0; +if (GETPOSTISSET('formfilteraction')) { + $searchCategoryKnowledgemanagementOperator = GETPOST('search_category_knowledgemanagement_operator', 'int'); +} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { + $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; +} // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -186,6 +196,10 @@ if (empty($reshook)) { || 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 } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $searchCategoryKnowledgemanagementOperator = 0; + $searchCategoryKnowledgemanagementList = array(); + } // Mass actions $objectclass = 'KnowledgeRecord'; @@ -229,9 +243,12 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= preg_replace('/^,/', ',', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $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'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && 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 (!empty($searchCategoryKnowledgemanagementList) || !empty($catid)) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_knowledgemanagement as ck ON t.rowid = ck.fk_knowledgemanagement"; // We'll need this table joined to the select in order to filter by categ +} // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -270,6 +287,32 @@ foreach ($search as $key => $val) { } } } +//Search for tag/category +$searchCategoryKnowledgemanagementSqlList = array(); +if ($searchCategoryKnowledgemanagementOperator == 1) { + foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) { + if (intval($searchCategoryKnowledgemanagement) == -2) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL"; + } elseif (intval($searchCategoryKnowledgemanagement) > 0) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie = ".$db->escape($searchCategoryKnowledgemanagement); + } + } + if (!empty($searchCategoryKnowledgemanagementSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")"; + } +} else { + foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) { + if (intval($searchCategoryKnowledgemanagement) == -2) { + $searchCategoryKnowledgemanagementSqlList[] = "ck.fk_categorie IS NULL"; + } elseif (intval($searchCategoryKnowledgemanagement) > 0) { + $searchCategoryKnowledgemanagementSqlList[] = "t.rowid IN (SELECT fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement WHERE fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")"; + } + } + if (!empty($searchCategoryKnowledgemanagementSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")"; + } +} + if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } @@ -379,6 +422,11 @@ $arrayofmassactions = array( if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } + +if ($user->rights->knowledgemanagement->knowledgerecord->write) { + $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); +} + if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } @@ -418,6 +466,18 @@ $moreforfilter = ''; $moreforfilter.= $langs->trans('MyFilter') . ': '; $moreforfilter.= '';*/ +// Filter on categories +$moreforfilter = ''; +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + $moreforfilter .= '
'; + $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"'); + $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 1); + $categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -'; + $moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300'); + $moreforfilter .= ' '; + $moreforfilter .= '
'; +} + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook if (empty($reshook)) { @@ -547,6 +607,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print '
'.$objp->tva_intra.''.dol_escape_htmltag($objp->tva_intra).''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 56f904e79ef..ee591df5413 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -631,7 +631,7 @@ if ($result) { print $product_static->getNomUrl(1); } if ($product_static->label) { - print '
'.$product_static->label.''; + print '
'.dol_escape_htmltag($product_static->label).''; } print '
'.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index b7d0a0423f3..ff52fd77bd6 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -521,7 +521,7 @@ if ($result) { } print ''.$objp->tva_intra.''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; From ff17fe5ae73ca79c641fe2988c919bb68e4e2744 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 13 Feb 2022 18:03:29 +0100 Subject: [PATCH 041/226] Fix reponsive --- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 92997b7a0e6..931b5e6420c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -516,7 +516,7 @@ if ($result) { } print ''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index ee591df5413..80b7bdf2217 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -665,7 +665,7 @@ if ($result) { print ''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ff52fd77bd6..9f769ae13b4 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -521,7 +521,7 @@ if ($result) { } print ''.dol_escape_htmltag($objp->tva_intra).''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 9faac9ee1c7..24d0ed08a0a 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -672,7 +672,7 @@ if ($result) { print ''.dol_escape_htmltag($objp->tva_intra).''.dol_escape_htmltag($objp->tva_intra).''; From 05bd37a9216688dc2d09830d00b006a83879a897 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Feb 2022 15:30:45 +0100 Subject: [PATCH 042/226] Fix menu "New" when using paranoiac MAIN_SECURITY_CSRF_WITH_TOKEN = 3 --- htdocs/barcode/printsheet.php | 10 +++++----- htdocs/main.inc.php | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 5128cd56164..8663d50e66a 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -374,24 +374,24 @@ jQuery(document).ready(function() { '; // Checkbox to select from free text -print ' '.$langs->trans("FillBarCodeTypeAndValueManually").'   '; +print ''; print '
'; if (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire)) { - print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'   '; + print ''; print '
'; print '
'; $form->select_produits(GETPOST('productid', 'int'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1); - print '   '; + print '   '; print '
'; } if (!empty($user->rights->societe->lire)) { - print ' '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'   '; + print ''; print '
'; print '
'; print $form->select_company(GETPOST('socid', 'int'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300'); - print '   '; + print '   '; print '
'; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d3d18a3e1c1..287185515e2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -475,7 +475,9 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( $sensitiveget = false; if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 3) { // All GET actions and mass actions are processed as sensitive. - $sensitiveget = true; + if (GETPOSTISSET('massaction') || !in_array(GETPOST('action', 'aZ09'), array('create', 'file_manager'))) { // We exclude the case action='create' and action='file_manager' that are legitimate + $sensitiveget = true; + } } elseif (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') >= 2) { // Few GET actions coded with a &token into url are processed as sensitive. $arrayofactiontoforcetokencheck = array( From 562c3cf9585bae4489730d9c753caad607c4c3bc Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 14 Feb 2022 14:15:38 +0100 Subject: [PATCH 043/226] FIX : There's no field "ref" in llx_facture_fourn_rec table --- htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql index b3065fdb5d6..b82e75d85d6 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_rec.key.sql @@ -16,7 +16,7 @@ -- ============================================================================ -ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (ref, entity); +ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref (titre, entity); ALTER TABLE llx_facture_fourn_rec ADD UNIQUE INDEX uk_facture_fourn_rec_ref_supplier (ref_supplier, fk_soc, entity); ALTER TABLE llx_facture_fourn_rec ADD INDEX idx_facture_fourn_rec_date_lim_reglement (date_lim_reglement); From 3305965c854cda61e9742e9b5ede6b7002c6d4d9 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 14 Feb 2022 15:04:12 +0100 Subject: [PATCH 044/226] FIX : Error with selectForForms function --- htdocs/core/class/html.form.class.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 09225f97158..b29093d7176 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7379,10 +7379,7 @@ class Form $objecttmp = null; - $InfoFieldList = explode(":", $objectdesc, 4); - $vartmp = $InfoFieldList[3]; - $InfoFieldList[4] = preg_replace('/^.*:(\w*)$/', '\1', $vartmp); // take the sort field - $InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field + $InfoFieldList = explode(":", $objectdesc); $classname = $InfoFieldList[0]; $classpath = $InfoFieldList[1]; From 3ebdb891339540d496498fb33a5d8c084df1d656 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 14 Feb 2022 15:11:26 +0100 Subject: [PATCH 045/226] fix pdf_mucadet --- .../doc/pdf_muscadet.modules.php | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 4a27b58f8ae..45df637fc51 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1151,26 +1151,28 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; - if ($this->emetteur->logo) - { - if (is_readable($logo)) - { - $height = pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { + if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir . '/logos/thumbs/' . $this->emetteur->logo_small; + } else { + $logo = $logodir . '/logos/' . $this->emetteur->logo; + } + if (is_readable($logo)) { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } else { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); + } + } else { + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } - else - { - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); - } - } - else - { - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); From 96c7a9f77c912d493df09d0dd4f52070e4240521 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 14 Feb 2022 15:16:36 +0100 Subject: [PATCH 046/226] fix pdf_cornas --- .../supplier_order/doc/pdf_cornas.modules.php | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 657160a9a1b..b63708dfa40 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1235,26 +1235,30 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; - if ($this->emetteur->logo) - { - if (is_readable($logo)) - { - $height = pdf_getHeightForLogo($logo); - $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { + if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) + { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } + if (is_readable($logo)) { + $height = pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } else { + $pdf->SetTextColor(200, 0, 0); + $pdf->SetFont('', 'B', $default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); + } + } else { + $text = $this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } - else - { - $pdf->SetTextColor(200, 0, 0); - $pdf->SetFont('', 'B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); - } - } - else - { - $text = $this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('', 'B', $default_font_size + 3); From b6879d795325848876a61c8c8975ba142b9af77a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2022 22:38:45 +0100 Subject: [PATCH 047/226] css --- htdocs/accountancy/index.php | 2 +- htdocs/accountancy/journal/bankjournal.php | 2 +- .../accountancy/journal/expensereportsjournal.php | 2 +- htdocs/accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/langs/en_US/accountancy.lang | 14 +++++++------- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 02c4d210496..925ab8c9ae3 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -171,7 +171,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S print $s; print "
\n"; } - if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several. + if (!empty($conf->expensereport->enabled)) { $step++; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}'); $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'', $s); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 49d379802fb..2530454d056 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1057,7 +1057,7 @@ if (empty($action) || $action == 'view') { } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 96ab150dd24..c80586fa3d0 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -521,7 +521,7 @@ if (empty($action) || $action == 'view') { print $desc; print '
'; } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 34ba4ae6337..8b1ac0d3de3 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -774,7 +774,7 @@ if (empty($action) || $action == 'view') { print $desc; print '
'; } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index ad1b7501a91..884c56ee6f2 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -716,7 +716,7 @@ if (empty($action) || $action == 'view') { print $desc; print '
'; } - print '
'; + print '
'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { print ''; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8bc4b54a090..893f448bbf8 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -62,24 +62,24 @@ MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscrip AccountancyArea=Accounting area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: AccountancyAreaDescActionOnce=The following actions are usually executed one time only, or once per year... -AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you the correct default accounting account when making the journalization (writing record in Journals and General ledger) +AccountancyAreaDescActionOnceBis=Next steps should be done to save you time in future by suggesting you automaticaly the correct default accounting account when transferring data in accounting AccountancyAreaDescActionFreq=The following actions are usually executed every month, week or day for very large companies... -AccountancyAreaDescJournalSetup=STEP %s: Create or check content of your journal list from menu %s +AccountancyAreaDescJournalSetup=STEP %s: Check content of your journal list from menu %s AccountancyAreaDescChartModel=STEP %s: Check that a model of chart of account exists or create one from menu %s AccountancyAreaDescChart=STEP %s: Select and|or complete your chart of account from menu %s AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. -AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of expense report. For this, use the menu entry %s. +AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of Expense report. For this, use the menu entry %s. AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this, use the menu entry %s. -AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expenses (miscellaneous taxes). For this, use the menu entry %s. +AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for Taxes (special expenses). For this, use the menu entry %s. AccountancyAreaDescDonation=STEP %s: Define default accounting accounts for donation. For this, use the menu entry %s. AccountancyAreaDescSubscription=STEP %s: Define default accounting accounts for member subscription. For this, use the menu entry %s. AccountancyAreaDescMisc=STEP %s: Define mandatory default account and default accounting accounts for miscellaneous transactions. For this, use the menu entry %s. AccountancyAreaDescLoan=STEP %s: Define default accounting accounts for loans. For this, use the menu entry %s. AccountancyAreaDescBank=STEP %s: Define accounting accounts and journal code for each bank and financial accounts. For this, use the menu entry %s. -AccountancyAreaDescProd=STEP %s: Define accounting accounts on your products/services. For this, use the menu entry %s. +AccountancyAreaDescProd=STEP %s: Define accounting accounts on your Products/Services. For this, use the menu entry %s. AccountancyAreaDescBind=STEP %s: Check the binding between existing %s lines and accounting account is done, so application will be able to journalize transactions in Ledger in one click. Complete missing bindings. For this, use the menu entry %s. AccountancyAreaDescWriteRecords=STEP %s: Write transactions into the Ledger. For this, go into menu %s, and click into button %s. @@ -112,7 +112,7 @@ MenuAccountancyClosure=Closure MenuAccountancyValidationMovements=Validate movements ProductsBinding=Products accounts TransferInAccounting=Transfer in accounting -RegistrationInAccounting=Registration in accounting +RegistrationInAccounting=Recording in accounting Binding=Binding to accounts CustomersVentilation=Customer invoice binding SuppliersVentilation=Vendor invoice binding @@ -120,7 +120,7 @@ ExpenseReportsVentilation=Expense report binding CreateMvts=Create new transaction UpdateMvts=Modification of a transaction ValidTransaction=Validate transaction -WriteBookKeeping=Register transactions in accounting +WriteBookKeeping=Record transactions in accounting Bookkeeping=Ledger BookkeepingSubAccount=Subledger AccountBalance=Account balance diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b7d12216c6a..7f4a12c888d 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -724,6 +724,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.centerimp { + text-align: center !important; +} .alignstart { text-align: start; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 37864c1562c..fa7676e8573 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -874,6 +874,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.centerimp { + text-align: center !important; +} .alignstart { text-align: start; } From 54bf8ed1edd1c66f0eba7f5a72ce92fa522ebb04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Feb 2022 22:53:24 +0100 Subject: [PATCH 048/226] Fix link --- htdocs/accountancy/expensereport/index.php | 20 +++++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 37abd56a21d..93419ce3cc4 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -199,7 +199,25 @@ for ($i = 1; $i <= 12; $i++) { if ($j > 12) { $j -= 12; } - print '
'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).''; + if (!empty($tmp['mday'])) { + $param = 'search_date_startday=1&search_date_startmonth='.$cursormonth.'&search_date_startyear='.$cursoryear; + $param .= '&search_date_endday='.$tmp['mday'].'&search_date_endmonth='.$tmp['mon'].'&search_date_endyear='.$tmp['year']; + $param .= '&search_month='.$tmp['mon'].'&search_year='.$tmp['year']; + print ''; + } + print $langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)); + if (!empty($tmp['mday'])) { + print ''; + } + print ''.$langs->trans("Total").'
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$sub_bom_line->efficiency.''.price($sub_bom_product->cost_price * $line->qty).''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).''.price($sub_bom_product->pmp * $line->qty).''.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).''.price($line_cost).'
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$sub_bom_line->efficiency.''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).''.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'
'; print ''; From 21ebedc755df6fe81534bbde73d6d7ef49911e6c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 20:10:09 +0100 Subject: [PATCH 084/226] Fix trans --- htdocs/langs/en_US/ticket.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 222efad8ba2..38b199f7260 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -136,8 +136,8 @@ TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. -TicketsAutoReadTicket=Automatically mark the ticket as read -TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. +TicketsAutoReadTicket=Automatically mark the ticket as read (when created from backoffice) +TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. When ticket is create from the public interface, ticket remains with the status "Not Read". # # Index & list page From 4fb651817ed2d8429f5c4b9711de253b4c6d40c9 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 17 Feb 2022 20:27:19 +0100 Subject: [PATCH 085/226] Update README http://pad.asp-software.org/padgen.php --- build/pad/README | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pad/README b/build/pad/README index 3cbc171686c..241d27d01c2 100644 --- a/build/pad/README +++ b/build/pad/README @@ -1,6 +1,7 @@ README (English) ################################################## Building PAD files +http://pad.asp-software.org/padgen.php ################################################## This directory contains files and docs used to build From 3ad95d55a5beb4718afa5d0471f31c64e773fa8d Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 17 Feb 2022 20:36:07 +0100 Subject: [PATCH 086/226] Update dolibarr.pl return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); $ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : --- build/perl/virtualmin/dolibarr.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 8b6a9888db0..b5bacf59356 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -30,7 +30,7 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "12.0.3", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); +return ( "14.0.5", "13.0.5", "12.0.5", "11.0.5", "10.0.7", "9.0.4", "8.0.6", "7.0.5" ); } sub script_dolibarr_release @@ -400,6 +400,8 @@ sub script_dolibarr_check_latest { local ($ver) = @_; local @vers = &osdn_package_versions("dolibarr", + $ver >= 14.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : + $ver >= 13.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 12.0 ? "dolibarr\\-(12\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 11.0 ? "dolibarr\\-(11\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 10.0 ? "dolibarr\\-(10\\.0\\.[0-9\\.]+)\\.tgz" : From b013c9a15f7d6e2266fc41d2c542b421e2830aba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 20:37:39 +0100 Subject: [PATCH 087/226] Fix duplicate div --- htdocs/core/lib/functions.lib.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9fed70a1fe1..7be3f5e3351 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2011,7 +2011,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if (empty($phototoshow)) { // Show No photo link (picto of object) - $morehtmlleft .= '
'; if ($object->element == 'action') { $width = 80; $cssclass = 'photorefcenter'; @@ -2029,8 +2028,6 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $morehtmlleft .= '
'; $morehtmlleft .= $nophoto; $morehtmlleft .= '
'; - - $morehtmlleft .= '
'; } } } From 9fd34b264fd20808ed136e11e2b96b8a5e9709e1 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 17 Feb 2022 21:05:23 +0100 Subject: [PATCH 088/226] Update README https://doxygen.dolibarr.org/ --- dev/examples/code/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/examples/code/README b/dev/examples/code/README index b7c31558de5..bf3dd3f4969 100644 --- a/dev/examples/code/README +++ b/dev/examples/code/README @@ -5,4 +5,4 @@ This directory contains samples of code to use Dolibarr business classes to buil external interfaces that need to read/update data from/into Dolibarr. You can also have a look at the Dolibarr doxygen doc that describes all files and classes: -http://www.dolibarr.org/html_doxygen/index.html +https://doxygen.dolibarr.org/ From b01fbba039311d15eeca3e961bf0d5bbfc724a7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 17 Feb 2022 23:41:31 +0100 Subject: [PATCH 089/226] Fix packages --- build/rpm/dolibarr_fedora.spec | 1 - build/rpm/dolibarr_generic.spec | 1 - build/rpm/dolibarr_mandriva.spec | 1 - build/rpm/dolibarr_opensuse.spec | 1 - 4 files changed, 4 deletions(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index dc23cff5486..27130244d00 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -166,7 +166,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index a446a7bd5d6..aeddd5526f8 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -247,7 +247,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 78d90080258..a1e4dffc781 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -163,7 +163,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index edae0126653..aed2d76ed29 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -174,7 +174,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/blockedlog %_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bom -%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/collab %_datadir/dolibarr/htdocs/comm From c32cc660a364617c2cac6412e270d70d80952530 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 18 Feb 2022 08:16:56 +0800 Subject: [PATCH 090/226] Update list.php --- htdocs/fourn/commande/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index eb13ead4fbd..72fc7a7439c 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1274,9 +1274,7 @@ if ($resql) { $projectstatic = new Project($db); $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val'] = array(); + $totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array()); $totalarray['val']['cf.total_ht'] = 0; $totalarray['val']['cf.total_ttc'] = 0; while ($i < min($num, $limit)) { From 7a457478d5fe213596bdd784d0c936a785abd82b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 18 Feb 2022 08:23:12 +0100 Subject: [PATCH 091/226] Fix : add missing formobjectoptions hook on 3 cards --- htdocs/compta/prelevement/card.php | 9 ++++++++- htdocs/loan/card.php | 5 +++++ htdocs/opensurvey/card.php | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d4311abe112..a076299b4cd 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -238,7 +238,14 @@ if ($id > 0 || $ref) { $modulepart = 'paymentbybanktransfer'; } print ''.$relativepath.''; - print '
'; + print ''; + + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + print ''; print ''; diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 88701e35166..4bc539c1ff0 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -618,6 +618,11 @@ if ($id > 0) { } print ''; + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print ''; diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 773571b7b1c..3f822679350 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -54,6 +54,9 @@ if ($result <= 0) { exit; } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('surveycard', 'globalcard')); + $expiredate = dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); @@ -338,6 +341,11 @@ if ($action != 'edit') { print ''; +// Other attributes +$parameters = array(); +$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''; print ''; From 3f109aa911e50c9f2f0257fc02131ed3d773863a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 18 Feb 2022 09:24:12 +0100 Subject: [PATCH 092/226] FIX Accountancy - On manual transaction with multicompany - Function transformTransaction can validate & delete transaction of an other entity --- .../accountancy/class/bookkeeping.class.php | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 43dcce8c646..5635df3c8e7 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -331,7 +331,7 @@ class BookKeeping extends CommonObject if (empty($this->piece_num)) { $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features + $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $resqlnum = $this->db->query($sqlnum); if ($resqlnum) { @@ -736,7 +736,7 @@ class BookKeeping extends CommonObject $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features if (null !== $ref) { $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; } else { @@ -881,7 +881,7 @@ class BookKeeping extends CommonObject } $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE 1 = 1'; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); } @@ -1037,7 +1037,7 @@ class BookKeeping extends CommonObject } } } - $sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')'; + $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if ($showAlreadyExportMovements == 0) { $sql .= " AND t.date_export IS NULL"; } @@ -1157,7 +1157,7 @@ class BookKeeping extends CommonObject } } } - $sql .= ' WHERE entity IN ('.getEntity('accountancy').')'; + $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features if (count($sqlwhere) > 0) { $sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere); } @@ -1454,7 +1454,7 @@ class BookKeeping extends CommonObject */ public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0) { - global $langs; + global $conf, $langs; if (empty($delyear) && empty($journal)) { $this->error = 'ErrorOneFieldRequired'; @@ -1475,7 +1475,7 @@ class BookKeeping extends CommonObject if (!empty($journal)) { $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; } - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features // Exclusion of validated entries at the time of deletion $sql .= " AND date_validated IS NULL"; @@ -1514,7 +1514,7 @@ class BookKeeping extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE piece_num = ".(int) $piecenum; $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $resql = $this->db->query($sql); @@ -1636,7 +1636,7 @@ class BookKeeping extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1674,9 +1674,9 @@ class BookKeeping extends CommonObject global $conf; $sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; - $sql .= " WHERE entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features - dol_syslog(get_class($this)."getNextNumMvt sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::getNextNumMvt sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -1717,7 +1717,7 @@ class BookKeeping extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; - $sql .= " AND entity IN (".getEntity('accountancy').")"; + $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sql); @@ -1780,7 +1780,7 @@ class BookKeeping extends CommonObject $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; $sql .= " date_validated as date_validation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); @@ -1836,6 +1836,8 @@ class BookKeeping extends CommonObject */ public function transformTransaction($direction = 0, $piece_num = '') { + global $conf; + $error = 0; $this->db->begin(); @@ -1855,14 +1857,14 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.", '".$this->db->idate($now)."'"; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = 'Error '.$this->db->lasterror(); dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1870,7 +1872,7 @@ class BookKeeping extends CommonObject dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } } elseif ($direction == 1) { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1885,14 +1887,14 @@ class BookKeeping extends CommonObject $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = 'Error '.$this->db->lasterror(); dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); } - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num); + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); $resql = $this->db->query($sql); if (!$resql) { $error++; @@ -1947,7 +1949,7 @@ class BookKeeping extends CommonObject $sql .= " AND aa.active = 1"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " AND asy.rowid = ".((int) $pcgver); - $sql .= " AND ab.entity IN (".getEntity('accountancy').")"; + $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features $sql .= " ORDER BY account_number ASC"; dol_syslog(get_class($this)."::select_account", LOG_DEBUG); @@ -2011,7 +2013,7 @@ class BookKeeping extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; - $sql .= " AND aa.entity IN (".getEntity('accountancy').")"; + $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); @@ -2051,7 +2053,7 @@ class BookKeeping extends CommonObject $sql .= " AND asy.rowid = ".((int) $pcgver); $sql .= " AND aa.active = 1"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; - $sql .= " WHERE aa.entity IN (".getEntity('accountancy').")"; + $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features dol_syslog(get_class($this)."::select_account sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); From 12c825ba84e4402b0ae329064db182423ed2cadc Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 18 Feb 2022 10:50:00 +0100 Subject: [PATCH 093/226] fix rounding for price and display currency --- htdocs/core/class/extrafields.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f8e5726d344..c0dc9c6a96f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1679,7 +1679,8 @@ class ExtraFields } elseif ($type == 'price') { //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') { - $value = price($value, 0, $langs, 0, 0, -1); + $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency); + } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); From b5afa2777422e3ee8b207b79f9592925f9d89ce4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 18 Feb 2022 10:09:38 +0000 Subject: [PATCH 094/226] Fixing style errors. --- htdocs/core/class/extrafields.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index c0dc9c6a96f..7a449f3e7ea 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1680,7 +1680,6 @@ class ExtraFields //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') { $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency); - } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); From aec2579c41b23213ed427fb99188fb695e771df3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 12:22:53 +0100 Subject: [PATCH 095/226] Clean code --- htdocs/projet/admin/website.php | 27 ------------- htdocs/recruitment/admin/public_interface.php | 38 ------------------- 2 files changed, 65 deletions(-) diff --git a/htdocs/projet/admin/website.php b/htdocs/projet/admin/website.php index 1af6b72c196..25497fef436 100644 --- a/htdocs/projet/admin/website.php +++ b/htdocs/projet/admin/website.php @@ -111,33 +111,6 @@ if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) { print $enabledisablehtml; print ''; -/* -print '
'; - -if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) { - print '
'; - - print ''; - - print ''; - print ''; - print ''; - print "\n"; - - // param - print '\n"; - - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; - print $langs->trans("CanEditAmount"); - print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); - print "
'; - - print '
'; - print ''; - print '
'; -} -*/ print dol_get_fiche_end(); diff --git a/htdocs/recruitment/admin/public_interface.php b/htdocs/recruitment/admin/public_interface.php index 3d431d026bc..b091cdea7a0 100644 --- a/htdocs/recruitment/admin/public_interface.php +++ b/htdocs/recruitment/admin/public_interface.php @@ -126,44 +126,6 @@ if (!empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) { print ''.$langs->trans("Value").''; print "\n"; - // Force Type - $adht = new AdherentType($db); - print ''; - print $langs->trans("ForceMemberType"); - print ''; - $listofval = array(); - $listofval += $adht->liste_array(); - $forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; - print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0); - print "\n"; - - // Amount - print ''; - print $langs->trans("DefaultAmount"); - print ''; - print ''; - print "\n"; - - // Can edit - print ''; - print $langs->trans("CanEditAmount"); - print ''; - print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1); - print "\n"; - - // Jump to an online payment page - print ''; - print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); - print ''; - $listofval = array(); - $listofval['-1'] = $langs->trans('No'); - $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')'; - if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox'; - if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal'; - if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe'; - print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0); - print "\n"; - print ''; print '
'; From 3ab2308124757a12ef70f459e7d723708baefc86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 12:36:05 +0100 Subject: [PATCH 096/226] Clean code --- htdocs/public/eventorganization/attendee_new.php | 10 ---------- htdocs/public/members/new.php | 1 + htdocs/public/payment/newpayment.php | 8 ++++---- htdocs/public/payment/paymentok.php | 13 ++++++++++++- htdocs/public/project/suggestbooth.php | 10 ---------- htdocs/public/project/suggestconference.php | 10 ---------- 6 files changed, 17 insertions(+), 35 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index b350ece39f4..55303bcb00e 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -19,16 +19,6 @@ * \file htdocs/public/eventorganization/attendee_new.php * \ingroup project * \brief Example of form to subscribe to an event - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6589f2a17d0..055ffec56f9 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -30,6 +30,7 @@ * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited + * MEMBER_MIN_AMOUNT Minimum amount * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 5158e294fb2..d25e14288f8 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -481,7 +481,7 @@ if ($action == 'dopayment') { // Called when choosing Stripe mode. -// When using the Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. +// When using the old Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. // When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge. if ($action == 'charge' && !empty($conf->stripe->enabled)) { $amountstripe = $amount; @@ -728,7 +728,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { } } - // When using the PaymentIntent API architecture + // When using the PaymentIntent API architecture (mode set on by default into conf.class.php) if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { $service = 'StripeTest'; $servicestatus = 0; @@ -793,8 +793,8 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { $remoteip = getUserRemoteIP(); $_SESSION["onlinetoken"] = $stripeToken; - $_SESSION["FinalPaymentAmt"] = $amount; - $_SESSION["currencyCodeType"] = $currency; + $_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php. + $_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php. $_SESSION["paymentType"] = ''; $_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip $_SESSION['payerID'] = is_object($customer) ? $customer->id : ''; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index c822bfcdf96..ea86f28a894 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -417,7 +417,7 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { // Security protection: - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount (if free amount is allowed, no need to check) if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected. $typeid = $object->typeid; @@ -440,6 +440,17 @@ if ($ispaymentok) { } } + // Security protection: + if (!empty($conf->global->MEMBER_MIN_AMOUNT)) { + if ($FinalPaymentAmt < $conf->global->MEMBER_MIN_AMOUNT) { + $error++; + $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.$conf->global->MEMBER_MIN_AMOUNT.'). May be a hack to try to pay a different amount ?'; + $postactionmessages[] = $errmsg; + $ispostactionok = -1; + dol_syslog("Failed to validate member (amount lower than minimum): ".$errmsg, LOG_ERR, 0, '_payment'); + } + } + // Security protection: if ($currencyCodeType && $currencyCodeType != $conf->currency) { // Check that currency is the good one $error++; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index c0bcdc751c6..39c2a57700e 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -19,16 +19,6 @@ * \file htdocs/public/project/suggestbooth.php * \ingroup member * \brief Example of form to suggest a booth - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index f2a919c0aa2..b97777c3a9a 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -19,16 +19,6 @@ * \file htdocs/public/project/suggestconference.php * \ingroup member * \brief Example of form to suggest a conference - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { From 8a0ee772d3d722f446f9fa253805934426b638c3 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 18 Feb 2022 13:10:38 +0100 Subject: [PATCH 097/226] add GitHub INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); --- htdocs/install/mysql/data/llx_c_socialnetworks.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_socialnetworks.sql b/htdocs/install/mysql/data/llx_c_socialnetworks.sql index 5bfbcf090d9..468086291fc 100644 --- a/htdocs/install/mysql/data/llx_c_socialnetworks.sql +++ b/htdocs/install/mysql/data/llx_c_socialnetworks.sql @@ -36,6 +36,7 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'flickr', 'Flickr', '{socialid}', 'fa-flickr', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'gifycat', 'Gificat', '{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'giphy', 'Giphy', '{socialid}', '', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1); From dee5d8f9e865a051617c23162b75bd6174fad059 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 13:45:28 +0100 Subject: [PATCH 098/226] Standardize name of button --- .../core/modules/barcode/mod_barcode_product_standard.php | 2 +- htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php | 2 +- .../modules/commande/doc/doc_generic_order_odt.modules.php | 2 +- .../expedition/doc/doc_generic_shipment_odt.modules.php | 2 +- .../modules/facture/doc/doc_generic_invoice_odt.modules.php | 2 +- .../modules/member/doc/doc_generic_member_odt.class.php | 2 +- htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php | 2 +- .../modules/product/doc/doc_generic_product_odt.modules.php | 2 +- htdocs/core/modules/product/mod_codeproduct_elephant.php | 2 +- .../modules/project/doc/doc_generic_project_odt.modules.php | 2 +- .../project/task/doc/doc_generic_task_odt.modules.php | 2 +- .../propale/doc/doc_generic_proposal_odt.modules.php | 2 +- .../reception/doc/doc_generic_reception_odt.modules.php | 2 +- htdocs/core/modules/societe/doc/doc_generic_odt.modules.php | 2 +- htdocs/core/modules/societe/mod_codeclient_elephant.php | 2 +- htdocs/core/modules/societe/mod_codecompta_aquarium.php | 2 +- htdocs/core/modules/societe/mod_codecompta_digitaria.php | 2 +- .../modules/stock/doc/doc_generic_stock_odt.modules.php | 2 +- .../doc/doc_generic_supplier_order_odt.modules.php | 2 +- .../doc/doc_generic_supplier_proposal_odt.modules.php | 2 +- .../modules/ticket/doc/doc_generic_ticket_odt.modules.php | 2 +- .../core/modules/user/doc/doc_generic_user_odt.modules.php | 2 +- .../usergroup/doc/doc_generic_usergroup_odt.modules.php | 2 +- .../mymodule/doc/doc_generic_myobject_odt.modules.php | 2 +- .../doc/doc_generic_recruitmentjobposition_odt.modules.php | 2 +- htdocs/societe/admin/societe.php | 6 +++--- 26 files changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index a0197f18cd3..c101001af4c 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -109,7 +109,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode //$texte.= ''.$langs->trans("Mask").' ('.$langs->trans("BarCodeModel").'):'; $texte .= ''.$langs->trans("Mask").':'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 463cbc46a24..761aae99142 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -152,7 +152,7 @@ class doc_generic_bom_odt extends ModelePDFBom $texte .= $conf->global->BOM_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index b98d403d8f7..c59d1c40ee9 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $texte .= $conf->global->COMMANDE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 2dd33bab141..a916bcc534f 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $texte .= $conf->global->EXPEDITION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index b8bfcdc16ac..9c0088bd398 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texte .= $conf->global->FACTURE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 4f1c20a464e..91d2248fb48 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -155,7 +155,7 @@ class doc_generic_member_odt extends ModelePDFMember $texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 07f5d5d1890..1df69d7ae53 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_mo_odt extends ModelePDFMo $texte .= $conf->global->MRP_MO_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 7fff122ec57..c1f6769579a 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -157,7 +157,7 @@ class doc_generic_product_odt extends ModelePDFProduct $texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 40b1f324cdd..ff724ab209d 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -119,7 +119,7 @@ class mod_codeproduct_elephant extends ModeleProductCode $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index bad6a369ba6..d653ed760a6 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -450,7 +450,7 @@ class doc_generic_project_odt extends ModelePDFProjects $texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 1fd0f9c23ee..7849e46edbe 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -417,7 +417,7 @@ class doc_generic_task_odt extends ModelePDFTask $texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e636645f6c8..e2e3ffd2a21 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -161,7 +161,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 7fde8e26c82..f8fd829591d 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -153,7 +153,7 @@ class doc_generic_reception_odt extends ModelePdfReception $texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index aaa9c03c6e7..3a62eb22937 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -143,7 +143,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte .= ''; $texte .= ''; $texte .= '  '; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 6079120a305..0142457cd40 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -135,7 +135,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):'; $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; - $texte .= '  '; + $texte .= '  '; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index ff5d737872a..4d1d01db682 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -103,7 +103,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $texte .= $langs->trans('COMPANY_AQUARIUM_CLEAN_REGEX').' = '.$conf->global->COMPANY_AQUARIUM_CLEAN_REGEX."
\n"; } $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index 217e027d152..dddd01a602d 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -126,7 +126,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $texte .= $langs->trans('COMPANY_DIGITARIA_UNIQUE_CODE').' = '.yn(1)."
\n"; } $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index c3e26e591c7..1fb120d4d29 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -156,7 +156,7 @@ class doc_generic_stock_odt extends ModelePDFStock $texte .= $conf->global->STOCK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 436622d6451..68caf286682 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $texte .= $conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 04f6ed49012..c79ee188213 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 86b9d44ad9b..d69da78aacc 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -151,7 +151,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $texte .= $conf->global->TICKET_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 656eb88ecaa..353d35fc182 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $conf->global->USER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index e1c83023df9..7ba82f5825e 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 8040c13d606..689503f0dee 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texte .= $conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index e818a0816a9..e2b7c545aa9 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -158,7 +158,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi $texte .= $conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 193dfc43cad..236551c1c2e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -780,7 +780,7 @@ if (!$conf->use_javascript_ajax) { ); print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'COMPANY_USE_SEARCH_TO_SELECT')?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; - print ''; + print ''; print ""; } print ''; @@ -801,7 +801,7 @@ if (!$conf->use_javascript_ajax) { ); print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'CONTACT_USE_SEARCH_TO_SELECT')?$conf->global->CONTACT_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); print ''; - print ''; + print ''; print ""; } print ''; @@ -905,7 +905,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print $formcompany->selectProspectCustomerType((property_exists($conf->global, 'THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')?$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT:''), 'defaultcustomertype', 'defaultcustomertype', 'admin'); print ''; print ''; - print ''; + print ''; print ''; print ''; } From 694ea8830bb6744e0f1be81c870a8d2d5b29e28d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 13:46:12 +0100 Subject: [PATCH 099/226] Fix missing name and type into template --- htdocs/adherents/admin/member.php | 86 ++++++++++--------- .../modules/member/doc/pdf_standard.class.php | 26 ++++++ 2 files changed, 73 insertions(+), 39 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 39587521c4d..2b6a0838fe1 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -196,6 +196,9 @@ print '
'; print ''; print ''; + +// Mains options + print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); print '
'; @@ -286,51 +289,15 @@ print '
'; print '
'; -print '
'; - - -/* - * Edit info of model document - */ -$constantes = array( - 'ADHERENT_CARD_TYPE', - //'ADHERENT_CARD_BACKGROUND', - 'ADHERENT_CARD_HEADER_TEXT', - 'ADHERENT_CARD_TEXT', - 'ADHERENT_CARD_TEXT_RIGHT', - 'ADHERENT_CARD_FOOTER_TEXT' -); - -print load_fiche_titre($langs->trans("MembersCards"), '', ''); - -$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; -$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; -$helptext .= '__YEAR__, __MONTH__, __DAY__'; - -form_constantes($constantes, 0, $helptext); print '
'; -/* - * Edit info of model document - */ -$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT'); - -print load_fiche_titre($langs->trans("MembersTickets"), '', ''); - -$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; -$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; -$helptext .= '__YEAR__, __MONTH__, __DAY__'; - -form_constantes($constantes, 0, $helptext); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); // Defined model definition table $def = array(); -$sql = "SELECT nom"; +$sql = "SELECT nom as name"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = '".$db->escape($type)."'"; $sql .= " AND entity = ".$conf->entity; @@ -339,14 +306,15 @@ if ($resql) { $i = 0; $num_rows = $db->num_rows($resql); while ($i < $num_rows) { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); + $obj = $db->fetch_object($resql); + array_push($def, $obj->name); $i++; } } else { dol_print_error($db); } + print load_fiche_titre($langs->trans("MembersDocModules"), '', ''); print '
'; @@ -460,6 +428,46 @@ foreach ($dirmodels as $reldir) { print ''; print '
'; + +/* + * Edit info of model document + */ +$constantes = array( + 'ADHERENT_CARD_TYPE', + //'ADHERENT_CARD_BACKGROUND', + 'ADHERENT_CARD_HEADER_TEXT', + 'ADHERENT_CARD_TEXT', + 'ADHERENT_CARD_TEXT_RIGHT', + 'ADHERENT_CARD_FOOTER_TEXT' +); + +print load_fiche_titre($langs->trans("MembersCards"), '', ''); + +$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; +$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; +$helptext .= '__YEAR__, __MONTH__, __DAY__'; + +form_constantes($constantes, 0, $helptext); + +print '
'; + + +/* + * Edit info of model document + */ +$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT'); + +print load_fiche_titre($langs->trans("MembersTickets"), '', ''); + +$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, '; +$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, '; +$helptext .= '__YEAR__, __MONTH__, __DAY__'; + +form_constantes($constantes, 0, $helptext); + + print "
"; print dol_get_fiche_end(); diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 15f3260c4d2..d39afdd9420 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -33,6 +33,32 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php'; */ class pdf_standard extends CommonStickerGenerator { + /** + * Dolibarr version of the loaded document + * @var string + */ + public $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf, $langs, $mysoc; + + // Translations + $langs->loadLangs(array("main", "bills")); + + $this->db = $db; + $this->name = "standard"; + $this->description = $langs->trans('PDFStandard'); + //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + + $this->type = 'html'; + } /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) From 61e91656e0073a31296c2961692d9cae06d09f76 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 14:14:34 +0100 Subject: [PATCH 100/226] FIX setup of member module FIX generation of business cards --- htdocs/adherents/admin/member.php | 9 +++++++++ htdocs/core/class/commonobject.class.php | 3 +-- htdocs/core/lib/admin.lib.php | 5 +++-- htdocs/core/modules/member/doc/pdf_standard.class.php | 6 +++--- htdocs/langs/en_US/admin.lang | 3 ++- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 2b6a0838fe1..d51dd8ef730 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -429,6 +429,14 @@ print ''; print ''; + +/* +TODO Use a global form instead of embeded form into table +print '
'; +print ''; +print ''; +*/ + /* * Edit info of model document */ @@ -467,6 +475,7 @@ $helptext .= '__YEAR__, __MONTH__, __DAY__'; form_constantes($constantes, 0, $helptext); +//print '
'; print "
"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8ab59689976..8dabc902e5c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5292,8 +5292,7 @@ abstract class CommonObject $sav_charset_output = $outputlangs->charset_output; if (in_array(get_class($this), array('Adherent'))) { - $arrayofrecords = array(); // The write_file of templates of adherent class need this var - $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); + $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards', $moreparams); } else { $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 448677002df..a068f5fb5f5 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1627,6 +1627,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu if (empty($strictw3c)) { print "\n".'
'; print ''; + print ''; } print ''; @@ -1733,7 +1734,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu // Submit if (empty($strictw3c)) { print ''; - print ''; + print ''; print ""; } @@ -1748,7 +1749,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu print ''; if (!empty($strictw3c) && $strictw3c == 1) { - print '
'; + print '
'; print "
\n"; } } diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index d39afdd9420..0fc13cbe134 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -50,14 +50,14 @@ class pdf_standard extends CommonStickerGenerator global $conf, $langs, $mysoc; // Translations - $langs->loadLangs(array("main", "bills")); + $langs->loadLangs(array("main", "admin")); $this->db = $db; $this->name = "standard"; - $this->description = $langs->trans('PDFStandard'); + $this->description = $langs->trans('TemplateforBusinessCards'); //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template - $this->type = 'html'; + $this->type = 'pdf-various-sizes'; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3506f024eea..5af3fe19592 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2218,4 +2218,5 @@ API_DISABLE_COMPRESSION=Disable compression of API responses EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first PreviousHash=Previous hash -LateWarningAfter="Late" warning after \ No newline at end of file +LateWarningAfter="Late" warning after +TemplateforBusinessCards=Template for a business card in different size \ No newline at end of file From 30cde100ffd55c0f513434cb06f79c515cd18a0b Mon Sep 17 00:00:00 2001 From: Atm-Gregr Date: Fri, 18 Feb 2022 14:41:29 +0100 Subject: [PATCH 101/226] trad us --- htdocs/langs/en_US/hrm.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index c571ec6ca8a..ab3628026c5 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -79,3 +79,6 @@ NoEval=No evaluation done for this employee HowManyUserWithThisMaxNote=Number of users with this rank HighestRank=Highest rank SkillComparison=Skill comparison +ActionsOnJob=Events on this job +VacantPosition=job vacancy +VacantCheckboxHelper=Checking this option will show unfilled positions (job vacancy) From e41e0f069a5d2be4041e7df58a769c2d47b3e14f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 15:09:52 +0100 Subject: [PATCH 102/226] Fix creator in PDF. Add log to help to find strange bug --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 9 +++++++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 8 ++++++-- htdocs/langs/en_US/members.lang | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index b9ceb3e346b..0760b85c65c 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -366,7 +366,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); @@ -374,10 +374,14 @@ class pdf_crabe extends ModelePDFFactures // Set certificate $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; } + if (!$certprivate) { + $certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + } // If a certificate is found if ($cert) { $info = array( @@ -386,7 +390,7 @@ class pdf_crabe extends ModelePDFFactures 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); - $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); + $pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info); } $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -814,6 +818,7 @@ class pdf_crabe extends ModelePDFFactures $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } + dol_syslog("bottomlasttab=".$bottomlasttab." this->page_hauteur=".$this->page_hauteur." heightforinfotot=".$heightforinfotot." heightforfreetext=".$heightforfreetext." heightforfooter=".$heightforfooter); // Display info area $posy = $this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs, $outputlangsbis); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index c1666545891..910790db51f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -367,7 +367,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("PdfInvoiceTitle")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetAuthor($mysoc->name.($user->id > 0 ? ' - '.$outputlangs->convToOutputCharset($user->getFullName($outputlangs)) : '')); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfInvoiceTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) { $pdf->SetCompression(false); @@ -375,10 +375,14 @@ class pdf_sponge extends ModelePDFFactures // Set certificate $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $certprivate = empty($user->conf->CERTIFICATE_CRT_PRIVATE) ? '' : $user->conf->CERTIFICATE_CRT_PRIVATE; // If user has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; } + if (!$certprivate) { + $certprivate = empty($conf->global->CERTIFICATE_CRT_PRIVATE) ? '' : $conf->global->CERTIFICATE_CRT_PRIVATE; + } // If a certificate is found if ($cert) { $info = array( @@ -387,7 +391,7 @@ class pdf_sponge extends ModelePDFFactures 'Reason' => 'INVOICE', 'ContactInfo' => $this->emetteur->email ); - $pdf->setSignature($cert, $cert, $this->emetteur->name, '', 2, $info); + $pdf->setSignature($cert, $certprivate, $this->emetteur->name, '', 2, $info); } $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 9605e7a8df7..8646c40b98f 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -159,7 +159,7 @@ HTPasswordExport=htpassword file generation NoThirdPartyAssociatedToMember=No third party associated with this member MembersAndSubscriptions=Members and Contributions MoreActions=Complementary action on recording -MoreActionsOnSubscription=Complementary action, suggested by default when recording a contribution +MoreActionsOnSubscription=Complementary action suggested by default when recording a contribution, also done automatially on online payment of a contribution MoreActionBankDirect=Create a direct entry on bank account MoreActionBankViaInvoice=Create an invoice, and a payment on bank account MoreActionInvoiceOnly=Create an invoice with no payment From 87a5defbd32d655aa211a7b053d0cade849192ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 15:11:54 +0100 Subject: [PATCH 103/226] Comment --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a0793e914e9..8a5f8166106 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2329,7 +2329,7 @@ class Societe extends CommonObject /** * Return array of sales representatives * - * @param User $user Object user + * @param User $user Object user (not used) * @param int $mode 0=Array with properties, 1=Array of id. * @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb' * @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC'; From f4f03d03f22c28b258efe855014006353ec2b1ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 15:23:13 +0100 Subject: [PATCH 104/226] Fix link --- htdocs/core/boxes/box_members_last_subscriptions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_last_subscriptions.php b/htdocs/core/boxes/box_members_last_subscriptions.php index 930b4d3a874..39ae0140ca4 100644 --- a/htdocs/core/boxes/box_members_last_subscriptions.php +++ b/htdocs/core/boxes/box_members_last_subscriptions.php @@ -142,7 +142,7 @@ class box_members_last_subscriptions extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', - 'text' => $staticmember->getNomUrl(-1, 32, 'subscription'), + 'text' => $staticmember->getNomUrl(-1, 32, 'card'), 'asis' => 1, ); From cd9c1acafece00cdc1098c310a3395fcfaf6a01e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 16:09:23 +0100 Subject: [PATCH 105/226] Fix missing token --- htdocs/main.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 287185515e2..3f8da14338b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3213,6 +3213,7 @@ if (!function_exists("llxFooter")) { id:id; ?> , element:'element ?>' , action:'DOC_PREVIEW' + , token: '' } ); }); @@ -3222,6 +3223,7 @@ if (!function_exists("llxFooter")) { id:id; ?> , element:'element ?>' , action:'DOC_DOWNLOAD' + , token: '' } ); }); From 3d9cdbf13693e683bc847d9aec7666e00dec41d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 16:24:11 +0100 Subject: [PATCH 106/226] FIX Debug v15 --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 4 ++-- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 4 ++-- htdocs/public/payment/paymentok.php | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1d12ad16194..1faa9271623 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1805,6 +1805,7 @@ class Adherent extends CommonObject $paiement = new Paiement($this->db); $paiement->datepaye = $paymentdate; $paiement->amounts = $amounts; + $paiement->paiementcode = $operation; $paiement->paiementid = dol_getIdFromCode($this->db, $operation, 'c_paiement', 'code', 'id', 1); $paiement->num_payment = $num_chq; $paiement->note_public = $label; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 2a8522ab05b..ab68ac7f9b1 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -613,7 +613,7 @@ class Paiement extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datepaye, - $this->paiementid, // Payment mode id or code ("CHQ or VIR for example") + $this->paiementcode ? $this->paiementcode : $this->paiementid, // Payment mode code ('CB', 'CHQ' or 'VIR' for example). Use payment id if not defined for backward compatibility. $label, $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note) $this->num_payment, diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7be3f5e3351..7668489c8ea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -10373,6 +10373,7 @@ function newToken() /** * Return the value of token currently saved into session with name 'token'. + * For ajax call, you must use this token as a parameter of the call into the js calling script (the called ajax php page must also set constant NOTOKENRENEWAL). * * @return string */ diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 0760b85c65c..63a68f7b802 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1181,9 +1181,9 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); - } - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; + } } // Show payment mode CHQ diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 910790db51f..7f3b543ebba 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1259,9 +1259,9 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($this->marge_gauche, $posy); $pdf->writeHTMLCell(80, 5, '', '', dol_htmlentitiesbr($linktopay), 0, 1); - } - $posy = $pdf->GetY() + 1; + $posy = $pdf->GetY() + 1; + } } // Show payment mode CHQ diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ea86f28a894..499ff2c4e31 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -412,7 +412,7 @@ if ($ispaymentok) { $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); + dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." paymentType=".$paymentType." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { From 1107a60b58eb690902ebd14b4f52597ae051c077 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Fri, 18 Feb 2022 16:53:55 +0100 Subject: [PATCH 107/226] FIX compute rule in FEC import --- .../class/accountancyimport.class.php | 6 ++--- .../modules/import/import_csv.modules.php | 23 +++++++++++++++++++ .../modules/import/import_xlsx.modules.php | 23 +++++++++++++++++++ htdocs/imports/import.php | 7 +++--- 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php index ece843515e2..ea88534b6ed 100644 --- a/htdocs/accountancy/class/accountancyimport.class.php +++ b/htdocs/accountancy/class/accountancyimport.class.php @@ -55,8 +55,8 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = trim($arrayrecord[11]['val']); - $credit = trim($arrayrecord[12]['val']); + $debit = floatval(trim($arrayrecord[11]['val'])); + $credit = floatval(trim($arrayrecord[12]['val'])); if (!empty($debit)) { $amount = $debit; } else { @@ -86,7 +86,7 @@ class AccountancyImport $fieldname = $fieldArr[1]; } - $debit = trim($arrayrecord[11]['val']); + $debit = floatval(trim($arrayrecord[11]['val'])); if (!empty($debit)) { $sens = 'D'; } else { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 35f0e4bc2f9..78c8f5e104f 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -736,6 +736,29 @@ class ImportCsv extends ModeleImports $tmp = explode('-', $val, 2); $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = "'".$tmp[1]."'"; + } elseif (preg_match('/^rule-/', $val)) { + $fieldname = $key; + if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { + if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { + $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); + $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; + $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); + break; + } + $classinstance = new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); + if ($res < 0) { + if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } } else { $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index ed14ae31ebb..38c9cd8c56a 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -777,6 +777,29 @@ class ImportXlsx extends ModeleImports $tmp = explode('-', $val, 2); $listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key); $listvalues[] = "'" . $tmp[1] . "'"; + } elseif (preg_match('/^rule-/', $val)) { + $fieldname = $key; + if (!empty($objimport->array_import_convertvalue[0][$fieldname])) { + if ($objimport->array_import_convertvalue[0][$fieldname]['rule'] == 'compute') { + $file = (empty($objimport->array_import_convertvalue[0][$fieldname]['classfile']) ? $objimport->array_import_convertvalue[0][$fieldname]['file'] : $objimport->array_import_convertvalue[0][$fieldname]['classfile']); + $class = $objimport->array_import_convertvalue[0][$fieldname]['class']; + $method = $objimport->array_import_convertvalue[0][$fieldname]['method']; + $resultload = dol_include_once($file); + if (empty($resultload)) { + dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method); + break; + } + $classinstance = new $class($this->db); + $res = call_user_func_array(array($classinstance, $method), array(&$arrayrecord, $fieldname, &$listfields, &$listvalues)); + if ($res < 0) { + if (!empty($objimport->array_import_convertvalue[0][$fieldname]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, end($listvalues), 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$fieldname]['dict'])); + else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; + $this->errors[$error]['type'] = 'FOREIGNKEY'; + $errorforthistable++; + $error++; + } + } + } } else { $this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index ff9b839d1d5..c477df5eb77 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -141,6 +141,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : ''); $updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array()); $separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ',')); $enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); +$separator_used = str_replace('\t', "\t", $separator); $objimport = new Import($db); $objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport)); @@ -773,7 +774,7 @@ if ($step == 4 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } if ($model == 'xlsx') { @@ -1334,7 +1335,7 @@ if ($step == 5 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } @@ -1783,7 +1784,7 @@ if ($step == 6 && $datatoimport) { require_once $dir.$file; $obj = new $classname($db, $datatoimport); if ($model == 'csv') { - $obj->separator = $separator; + $obj->separator = $separator_used; $obj->enclosure = $enclosure; } From 0517e2e2d33699d3fd2088dd0d51429f8f75108f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 18:35:21 +0100 Subject: [PATCH 108/226] Fix error --- htdocs/compta/paiement/class/paiement.class.php | 2 +- htdocs/hrm/class/skill.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index a59998f0165..84d1b007e09 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1151,7 +1151,7 @@ class Paiement extends CommonObject */ public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0, $morecss = '') { - global $conf, $langs; + global $conf, $langs, $hookmanager; if (!empty($conf->dol_no_mouse_hover)) { $notooltip = 1; // Force disable tooltips diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 448538c39a8..724c14b93c0 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -853,7 +853,7 @@ class Skill extends CommonObject //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); global $action, $hookmanager; - $hookmanager->initHooks(array('jobdao')); + $hookmanager->initHooks(array('skilldao')); $parameters = array('id'=>$this->id, 'getnomurl' => &$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) { From 5eb4d3408c3c4fd3303002efe6a71e8032ddbc94 Mon Sep 17 00:00:00 2001 From: Romain DESCHAMPS Date: Fri, 18 Feb 2022 19:31:42 +0100 Subject: [PATCH 109/226] Update param_ihm.php --- htdocs/user/param_ihm.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 72f9b075be9..0d2729d904f 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -207,6 +207,9 @@ if (!empty($conf->adherent->enabled)) { if (!empty($conf->agenda->enabled)) { $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda'; } +if (!empty($conf->ticket->enabled)) { + $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = 'Tickets'; +} $head = user_prepare_head($object); From 05f0f1733d275a393d5aa5192eb8ec53f7485d09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 18 Feb 2022 21:52:33 +0100 Subject: [PATCH 110/226] Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 15.0 --- htdocs/hrm/class/position.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index d9df0624b0b..ada58998238 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -853,6 +853,7 @@ class Position extends CommonObject * @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @param int $nonewbutton Do not show new button * @return string */ public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) From 6b8793e1711269310bf1f044a7d904b4baf548cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Feb 2022 00:41:45 +0100 Subject: [PATCH 111/226] Fix sql error on web service --- htdocs/webservices/server_supplier_invoice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 926fa8f6418..1581d569f27 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -350,8 +350,8 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) if (!$error) { $linesinvoice = array(); - $sql .= "SELECT f.rowid as facid"; - $sql .= " FROM '.MAIN_DB_PREFIX.'facture_fourn as f"; + $sql = "SELECT f.rowid as facid"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.entity = ".((int) $conf->entity); if ($idthirdparty != 'all') { $sql .= " AND f.fk_soc = ".((int) $idthirdparty); From 996dcdde8262544692b8eb25e04869417f6c0332 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 19 Feb 2022 18:34:53 +0100 Subject: [PATCH 112/226] FIX error with php8 --- htdocs/admin/system/filecheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 1f183e1b730..0d5a5673db1 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -416,7 +416,7 @@ if (empty($error) && !empty($xml)) { $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")); if ($checksumget == $checksumtoget) { - if (count($file_list['added'])) { + if (is_countable($file_list['added'])) { $resultcode = 'warning'; $resultcomment = 'FileIntegrityIsOkButFilesWereAdded'; $outcurrentchecksum = $checksumget.' - '.$langs->trans($resultcomment).''; From b8d82671b3df6d603f75c3553920629e3921eab9 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 20 Feb 2022 10:39:59 +0100 Subject: [PATCH 113/226] Update filecheck.php --- htdocs/admin/system/filecheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 0d5a5673db1..10edae1a24b 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -416,7 +416,7 @@ if (empty($error) && !empty($xml)) { $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")); if ($checksumget == $checksumtoget) { - if (is_countable($file_list['added'])) { + if (is_array($file_list['added']) && count($file_list['added'])) { $resultcode = 'warning'; $resultcomment = 'FileIntegrityIsOkButFilesWereAdded'; $outcurrentchecksum = $checksumget.' - '.$langs->trans($resultcomment).''; From 678c3bdb76c09db995401176c3b9a7de7ec0d1ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Feb 2022 18:07:10 +0100 Subject: [PATCH 114/226] Fix switch to login page --- htdocs/main.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3f8da14338b..46315f2d688 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -533,7 +533,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused by CSRF protection (invalid token), so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. setEventMessages('SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry', null, 'warnings'); - if (isset($_POST['id'])) $savid = ((int) $_POST['id']); + $savid = null; + if (isset($_POST['id'])) { + $savid = ((int) $_POST['id']); + } unset($_POST); //unset($_POST['action']); unset($_POST['massaction']); //unset($_POST['confirm']); unset($_POST['confirmmassaction']); @@ -541,7 +544,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( unset($_GET['action']); unset($_GET['confirmmassaction']); unset($_GET['massaction']); - if (isset($savid)) $_POST['id'] = ((int) $savid); + unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ? + if (isset($savid)) { + $_POST['id'] = ((int) $savid); + } } // Note: There is another CSRF protection into the filefunc.inc.php From 3a2fcaae6cddd38d3ded4c2b0dbeb4abead9d9bb Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 21 Feb 2022 10:12:28 +0100 Subject: [PATCH 115/226] wip: SendMail dolGetButtonAction --- htdocs/user/card.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index be91f302b97..63ced51d852 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1827,10 +1827,20 @@ if ($action == 'create' || $action == 'adduserldap') { if (empty($user->socid)) { if (!empty($object->email)) { $langs->load("mails"); - print ''; + // TODO Replace div with dolGetButtonAction + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', ''); + //print ''; } else { $langs->load("mails"); - print ''; + // TODO Replace div with dolGetButtonAction + //$params = array( + // 'attr' => array( + // 'title' => $langs->trans('ImpersonateButtonDescription'), + // 'class' => 'classfortooltip' + // ) + //); + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $permissiontoadd, $params); + //print ''; } } From 0e3ec0502866ed5f242baf228e2800ab99bceb13 Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 21 Feb 2022 11:12:06 +0100 Subject: [PATCH 116/226] wip: dolGetButtonAction Nomail --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 63ced51d852..3f16f690127 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1839,7 +1839,7 @@ if ($action == 'create' || $action == 'adduserldap') { // 'class' => 'classfortooltip' // ) //); - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $permissiontoadd, $params); + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', ''); //print ''; } } From 9e6f782907fe8e6cc7d79429a1cb994fc7ed82f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Feb 2022 11:26:03 +0100 Subject: [PATCH 117/226] Clean code --- htdocs/core/class/events.class.php | 2 +- htdocs/core/lib/security2.lib.php | 3 ++- htdocs/main.inc.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 104f1567d44..63b5e5e494b 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -167,7 +167,7 @@ class Events // extends CommonObject $sql .= " '".$this->db->escape(getUserRemoteIP())."',"; $sql .= " ".($this->user_agent ? "'".$this->db->escape(dol_trunc($this->user_agent, 250))."'" : 'NULL').","; $sql .= " '".$this->db->idate($this->dateevent)."',"; - $sql .= " ".($user->id ? "'".$this->db->escape($user->id)."'" : 'NULL').","; + $sql .= " ".($user->id > 0 ? ((int) $user->id) : 'NULL').","; $sql .= " '".$this->db->escape(dol_trunc($this->description, 250))."',"; $sql .= " '".$this->db->escape(dol_getprefix())."'"; $sql .= ")"; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index a37a77712c3..e156c83b147 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -187,7 +187,8 @@ if (!function_exists('dol_loginfunction')) { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } - // Set cookie for timeout management + // Set cookie for timeout management. We set it as a cookie so we will be able to use it to set timeout on next page before the session start + // and the conf file is loaded. $prefix = dol_getprefix(''); $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8ddcce45285..88ed3a12f3a 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -282,7 +282,7 @@ if (!empty($php_session_save_handler) && $php_session_save_handler == 'db') { // Init session. Name of session is specific to Dolibarr instance. // Must be done after the include of filefunc.inc.php so global variables of conf file are defined (like $dolibarr_main_instance_unique_id or $dolibarr_main_force_https). -// Note: the function dol_getprefix is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. +// Note: the function dol_getprefix() is defined into functions.lib.php but may have been defined to return a different key to manage another area to protect. $prefix = dol_getprefix(''); $sessionname = 'DOLSESSID_'.$prefix; $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; From e8c48a06c0822b1b477e212cb77bc73cc6ccf0f7 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 27 Jan 2022 11:26:16 +0100 Subject: [PATCH 118/226] Correct typos in ticket.lib --- htdocs/core/lib/ticket.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 3599c17887f..2e70bfba3b9 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -476,7 +476,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no if ($sql) { // May not be defined if module Agenda is not enabled and mailing module disabled too $sql .= $db->order($sortfield_new, $sortorder); - dol_syslog("company.lib::show_actions_done", LOG_DEBUG); + dol_syslog("ticket.lib::show_ticket_messaging", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { $i = 0; @@ -491,7 +491,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no $result = $contactaction->fetchResources(); if ($result < 0) { dol_print_error($db); - setEventMessage("company.lib::show_actions_done Error fetch ressource", 'errors'); + setEventMessage("ticket.lib::show_ticket_messaging Error fetch ressource", 'errors'); } //if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))"; From bf9ca1caaa370504448c966cad9c73539adccc86 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 7 Feb 2022 12:30:47 +0100 Subject: [PATCH 119/226] new : allow to display a warning on untreated tickets. Introduces options TICKET_DELAY_BEFORE_FIRST_RESPONSE and TICKET_DELAY_SINCE_LAST_RESPONSE --- htdocs/ticket/list.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index b2548807be4..bfb0c8dcbea 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -329,8 +329,6 @@ if (empty($reshook)) { $form = new Form($db); $formTicket = new FormTicket($db); -$now = dol_now(); - $user_temp = new User($db); $socstatic = new Societe($db); @@ -942,6 +940,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; +$now = dol_now(); $cacheofoutputfield = array(); while ($i < ($limit ? min($num, $limit) : $num)) { @@ -956,6 +955,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print ''; foreach ($object->fields as $key => $val) { + $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -1033,6 +1033,26 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); + } elseif ($key == 'ref') { + print $object->showOutputField($val, $key, $obj->$key, ''); + + // display a warning on untreated tickets + $is_open = ($object->status != Ticket::STATUS_CLOSED && $object->status != Ticket::STATUS_CANCELED ); + $should_show_warning = (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) || !empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE)); + if ($is_open && $should_show_warning) { + $date_last_msg_sent = (int) $object->date_last_msg_sent; + $hour_diff = ($now - $date_last_msg_sent) / 3600 ; + + if (!empty($conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE && $date_last_msg_sent == 0)) { + $creation_date = $object->datec; + $hour_diff_creation = ($now - $creation_date) / 3600 ; + if ($hour_diff_creation > $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayForFirstResponseTooLong', $conf->global->TICKET_DELAY_BEFORE_FIRST_RESPONSE), 'warning', 'style="color: red;"', false, 0, 0, '', ''); + } + } elseif (!empty($conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) && $hour_diff > $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE) { + print " " . img_picto($langs->trans('Late') . ' : ' . $langs->trans('TicketsDelayFromLastResponseTooLong', $conf->global->TICKET_DELAY_SINCE_LAST_RESPONSE), 'warning'); + } + } } 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])) { From ffbe0946354a8681801ee4b73b8195d40ff6dafa Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 27 Jan 2022 17:02:09 +0100 Subject: [PATCH 120/226] Add strings for ticket warnings --- htdocs/langs/en_US/ticket.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 38b199f7260..710ae491973 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -244,6 +244,8 @@ TicketNotNotifyTiersAtCreate=Not notify company at create Unread=Unread TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface. ErrorTicketRefRequired=Ticket reference name is required +TicketsDelayForFirstResponseTooLong=Too much time elapsed since ticket opening without any answer. +TicketsDelayFromLastResponseTooLong=Too much time elapsed since last answer on this ticket. # # Logs From ad3f7b531e13f1a43a2bb2c7fe0d395f5a01bb18 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 28 Jan 2022 14:31:11 +0100 Subject: [PATCH 121/226] add constants declarations in the module class --- htdocs/core/modules/modTicket.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 68cb3f45551..0ae6b00b1c3 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -107,7 +107,9 @@ class modTicket extends DolibarrModules 1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0), 2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0), 3 => array('TICKET_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/tickets', 'Ticket templates ODT/ODS directory for templates', 0), - 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0) + 4 => array('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND', 'chaine', 0, 'Automatically mark ticket as read when created from backend', 0), + 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), + 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0) ); From 5d10d6cb781993d879691cabb80b01d922335cc9 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 28 Jan 2022 16:38:31 +0100 Subject: [PATCH 122/226] allow delays configuration from ticket module params --- htdocs/admin/ticket.php | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index fc8a5e8e0b9..c36f6ae1d1b 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -191,6 +191,18 @@ if ($action == 'setvarother') { if (!($res > 0)) { $error++; } + + $param_delay_first_response = GETPOST('delay_first_response', 'int'); + $res = dolibarr_set_const($db, 'TICKET_DELAY_BEFORE_FIRST_RESPONSE', $param_delay_first_response, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + $param_delay_between_responses = GETPOST('delay_between_responses', 'int'); + $res = dolibarr_set_const($db, 'TICKET_DELAY_SINCE_LAST_RESPONSE', $param_delay_between_responses, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } } @@ -503,7 +515,8 @@ print ''; print ''; // Auto assign ticket at user who created it -print ''.$langs->trans("TicketsAutoAssignTicket").''; +print ''; +print ''.$langs->trans("TicketsAutoAssignTicket").''; print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); @@ -517,12 +530,41 @@ print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, print ''; print ''; -print '
'; - if (!$conf->use_javascript_ajax) { print ''; } +// Define wanted maximum time elapsed before answers to tickets +print '
'; +print ''; + +print ''; +print ''.$langs->trans("TicketsDelayBeforeFirstAnswer").""; +print ' + + + '; +print ''; +print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help'); +print ''; +print ''; + +print ''; +print ''.$langs->trans("TicketsDelayBetweenAnswers").""; +print ' + + + '; +print ''; +print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help'); +print ''; +print ''; + +print '
'; + +print '
'; + + // Admin var of module print load_fiche_titre($langs->trans("Notification"), '', ''); From cdbf0bdf6faac8d424731d172307884ca6f1e357 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Mon, 31 Jan 2022 09:45:20 +0100 Subject: [PATCH 123/226] add translation strings --- htdocs/langs/en_US/ticket.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 710ae491973..9dfc4874cc5 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -138,6 +138,10 @@ TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) TicketPublicNotificationNewMessageDefaultEmailHelp=Send an email to this address for each new message notifications if the ticket doesn't have a user assigned to it or if the user doesn't have any known email. TicketsAutoReadTicket=Automatically mark the ticket as read (when created from backoffice) TicketsAutoReadTicketHelp=Automatically mark the ticket as read when created from backoffice. When ticket is create from the public interface, ticket remains with the status "Not Read". +TicketsDelayBeforeFirstAnswer=A new ticket should receive a first answer before (hours): +TicketsDelayBeforeFirstAnswerHelp=If a new ticket has not received an answer after this time period (in hours), an important warning icon will be displayed in the list view. +TicketsDelayBetweenAnswers=An unresolved ticket should not be unactive during (hours): +TicketsDelayBetweenAnswersHelp=If an unresolved ticket that has already received an answer has not had further interaction after this time period (in hours), a warning icon will be displayed in the list view. # # Index & list page From d769d856e745b8d5c55251a4689822fb2a2a2684 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 10 Feb 2022 11:15:11 +0100 Subject: [PATCH 124/226] fix $object->status not being set. Avoid using $object->fk_statut. --- htdocs/ticket/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index bfb0c8dcbea..c7f603056b4 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -951,6 +951,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Store properties in $object $object->setVarsFromFetchObj($obj); + $object->status = $object->fk_statut; // fk_statut is deprecated // Show here line of result print ''; From 00e6d2786dc7c92abff39e5d909e54532a6acb8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Feb 2022 12:21:43 +0100 Subject: [PATCH 125/226] Do not use dol_hash anymore for the name of cookies. --- htdocs/core/lib/functions.lib.php | 25 ++++++++++--------- htdocs/main.inc.php | 3 +-- .../public/eventorganization/attendee_new.php | 1 - .../eventorganization/subscriptionok.php | 2 +- htdocs/public/payment/newpayment.php | 3 --- htdocs/public/payment/paymentok.php | 2 -- htdocs/public/project/index.php | 3 --- htdocs/public/project/suggestbooth.php | 1 - htdocs/public/project/suggestconference.php | 1 - htdocs/public/project/viewandvote.php | 2 +- 10 files changed, 16 insertions(+), 27 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 236c76e3bf5..86c1cbe0888 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -870,31 +870,32 @@ if (!function_exists('dol_getprefix')) { * Return a prefix to use for this Dolibarr instance, for session/cookie names or email id. * The prefix is unique for instance and avoid conflict between multi-instances, even when having two instances with same root dir * or two instances in same virtual servers. + * This function must not use dol_hash (that is used for password hash) and need to have all context $conf loaded. * * @param string $mode '' (prefix for session name) or 'email' (prefix for email id) * @return string A calculated prefix */ function dol_getprefix($mode = '') { - // If prefix is for email (we need to have $conf alreayd loaded for this case) + // If prefix is for email (we need to have $conf already loaded for this case) if ($mode == 'email') { global $conf; - if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) + if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { // If MAIL_PREFIX_FOR_EMAIL_ID is set if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') { return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; - } elseif (isset($_SERVER["SERVER_NAME"])) { + } elseif (isset($_SERVER["SERVER_NAME"])) { // If MAIL_PREFIX_FOR_EMAIL_ID is set to 'SERVER_NAME' return $_SERVER["SERVER_NAME"]; } } - // The recommended value (may be not defined for old versions) + // The recommended value if MAIL_PREFIX_FOR_EMAIL_ID is not defined (may be not defined for old versions) if (!empty($conf->file->instance_unique_id)) { - return $conf->file->instance_unique_id; + return sha1('dolibarr'.$conf->file->instance_unique_id); } - // For backward compatibility - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + // For backward compatibility when instance_unique_id is not set + return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } // If prefix is for session (no need to have $conf loaded) @@ -903,15 +904,15 @@ if (!function_exists('dol_getprefix')) { // The recommended value (may be not defined for old versions) if (!empty($tmp_instance_unique_id)) { - return $tmp_instance_unique_id; + return sha1('dolibarr'.$tmp_instance_unique_id); } - // For backward compatibility + // For backward compatibility when instance_unique_id is not set if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { - return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); + return sha1($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT); + } else { + return sha1(DOL_DOCUMENT_ROOT.DOL_URL_ROOT); } - - return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 88ed3a12f3a..093813f5776 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -290,7 +290,6 @@ if (!empty($_COOKIE[$sessiontimeout])) { ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); } - // This create lock, released by session_write_close() or end of page. // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. if (!defined('NOSESSION')) { @@ -3263,7 +3262,7 @@ if (!function_exists("llxFooter")) { $forceping = GETPOST('forceping', 'alpha'); if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) { //print ''; - $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); + $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); // Do not use dol_hash(), must not change if salt changes. if (empty($conf->global->MAIN_FIRST_PING_OK_DATE) || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled')) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 55303bcb00e..a7cdd1ceda8 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -56,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 4a81084223d..8acf3daba78 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -57,7 +57,7 @@ if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } -global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root, $mysoc; +global $dolibarr_main_url_root, $mysoc; $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index d25e14288f8..7bb61a708c5 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -70,9 +70,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); -// For encryption -global $dolibarr_main_instance_unique_id; - // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 499ff2c4e31..9765af89f7e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -61,8 +61,6 @@ if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; } -global $dolibarr_main_instance_unique_id; - $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal")); // Clean parameters diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 5f450a6c557..0add64bb700 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -54,9 +54,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); -// For encryption -global $dolibarr_main_instance_unique_id; - // Load translation files $langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 39c2a57700e..cb1b1089b0c 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -56,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index b97777c3a9a..22589c941d2 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -56,7 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -global $dolibarr_main_instance_unique_id; global $dolibarr_main_url_root; // Init vars diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index e680df15a1c..805eb8cfdd1 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -56,7 +56,7 @@ $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); // For encryption -global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; +global $dolibarr_main_url_root; // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data From c78ec56c8f6e035886f85d98b0764c91da04807d Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 21 Feb 2022 14:43:00 +0100 Subject: [PATCH 126/226] feat: dolGetButtonAction for sendmail --- htdocs/user/card.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3f16f690127..dbc93bd0a2c 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1825,23 +1825,21 @@ if ($action == 'create' || $action == 'adduserldap') { $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if (empty($user->socid)) { + $canSendMail = false; + $params = array( + 'attr' => array( + 'title' => $langs->trans('SendMail'), + 'class' => 'classfortooltip' + ) + ); if (!empty($object->email)) { $langs->load("mails"); - // TODO Replace div with dolGetButtonAction - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', ''); - //print ''; + $canSendMail = true; } else { $langs->load("mails"); - // TODO Replace div with dolGetButtonAction - //$params = array( - // 'attr' => array( - // 'title' => $langs->trans('ImpersonateButtonDescription'), - // 'class' => 'classfortooltip' - // ) - //); - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', ''); - //print ''; + $params['attr']['title'] = $langs->trans('NoEMail'); } + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params); } if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { From 2e02b3fcae1ccfd42183f83f58bc42058c57140f Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 14:58:47 +0100 Subject: [PATCH 127/226] Ajout table "llx_inventory_extrafields" --- .../install/mysql/migration/15.0.0-16.0.0.sql | 9 ++++++- .../tables/llx_inventory_extrafields.key.sql | 21 +++++++++++++++ .../tables/llx_inventory_extrafields.sql | 27 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_inventory_extrafields.sql diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index b78e53bd287..cbf3c8fadc5 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -237,4 +237,11 @@ ALTER TABLE llx_advtargetemailing RENAME TO llx_mailing_advtarget; ALTER TABLE llx_mailing ADD UNIQUE uk_mailing(titre, entity); - +create table llx_inventory_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql b/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql new file mode 100644 index 00000000000..ecfd1de723e --- /dev/null +++ b/htdocs/install/mysql/tables/llx_inventory_extrafields.key.sql @@ -0,0 +1,21 @@ +-- =================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- Copyright (C) 2022 ATM Consulting +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_inventory_extrafields.sql b/htdocs/install/mysql/tables/llx_inventory_extrafields.sql new file mode 100644 index 00000000000..f6a6a59e0a1 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_inventory_extrafields.sql @@ -0,0 +1,27 @@ +-- ======================================================================== +-- Copyright (C) 2022 Laurent Destailleur +-- Copyright (C) 2022 ATM Consulting + +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ======================================================================== + +create table llx_inventory_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + From 8bbbc843eb66afaa40e0ae9772a554f7d5b8c88d Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 15:20:22 +0100 Subject: [PATCH 128/226] =?UTF-8?q?Ajout=20onglet=20param=C3=A8tres=20"Inv?= =?UTF-8?q?entaire=20extrafields"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/lib/stock.lib.php | 5 + .../product/admin/inventory_extrafields.php | 123 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 htdocs/product/admin/inventory_extrafields.php diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php index 066bf2165be..c6b1bdefe6c 100644 --- a/htdocs/core/lib/stock.lib.php +++ b/htdocs/core/lib/stock.lib.php @@ -114,6 +114,11 @@ function stock_admin_prepare_head() $head[$h][2] = 'stockMouvementAttributes'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/product/admin/inventory_extrafields.php'; + $head[$h][1] = $langs->trans("InventoryExtraFields"); + $head[$h][2] = 'inventoryAttributes'; + $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove'); return $head; diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php new file mode 100644 index 00000000000..c4566c60741 --- /dev/null +++ b/htdocs/product/admin/inventory_extrafields.php @@ -0,0 +1,123 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2015 Jean-François Ferry + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/product/admin/inventory_extrafields.php + * \ingroup stock + * \brief Page to setup extra fields of inventory + */ + +// Load Dolibarr environment +$res = 0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME +$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +// Try main.inc.php using relative path +if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; +if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; +if (!$res) die("Include of main fails"); + +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('stock@stock', 'admin')); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label = ExtraFields::$type2label; +$type2label = array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); + +$action = GETPOST('action', 'aZ09'); +$attrname = GETPOST('attrname', 'alpha'); +$elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + + +llxHeader('', $langs->trans("InventorySetup"), $help_url); + + +$linkback = ''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); + + +$head = stock_admin_prepare_head(); + +print dol_get_fiche_head($head, 'inventoryAttributes', $langs->trans("InventoryExtraFields"), -1, 'account'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +print dol_get_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') { + print '
'; + print "".$langs->trans("NewAttribute").""; + print "
"; +} + + +/* + * Creation of an optional field + */ +if ($action == 'create') { + print '
'; + print load_fiche_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* + * Edition of an optional field + */ +if ($action == 'edit' && !empty($attrname)) { + print "
"; + print load_fiche_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +// End of page +llxFooter(); +$db->close(); From dd6d0a118a74915c33d93768e3d2619697f65857 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 15:28:38 +0100 Subject: [PATCH 129/226] Translation --- htdocs/langs/en_US/admin.lang | 3 ++- htdocs/langs/en_US/products.lang | 1 + htdocs/product/admin/inventory_extrafields.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1e94ecbfdf0..426e1186868 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2222,4 +2222,5 @@ EachTerminalHasItsOwnCounter=Each terminal use its own counter. FillAndSaveAccountIdAndSecret=Fill and save account ID and secret first PreviousHash=Previous hash LateWarningAfter="Late" warning after -TemplateforBusinessCards=Template for a business card in different size \ No newline at end of file +TemplateforBusinessCards=Template for a business card in different size +InventorySetup= Inventory Setup diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 14715670882..960bf02eb46 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -411,3 +411,4 @@ Rank=Rank SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status StockMouvementExtraFields= Extra Fields (stock mouvement) +InventoryExtraFields= Extra Fields (inventory) diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php index c4566c60741..d21328da336 100644 --- a/htdocs/product/admin/inventory_extrafields.php +++ b/htdocs/product/admin/inventory_extrafields.php @@ -78,7 +78,7 @@ llxHeader('', $langs->trans("InventorySetup"), $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans("InventorySetup"), $linkback, 'title_setup'); $head = stock_admin_prepare_head(); From 5647a0436991bdae03f37bcd3c20da6512c1e3e1 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 21 Feb 2022 16:50:12 +0100 Subject: [PATCH 130/226] fix : bad redirection after create we have __ID__ on url redirect, so repplace it with the $id value --- htdocs/product/stock/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 8389d63e843..c784ff3317e 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -159,6 +159,8 @@ if (empty($reshook)) { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); if (!empty($backtopage)) { + + $backtopage = str_replace("__ID__", $id, $backtopage); header("Location: ".$backtopage); exit; } else { From 97ed94fbda6d76b68c2db0c3399731a18754f981 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Feb 2022 16:54:07 +0100 Subject: [PATCH 131/226] NEW Support html content for multiselect component. --- htdocs/categories/edit.php | 2 ++ htdocs/core/class/html.form.class.php | 10 ++++------ htdocs/theme/eldy/global.inc.php | 4 ++++ htdocs/theme/md/style.css.php | 4 ++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 2b3ffc95c41..518889b85b3 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -178,7 +178,9 @@ print ''; // Parent category print ''.$langs->trans("In").''; +print img_picto('', 'category', 'class="pictofixedwidth"'); print $form->select_all_categories($type, $object->fk_parent, 'parent', 64, $object->id); +print ajax_combobox('parent'); print ''; $parameters = array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8f112b9aa98..fa7fb264995 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8123,12 +8123,9 @@ class Form $out .= "\n".''; - print ' - '.$langs->trans("ShowHideDetails").''; + print ' - '.$langs->trans("ShowHideDetails").''; //} print ''."\n"; diff --git a/htdocs/install/default.css b/htdocs/install/default.css index d18e54c0c1c..e7bbe6c7771 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -32,6 +32,10 @@ vertical-align: middle; } +.right { + text-align: right; +} + .opacitymedium { opacity: 0.5; } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 53cd1755dda..25dd1ee84fd 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -235,8 +235,12 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ // Force l'affichage de la progression if ($ok) { - print ''.$langs->trans("PleaseBePatient").''; + print ''.$langs->trans("PleaseBePatient").''; + print ''; + flush(); + + print ''; } @@ -401,6 +405,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } } + if (empty($actiondone)) { print '
'.$langs->trans("ErrorWrongParameters").'
'; } From c7077ef1d7d7d61f248e50f419197efc330084ab Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 23 Feb 2022 14:49:12 +0100 Subject: [PATCH 163/226] fix: send mail title --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3b1567bacfc..64d698e2615 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1833,7 +1833,7 @@ if ($action == 'create' || $action == 'adduserldap') { $canSendMail = false; $params = array( 'attr' => array( - 'title' => $langs->trans('SendMail'), + 'title' => '', 'class' => 'classfortooltip' ) ); From b99557e60c0a65775c5ecface5a1800d61be681d Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 23 Feb 2022 14:59:39 +0100 Subject: [PATCH 164/226] fix: feedback travis --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 64d698e2615..0c2c667a46d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1938,7 +1938,7 @@ if ($action == 'create' || $action == 'adduserldap') { - //Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } From 6047e4e90be3bdf6819ae7d50d106ba8711ad98f Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 23 Feb 2022 15:06:58 +0100 Subject: [PATCH 165/226] fix: travis + stickler --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0c2c667a46d..64d698e2615 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1938,7 +1938,7 @@ if ($action == 'create' || $action == 'adduserldap') { - // Select mail models is same action as presend + //Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } From bd6c547b4d6621593759c11413a5265fad761599 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 23 Feb 2022 15:20:45 +0100 Subject: [PATCH 166/226] fix: merge develop --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 64d698e2615..0c2c667a46d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1938,7 +1938,7 @@ if ($action == 'create' || $action == 'adduserldap') { - //Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } From ed6f4b4ee1a0cf96ec64427623c41ff0055fd2b4 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 23 Feb 2022 15:33:51 +0100 Subject: [PATCH 167/226] Display Salary Paiement on compta report --- htdocs/compta/resultat/clientfourn.php | 4 +++- htdocs/compta/resultat/index.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index b5aca49aaae..f650244d677 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -857,7 +857,7 @@ if ($modecompta == 'BOOKKEEPING') { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { if ($modecompta == 'CREANCES-DETTES') { - $column = 'p.datev'; + $column = 'b.datev'; } else { $column = 'p.datep'; } @@ -865,6 +865,7 @@ if ($modecompta == 'BOOKKEEPING') { $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank=b.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user"; $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; if (!empty($date_start) && !empty($date_end)) { @@ -876,6 +877,7 @@ if ($modecompta == 'BOOKKEEPING') { $sql .= " UNION "; $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank=b.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; if (!empty($date_start) && !empty($date_end)) { diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 2d4ea6fc9e0..5f10013f294 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -611,7 +611,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { if ($modecompta == 'CREANCES-DETTES') { - $column = 'p.datev'; + $column = 'b.datev'; } if ($modecompta == "RECETTES-DEPENSES") { $column = 'p.datep'; @@ -621,6 +621,7 @@ if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo $subtotal_ttc = 0; $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank=b.rowid"; $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; if (!empty($date_start) && !empty($date_end)) { $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'"; From f70e97bafac657e5bce22c8e3bfe99999d247a48 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 23 Feb 2022 15:45:50 +0100 Subject: [PATCH 168/226] fix: travis --- htdocs/user/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 0c2c667a46d..762da1f83cc 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1823,7 +1823,6 @@ if ($action == 'create' || $action == 'adduserldap') { /* * Buttons actions */ - print '
'; $parameters = array(); From 80d85b42395c8d3978a14410d901c0ca5d899082 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 23 Feb 2022 16:17:18 +0100 Subject: [PATCH 169/226] db migration: add a column in llx_bank_account to store the expected SEPA format concerning PmtTpInf. --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index cbf3c8fadc5..957a16152b8 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -245,3 +245,5 @@ create table llx_inventory_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object); + +ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti integer DEFAULT 0 AFTER domiciliation; From 6136de6a4afe3cc124d86788750f706df48c645c Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 23 Feb 2022 12:11:40 +0100 Subject: [PATCH 170/226] add 'pti_in_ctti' property for Account object. Update related methods. --- htdocs/compta/bank/class/account.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cb2de5aca46..f0f1b54dd7b 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -145,6 +145,12 @@ class Account extends CommonObject */ public $iban_prefix; + /** + * XML SEPA format: place Payment Type Information (PmtTpInf) in Credit Transfer Transaction Information (CdtTrfTxInf) + * @var int + */ + public $pti_in_ctti = 0; + /** * Name of account holder * @var string @@ -680,6 +686,7 @@ class Account extends CommonObject $sql .= ", bic"; $sql .= ", iban_prefix"; $sql .= ", domiciliation"; + $sql .= ", pti_in_ctti"; $sql .= ", proprio"; $sql .= ", owner_address"; $sql .= ", currency_code"; @@ -706,6 +713,7 @@ class Account extends CommonObject $sql .= ", '".$this->db->escape($this->bic)."'"; $sql .= ", '".$this->db->escape($this->iban)."'"; $sql .= ", '".$this->db->escape($this->domiciliation)."'"; + $sql .= ", ".((int) $this->pti_in_ctti); $sql .= ", '".$this->db->escape($this->proprio)."'"; $sql .= ", '".$this->db->escape($this->owner_address)."'"; $sql .= ", '".$this->db->escape($this->currency_code)."'"; @@ -828,6 +836,7 @@ class Account extends CommonObject $sql .= ",bic='".$this->db->escape($this->bic)."'"; $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; + $sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti); $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; @@ -949,7 +958,7 @@ class Account extends CommonObject $sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,"; $sql .= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,"; - $sql .= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,"; + $sql .= " ba.domiciliation, ba.pti_in_ctti, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,"; $sql .= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,"; $sql .= " ba.min_allowed, ba.min_desired, ba.comment,"; $sql .= " ba.datec as date_creation, ba.tms as date_update, ba.ics, ba.ics_transfer,"; @@ -992,6 +1001,7 @@ class Account extends CommonObject $this->bic = $obj->bic; $this->iban = $obj->iban; $this->domiciliation = $obj->domiciliation; + $this->pti_in_ctti = $obj->pti_in_ctti; $this->proprio = $obj->proprio; $this->owner_address = $obj->owner_address; From 7a13112ad8e142e51130c718cd1c7007d7708486 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 23 Feb 2022 11:41:42 +0100 Subject: [PATCH 171/226] bank card interface modification to allow configuration of payment type information in SEPA XML --- htdocs/compta/bank/card.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 4e37268756d..0d9ea0ecfb3 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -124,6 +124,7 @@ if (empty($reshook)) { $object->bic = trim(GETPOST("bic")); $object->iban = trim(GETPOST("iban")); $object->domiciliation = trim(GETPOST("domiciliation", "nohtml")); + $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); @@ -224,6 +225,7 @@ if (empty($reshook)) { $object->bic = trim(GETPOST("bic")); $object->iban = trim(GETPOST("iban")); $object->domiciliation = trim(GETPOST("domiciliation", "nohtml")); + $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); @@ -537,6 +539,11 @@ if ($action == 'create') { print '
'; print ''; + print ''; + print ''; + print ''; // Duration - Time spent print 'attributes[$object->table_element]['label'])) { print ' trextrafields_collapse_last'; } - print '">'; + print '"'; + if (empty($extrafields->expand_display[$collapse_group])) { + print ' style="display: none;"'; + } + print '>'; $extrafields_collapse_num_old = $extrafields_collapse_num; print ''; } print ''; print ''; print ''; @@ -394,12 +417,11 @@ if ($result) { print ''; // Accounting account affected - print ''; - print ''; print ""; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 863001c3bc0..908159cbe1c 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -30,9 +30,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page @@ -59,9 +59,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -83,6 +88,9 @@ if (!$sortorder) { } } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('accountancyexpensereportlist')); + $formaccounting = new FormAccounting($db); $accounting = new AccountingAccount($db); @@ -101,7 +109,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { /* - * Action + * Actions */ if (GETPOST('cancel', 'alpha')) { @@ -111,30 +119,47 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -// 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 - $search_login = ''; - $search_expensereport = ''; - $search_label = ''; - $search_desc = ''; - $search_amount = ''; - $search_account = ''; - $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; +$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 (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 + $search_login = ''; + $search_expensereport = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_country = ''; + $search_tvaintra = ''; + } + // Mass actions -$objectclass = 'ExpenseReport'; -$objectlabel = 'ExpenseReport'; -$permissiontoread = $user->rights->expensereport->read; -$permissiontodelete = $user->rights->expensereport->delete; -$uploaddir = $conf->expensereport->dir_output; -include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + $objectclass = 'ExpenseReport'; + $objectlabel = 'ExpenseReport'; + $permissiontoread = $user->rights->expensereport->read; + $permissiontodelete = $user->rights->expensereport->delete; + $uploaddir = $conf->expensereport->dir_output; + include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php'; +} + if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { $msg = ''; + //print '
' . $langs->trans("Processing") . '...
'; if (!empty($mesCasesCochees)) { $msg = '
'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'
'; @@ -159,7 +184,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) { $accountventilated = new AccountingAccount($db); $accountventilated->fetch($monCompte, '', 1); - dol_syslog('accountancy/expensereport/list.php', LOG_DEBUG); + dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG); if ($db->query($sql)) { $msg .= '
'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'
'; $ok++; @@ -201,6 +226,9 @@ $sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, er $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,"; $sql .= " u.rowid as userid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,"; $sql .= " aa.rowid as aarowid"; +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees"; @@ -233,9 +261,19 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("erd.tva_tx", $search_vat, 1); } -$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND erd.date >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND erd.date <= '".$db->idate($search_date_end)."'"; +} $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -251,7 +289,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/expensereport/list.php'); +dol_syslog("accountancy/expensereport/list.php", LOG_DEBUG); +// MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso) +// This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security +if ($db->type == 'mysqli') { + $db->query("SET SQL_BIG_SELECTS=1"); +} + $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); @@ -272,14 +316,23 @@ if ($result) { if ($search_lineid) { $param .= '&search_lineid='.urlencode($search_lineid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } if ($search_expensereport) { $param .= '&search_expensereport='.urlencode($search_expensereport); @@ -302,7 +355,6 @@ if ($result) { ); $massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1); - print ''."\n"; print ''; if ($optioncss != '') { @@ -335,20 +387,21 @@ if ($result) { if (!empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) { print '
'; } - print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; @@ -468,6 +521,9 @@ if ($result) { } else { print $db->error(); } +if ($db->type == 'mysqli') { + $db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation +} // Add code to auto check the box when we select an account print ''; + } + return $out; } From c0dd96a45654aa8f85f5fcc7278bfcc510cf97bb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 25 Feb 2022 10:36:02 +0000 Subject: [PATCH 200/226] Fixing style errors. --- htdocs/accountancy/bookkeeping/card.php | 5 ++--- htdocs/core/class/html.formaccounting.class.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index df43f28bd1f..01e78cf4d27 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -659,7 +659,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1,'maxwidth250','','subledger_label'); + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } @@ -728,7 +728,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1,'maxwidth250','','subledger_label'); + print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { print ''; } @@ -758,7 +758,6 @@ if ($action == 'create') { print ""; } print ''; - } } } else { diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 638d3a4bdfd..645e045a903 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -518,7 +518,7 @@ class FormAccounting extends Form '; } - + return $out; } From a9450f5673e60320ed86e2ffd84dafaa3398cf3f Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 25 Feb 2022 11:50:41 +0100 Subject: [PATCH 201/226] Update societe.php --- htdocs/societe/admin/societe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 95e1d5e47cb..3d7725c7d19 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -612,7 +612,7 @@ foreach ($dirsociete as $dirroot) { // Preview print ''; + // Date print ''; @@ -1378,15 +1395,6 @@ if ($action == 'create') { } print ''; - - $line = new FichinterLigne($db); - $line->fetch($objp->rowid); - - $extrafields->fetch_name_optionals_label($line->table_element); - - $line->fetch_optionals(); - - print $line->showOptionals($extrafields, 'view', array('colspan'=>5)); } // Line in update mode @@ -1405,6 +1413,22 @@ if ($action == 'create') { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('np_desc', $objp->description, '', 164, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%'); $doleditor->Create(); + + $objectline = new FichinterLigne($db); + $objectline->fetch($objp->rowid); + $objectline->fetch_optionals(); + + $extrafields->fetch_name_optionals_label($objectline->table_element); + + if (!empty($extrafields)) { + $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', 1, 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } + } + print ''; // Date d'intervention @@ -1431,14 +1455,6 @@ if ($action == 'create') { print ''; print ''; print ''."\n"; - - $line = new FichinterLigne($db); - $line->fetch($objp->rowid); - - $extrafields->fetch_name_optionals_label($line->table_element); - $line->fetch_optionals(); - - print $line->showOptionals($extrafields, 'edit', array('colspan'=>5)); } $i++; @@ -1481,6 +1497,20 @@ if ($action == 'create') { $doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'restricthtml'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%'); $doleditor->Create(); } + + $objectline = new FichinterLigne($db); + $extrafields->fetch_name_optionals_label($objectline->table_element); + + if (is_object($objectline)) { + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); + + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } + } + print ''; // Date intervention @@ -1513,14 +1543,6 @@ if ($action == 'create') { print ''; print ''; - //Line extrafield - - $lineadd = new FichinterLigne($db); - - $extrafields->fetch_name_optionals_label($lineadd->table_element); - - print $lineadd->showOptionals($extrafields, 'edit', array('colspan'=>5)); - if (!$num) { print '
'.$langs->trans($bickey).'
'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").' '; + print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info'); + print '
'.$langs->trans("BankAccountDomiciliation").''; print ''; + print ''; print ''; - $durationtouse = ($_POST['timespent_duration'] ? $_POST['timespent_duration'] : ''); + $durationtouse = (GETPOST('timespent_duration') ? GETPOST('timespent_duration') : ''); if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) { $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); } From 118b211807f2b5ddffe4db03d6c7289d08feba1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Feb 2022 12:37:20 +0100 Subject: [PATCH 183/226] Fix error on null --- htdocs/core/lib/functions.lib.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aea77cd018d..3b0e90c9013 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6582,16 +6582,18 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes } elseif (in_array($attrs->item($ii)->name, array('style'))) { $valuetoclean = $attrs->item($ii)->value; - do { - $oldvaluetoclean = $valuetoclean; - $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments - $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); - if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. - $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); - $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); - $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); - } - } while ($oldvaluetoclean != $valuetoclean); + if (isset($valuetoclean)) { + do { + $oldvaluetoclean = $valuetoclean; + $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments + $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); + if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. + $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); + } + } while ($oldvaluetoclean != $valuetoclean); + } $attrs->item($ii)->value = $valuetoclean; } From a6e7a41e98ba057b1117e982af4b3a3409ed9135 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Feb 2022 12:54:33 +0100 Subject: [PATCH 184/226] FIX Reduce flash effect on collapse extrafield FIX Reduce flash effect on edit inline feature. --- htdocs/core/class/extrafields.class.php | 86 +++++++++++++----------- htdocs/core/class/html.form.class.php | 12 ++-- htdocs/core/tpl/extrafields_view.tpl.php | 9 ++- htdocs/theme/eldy/global.inc.php | 22 +++--- htdocs/theme/md/style.css.php | 17 +++-- 5 files changed, 85 insertions(+), 61 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 31c33716233..319447b0996 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -66,6 +66,11 @@ class ExtraFields */ public $attributes; + /** + * @var array Array with boolean of status of groups + */ + public $expand_display; + /** * @var string Error code (or message) */ @@ -1866,55 +1871,58 @@ class ExtraFields $colspan=0; } + $extrafield_param = $this->attributes[$object->table_element]['param'][$key]; + $extrafield_param_list = array(); + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + } + $extrafield_collapse_display_value = -1; + $expand_display = false; + if (is_array($extrafield_param_list) && count($extrafield_param_list) > 0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + $expand_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); + } + $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>'; // Some js code will be injected here to manage the collapsing of extrafields - $out .=''; + $out .= ' '; + $out .= ''; $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= ''; $out .= ''; $out .= ''; - $extrafield_param = $this->attributes[$object->table_element]['param'][$key]; - if (!empty($extrafield_param) && is_array($extrafield_param)) { - $extrafield_param_list = array_keys($extrafield_param['options']); + if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) { + // Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup. + $extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:''); + $this->expand_display[$extrafields_collapse_num] = $expand_display; - if (count($extrafield_param_list) > 0) { - $extrafield_collapse_display_value = intval($extrafield_param_list[0]); - if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) { - // Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup. - $collapse_display = ((isset($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? ($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key] ? true : false) : ($extrafield_collapse_display_value == 2 ? false : true)); - $extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key].(!empty($object->id)?'_'.$object->id:''); - - if (!empty($conf->use_javascript_ajax)) { - $out .= ''."\n"; - $out .= ''."\n"; - } + if (!empty($conf->use_javascript_ajax)) { + $out .= ''."\n"; + $out .= ''."\n"; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 68fe5152407..b4f1daf9674 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -141,9 +141,9 @@ class Form } } } else { - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + //if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { $ret .= ''; - } + //} if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { $ret .= ''; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + //if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { $ret .= '
'; - } + //} if ($fieldrequired) { $ret .= ''; } @@ -158,9 +158,9 @@ class Form if (!empty($notabletag)) { $ret .= ' '; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + //if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { $ret .= ''; } @@ -176,9 +176,9 @@ class Form if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { $ret .= '
'; - } + //} } return $ret; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b5656c89339..8afa9a16ff0 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -125,14 +125,19 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l $lastseparatorkeyfound = $tmpkeyextra; } else { - print '
'; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b55ad42182c..74807d8f216 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -223,7 +223,7 @@ input { padding-left: 5px; } select { - padding-top: 5px; + padding-top: 4px; padding-right: 4px; padding-bottom: 5px; padding-left: 2px; @@ -550,6 +550,13 @@ div#moretabsList, div#moretabsListaction { hr { border: 0; border-top: 1px solid #ccc; } .tabBar hr { margin-top: 20px; margin-bottom: 17px; } + +table.tableforfield .button:not(.bordertransp):not(.buttonpayment), +table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { + margin-bottom: 2px; + margin-top: 2px; +} + .button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { margin-bottom: 3px; @@ -3495,11 +3502,10 @@ table.border, table.bordernooddeven, table.dataTable, .table-border, .table-bord table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 22px; -} +.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 22px; + height: 28px; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { @@ -3507,17 +3513,15 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border } div .tdtop { vertical-align: top !important; - /*padding-top: 10px !important; - padding-bottom: 2px !important; */ } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 5px 2px 5px 2px; + padding: 2px 2px 2px 2px; border-collapse: collapse; } div.tabBar .fichecenter table.border>tbody>tr>td, div.tabBar .fichecenter div.border div div.tagtd, div.tabBar div.border div div.tagtd { - padding-top: 5px; + padding-top: 2px; border-bottom: 1px solid #E0E0E0; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5c5b4992806..11e15869f45 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -730,6 +730,14 @@ div#moretabsList, div#moretabsListaction { } hr { border: 0; border-top: 1px solid #ccc; } +.tabBar hr { margin-top: 20px; margin-bottom: 17px; } + + +table.tableforfield .button:not(.bordertransp):not(.buttonpayment), +table.tableforfield .buttonDelete:not(.bordertransp):not(.buttonpayment) { + margin-bottom: 2px; + margin-top: 2px; +} .button:not(.bordertransp):not(.buttonpayment), .buttonDelete:not(.bordertransp):not(.buttonpayment) { border-color: #c5c5c5; @@ -3564,15 +3572,14 @@ table.borderplus { border: 1px solid #BBB; } -.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 26px; -} +.border tbody tr, .bordernooddeven tbody tr, .border tbody tr td, .bordernooddeven tbody tr td, +div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col, tr.liste_titre.box_titre td table td, .bordernooddeven tr td { - height: 26px; + height: 28px; } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 4px 4px 4px 4px; + padding: 3px 4px 3px 4px; border: 1px solid #f0f0f0; border-collapse: collapse; } From ba3856f9e9f6b424ceeae7007e7105ee984cfb34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Feb 2022 14:14:04 +0100 Subject: [PATCH 185/226] Fix regression --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/class/html.form.class.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 319447b0996..e9b23bfdbd9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1886,7 +1886,7 @@ class ExtraFields $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; $out .= '<'.$tagtype_dyn.' '.(!empty($colspan)?'colspan="' . $colspan . '"':'').'>'; // Some js code will be injected here to manage the collapsing of extrafields - $out .= ' '; + $out .= ' '; $out .= ''; $out .= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out .= ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b4f1daf9674..6e5c0a572d2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -141,9 +141,9 @@ class Form } } } else { - //if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; - //} - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + } + if (empty($notabletag) && $perm) { $ret .= ''; } - //if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; - //} + } if ($fieldrequired) { $ret .= ''; } @@ -158,10 +158,10 @@ class Form if (!empty($notabletag)) { $ret .= ' '; } - //if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= ''; } if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { @@ -173,12 +173,12 @@ class Form if (!empty($notabletag) && $notabletag == 3) { $ret .= ' '; } - if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) { + if (empty($notabletag) && $perm) { $ret .= '
'; - //} + } } return $ret; From 4d2dde0fe48d335a434a0e88a5101d878d1c7b7e Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 24 Feb 2022 14:34:06 +0100 Subject: [PATCH 186/226] fix bookmarks info bubble --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index d24ba63ef55..f8daff1cd14 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -66,7 +66,7 @@ function printDropdownBookmarksList() // Url to list bookmark - $listbtn = ''; + $listbtn = ''; $listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').''; // Url to go on create new bookmark page From 517562b465eee56d3b1df297086e4fe39cfe091d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 24 Feb 2022 15:26:11 +0100 Subject: [PATCH 187/226] NEW : solde() function evolution to be able to get solde until a chosen date --- htdocs/compta/bank/class/account.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cb2de5aca46..655c49bcc44 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1188,9 +1188,11 @@ class Account extends CommonObject * Return current sold * * @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold) - * @return int Current sold (value date <= today) + * @param tms $date_end Date until we want to get bank account sold + * @param string $field dateo or datev + * @return int current sold (value date <= today) */ - public function solde($option = 0) + public function solde($option = 0, $date_end='', $field='dateo') { $solde = 0; @@ -1198,7 +1200,7 @@ class Account extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."bank"; $sql .= " WHERE fk_account = ".((int) $this->id); if ($option == 1) { - $sql .= " AND dateo <= '".$this->db->idate(dol_now())."'"; + $sql .= " AND ".$this->db->escape($field)." <= '".(!empty($date_end) ? $this->db->idate($date_end) : $this->db->idate(dol_now()))."'"; } $resql = $this->db->query($sql); From a0bc41cdba3fd8561f2ed84c5dc6aa3511413c0f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 24 Feb 2022 14:32:59 +0000 Subject: [PATCH 188/226] Fixing style errors. --- htdocs/compta/bank/class/account.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 655c49bcc44..18fc015fb2d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1192,7 +1192,7 @@ class Account extends CommonObject * @param string $field dateo or datev * @return int current sold (value date <= today) */ - public function solde($option = 0, $date_end='', $field='dateo') + public function solde($option = 0, $date_end = '', $field = 'dateo') { $solde = 0; From f0c5fe31f818f743cfefe62d880c25e1e1faed56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Feb 2022 17:49:52 +0100 Subject: [PATCH 189/226] FIX #yogosha9083 --- htdocs/main.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 624c7bd6e73..9a9da452a44 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -97,15 +97,15 @@ function testSqlAndScriptInject($val, $type) //$val = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $val); // Sometimes we have entities without the ; at end so html_entity_decode does not work but entities is still interpreted by browser. $val = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', function ($m) { return realCharForNumericEntities($m); }, $val); + + // We clean string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char) + // We should use dol_string_nounprintableascii but function is not yet loaded/available + $val = preg_replace('/[\x00-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace + // We clean html comments because some hacks try to obfuscate evil strings by inserting HTML comments. Example: onerror=alert(1) + $val = preg_replace('//', '', $val); } while ($oldval != $val); //print "after decoding $val\n"; - // We clean string because some hacks try to obfuscate evil strings by inserting non printable chars. Example: 'java(ascci09)scr(ascii00)ipt' is processed like 'javascript' (whatever is place of evil ascii char) - // We should use dol_string_nounprintableascii but function is not yet loaded/available - $val = preg_replace('/[\x00-\x1F\x7F]/u', '', $val); // /u operator makes UTF8 valid characters being ignored so are not included into the replace - // We clean html comments because some hacks try to obfuscate evil strings by inserting HTML comments. Example: onerror=alert(1) - $val = preg_replace('//', '', $val); - $inj = 0; // For SQL Injection (only GET are used to scan for such injection strings) if ($type == 1 || $type == 3) { From 98da84f9b2594124841659ab00b887a59a219f92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Feb 2022 18:15:04 +0100 Subject: [PATCH 190/226] FIX #yogosha9086 --- htdocs/core/lib/website.lib.php | 4 +++ htdocs/website/index.php | 48 ++++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index ea40cb2dd7e..138be225166 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -31,6 +31,8 @@ */ function dolStripPhpCode($str, $replacewith = '') { + $str = str_replace('\n*/ims', '/<\/html>\n*/ims'), array('', ''), $dataposted); + $dataposted = str_replace('\n";*/ - $htmlheadercontent .= preg_replace(array('/\n*/ims', '/<\/html>\n*/ims'), array('', ''), GETPOST('WEBSITE_HTML_HEADER', 'none')); + $htmlheadercontent .= $dataposted."\n"; /*$htmlheadercontent.= "\n".'"."\n";*/ - $htmlheadercontent = trim($htmlheadercontent)."\n"; - $result = dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); if (!$result) { $error++; @@ -1443,10 +1445,12 @@ if ($action == 'updatecss' && $usercanedit) { $error++; } + $dataposted = trim(GETPOST('WEBSITE_CSS_INLINE', 'none')); + $dataposted = str_replace('\n"; - $csscontent .= trim(GETPOST('WEBSITE_CSS_INLINE', 'none'))."\n"; + $csscontent .= $dataposted."\n"; $csscontent .= '\n"; - $jscontent .= trim(GETPOST('WEBSITE_JS_INLINE', 'none'))."\n"; + $jscontent .= $dataposted."\n"; $jscontent .= '\n";*/ - $robotcontent .= trim(GETPOST('WEBSITE_ROBOT', 'restricthtml'))."\n"; + $robotcontent .= $dataposted."\n"; /*$robotcontent.= "\n".'\n"; - $manifestjsoncontent .= trim(GETPOST('WEBSITE_MANIFEST_JSON', 'none'))."\n"; + $manifestjsoncontent .= $dataposted."\n"; $manifestjsoncontent .= '\n";*/ - $readmecontent .= trim(GETPOST('WEBSITE_README', 'restricthtml'))."\n"; + $readmecontent .= $dataposted."\n"; /*$readmecontent.= ' Date: Thu, 24 Feb 2022 18:29:24 +0100 Subject: [PATCH 191/226] FIX #yogosha9083 --- htdocs/opensurvey/card.php | 10 +++++----- htdocs/public/opensurvey/studs.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 3f822679350..bc018a2dda1 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -137,18 +137,18 @@ if (empty($reshook)) { if (GETPOST('ajoutcomment')) { $error = 0; - if (!GETPOST('comment')) { + if (!GETPOST('comment', "alphanohtml")) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } - if (!GETPOST('commentuser')) { + if (!GETPOST('commentuser', "alphanohtml")) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("User")), null, 'errors'); } if (!$error) { - $comment = (string) GETPOST("comment", "restricthtml"); - $comment_user = (string) GETPOST('commentuser', "restricthtml"); + $comment = (string) GETPOST("comment", "alphanohtml"); + $comment_user = (string) GETPOST('commentuser', "alphanohtml"); $resql = $object->addComment($comment, $comment_user); @@ -422,7 +422,7 @@ print '
'; if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'
'; print '
'."\n"; - print $langs->trans("Name").': '."\n"; + print $langs->trans("Name").': '."\n"; print '
'."\n"; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index c14935d6708..a1c9efed6c3 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -79,8 +79,8 @@ if (GETPOST('ajoutcomment', 'alpha')) { $error = 0; - $comment = GETPOST("comment", 'restricthtml'); - $comment_user = GETPOST('commentuser', 'nohtml'); + $comment = GETPOST("comment", 'alphanohtml'); + $comment_user = GETPOST('commentuser', 'alphanohtml'); if (!$comment) { $error++; @@ -780,9 +780,9 @@ if ($comments) { if ($object->allow_comments) { print '
'.$langs->trans("AddACommentForPoll")."
\n"; - print '
'."\n"; + print '
'."\n"; print $langs->trans("Name").': '; - print '   '."\n"; + print '   '."\n"; print '
'."\n"; print ''."\n"; From 8c61a29051e1225cf050bc5e2d11b0d95e62e890 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 01:30:34 +0100 Subject: [PATCH 192/226] Show value of short_open_tags --- htdocs/admin/system/security.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 9321fa11c12..c48acebe140 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -99,6 +99,7 @@ if (!ini_get('session.cookie_samesite') || ini_get('session.cookie_samesite') == } print "
\n"; print "PHP open_basedir = ".(ini_get('open_basedir') ? ini_get('open_basedir') : yn(0).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("ARestrictedPath").', '.$langs->transnoentitiesnoconv("Example").': '.$_SERVER["DOCUMENT_ROOT"].','.DOL_DATA_ROOT).')')."
\n"; +print "PHP short_open_tag = ".((empty(ini_get('short_open_tag')) || ini_get('short_open_tag') == 'Off') ? yn(0) : img_warning().' '.yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).')'."
\n"; print "PHP allow_url_fopen = ".(ini_get('allow_url_fopen') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_fopen') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; print "PHP allow_url_include = ".(ini_get('allow_url_include') ? img_picto($langs->trans("YouShouldSetThisToOff"), 'warning').' '.ini_get('allow_url_include') : yn(0)).'   ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("No")).")
\n"; //print "PHP safe_mode = ".(ini_get('safe_mode') ? ini_get('safe_mode') : yn(0)).'   '.$langs->trans("Deprecated")." (removed in PHP 5.4)
\n"; From c097ee533187cbf1619f8fd4f3c5fa8ea8f14dd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 01:49:38 +0100 Subject: [PATCH 193/226] FIX #yogosha9089 --- htdocs/core/lib/website2.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 64111e295d2..f61bd298c62 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -647,6 +647,11 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) break; } } + // Check dynamic functions $xxx( + if (preg_match('/\$[a-z0-9_]+\(/ims', $phpfullcodestring)) { + $error++; + setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", '$...('), null, 'errors'); + } if (!$error && empty($user->rights->website->writephp)) { if ($phpfullcodestringold != $phpfullcodestring) { From 6b4c4f19aba356a05b76735a91747df9a7848019 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 25 Feb 2022 04:55:55 +0100 Subject: [PATCH 194/226] NEW Accountancy - Add date from/to on expense report binding & uniformize --- htdocs/accountancy/expensereport/lines.php | 78 +++++++---- htdocs/accountancy/expensereport/list.php | 142 ++++++++++++++------- 2 files changed, 149 insertions(+), 71 deletions(-) diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index fb3bf1a6e04..ff7b9295693 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -26,8 +26,8 @@ */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -49,9 +49,14 @@ $search_desc = GETPOST('search_desc', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha'); -$search_day = GETPOST("search_day", "int"); -$search_month = GETPOST("search_month", "int"); -$search_year = GETPOST("search_year", "int"); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); @@ -61,9 +66,9 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa if (empty($page) || $page < 0) { $page = 0; } +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$offset = $limit * $page; if (!$sortfield) { $sortfield = "erd.date, erd.rowid"; } @@ -101,9 +106,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_amount = ''; $search_account = ''; $search_vat = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; } if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { @@ -204,7 +214,12 @@ if (strlen(trim($search_account))) { if (strlen(trim($search_vat))) { $sql .= natural_search("erd.tva_tx", price2num($search_vat), 1); } -$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND erd.date >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND erd.date <= '".$db->idate($search_date_end)."'"; +} $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy $sql .= $db->order($sortfield, $sortorder); @@ -222,9 +237,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $sql .= $db->plimit($limit + 1, $offset); -dol_syslog('accountancy/expensereport/lines.php::list'); +dol_syslog("accountancy/expensereport/lines.php", LOG_DEBUG); $result = $db->query($sql); - if ($result) { $num_lines = $db->num_rows($result); $i = 0; @@ -254,14 +268,23 @@ if ($result) { if ($search_vat) { $param .= "&search_vat=".urlencode($search_vat); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } print '
'."\n"; @@ -276,12 +299,11 @@ if ($result) { print ''; print_barre_liste($langs->trans("ExpenseReportLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); - print ''.$langs->trans("DescVentilDoneExpenseReport").'
'; - print '
'.$langs->trans("ChangeAccount").'
'; + print '
'.$langs->trans("ChangeAccount").' '; print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); - print '
'; + print '
'; $moreforfilter = ''; @@ -296,11 +318,12 @@ if ($result) { print '
'; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print '
'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).''; + print ''; print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print ' '; print img_edit(); print '
'; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print '
'; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print ''; if ($module->type == 'pdf') { - $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; + $linkspec = ''.img_object($langs->trans("Preview"), 'pdf').''; } else { $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic'); } From cb862246131978fa1c62cde353f6c813216f5681 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Fri, 25 Feb 2022 09:33:08 +0100 Subject: [PATCH 202/226] new : allow to show all logos on a table --- htdocs/core/lib/files.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d1364598c07..04c3a481d00 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -987,7 +987,7 @@ function dol_unescapefile($filename) */ function dolCheckVirus($src_file) { - global $conf; + global $conf, $db; if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { if (!class_exists('AntiVir')) { @@ -2371,6 +2371,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, // Wrapping for users photos $accessallowed = 1; $original_file = $conf->user->dir_output.'/'.$original_file; + } elseif (($modulepart == 'companylogo') && !empty($conf->mycompany->dir_output)) { + // Wrapping for users logos + $accessallowed = 1; + $original_file = $conf->mycompany->dir_output.'/logos/'.$original_file; } elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { // Wrapping for members photos $accessallowed = 1; From be95662ece21162f475fb42876cff87e2843cf06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 13:19:01 +0100 Subject: [PATCH 203/226] Revert "NEW : accoutancy : subleger label input automatic filling when selecting subleger account in select2 list" --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- htdocs/core/class/html.formaccounting.class.php | 15 +-------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 01e78cf4d27..c156a388735 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -659,7 +659,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); } else { print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } @@ -728,7 +728,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); + print $formaccounting->select_auxaccount('', 'subledger_account', 1); } else { print ''; } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 645e045a903..dc6e6d8c6cd 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -441,7 +441,7 @@ class FormAccounting extends Form * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @return string String with HTML select */ - public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth250', $usecache = '', $labelhtmlname = '') + public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth250', $usecache = '') { // phpcs:enable @@ -505,19 +505,6 @@ class FormAccounting extends Form // Build select $out .= Form::selectarray($htmlname, $aux_account, $selectid, ($showempty ? (is_numeric($showempty) ? 1 : $showempty): 0), 0, 0, '', 0, 0, 0, '', $morecss, 1); - //automatic filling if we give the name of the subledger_label input - if (!empty($labelhtmlname)) { - $out .= ''; - } return $out; } From 84db3437bd60524105b93f98da0ab4a5adf510a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 14:13:42 +0100 Subject: [PATCH 204/226] Add missing ' in command --- htdocs/admin/tools/export_files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index 36be1f273ff..a3c20d0dffc 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -173,7 +173,7 @@ if ($compression == 'zip') { // We also exclude '/temp/' dir and 'documents/admin/documents' // We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped. - $cmd = "tar -cf ".escapeshellcmd($outputdir."/".$file)." --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='*.pdf_preview-*.png' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'"; + $cmd = "tar -cf '".escapeshellcmd($outputdir."/".$file)."' --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='*.pdf_preview-*.png' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'"; $result = $utils->executeCLI($cmd, $outputfile, 0, null, 1); From 722b1de2b7fb9914e23599929a686a97ff7e53da Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 25 Feb 2022 15:10:10 +0000 Subject: [PATCH 205/226] Fixing style errors. --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- htdocs/core/class/html.formaccounting.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index ce284598820..5b645796a32 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -663,7 +663,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1,'maxwidth250','','subledger_label'); + print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { print 'subledger_account).'" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; } @@ -746,7 +746,7 @@ if ($action == 'create') { // Also, it is not possible to use a value that is not in the list. // Also, the label is not automatically filled when a value is selected. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1,'maxwidth250','','subledger_label'); + print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); } else { print ''; } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 44a52ae7721..3dc81333e7f 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -518,7 +518,7 @@ class FormAccounting extends Form '; } - + return $out; } From 4082de422f38a284c3c1baad7c60b7d50d4e878b Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Fri, 25 Feb 2022 16:27:55 +0100 Subject: [PATCH 206/226] Set default ticket type to OTHER if no default exists --- htdocs/install/mysql/data/llx_c_ticket_type.sql | 2 +- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_ticket_type.sql b/htdocs/install/mysql/data/llx_c_ticket_type.sql index 3b6fda322ad..85a85b0a63d 100644 --- a/htdocs/install/mysql/data/llx_c_ticket_type.sql +++ b/htdocs/install/mysql/data/llx_c_ticket_type.sql @@ -23,4 +23,4 @@ INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, descriptio INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROBLEM', '22', 'Problem', 0, 0, NULL); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('REQUEST', '25', 'Change or enhancement request', 1, 0, NULL); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('PROJECT', '30', 'Project', 0, 0, NULL); -INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 0, NULL); +INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('OTHER', '40', 'Other', 1, 1, NULL); diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 03261a5fe62..5e4cf4adfad 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -251,3 +251,5 @@ ALTER TABLE llx_reception MODIFY COLUMN ref_supplier varchar(128); ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation; +-- Set default ticket type to OTHER if no default exists +UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); \ No newline at end of file From b989c257ad956c79a5d990a1f51e733790416c79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 18:53:21 +0100 Subject: [PATCH 207/226] Fix report on salaries --- htdocs/compta/resultat/clientfourn.php | 45 ++++++++++++-------------- htdocs/compta/resultat/index.php | 27 ++++++++++------ 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index f650244d677..8f71015517c 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -857,34 +857,29 @@ if ($modecompta == 'BOOKKEEPING') { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { if ($modecompta == 'CREANCES-DETTES') { - $column = 'b.datev'; + $column = 's.dateep'; // We use the date of end of period of salary + + $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, s.label as label, date_format($column,'%Y-%m') as dm, sum(s.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; + $sql .= " WHERE s.entity IN (".getEntity('salary').")"; + if (!empty($date_start) && !empty($date_end)) { + $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; + } + $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, s.label, dm"; } else { $column = 'p.datep'; + $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid = p.fk_salary"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = s.fk_user"; + $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; + if (!empty($date_start) && !empty($date_end)) { + $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; + } + $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm"; } - $sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank=b.rowid"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user"; - $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; - if (!empty($date_start) && !empty($date_end)) { - $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; - } - $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm"; - - // For backward compatibility with old module salary - $sql .= " UNION "; - $sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank=b.rowid"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user"; - $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; - if (!empty($date_start) && !empty($date_end)) { - $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; - } - $sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; - $newsortfield = $sortfield; if ($newsortfield == 's.nom, s.rowid') { $newsortfield = 'u.firstname, u.lastname'; @@ -898,7 +893,7 @@ if ($modecompta == 'BOOKKEEPING') { $sql .= $db->order($newsortfield, $sortorder); } - dol_syslog("get payment salaries"); + dol_syslog("get salaries"); $result = $db->query($sql); $subtotal_ht = 0; $subtotal_ttc = 0; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 5f10013f294..2d3ba90cd7d 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -611,22 +611,31 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { if ($modecompta == 'CREANCES-DETTES') { - $column = 'b.datev'; + $column = 's.dateep'; // we use the date of end of period of salary + + $sql = "SELECT s.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(s.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; + $sql .= " WHERE s.entity IN (".getEntity('salary').")"; + if (!empty($date_start) && !empty($date_end)) { + $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'"; + } + $sql .= " GROUP BY s.label, dm"; } if ($modecompta == "RECETTES-DEPENSES") { $column = 'p.datep'; + + $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON p.fk_salary = s.rowid"; + $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; + if (!empty($date_start) && !empty($date_end)) { + $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'"; + } + $sql .= " GROUP BY p.label, dm"; } $subtotal_ht = 0; $subtotal_ttc = 0; - $sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank=b.rowid"; - $sql .= " WHERE p.entity IN (".getEntity('payment_salary').")"; - if (!empty($date_start) && !empty($date_end)) { - $sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'"; - } - $sql .= " GROUP BY p.label, dm"; dol_syslog("get social salaries payments"); $result = $db->query($sql); From 488049c6a657df9004bacdaef595b247cdb9b80f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 20:36:40 +0100 Subject: [PATCH 208/226] FIX bad position of extrafields for interventions --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/fichinter/card.php | 72 +++++++++++++++-------- 3 files changed, 49 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8dabc902e5c..4b3d6fca2d3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7699,7 +7699,7 @@ abstract class CommonObject if (empty($reshook)) { if (key_exists('label', $extrafields->attributes[$this->table_element]) && is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) { $out .= "\n"; - $out .= ' '; + $out .= ' '; $out .= "\n"; $extrafields_collapse_num = ''; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8d21a789648..daef20542a5 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -354,7 +354,7 @@ if ($nolinesbefore) { } if (is_object($objectline)) { $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); - ; + if (!empty($temps)) { print '
'; print $temps; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index a58a62b5ffd..e02a601c9cd 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1342,6 +1342,23 @@ if ($action == 'create') { print ''; // ancre pour retourner sur la ligne print dol_htmlentitiesbr($objp->description); + $objectline = new FichinterLigne($db); + $objectline->fetch($objp->rowid); + $objectline->fetch_optionals(); + + $extrafields->fetch_name_optionals_label($objectline->table_element); + + if (!empty($extrafields)) { + $temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', 1, 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; + } + } + + print '
'.(empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR) ?dol_print_date($db->jdate($objp->date_intervention), 'dayhour') : dol_print_date($db->jdate($objp->date_intervention), 'day')).'
'; } From acf6d195005b55b1ecb2c818c30af3e6a45d040a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 21:45:29 +0100 Subject: [PATCH 209/226] Fix CSS --- htdocs/core/class/html.form.class.php | 15 ++++++++------- htdocs/core/class/html.formcategory.class.php | 4 ++-- htdocs/core/class/html.formother.class.php | 19 ++++++++++--------- htdocs/projet/list.php | 6 +++--- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6e5c0a572d2..1bdd1161770 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1599,7 +1599,7 @@ class Form * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label - * @param string $moreclass Add more class to class style + * @param string $morecss Add more class to class style * @param integer $showsoc Add company into label * @param int $forcecombo Force to use combo box * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @@ -1609,10 +1609,10 @@ class Form * @return int <0 if KO, Nb of contact in list if OK * @deprecated You can use selectcontacts directly (warning order of param was changed) */ - public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') + public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') { // phpcs:enable - print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); + print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $morecss, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); return $this->num; } @@ -1629,7 +1629,7 @@ class Form * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label - * @param string $moreclass Add more class to class style + * @param string $morecss Add more class to class style * @param bool $options_only Return options only (for ajax treatment) * @param integer $showsoc Add company into label * @param int $forcecombo Force to use combo box (so no ajax beautify effect) @@ -1640,7 +1640,7 @@ class Form * @param integer $disableifempty Set tag 'disabled' on select if there is no choice * @return int|string <0 if KO, HTML with select string if OK. */ - public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) + public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) { global $conf, $langs, $hookmanager, $action; @@ -1687,7 +1687,7 @@ class Form $num = $this->db->num_rows($resql); if ($htmlname != 'none' && !$options_only) { - $out .= ''; } if ($showempty && ! is_numeric($showempty)) { @@ -2085,7 +2085,7 @@ class Form if ($num) { // Enhance with select2 include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out = ajax_combobox($htmlname).$out; + $out .= ajax_combobox($htmlname); } } else { dol_print_error($this->db); @@ -2094,6 +2094,7 @@ class Form if ($outputmode) { return $outarray; } + return $out; } diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 518a8f93290..1a2c02deb54 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -49,13 +49,13 @@ class FormCategory extends Form $categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1); $categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -"; - $tmptitle = $langs->trans("Category"); + $tmptitle = $langs->transnoentitiesnoconv("Category"); $filter = ''; $filter .= '
'; $filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); //$filter .= $langs->trans('Categories').": "; - $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300", 0, 0, '', '', $tmptitle); + $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300 widthcentpercentminusx", 0, 0, '', '', $tmptitle); $filter .= "
"; return $filter; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 0c55a1fd853..f1f0a846f93 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -473,15 +473,6 @@ class FormOther $langs->load('users'); $out = ''; - // Enhance with select2 - if ($conf->use_javascript_ajax) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - - $comboenhancement = ajax_combobox($htmlname); - if ($comboenhancement) { - $out .= $comboenhancement; - } - } $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectSalesRep', array(), $this, $action); @@ -622,6 +613,16 @@ class FormOther $out .= ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + + $comboenhancement = ajax_combobox($htmlname); + if ($comboenhancement) { + $out .= $comboenhancement; + } + } + return $out; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index b19bc407537..54cb72f744e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -821,12 +821,12 @@ $includeonly = ''; if (empty($user->rights->user->user->lire)) { $includeonly = array($user->id); } -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250'); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= ''; $moreforfilter .= '
'; $tmptitle = $langs->trans('ProjectsWithThisContact'); -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->selectcontacts(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; // If the user can view thirdparties other than his' @@ -834,7 +834,7 @@ if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } From eba20957f3572965aa029a7c0e4e47624b534964 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 25 Feb 2022 21:45:29 +0100 Subject: [PATCH 210/226] Fix CSS Conflicts: htdocs/projet/list.php --- htdocs/core/class/html.form.class.php | 15 ++++++++------- htdocs/core/class/html.formcategory.class.php | 4 ++-- htdocs/core/class/html.formother.class.php | 19 ++++++++++--------- htdocs/projet/list.php | 4 ++-- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8a0b66e0b78..f25c9aad9d3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1599,7 +1599,7 @@ class Form * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label - * @param string $moreclass Add more class to class style + * @param string $morecss Add more class to class style * @param integer $showsoc Add company into label * @param int $forcecombo Force to use combo box * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) @@ -1609,10 +1609,10 @@ class Form * @return int <0 if KO, Nb of contact in list if OK * @deprecated You can use selectcontacts directly (warning order of param was changed) */ - public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') + public function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') { // phpcs:enable - print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); + print $this->selectcontacts($socid, $selected, $htmlname, $showempty, $exclude, $limitto, $showfunction, $morecss, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); return $this->num; } @@ -1629,7 +1629,7 @@ class Form * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param integer $showfunction Add function into label - * @param string $moreclass Add more class to class style + * @param string $morecss Add more class to class style * @param bool $options_only Return options only (for ajax treatment) * @param integer $showsoc Add company into label * @param int $forcecombo Force to use combo box (so no ajax beautify effect) @@ -1640,7 +1640,7 @@ class Form * @param integer $disableifempty Set tag 'disabled' on select if there is no choice * @return int|string <0 if KO, HTML with select string if OK. */ - public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) + public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) { global $conf, $langs, $hookmanager, $action; @@ -1687,7 +1687,7 @@ class Form $num = $this->db->num_rows($resql); if ($htmlname != 'none' && !$options_only) { - $out .= ''; } if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { @@ -2080,7 +2080,7 @@ class Form if ($num) { // Enhance with select2 include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out = ajax_combobox($htmlname).$out; + $out .= ajax_combobox($htmlname); } } else { dol_print_error($this->db); @@ -2089,6 +2089,7 @@ class Form if ($outputmode) { return $outarray; } + return $out; } diff --git a/htdocs/core/class/html.formcategory.class.php b/htdocs/core/class/html.formcategory.class.php index 518a8f93290..1a2c02deb54 100644 --- a/htdocs/core/class/html.formcategory.class.php +++ b/htdocs/core/class/html.formcategory.class.php @@ -49,13 +49,13 @@ class FormCategory extends Form $categoryArray = $this->select_all_categories($type, "", "", 64, 0, 1); $categoryArray[-2] = "- ".$langs->trans('NotCategorized')." -"; - $tmptitle = $langs->trans("Category"); + $tmptitle = $langs->transnoentitiesnoconv("Category"); $filter = ''; $filter .= '
'; $filter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); //$filter .= $langs->trans('Categories').": "; - $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300", 0, 0, '', '', $tmptitle); + $filter .= Form::multiselectarray($htmlName, $categoryArray, $preSelected, 0, 0, "minwidth300 widthcentpercentminusx", 0, 0, '', '', $tmptitle); $filter .= "
"; return $filter; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 2b7466628a5..aa0e5486761 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -473,15 +473,6 @@ class FormOther $langs->load('users'); $out = ''; - // Enhance with select2 - if ($conf->use_javascript_ajax) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - - $comboenhancement = ajax_combobox($htmlname); - if ($comboenhancement) { - $out .= $comboenhancement; - } - } $reshook = $hookmanager->executeHooks('addSQLWhereFilterOnSelectSalesRep', array(), $this, $action); @@ -622,6 +613,16 @@ class FormOther $out .= ''; + // Enhance with select2 + if ($conf->use_javascript_ajax) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + + $comboenhancement = ajax_combobox($htmlname); + if ($comboenhancement) { + $out .= $comboenhancement; + } + } + return $out; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6019011956a..552022f883f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -806,7 +806,7 @@ $includeonly = ''; if (empty($user->rights->user->user->lire)) { $includeonly = array($user->id); } -$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250'); +$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= ''; // If the user can view thirdparties other than his' @@ -814,7 +814,7 @@ if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } From fb0e2f9c6c87fcaa05c59212a62573d5b9c9c2be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Feb 2022 01:00:22 +0100 Subject: [PATCH 211/226] FIX #yogosha9095 --- htdocs/core/lib/geturl.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 50ae7c33561..1f6c088ac1b 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -215,7 +215,14 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = } // Common check on ip (local and external) - $arrayofmetadataserver = array('100.100.100.200' => 'Alibaba', '192.0.0.192'=> 'Oracle', '192.80.8.124'=>'Packet'); + // See list on https://tagmerge.com/gist/a7b9d57ff8ec11d63642f8778609a0b8 + // Not evasive url that ar enot IP are excluded by test on IP v4/v6 validity. + $arrayofmetadataserver = array( + '100.100.100.200' => 'Alibaba', + '192.0.0.192' => 'Oracle', + '192.80.8.124' => 'Packet', + '100.88.222.5' => 'Tencent cloud', + ); foreach ($arrayofmetadataserver as $ipofmetadataserver => $nameofmetadataserver) { if ($iptocheck == $ipofmetadataserver) { $info['http_code'] = 400; From 5d0408f7af4bef67ea24b5ab469968feac1f600e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Feb 2022 19:15:40 +0100 Subject: [PATCH 212/226] Fix filter on member list --- htdocs/adherents/list.php | 8 ++++---- htdocs/projet/list.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 322c08bd77c..996f2d16c8d 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -307,7 +307,7 @@ $memberstatic = new Adherent($db); $now = dol_now(); -if (!empty($search_categ) || !empty($catid)) { +if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { $sql = "SELECT DISTINCT"; } else { $sql = "SELECT"; @@ -336,7 +336,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; if (!empty($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 (d.rowid = ef.fk_object)"; } -if (!empty($search_categ) || !empty($catid)) { +if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { // We need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; } @@ -540,7 +540,7 @@ if ($search_login) { if ($search_email) { $param .= "&search_email=".urlencode($search_email); } -if ($search_categ) { +if ($search_categ > 0 || $search_categ == -2) { $param .= "&search_categ=".urlencode($search_categ); } if ($search_company) { @@ -573,7 +573,7 @@ if ($search_phone_mobile != '') { if ($search_filter && $search_filter != '-1') { $param .= "&search_filter=".urlencode($search_filter); } -if ($search_status != "" && $search_status != Adherent::STATUS_DRAFT) { +if ($search_status != "" && $search_status != -3) { $param .= "&search_status=".urlencode($search_status); } if ($search_type > 0) { diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 552022f883f..cc9099b463b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -687,7 +687,7 @@ if ($search_opp_percent != '') { if ($search_public != '') { $param .= '&search_public='.urlencode($search_public); } -if ($search_project_user != '') { +if ($search_project_user > 0) { $param .= '&search_project_user='.urlencode($search_project_user); } if ($search_sale > 0) { From 2ce50b6c00cb830552f614a787de657428fb1a33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 26 Feb 2022 19:30:46 +0100 Subject: [PATCH 213/226] CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f26e9765db2..b88cecda187 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5210,7 +5210,7 @@ td.cal_other_month { /* ============================================================================== */ /* CSS for treeview */ -.treeview ul { background-color: transparent !important; margin-bottom: 4px !important; margin-top: 0 !important; padding-top: 8px !important; } +.treeview ul { background-color: transparent !important; margin-bottom: 4px !important; margin-top: 0 !important; padding-top: 2px !important; } .treeview li { background-color: transparent !important; padding: 0 0 0 16px !important; min-height: 30px; } .treeview .hover { color: var(--colortextlink) !important; text-decoration: underline !important; } .treeview .hitarea { margin-top: 3px; } @@ -6223,7 +6223,7 @@ span.noborderoncategories a, li.noborderoncategories a { /* vertical-align: top; */ } span.noborderoncategories { - padding: 4px 5px 0px 5px; + padding: 3px 5px 3px 5px; display: inline-block; } .categtextwhite, .treeview .categtextwhite.hover { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index aeb25a84933..15c9ef74612 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6063,7 +6063,7 @@ span.noborderoncategories a, li.noborderoncategories a { line-height: normal; } span.noborderoncategories { - padding: 3px 5px 0px 5px; + padding: 3px 5px 3px 5px; } .categtextwhite, .treeview .categtextwhite.hover { color: #fff !important; From b598671484ee0ddae7ab85c6339dcee1b01d3b7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Feb 2022 14:46:40 +0100 Subject: [PATCH 214/226] NEW ACE Editor is restored at same cursor position after a save --- htdocs/core/class/doleditor.class.php | 18 +++++++++++---- htdocs/website/index.php | 33 ++++++++++++++++++--------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index da98719d828..60de007ee6c 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -44,6 +44,8 @@ class DolEditor public $height; public $width; public $readonly; + public $posx; + public $posy; /** @@ -64,8 +66,9 @@ class DolEditor * @param int $rows Size of rows for textarea tool * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') * @param int $readonly 0=Read/Edit, 1=Read only + * @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y) */ - public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0) + public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array()) { global $conf, $langs; @@ -106,8 +109,10 @@ class DolEditor $this->toolbarstartexpanded = $toolbarstartexpanded; $this->rows = max(ROWS_3, $rows); $this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max - $this->height = $height; + $this->height = $height; $this->width = $width; + $this->posx = empty($poscursor['x']) ? 0 : $poscursor['x']; + $this->posy = empty($poscursor['y']) ? 0 : $poscursor['y']; } } @@ -257,9 +262,12 @@ class DolEditor $out .= '