From d9a1e1b348cb4b0ec1633cd0cf28cef4d0aba351 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 10:01:11 +0100 Subject: [PATCH 01/23] Fix several non dolibarr behaviour on input of salary payments --- htdocs/compta/accounting-files.php | 6 +-- htdocs/langs/en_US/main.lang | 1 + htdocs/salaries/card.php | 72 +++++++++++++++++------------- 3 files changed, 45 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index a7de150edee..ac019de8088 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -136,7 +136,7 @@ if (($action == "searchfiles" || $action == "dl")) { $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; $sql .= " UNION ALL"; // Paiements of salaries - $sql .= " SELECT t.rowid as id, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " SELECT t.rowid as id, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -450,7 +450,7 @@ if (!empty($date_start) && !empty($date_stop)) print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'nowrap '); + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "item", "", $param, '', $sortfield, $sortorder, 'nowrap '); print_liste_field_titre($arrayfields['date']['label'], $_SERVER["PHP_SELF"], "date", "", $param, '', $sortfield, $sortorder, 'center nowrap '); print ''; print ''; @@ -465,7 +465,7 @@ if (!empty($date_start) && !empty($date_stop)) print ''; if ($result) { - $TData = dol_sort_array($filesarray, 'date', 'ASC'); + $TData = dol_sort_array($filesarray, $sortfield, $sortorder); if (empty($TData)) { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index b177abf75fd..fa9f48ee4c4 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -171,6 +171,7 @@ NotValidated=Not validated Save=Save SaveAs=Save As SaveAndStay=Save and stay +SaveAndNew=Save and new TestConnection=Test connection ToClone=Clone ConfirmClone=Choose data you want to clone: diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index c9ccd78c244..798ef8dab4a 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -41,11 +41,17 @@ if (! empty($conf->projet->enabled)) $langs->loadLangs(array("compta","banks","bills","users","salaries","hrm")); if (! empty($conf->projet->enabled)) $langs->load("projects"); -$id=GETPOST("id", 'int'); -$action=GETPOST('action', 'aZ09'); -$cancel= GETPOST('cancel', 'aZ09'); +$id = GETPOST("id", 'int'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); +$accountid = GETPOST("accountid", 'int'); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); +$datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int')); +$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int')); +$datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int')); +$dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int')); + // Security check $socid = GETPOST("socid", "int"); if ($user->socid) $socid=$user->socid; @@ -60,6 +66,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('salarycard', 'globalcard')); + /** * Actions */ @@ -74,34 +81,30 @@ if ($cancel) if ($action == 'classin' && $user->rights->banque->modifier) { $object->fetch($id); - $object->setProject(GETPOST('projectid')); + $object->setProject($projectid); } if ($action == 'add' && empty($cancel)) { $error = 0; - $datep = dol_mktime(12, 0, 0, GETPOST("datepmonth", 'int'), GETPOST("datepday", 'int'), GETPOST("datepyear", 'int')); - $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", 'int'), GETPOST("datevyear", 'int')); - $datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int')); - $dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int')); if (empty($datev)) $datev = $datep; $type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1); - $object->accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0; - $object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user", "int") : 0; + $object->accountid = GETPOST("accountid", 'int') > 0 ? GETPOST("accountid", "int") : 0; + $object->fk_user = GETPOST("fk_user", 'int') > 0 ? GETPOST("fk_user", "int") : 0; $object->datev = $datev; $object->datep = $datep; - $object->amount = price2num(GETPOST("amount")); - $object->label = GETPOST("label"); + $object->amount = price2num(GETPOST("amount", 'alpha')); + $object->label = GETPOST("label", 'alphanohtml'); $object->datesp = $datesp; $object->dateep = $dateep; - $object->note = GETPOST("note"); + $object->note = GETPOST("note", 'none'); $object->type_payment = ($type_payment > 0 ? $type_payment : 0); - $object->num_payment = GETPOST("num_payment"); + $object->num_payment = GETPOST("num_payment", 'alphanohtml'); $object->fk_user_author = $user->id; - $object->fk_project = GETPOST('fk_project', 'int'); + $object->fk_project = $projectid; // Set user current salary as ref salary for the payment $fuser = new User($db); @@ -146,8 +149,15 @@ if ($action == 'add' && empty($cancel)) if ($ret > 0) { $db->commit(); - header("Location: list.php"); - exit; + + if (GETPOST('saveandnew', 'alpha')) { + setEventMessages($langs->trans("RecordSaved"), '', 'mesgs'); + header("Location: card.php?action=create&fk_project=".urlencode($projectid)."&accountid=".urlencode($accountid).'&paymenttype='.urlencode(GETPOST('paymenttype', 'az09')).'&datepday='.GETPOST("datepday", 'int').'&datepmonth='.GETPOST("datepmonth", 'int').'&datepyear='.GETPOST("datepyear", 'int')); + exit; + } else { + header("Location: list.php"); + exit; + } } else { @@ -272,13 +282,6 @@ if ($action == 'create') print $form->selectDate((empty($datev) ?-1 : $datev), "datev", '', '', '', 'add', 1, 1); print ''; - // Employee - print ''; - // Label print ''; + // Employee + print ''; + // Amount print ''; } @@ -320,14 +328,14 @@ if ($action == 'create') { print ''; } // Type payment print ''; // Number @@ -354,8 +362,10 @@ if ($action == 'create') dol_fiche_end(); print '
'; - print ''; - print '     '; + print ''; + print '     '; + print ''; + print '     '; print ''; print '
'; From 38c8b79c5485ecff93e1301d88e2bafcf4e8cf4f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 10:03:10 +0100 Subject: [PATCH 02/23] Fix clear search field --- htdocs/salaries/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 50bb56bbd28..ba833d79d48 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -80,6 +80,7 @@ else 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_ref = ""; + $search_user = ""; $search_label = ""; $search_amount = ""; $search_account = ''; From e8db3a2aa0035839b784912db3ab93c0e5818b54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 10:17:20 +0100 Subject: [PATCH 03/23] Fix look and feel v11 --- htdocs/ticket/card.php | 2 +- htdocs/ticket/class/actions_ticket.class.php | 7 ++----- htdocs/user/class/user.class.php | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index b03ca04461d..940710ff55c 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -970,7 +970,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print ''; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print '
'.$langs->trans("Ref").''.$langs->trans("Document").'
'; - print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).''; - $noactive = 0; // We keep active and unactive users - print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); - print '
'; print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).''; @@ -297,6 +300,13 @@ if ($action == 'create') print $form->selectDate($dateep, "dateep", '', '', '', 'add'); print '
'; + print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).''; + $noactive = 0; // We keep active and unactive users + print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); + print '
'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; @@ -309,9 +319,7 @@ if ($action == 'create') $formproject = new FormProjets($db); print '
'.$langs->trans("Project").''; - - $numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); - + $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); print '
'; print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).''; - $form->select_comptes($_POST["accountid"], "accountid", 0, '', 1); // Affiche liste des comptes courant + $form->select_comptes($accountid, "accountid", 0, '', 1); // Affiche liste des comptes courant print '
'; print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).''; - $form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2); + $form->select_types_paiements(GETPOST("paymenttype", 'aZ09'), "paymenttype", '', 2); print '
'; + print '
'; print ''; print '
'; print $langs->trans('Properties'); diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index f6d03d3360a..2f2a8313c50 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -192,7 +192,7 @@ class ActionsTicket // Initial message print '
'; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; + print '
'; print ''; // Line to enter new values - print ""; + print ''; $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. @@ -597,44 +597,9 @@ if ($id) // Title of lines print ''; - foreach ($fieldlist as $field => $value) - { - // Determine le nom du champ par rapport aux noms possibles - // dans les dictionnaires de donnees - $showfield=1; // By defaut - $class="left"; - $sortable=1; - $valuetoshow=''; - /* - $tmparray=getLabelOfField($fieldlist[$field]); - $showfield=$tmp['showfield']; - $valuetoshow=$tmp['valuetoshow']; - $align=$tmp['align']; - $sortable=$tmp['sortable']; - */ - $valuetoshow=ucfirst($fieldlist[$field]); // By defaut - $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='code') { - $valuetoshow=$langs->trans("Code"); - } - if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { - $valuetoshow=$langs->trans("Label"); - } - if ($fieldlist[$field]=='country') { - $valuetoshow=$langs->trans("Country"); - } - if ($fieldlist[$field]=='country_id') { - $showfield=0; - } - if ($fieldlist[$field]=='fk_pcg_version') { - $valuetoshow=$langs->trans("Pcg_version"); - } - - // Affiche nom du champ - if ($showfield) { - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' '); - } - } + print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, ''); + print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, ''); + print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, ''); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList(''); print getTitleFieldOfList(''); diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql index 6a04816ca27..845b68e54a4 100644 --- a/htdocs/install/mysql/data/llx_accounting_abc.sql +++ b/htdocs/install/mysql/data/llx_accounting_abc.sql @@ -77,6 +77,10 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE -- Description of chart of account MA PCG INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 12, 'PCG', 'The Moroccan chart of accounts', 1); +-- Description of chart of account SE BAS-K1-MINI +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 20, 'BAS-K1-MINI', 'The Swedish mini chart of accounts', 1); + + --DELETE FROM llx_accounting_system WHERE pcg_version = 'SYSCOHADA'; -- Description of chart of account BJ SYSCOHADA diff --git a/htdocs/install/mysql/data/llx_accounting_account_se.sql b/htdocs/install/mysql/data/llx_accounting_account_se.sql new file mode 100644 index 00000000000..0a0c890bcf6 --- /dev/null +++ b/htdocs/install/mysql/data/llx_accounting_account_se.sql @@ -0,0 +1,60 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011-2017 Alexandre Spangaro +-- Copyright (C) 2019 swedebugia +-- +-- 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 . +-- + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l'install et tous les sigles '--' sont supprimés. +-- + +-- Description of the accounts in BAS-K1-MINI +-- ADD 2000000 to rowid # Do no remove this comment -- + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1, 'BAS-K1-MINI', 'IMMO', '', '1000', '0', 'Immateriella anläggningstillgångar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 2, 'BAS-K1-MINI', 'IMMO', '', '1110', '0', 'Byggnader och markanläggningar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 3, 'BAS-K1-MINI', 'IMMO', '', '1130', '0', 'Mark och andra tillgångar som inte får skrivas av', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 4, 'BAS-K1-MINI', 'IMMO', '', '1220', '0', 'Maskiner och inventarier', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 5, 'BAS-K1-MINI', 'IMMO', '', '1300', '0', 'Övriga anläggningstillgångar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 6, 'BAS-K1-MINI', 'CAPIT', '', '1400', '0', 'Varulager', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7, 'BAS-K1-MINI', 'CAPIT', '', '1500', '0', 'Kundfordringar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 8, 'BAS-K1-MINI', 'CAPIT', '', '1600', '0', 'Övriga fordringar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 9, 'BAS-K1-MINI', 'CAPIT', '', '1920', '0', 'Kassa och bank', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 10, 'BAS-K1-MINI', 'FINAN', '', '2010', '0', 'Eget kapital', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 11, 'BAS-K1-MINI', 'FINAN', '', '2330', '0', 'Låneskulder', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 12, 'BAS-K1-MINI', 'FINAN', '', '2610', '0', 'Skatteskulder', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 13, 'BAS-K1-MINI', 'FINAN', '', '2440', '0', 'Leverantörsskulder', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 14, 'BAS-K1-MINI', 'FINAN', '', '2900', '0', 'Övriga skulder', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 15, 'BAS-K1-MINI', 'INCOME', '', '3000', '0', 'Försäljning och utfört arbete samt övriga momspliktiga intäkter', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 16, 'BAS-K1-MINI', 'INCOME', '', '3100', '0', 'Momsfria intäkter', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 17, 'BAS-K1-MINI', 'INCOME', '', '3200', '0', 'Bil- och bostadsförmån m.m.', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 18, 'BAS-K1-MINI', 'INCOME', '', '8310', '0', 'Ränteintäkter', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 19, 'BAS-K1-MINI', 'EXPENSE', '', '4000', '0', 'Varor, material och tjänster', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 20, 'BAS-K1-MINI', 'EXPENSE', '', '6900', '0', 'Övriga externa kostnader', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 21, 'BAS-K1-MINI', 'EXPENSE', '', '7000', '0', 'Anställd personal', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 22, 'BAS-K1-MINI', 'EXPENSE', '', '8410', '0', 'Räntekostnader m.m.', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 23, 'BAS-K1-MINI', 'OTHER', '', '7820', '0', 'Avskrivningar och nedskrivningar av byggnader och markanläggningar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 24, 'BAS-K1-MINI', 'OTHER', '', '7810', '0', 'Avskrivningar och nedskrivningar av maskiner och inventarier och immateriella tillgångar', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 25, 'BAS-K1-MINI', 'OTHER', '', '2080', '0', 'Periodiseringsfonder', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 26, 'BAS-K1-MINI', 'OTHER', '', '2050', '0', 'Expansionsfond', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 27, 'BAS-K1-MINI', 'OTHER', '', '2060', '0', 'Ersättningsfonder', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 28, 'BAS-K1-MINI', 'OTHER', '', '2070', '0', 'Insatsemissioner, skogskonto, upphovsmannakonto, avbetalningsplan på skog o.d.', 1); diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index e35be192bd5..d3c15dc3f68 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -59,6 +59,8 @@ ALTER TABLE llx_emailcollector_emailcollectoraction ADD COLUMN position integer -- For v11 +INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 20, 'BAS-K1-MINI', 'The Swedish mini chart of accounts', 1); + ALTER TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(64) NOT NULL; ALTER TABLE llx_societe_account ADD COLUMN site_account varchar(128); From fb02582de08e97a0a4cca911eafbee04a210a887 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 12:05:18 +0100 Subject: [PATCH 07/23] Fix clean of constant _TABS_ was forgotten --- htdocs/install/repair.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index b46e9713983..e433ec27f8c 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -68,18 +68,23 @@ $actiondone=1; print '

'.$langs->trans("Repair").'

'; print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST('standard', 'alpha')?GETPOST('standard', 'alpha'):'undefined').'
'."\n"; +// Disable modules +print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; +// Files print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha')?GETPOST('restore_thirdparties_logos', 'alpha'):'undefined').'
'."\n"; print 'Option restore_user_pictures (\'test\' or \'confirmed\') is '.(GETPOST('restore_user_pictures', 'alpha')?GETPOST('restore_user_pictures', 'alpha'):'undefined').'
'."\n"; +print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'
'."\n"; +// Clean tables and data print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha')?GETPOST('clean_linked_elements', 'alpha'):'undefined').'
'."\n"; print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha')?GETPOST('clean_menus', 'alpha'):'undefined').'
'."\n"; print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha')?GETPOST('clean_orphelin_dir', 'alpha'):'undefined').'
'."\n"; print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha')?GETPOST('clean_product_stock_batch', 'alpha'):'undefined').'
'."\n"; -print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'
'."\n"; -print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha')?GETPOST('rebuild_product_thumbs', 'alpha'):'undefined').'
'."\n"; -print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'
'."\n"; -print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'):'undefined').'
'."\n"; +// Init data +print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha')?GETPOST('set_empty_time_spent_amount', 'alpha'):'undefined').'
'."\n"; +// Structure +print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; print '
'; print '
'; print $langs->trans("InitialMessage"); print ''; @@ -381,9 +381,6 @@ class ActionsTicket print '
'; print '
'; print '
'; - print '
'; - print '' . $langs->trans('TicketChangeStatus') . ''; - print '
'; // Exclude status which requires specific method $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED); // Exclude actual status @@ -394,7 +391,7 @@ class ActionsTicket foreach ($object->statuts_short as $status => $status_label) { if (!in_array($status, $exclude_status)) { - print '
'; + print '
'; if ($status == 1) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7b89c21972b..3a4f6aee138 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2436,7 +2436,7 @@ class User extends CommonObject } if ($withpictoimg > -2 && $withpictoimg != 2) { - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= ''; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= ''; if ($mode == 'login') $result .= dol_trunc($this->login, $maxlen); else $result .= $this->getFullName($langs, '', ($mode == 'firstelselast' ? 3 : ($mode == 'firstname' ? 2 : -1)), $maxlen); if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= ''; From fea34fa908cee1ca188899fde4cb57831b3c4e1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 10:41:59 +0100 Subject: [PATCH 04/23] Fix load of CSS using dolibarr server --- htdocs/public/website/styles.css.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php index 0cf70fdf2b1..e8e4e9a8378 100644 --- a/htdocs/public/website/styles.css.php +++ b/htdocs/public/website/styles.css.php @@ -82,7 +82,9 @@ if (empty($pageid)) { $object->fetch(0, $website); } + $objectpage=new WebsitePage($db); + /* Not required for CSS file $array=$objectpage->fetchAll($object->id); if (is_array($array) && count($array) > 0) @@ -90,13 +92,16 @@ if (empty($pageid)) $firstrep=reset($array); $pageid=$firstrep->id; } + */ } +/* Not required for CSS file if (empty($pageid)) { $langs->load("website"); print $langs->trans("PreviewOfSiteNotYetAvailable"); exit; } +*/ // Security: Delete string ../ into $original_file global $dolibarr_main_data_root; From 2afaed69819b0e1646bc29b2e482b77a424554bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 10:50:23 +0100 Subject: [PATCH 05/23] Fix bad use of MAIN_MAX_DECIMALS_UNIT_ for foreign currencies --- htdocs/core/lib/price.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 5ff4c77ae2e..c06c4431562 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -378,9 +378,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $keyforforeignMAIN_MAX_DECIMALS_TOT = 'MAIN_MAX_DECIMALS_TOT_'.$multicurrency_code; $keyforforeignMAIN_ROUNDING_RULE_TOT = 'MAIN_ROUNDING_RULE_TOT_'.$multicurrency_code; if (!empty($conf->global->$keyforforeignMAIN_ROUNDING_RULE_TOT)) { - $conf->global->MAIN_MAX_DECIMALS_UNIT = $keyforforeignMAIN_MAX_DECIMALS_UNIT; - $conf->global->MAIN_MAX_DECIMALS_TOT = $keyforforeignMAIN_MAX_DECIMALS_TOT; - $conf->global->MAIN_ROUNDING_RULE_TOT = $keyforforeignMAIN_ROUNDING_RULE_TOT; + $conf->global->MAIN_MAX_DECIMALS_UNIT = $conf->global->$keyforforeignMAIN_MAX_DECIMALS_UNIT; + $conf->global->MAIN_MAX_DECIMALS_TOT = $conf->global->$keyforforeignMAIN_MAX_DECIMALS_TOT; + $conf->global->MAIN_ROUNDING_RULE_TOT = $conf->global->$keyforforeignMAIN_ROUNDING_RULE_TOT; } } From d1fdd11b3759d63ec05b450c816ea099338a8bb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 11:32:10 +0100 Subject: [PATCH 06/23] Close #10907 --- htdocs/accountancy/admin/accountmodel.php | 43 ++----------- .../install/mysql/data/llx_accounting_abc.sql | 4 ++ .../mysql/data/llx_accounting_account_se.sql | 60 +++++++++++++++++++ .../install/mysql/migration/10.0.0-11.0.0.sql | 2 + 4 files changed, 70 insertions(+), 39 deletions(-) create mode 100644 htdocs/install/mysql/data/llx_accounting_account_se.sql diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index b19303f7d38..2e39105eb21 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -509,7 +509,7 @@ if ($id) print '
'; @@ -345,13 +350,13 @@ if ($ok && GETPOST('standard', 'alpha')) // clean declaration constants if ($ok && GETPOST('standard', 'alpha')) { - print ''; + print ''; $sql ="SELECT name, entity, value"; $sql.=" FROM ".MAIN_DB_PREFIX."const as c"; $sql.=" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'"; $sql.=" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'"; - $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE' OR name LIKE 'MAIN_MODULE_%_TABS_%'"; $sql.=" ORDER BY name, entity"; $resql = $db->query($sql); @@ -376,7 +381,7 @@ if ($ok && GETPOST('standard', 'alpha')) $sql2 ="SELECT COUNT(*) as nb"; $sql2.=" FROM ".MAIN_DB_PREFIX."const as c"; - $sql2.=" WHERE name LIKE 'MAIN_MODULE_".$name."'"; + $sql2.=" WHERE name = 'MAIN_MODULE_".$name."'"; $sql2.=" AND entity = ".$obj->entity; $resql2 = $db->query($sql2); if ($resql2) @@ -384,7 +389,7 @@ if ($ok && GETPOST('standard', 'alpha')) $obj2 = $db->fetch_object($resql2); if ($obj2 && $obj2->nb == 0) { - // Module not found, so we canremove entry + // Module not found, so we can remove entry $sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."const WHERE name = '".$db->escape($obj->name)."' AND entity = ".$obj->entity; if (GETPOST('standard', 'alpha') == 'confirmed') From 7e526f4f419dc702cba80c2306d7912944ff0770 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 12:28:50 +0100 Subject: [PATCH 08/23] Fix repair.php removed tabs when it should not --- htdocs/install/repair.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index e433ec27f8c..78abde9caa1 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -357,6 +357,7 @@ if ($ok && GETPOST('standard', 'alpha')) $sql.=" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'"; $sql.=" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'"; $sql.=" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE' OR name LIKE 'MAIN_MODULE_%_TABS_%'"; + $sql.=" OR name LIKE 'MAIN_MODULE_%_MODULEFOREXTERNAL'"; $sql.=" ORDER BY name, entity"; $resql = $db->query($sql); @@ -374,7 +375,7 @@ if ($ok && GETPOST('standard', 'alpha')) $obj=$db->fetch_object($resql); $reg = array(); - if (preg_match('/MAIN_MODULE_(.*)_(.*)/i', $obj->name, $reg)) + if (preg_match('/MAIN_MODULE_([^_]+)_(.+)/i', $obj->name, $reg)) { $name=$reg[1]; $type=$reg[2]; @@ -396,11 +397,11 @@ if ($ok && GETPOST('standard', 'alpha')) { $db->query($sqldelete); - print ''; + print ''; } else { - print ''; + print ''; } } else @@ -415,6 +416,8 @@ if ($ok && GETPOST('standard', 'alpha')) $db->commit(); } + } else { + dol_print_error($db); } } From 3cef84f26d57f6232cd1fd14275897fe5591e0ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 12:34:58 +0100 Subject: [PATCH 09/23] Move feature from experimental to stable --- ChangeLog | 3 ++- htdocs/core/menus/standard/eldy.lib.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7091a7010ba..e3a5ef0cbbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,7 +11,8 @@ NEW: Can set the Address/Contact by default on third parties. NEW: Add a dictionary for list of Social networks NEW: A nicer dashboard for open elements on Home page. NEW: Add task widget and add task progress bar -NEW: Support of deployement of metapackages +NEW: Support of deployment of metapackages +NEW: Menu "Export accounting document" to generate a zip with all documents requested by a bookkeeper is now stable. NEW: Add button "Save and Stay" in website editor of pages. NEW: Accountancy - Can add specific widget in this accountancy area. NEW: Accountancy - Add export model LDCompta V9 & higher diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d1db12b9e2e..99bd8042890 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1316,7 +1316,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Files - if ((!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || !empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU)) + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); } From 44978db0279a1b3f732c315fbf335a02d890f3c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 13:41:43 +0100 Subject: [PATCH 10/23] FIX The substitution variable array was not complete --- htdocs/core/menus/standard/auguria.lib.php | 9 +++++---- htdocs/core/menus/standard/eldy.lib.php | 9 +++++---- htdocs/core/menus/standard/empty.php | 11 +++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index cc8a2d42ce5..e35f45576d1 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -52,6 +52,8 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $menuArbo = new Menubase($db, 'auguria'); $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria', $tabMenu); + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + if (empty($noout)) print_start_menu_array_auguria(); global $usemenuhider; @@ -75,8 +77,6 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $showmode=dol_auguria_showmenu($type_user, $newTabMenu[$i], $listofmodulesforexternal); if ($showmode == 1) { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); $url = $shorturl = $newTabMenu[$i]['url']; @@ -314,6 +314,8 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t print "\n"; } + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + // We update newmenu with entries found into database $menuArbo = new Menubase($db, 'auguria'); $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid?1:0), 'auguria', $tabMenu); @@ -512,8 +514,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t } // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility + $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 99bd8042890..253b745e25f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -52,6 +52,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $id = 'mainmenu'; $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + if (empty($noout)) print_start_menu_array(); $usemenuhider = 1; @@ -448,8 +450,6 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $showmode = isVisibleToUserType($type_user, $newTabMenu[$i], $listofmodulesforexternal); if ($showmode == 1) { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); // url = url from host, shorturl = relative path into dolibarr sources @@ -679,6 +679,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print "\n"; } + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + /** * We update newmenu with entries found into database * -------------------------------------------------- @@ -1982,8 +1984,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility + $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray); $url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url']; diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 290ef0a959c..923f4e84965 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -146,6 +146,7 @@ class MenuManager $this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname); + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); // $this->menu->liste is top menu //var_dump($this->menu->liste);exit; @@ -156,8 +157,6 @@ class MenuManager print '
    '; print '
  • '; - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val['url'] = make_substitutions($val['url'], $substitarray); if ($val['enabled'] == 1) @@ -257,8 +256,6 @@ class MenuManager if ($showmenu) // Visible (option to hide when not allowed is off or allowed) { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val2['url'] = make_substitutions($val2['url'], $substitarray); $relurl2 = dol_buildpath($val2['url'], 1); @@ -453,13 +450,13 @@ class MenuManager /* if ($mode == 'jmobile') { + $substitarray = getCommonSubstitutionArray($langs, 0, null, null); + foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { print '
      '; print '
    • '; - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val['url'] = make_substitutions($val['url'], $substitarray); if ($val['enabled'] == 1) @@ -487,8 +484,6 @@ class MenuManager } foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { - $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); - $substitarray['__USERID__'] = $user->id; // For backward compatibility $val2['url'] = make_substitutions($val2['url'], $substitarray); $relurl2=dol_buildpath($val2['url'],1); From 03649ea2c8d49972f962e2d7b553b3511cc3455f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 19 Dec 2019 19:09:56 +0100 Subject: [PATCH 11/23] Fix pb with svg images --- htdocs/core/lib/images.lib.php | 6 +++--- htdocs/product/class/product.class.php | 12 ++++++++---- htdocs/theme/eldy/global.inc.php | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 1d1a6b8c7b9..1e6ebfa6d85 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -33,7 +33,7 @@ $quality = 80; * Return if a filename is file name of a supported image format * * @param string $file Filename - * @return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported by this PHP + * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP */ function image_format_supported($file) { @@ -57,12 +57,12 @@ function image_format_supported($file) { if (!function_exists($imgfonction)) { - // Fonctions de conversion non presente dans ce PHP + // Fonctions of conversion not available in this PHP return 0; } } - // Filename is a format image and supported by this PHP + // Filename is a format image and supported for conversion by this PHP return 1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e32f0c32f8f..8b7d27073c0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4835,8 +4835,10 @@ class Product extends CommonObject global $conf; $dir = $sdir; - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $dir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'product').$this->id."/photos/"; - } else { $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref).'/'; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + $dir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'product').$this->id."/photos/"; + } else { + $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref).'/'; } $nbphoto = 0; @@ -4847,9 +4849,11 @@ class Product extends CommonObject if (is_resource($handle)) { while (($file = readdir($handle)) !== false) { - if (!utf8_check($file)) { $file = utf8_encode($file); // To be sure data is stored in UTF8 in memory + if (!utf8_check($file)) { + $file = utf8_encode($file); // To be sure data is stored in UTF8 in memory } - if (dol_is_file($dir.$file) && image_format_supported($file) > 0) { return true; + if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) { + return true; } } } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a15b6a3dd81..d18c3806363 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1446,7 +1446,7 @@ div.heightref { min-height: 80px; } div.divphotoref { - padding-: 20px; + padding-: 10px; } div.paginationref { padding-bottom: 10px; @@ -3602,6 +3602,7 @@ label.radioprivate { .photowithmargin { margin-bottom: 2px; margin-top: 10px; + margin-right: 10px; } .photowithborder { border: 1px solid #f0f0f0; From bceba83f0c54e4ccd203e2a0f68f6e46f4ee6315 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Dec 2019 10:42:05 +0100 Subject: [PATCH 12/23] Fix position of fields --- htdocs/societe/list.php | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 1cc10743c3a..47a116c7fdf 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -174,36 +174,36 @@ $checkedprofid6 = 0; $checkprospectlevel = (in_array($contextpage, array('prospectlist')) ? 1 : 0); $checkstcomm = (in_array($contextpage, array('prospectlist')) ? 1 : 0); $arrayfields = array( - 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), - 's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1), - 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1), - 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), - 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled))), - 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled))), - 's.town'=>array('label'=>"Town", 'checked'=>1), - 's.zip'=>array('label'=>"Zip", 'checked'=>1), - 'state.nom'=>array('label'=>"State", 'checked'=>0), - 'region.nom'=>array('label'=>"Region", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 's.email'=>array('label'=>"Email", 'checked'=>0), - 's.url'=>array('label'=>"Url", 'checked'=>0), - 's.phone'=>array('label'=>"Phone", 'checked'=>1), - 's.fax'=>array('label'=>"Fax", 'checked'=>0), - 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'staff.code'=>array('label'=>"Staff", 'checked'=>0), - 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), - 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), - 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), - 's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4), - 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), - 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), - 's.tva_intra'=>array('label'=>"VATIntraShort", 'checked'=>0), - 'customerorsupplier'=>array('label'=>'NatureOfThirdParty', 'checked'=>1), - 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), - 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), - 's2.nom'=>array('label'=>'ParentCompany', 'checked'=>0), + 's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), + 's.nom'=>array('label'=>"ThirdPartyName", 'position'=>2, 'checked'=>1), + 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1), + 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), + 's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode), + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled))), + 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled))), + 's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1), + 'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0), + 'region.nom'=>array('label'=>"Region", 'position'=>23, 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'position'=>24, 'checked'=>0), + 's.email'=>array('label'=>"Email", 'position'=>25, 'checked'=>0), + 's.url'=>array('label'=>"Url", 'position'=>26, 'checked'=>0), + 's.phone'=>array('label'=>"Phone", 'position'=>27, 'checked'=>1), + 's.fax'=>array('label'=>"Fax", 'position'=>28, 'checked'=>0), + 'typent.code'=>array('label'=>"ThirdPartyType", 'position'=>29, 'checked'=>$checkedtypetiers), + 'staff.code'=>array('label'=>"Staff", 'position'=>30, 'checked'=>0), + 's.siren'=>array('label'=>"ProfId1Short", 'position'=>40, 'checked'=>$checkedprofid1), + 's.siret'=>array('label'=>"ProfId2Short", 'position'=>41, 'checked'=>$checkedprofid2), + 's.ape'=>array('label'=>"ProfId3Short", 'position'=>42, 'checked'=>$checkedprofid3), + 's.idprof4'=>array('label'=>"ProfId4Short", 'position'=>43, 'checked'=>$checkedprofid4), + 's.idprof5'=>array('label'=>"ProfId5Short", 'position'=>44, 'checked'=>$checkedprofid5), + 's.idprof6'=>array('label'=>"ProfId6Short", 'position'=>45, 'checked'=>$checkedprofid6), + 's.tva_intra'=>array('label'=>"VATIntraShort", 'position'=>50, 'checked'=>0), + 'customerorsupplier'=>array('label'=>'NatureOfThirdParty', 'position'=>61, 'checked'=>1), + 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'position'=>62, 'checked'=>$checkprospectlevel), + 's.fk_stcomm'=>array('label'=>"StatusProsp", 'position'=>63, 'checked'=>$checkstcomm), + 's2.nom'=>array('label'=>'ParentCompany', 'position'=>64, 'checked'=>0), 's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), From 9f86cd8824e52280f7b8085885858a43b1920e7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Dec 2019 11:14:16 +0100 Subject: [PATCH 13/23] Debug v11 --- htdocs/contact/class/contact.class.php | 72 ++++++++++++++++++- htdocs/contact/list.php | 29 ++++---- .../class/expensereport.class.php | 2 +- htdocs/modulebuilder/index.php | 27 +++++-- htdocs/mrp/class/mo.class.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/productlot_list.php | 2 +- htdocs/projet/class/project.class.php | 6 +- 8 files changed, 115 insertions(+), 27 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0c8da446df7..d33a9b67bb2 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Marcos García - * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -64,6 +64,43 @@ class Contact extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>15), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), + 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30, 'index'=>1), + 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), + 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>-1, 'position'=>70), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'Phone perso', 'enabled'=>1, 'visible'=>-1, 'position'=>95), + 'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'Phone mobile', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>-1, 'position'=>110), + 'socialnetworks' =>array('type'=>'text', 'label'=>'Socialnetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115), + 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170), + 'priv' =>array('type'=>'smallint(6)', 'label'=>'Priv', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175), + 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>195), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>200), + 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=>205), + 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>-1, 'position'=>210), + 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), + ); + + /* public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), @@ -73,12 +110,13 @@ class Contact extends CommonObject 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), + //'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000), ); + */ public $civility_id; // In fact we store civility_code public $civility_code; @@ -193,8 +231,38 @@ class Contact extends CommonObject */ public function __construct($db) { + global $conf, $langs; + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; + if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0; + if (!empty($conf->global->SOCIETE_DISABLE_CONTACTS)) $this->fields['thirdparty']['enabled'] = 0; $this->statut = 1; // By default, status is enabled + + // Unset fields that are disabled + foreach ($this->fields as $key => $val) + { + if (isset($val['enabled']) && empty($val['enabled'])) + { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + /*if (is_object($langs)) + { + foreach($this->fields as $key => $val) + { + if (is_array($val['arrayofkeyval'])) + { + foreach($val['arrayofkeyval'] as $key2 => $val2) + { + $this->fields[$key]['arrayofkeyval'][$key2]=$langs->trans($val2); + } + } + } + }*/ } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 06cfe319c41..1d0c3839f4f 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -160,20 +160,20 @@ $fieldstosearchall = array( // Definition of fields for list $arrayfields = array( - 'p.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), - 'p.lastname'=>array('label'=>"Lastname", 'checked'=>1), - 'p.firstname'=>array('label'=>"Firstname", 'checked'=>1), - 'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1), - 'p.town'=>array('label'=>"Town", 'checked'=>0), - 'p.zip'=>array('label'=>"Zip", 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), - 'p.phone'=>array('label'=>"Phone", 'checked'=>1), - 'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0), - 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1), - 'p.fax'=>array('label'=>"Fax", 'checked'=>0), - 'p.email'=>array('label'=>"EMail", 'checked'=>1), - 'p.no_email'=>array('label'=>"No_Email", 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), - 'p.thirdparty'=>array('label'=>"ThirdParty", 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), + 'p.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), + 'p.lastname'=>array('label'=>"Lastname", 'position'=>2, 'checked'=>1), + 'p.firstname'=>array('label'=>"Firstname", 'position'=>3, 'checked'=>1), + 'p.poste'=>array('label'=>"PostOrFunction", 'position'=>10, 'checked'=>1), + 'p.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>0), + 'p.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'position'=>22, 'checked'=>0), + 'p.phone'=>array('label'=>"Phone", 'position'=>30, 'checked'=>1), + 'p.phone_perso'=>array('label'=>"PhonePerso", 'position'=>31, 'checked'=>0), + 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1), + 'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0), + 'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1), + 'p.no_email'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), + 'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), 'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200), 'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), 'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), @@ -186,6 +186,7 @@ if (!empty($conf->socialnetworks->enabled)) { $arrayfields['p.'.$key] = array( 'label' => $value['label'], 'checked' => 0, + 'position' => 300 ); } } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 6d21093f971..05272aa2ff7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -178,7 +178,7 @@ class ExpenseReport extends CommonObject 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>220), 'date_create' =>array('type'=>'datetime', 'label'=>'Date create', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>300), 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>305), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), 'fk_statut' =>array('type'=>'integer', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), ); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 70f9287501b..580255d596f 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -718,14 +718,28 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', if ($type == 'int(11)') $type='integer'; // notnull $notnull = ($obj->Null == 'YES'?0:1); + if ($fieldname == 'fk_user_modif') $notnull = -1; // label $label = preg_replace('/_/', ' ', ucfirst($fieldname)); - if ($fieldname == 'rowid') $label='ID'; - if ($fieldname == 'import_key') $label='ImportKey'; + if ($fieldname == 'rowid') $label='TechnicalID'; + if ($fieldname == 'import_key') $label='ImportId'; + if ($fieldname == 'fk_soc') $label='ThirdParty'; + if ($fieldname == 'tms') $label='DateModification'; + if ($fieldname == 'datec') $label='DateCreation'; + if ($fieldname == 'date_valid') $label='DateValidation'; + if ($fieldname == 'datev') $label='DateValidation'; + if ($fieldname == 'note_private') $label='NotePublic'; + if ($fieldname == 'note_public') $label='NotePrivate'; + if ($fieldname == 'fk_user_creat') $label='UserAuthor'; + if ($fieldname == 'fk_user_modif') $label='UserModif'; + if ($fieldname == 'fk_user_valid') $label='UserValidation'; // visible $visible = -1; if ($fieldname == 'entity') $visible = -2; - if (in_array($fieldname, array('model_pdf', 'note_public', 'note_private'))) $visible = 0; + if ($fieldname == 'import_key') $visible = -2; + if ($fieldname == 'fk_user_creat') $visible = -2; + if ($fieldname == 'fk_user_modif') $visible = -2; + if (in_array($fieldname, array('ref_ext', 'model_pdf', 'note_public', 'note_private'))) $visible = 0; // enabled $enabled = 1; // default @@ -734,6 +748,9 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', // position $position = $i; if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) $position = 500; + // index + $index = 0; + if ($fieldname == 'entity') $index=1; $string.= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',"; if ($default != '') $string.= " 'default'=>".$default.","; @@ -741,7 +758,9 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', $string.= " 'visible'=>".$visible; if ($notnull) $string.= ", 'notnull'=>".$notnull; if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1"; - $string.= ", 'position'=>".$position."),\n"; + $string.= ", 'position'=>".$position; + if ($index) $string.= ", 'index'=>".$index; + print "),\n"; $string.="
      "; $i+=5; } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 393d5416d52..49c5bed3dda 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -929,7 +929,7 @@ class MoLine extends CommonObjectLine 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>165), 'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>170), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>175), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-1, 'position'=>180), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>180), ); public $rowid; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 07eeea82137..a3a97984ce9 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -117,7 +117,7 @@ class Entrepot extends CommonObject //'fk_user_author' =>array('type'=>'integer', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-2, 'position'=>82), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), + //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>1010), 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-2, 'position'=>200), ); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 0930cee2090..4f851d8e1de 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -96,7 +96,7 @@ $arrayfields = array( 't.fk_product'=>array('label'=>$langs->trans("Product"), 'checked'=>1), 't.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>1), 't.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>1), - //'t.import_key'=>array('label'=>$langs->trans("ImportKey"), 'checked'=>1), + //'t.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>1), //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))), //'t.fk_user_creat'=>array('label'=>$langs->trans("UserCreationShort"), 'checked'=>0, 'position'=>500), //'t.fk_user_modif'=>array('label'=>$langs->trans("UserModificationShort"), 'checked'=>0, 'position'=>500), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6448dbbf622..9fc172207a3 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -180,14 +180,14 @@ class Project extends CommonObject 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), 'fk_opp_status' =>array('type'=>'integer', 'label'=>'Fk opp status', 'enabled'=>1, 'visible'=>-1, 'position'=>75), 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'Opp percent', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'note_private' =>array('type'=>'text', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>85), - 'note_public' =>array('type'=>'text', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>90), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), 'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget amount', 'enabled'=>1, 'visible'=>-1, 'position'=>100), 'date_close' =>array('type'=>'datetime', 'label'=>'Date close', 'enabled'=>1, 'visible'=>-1, 'position'=>105), 'fk_user_close' =>array('type'=>'integer', 'label'=>'Fk user close', 'enabled'=>1, 'visible'=>-1, 'position'=>110), 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'Opp amount', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportKey', 'enabled'=>1, 'visible'=>-1, 'position'=>120), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>120), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>125), 'usage_bill_time' =>array('type'=>'integer', 'label'=>'Usage bill time', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'usage_opportunity' =>array('type'=>'integer', 'label'=>'Usage opportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135), From be8075881c6be0599861932b1c3bf371a83a3e34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Dec 2019 11:15:15 +0100 Subject: [PATCH 14/23] Clean dead code --- htdocs/contact/class/contact.class.php | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d33a9b67bb2..038cb82845e 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -100,24 +100,6 @@ class Contact extends CommonObject 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), ); - /* - public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), - 'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - //'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), - //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000), - ); - */ - public $civility_id; // In fact we store civility_code public $civility_code; public $civility; From ca6277379a7d3ca50a30adcaa56a617812f41bba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Dec 2019 11:17:03 +0100 Subject: [PATCH 15/23] Fix regression --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 580255d596f..2efb90fa7cf 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -760,7 +760,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', if ($fieldname == 'ref') $string.= ", 'showoncombobox'=>1"; $string.= ", 'position'=>".$position; if ($index) $string.= ", 'index'=>".$index; - print "),\n"; + $string.= "),\n"; $string.="
      "; $i+=5; } From cb5b573c5003af894187e0442e6000aebc627097 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 20 Dec 2019 11:31:40 +0100 Subject: [PATCH 16/23] Fix Too many try of ping --- htdocs/main.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3acc10fe9d7..7744e1ffd16 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2555,17 +2555,17 @@ if (!function_exists("llxFooter")) if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || GETPOST('forceping', 'alpha')) { //print ''; + $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); if (empty($conf->global->MAIN_FIRST_PING_OK_DATE) - || (!empty($conf->file->instance_unique_id) && (md5($conf->file->instance_unique_id) != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled')) + || (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled')) || GETPOST('forceping', 'alpha')) { - if (empty($_COOKIE['DOLINSTALLNOPING_'.md5($conf->file->instance_unique_id)])) + if (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id])) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print "\n".''."\n"; print "\n\n"; - $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); $url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING); ?>

*** Clean module_parts entries of modules not enabled

*** Clean constant record of modules not enabled
Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we delete record
Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module '.$name.' not enabled in entity '.$obj->entity.', we delete record
Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)
Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module '.$name.' not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)