From a5635825f34ffbf6c4697a765349371ae5b85122 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 14 Nov 2019 12:09:32 +0100 Subject: [PATCH 01/13] FIX : wrong invoice id for fetchObjetctLinked --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f35281f73d6..9f13313ffe1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -875,7 +875,7 @@ class Facture extends CommonInvoice } elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { - $this->fetchObjectLinked('', '', $facture->id, 'facture'); + $this->fetchObjectLinked('', '', $this->id, 'facture'); foreach ($this->linkedObjectsIds as $typeObject => $Tfk_object) { From 3937b45c5f18a8964299081538bcee7a406a8286 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 16 Nov 2019 07:51:38 +0100 Subject: [PATCH 02/13] Core - Fix accountancy write social contribution in bookkeeping (Need for FEC format) --- htdocs/accountancy/journal/bankjournal.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index a532379c358..16996358425 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -632,7 +632,9 @@ if (! $error && $action == 'writebookkeeping') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $objmid->labelc; + + $accountingaccount->fetch(null, $k, true); + $bookkeeping->label_compte = $accountingaccount->label; } elseif ($tabtype[$key] == 'payment_vat') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; From 7a5883588cb332f6a63f04a6db1ce987a4cff5cf Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Sun, 17 Nov 2019 14:07:01 +0100 Subject: [PATCH 03/13] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a70cf20503a..f3846ff951c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -548,10 +548,10 @@ abstract class CommonObject if (empty($lastname)) $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : ''))))); $ret = ''; - if ($option && $this->civility_id) + if ($option && $this->civility_code) { - if ($langs->transnoentitiesnoconv("Civility".$this->civility_id) != "Civility".$this->civility_id) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_id).' '; - else $ret .= $this->civility_id.' '; + if ($langs->transnoentitiesnoconv("Civility".$this->civility_code) != "Civility".$this->civility_code) $ret .= $langs->transnoentitiesnoconv("Civility".$this->civility_code).' '; + else $ret .= $this->civility_code.' '; } $ret .= dolGetFirstLastname($firstname, $lastname, $nameorder); From 79ee2b8c4d1816f1bbb77713c385d823880fb6a2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 18 Nov 2019 11:48:44 +0100 Subject: [PATCH 04/13] Missing language key --- htdocs/langs/en_US/stocks.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 17f914b7405..96e4a911d10 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -210,3 +210,4 @@ StockIncreaseAfterCorrectTransfer=Increase by correction/transfer StockDecreaseAfterCorrectTransfer=Decrease by correction/transfer StockIncrease=Stock increase StockDecrease=Stock decrease +StockIsRequiredToChooseWhichLotToUse=Stock is required to choose which lot to use From 99f93dbbf5894ee0ed8f8447069a976f13786e7a Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 18 Nov 2019 14:33:01 +0100 Subject: [PATCH 05/13] fix bad getpost --- htdocs/contact/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index cfe86fb3793..909dfd9e2e2 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -927,7 +927,7 @@ else // Civility print ''; - print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility", "aZ09"):$object->civility_code, 'civility_code'); + print $formcompany->select_civility(GETPOSTISSET("civility_code")?GETPOST("civility_code", "aZ09"):$object->civility_code, 'civility_code'); print ''; print ''; From 74c85b742e4836406abffb9934f2e64ec48d7145 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2019 18:09:12 +0100 Subject: [PATCH 06/13] Fix ref must be null until the generation of ref is ok --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index e9130c5d5c4..df796e54f49 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -328,6 +328,9 @@ UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos UPDATE llx_c_shipment_mode SET label = 'https://www.laposte.fr/outils/suivre-vos-envois?code={TRACKID}' WHERE code IN ('LETTREMAX'); +-- VMYSQL4.3 ALTER TABLE llx_holiday MODIFY COLUMN ref varchar(30) NULL; +-- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref DROP NOT NULL; + create table llx_reception ( From 918f476c2b802f6770fb5f127ffe5091c765e7f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 18 Nov 2019 19:02:12 +0100 Subject: [PATCH 07/13] Fix backport fix not checking mandatory extrafields of type select --- htdocs/core/class/extrafields.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b3c257bfaaa..5b171d70bfb 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1830,7 +1830,7 @@ class ExtraFields function setOptionalsFromPost($extralabels, &$object, $onlykey='') { global $_POST, $langs; - $nofillrequired='';// For error when required field left blank + $nofillrequired=0;// For error when required field left blank $error_field_required = array(); if (is_array($this->attributes[$object->table_element]['label'])) $extralabels=$this->attributes[$object->table_element]['label']; @@ -1861,8 +1861,9 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { // Check if empty without using GETPOST, value can be alpha, int, array, etc... - if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $_POST["options_".$key] != '0') - || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) + if ((! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') + || (! is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') + || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; $nofillrequired++; From 010219bf097851bc40db06114efe5ef3f93b6a3f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 18 Nov 2019 19:47:34 +0100 Subject: [PATCH 08/13] fix title pasge linked files user --- htdocs/user/document.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 91d0e7219ce..3b0282179d2 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -115,8 +115,7 @@ if (empty($reshook)) { $form = new Form($db); -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; -llxHeader('', $langs->trans("ThirdParty").' - '.$langs->trans("Files"), $help_url); +llxHeader('', $langs->trans("UserCard").' - '.$langs->trans("Files")); if ($object->id) { From b61a3f1ba946217f4c807ab7ace36e78a27fa13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 18 Nov 2019 19:59:21 +0100 Subject: [PATCH 09/13] Update bookkeeping.class.php --- .../accountancy/class/bookkeeping.class.php | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index d8a33ac1054..a1116ecd6a2 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2014-2017 Olivier Geffroy * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2015-2017 Florian Henry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-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 @@ -32,16 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class BookKeeping extends CommonObject { - /** - * @var string Error code (or message) - */ - public $error; - - /** - * @var string[] Array of Error codes (or messages) - */ - public $errors = array(); - /** * @var string Id to identify managed objects */ @@ -235,13 +225,13 @@ class BookKeeping extends CommonObject $this->label_operation = trim($this->label_operation); } if (isset($this->debit)) { - $this->debit = trim($this->debit); + $this->debit = (float) $this->debit; } if (isset($this->credit)) { - $this->credit = trim($this->credit); + $this->credit = (float) $this->credit; } if (isset($this->montant)) { - $this->montant = trim($this->montant); + $this->montant = (float) $this->montant; } if (isset($this->sens)) { $this->sens = trim($this->sens); @@ -258,8 +248,8 @@ class BookKeeping extends CommonObject if (isset($this->piece_num)) { $this->piece_num = trim($this->piece_num); } - if (empty($this->debit)) $this->debit = 0; - if (empty($this->credit)) $this->credit = 0; + if (empty($this->debit)) $this->debit = 0.0; + if (empty($this->credit)) $this->credit = 0.0; // Check parameters if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined') From cd7523318d8ffd2d37b430ce3f076ba117600d1d Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 19 Nov 2019 08:30:26 +0000 Subject: [PATCH 10/13] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/admin/emailcollector_list.php | 2 +- htdocs/core/actions_addupdatedelete.inc.php | 22 +-- htdocs/core/class/commonobject.class.php | 14 +- htdocs/core/lib/modulebuilder.lib.php | 166 ++++++++++---------- 4 files changed, 102 insertions(+), 102 deletions(-) diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 64b11125d91..c10e44e0e10 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -321,7 +321,7 @@ print ''; print ''; print ''; -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; $newcardbutton = ''; //if ($user->rights->emailcollector->creer) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index a24274b81af..ee4208cd65e 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -30,22 +30,22 @@ // $backtopage may be defined // $triggermodname may be defined -if (! empty($permissionedit) && empty($permissiontoadd)) $permissiontoadd = $permissionedit; // For backward compatibility +if (!empty($permissionedit) && empty($permissiontoadd)) $permissiontoadd = $permissionedit; // For backward compatibility if ($cancel) { /*var_dump($cancel); var_dump($backtopage);exit;*/ - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } - $action=''; + $action = ''; } // Action to add record -if ($action == 'add' && ! empty($permissiontoadd)) +if ($action == 'add' && !empty($permissiontoadd)) { foreach ($object->fields as $key => $val) { @@ -66,17 +66,17 @@ if ($action == 'add' && ! empty($permissiontoadd)) } elseif ($object->fields[$key]['type'] == 'datetime') { $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); } elseif ($object->fields[$key]['type'] == 'duration') { - $value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int'); + $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int'); } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { - $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup + $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup } else { $value = GETPOST($key, 'alpha'); } - if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field - if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field + if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field + if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field - $object->$key=$value; - if ($val['notnull'] > 0 && $object->$key == '' && ! is_null($val['default']) && $val['default'] == '(PROV)') + $object->$key = $value; + if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') { $object->$key = '(PROV)'; } @@ -136,7 +136,7 @@ if ($action == 'update' && !empty($permissiontoadd)) $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); } elseif ($object->fields[$key]['type'] == 'duration') { if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') { - $value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int'); + $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int'); } else { $value = ''; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1ce1eca120f..c40897c4b01 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5689,7 +5689,7 @@ abstract class CommonObject } elseif (in_array($type, array('duration'))) { - $out=$form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1); + $out = $form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1); } elseif (in_array($type, array('int', 'integer'))) { @@ -6317,13 +6317,13 @@ abstract class CommonObject elseif ($type == 'duration') { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - if (! is_null($value) && $value !== '') { + if (!is_null($value) && $value !== '') { $value = convertSecondToTime($value, 'allhourmin'); } } elseif ($type == 'double' || $type == 'real') { - if (! is_null($value) && $value !== '') { + if (!is_null($value) && $value !== '') { $value = price($value); } } @@ -6349,7 +6349,7 @@ abstract class CommonObject } elseif ($type == 'price') { - if (! is_null($value) && $value !== '') { + if (!is_null($value) && $value !== '') { $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); } } @@ -7366,7 +7366,7 @@ abstract class CommonObject } if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]); - if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; // May force 0 to null + if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; // May force 0 to null } return $queryarray; @@ -7409,7 +7409,7 @@ abstract class CommonObject } else { - if (! is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { + if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->{$field} = (int) $obj->{$field}; } else { $this->{$field} = null; @@ -7426,7 +7426,7 @@ abstract class CommonObject } else { - if (! is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { + if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->{$field} = (double) $obj->{$field}; } else { $this->{$field} = null; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 02a9932d474..deac3de6157 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -42,9 +42,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = global $db, $langs; if (empty($objectname)) return -1; - if (empty($readdir)) $readdir=$destdir; + if (empty($readdir)) $readdir = $destdir; - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) { dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.'); return -1; @@ -63,17 +63,17 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors'); return -2; } - if (! preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type']) - && ! preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type'])) + if (!preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type']) + && !preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type'])) { setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors'); return -2; } } - $pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; - $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); - if (! dol_is_file($pathoffiletoeditsrc)) + $pathoffiletoeditsrc = $readdir.'/class/'.strtolower($objectname).'.class.php'; + $pathoffiletoedittarget = $destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); + if (!dol_is_file($pathoffiletoeditsrc)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); @@ -86,7 +86,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = try { include_once $pathoffiletoeditsrc; - if (class_exists($objectname)) $object=new $objectname($db); + if (class_exists($objectname)) $object = new $objectname($db); else return -4; // Backup old file @@ -100,86 +100,86 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = { if (is_array($addfieldentry) && count($addfieldentry)) { - $name=$addfieldentry['name']; + $name = $addfieldentry['name']; unset($addfieldentry['name']); - $object->fields[$name]=$addfieldentry; + $object->fields[$name] = $addfieldentry; } - if (! empty($delfieldentry)) + if (!empty($delfieldentry)) { - $name=$delfieldentry; + $name = $delfieldentry; unset($object->fields[$name]); } } dol_sort_array($object->fields, 'position'); - $i=0; + $i = 0; $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; - $texttoinsert.= "\t".'/**'."\n"; - $texttoinsert.= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; - $texttoinsert.= "\t".' */'."\n"; - $texttoinsert.= "\t".'public $fields=array('."\n"; + $texttoinsert .= "\t".'/**'."\n"; + $texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; + $texttoinsert .= "\t".' */'."\n"; + $texttoinsert .= "\t".'public $fields=array('."\n"; if (count($object->fields)) { - foreach($object->fields as $key => $val) + foreach ($object->fields as $key => $val) { $i++; - $texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; - $texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).","; - $texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).","; - $texttoinsert.= " 'notnull'=>".(empty($val['notnull'])?0:$val['notnull']).","; - $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).","; - if ($val['noteditable']) $texttoinsert.= " 'noteditable'=>'".$val['noteditable']."',"; - if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',"; - if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; - if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',"; - if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; - if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',"; - if ($val['css']) $texttoinsert.= " 'css'=>'".$val['css']."',"; - if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; - if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',"; - if ($val['disabled']) $texttoinsert.= " 'disabled'=>'".$val['disabled']."',"; + $texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; + $texttoinsert .= " 'enabled'=>".($val['enabled'] != '' ? $val['enabled'] : 1).","; + $texttoinsert .= " 'position'=>".($val['position'] != '' ? $val['position'] : 50).","; + $texttoinsert .= " 'notnull'=>".(empty($val['notnull']) ? 0 : $val['notnull']).","; + $texttoinsert .= " 'visible'=>".($val['visible'] != '' ? $val['visible'] : -1).","; + if ($val['noteditable']) $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',"; + if ($val['default']) $texttoinsert .= " 'default'=>'".$val['default']."',"; + if ($val['index']) $texttoinsert .= " 'index'=>".$val['index'].","; + if ($val['foreignkey']) $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',"; + if ($val['searchall']) $texttoinsert .= " 'searchall'=>".$val['searchall'].","; + if ($val['isameasure']) $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',"; + if ($val['css']) $texttoinsert .= " 'css'=>'".$val['css']."',"; + if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; + if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',"; + if ($val['disabled']) $texttoinsert .= " 'disabled'=>'".$val['disabled']."',"; if ($val['arrayofkeyval']) { - $texttoinsert.= " 'arrayofkeyval'=>array("; - $i=0; - foreach($val['arrayofkeyval'] as $key2 => $val2) + $texttoinsert .= " 'arrayofkeyval'=>array("; + $i = 0; + foreach ($val['arrayofkeyval'] as $key2 => $val2) { - if ($i) $texttoinsert.=", "; - $texttoinsert.="'".$key2."'=>'".$val2."'"; + if ($i) $texttoinsert .= ", "; + $texttoinsert .= "'".$key2."'=>'".$val2."'"; $i++; } - $texttoinsert.= "),"; + $texttoinsert .= "),"; } - if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\""; + if ($val['comment']) $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\""; - $texttoinsert.= "),\n"; + $texttoinsert .= "),\n"; } } - $texttoinsert.= "\t".');'."\n"; + $texttoinsert .= "\t".');'."\n"; //print ($texttoinsert);exit; if (count($object->fields)) { //$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string'); - foreach($object->fields as $key => $val) + foreach ($object->fields as $key => $val) { $i++; //$typephp=$typetotypephp[$val['type']]; - $texttoinsert.= "\t".'public $'.$key.";"; + $texttoinsert .= "\t".'public $'.$key.";"; //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; //$texttoinsert.= ($val['notnull']?' NOT NULL':''); //if ($i < count($object->fields)) $texttoinsert.=";"; - $texttoinsert.= "\n"; + $texttoinsert .= "\n"; } } - $texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES'; + $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES'; //print($texttoinsert);exit; @@ -193,7 +193,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = return $object; } - catch(Exception $e) + catch (Exception $e) { print $e->getMessage(); return -5; @@ -219,14 +219,14 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $error = 0; if (empty($objectname)) return -1; - if (empty($readdir)) $readdir=$destdir; + if (empty($readdir)) $readdir = $destdir; - $pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; + $pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php'; // Edit .sql file - $pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; - $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); - if (! dol_is_file($pathoffiletoeditsrc)) + $pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; + $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); + if (!dol_is_file($pathoffiletoeditsrc)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); @@ -236,14 +236,14 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' // Load object from myobject.class.php try { - if (! is_object($object)) + if (!is_object($object)) { include_once $pathoffiletoclasssrc; - if (class_exists($objectname)) $object=new $objectname($db); + if (class_exists($objectname)) $object = new $objectname($db); else return -1; } } - catch(Exception $e) + catch (Exception $e) { print $e->getMessage(); } @@ -253,38 +253,38 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); - $i=0; + $i = 0; $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n"; if (count($object->fields)) { - foreach($object->fields as $key => $val) + foreach ($object->fields as $key => $val) { $i++; $type = $val['type']; - $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' + $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' - if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database - elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database + if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database + elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer'; - $texttoinsert.= "\t".$key." ".$type; - if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; - if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; + $texttoinsert .= "\t".$key." ".$type; + if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY'; + if ($key == 'entity') $texttoinsert .= ' DEFAULT 1'; else { if ($val['default'] != '') { - if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL"; - elseif (preg_match('/varchar/', $type)) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'"; - else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:''); + if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL"; + elseif (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'"; + else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : ''); } } - $texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':''); - if ($i < count($object->fields)) $texttoinsert.=", "; - $texttoinsert.= "\n"; + $texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : ''); + if ($i < count($object->fields)) $texttoinsert .= ", "; + $texttoinsert .= "\n"; } } - $texttoinsert.= "\t".'-- END MODULEBUILDER FIELDS'; + $texttoinsert .= "\t".'-- END MODULEBUILDER FIELDS'; $contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql); @@ -299,35 +299,35 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' } // Edit .key.sql file - $pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'; - $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); + $pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'; + $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); - $i=0; + $i = 0; $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n"; if (count($object->fields)) { - foreach($object->fields as $key => $val) + foreach ($object->fields as $key => $val) { $i++; - if (! empty($val['index'])) + if (!empty($val['index'])) { - $texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");"; - $texttoinsert.= "\n"; + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");"; + $texttoinsert .= "\n"; } - if (! empty($val['foreignkey'])) + if (!empty($val['foreignkey'])) { - $tmp=explode('.', $val['foreignkey']); - if (! empty($tmp[0]) && ! empty($tmp[1])) + $tmp = explode('.', $val['foreignkey']); + if (!empty($tmp[0]) && !empty($tmp[1])) { - $texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; - $texttoinsert.= "\n"; + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; + $texttoinsert .= "\n"; } } } } - $texttoinsert.= '-- END MODULEBUILDER INDEXES'; + $texttoinsert .= '-- END MODULEBUILDER INDEXES'; $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql); From 07c01a821e94dd1a6aee2e23e825df05d78d0269 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2019 19:43:02 +0100 Subject: [PATCH 11/13] FIx #12466 manually (conflict pb) --- htdocs/compta/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b6997922e2a..0d39cda6513 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -986,7 +986,7 @@ if (empty($reshook)) $object->entity = $originentity; } $object->socid = GETPOST('socid', 'int'); - $object->number = $_POST['ref']; + $object->ref = $_POST['ref']; $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'none')); @@ -1166,7 +1166,7 @@ if (empty($reshook)) { $object->socid = GETPOST('socid', 'int'); $object->type = $_POST['type']; - $object->number = $_POST['ref']; + $object->ref = $_POST['ref']; $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'none')); @@ -1216,7 +1216,7 @@ if (empty($reshook)) // Si facture standard $object->socid = GETPOST('socid', 'int'); $object->type = GETPOST('type'); - $object->number = $_POST['ref']; + $object->ref = $_POST['ref']; $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'none')); From 1b533753716f732cc130bad815d1d84b7f0ef672 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2019 21:21:15 +0100 Subject: [PATCH 12/13] Look and feel v11 --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 78eda38ea51..1ccb1631a31 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -163,7 +163,7 @@ dol_fiche_head($head, 'stripeaccount', '', -1); $stripearrayofwebhookevents = array('payout.created', 'payout.paid', 'charge.pending', 'charge.refunded', 'charge.succeeded', 'charge.failed', 'payment_intent.succeeded', 'payment_intent.payment_failed', 'payment_method.attached', 'payment_method.updated', 'payment_method.card_automatically_updated', 'payment_method.detached', 'source.chargeable', 'customer.deleted'); -print $langs->trans("StripeDesc")."
\n"; +print ''.$langs->trans("StripeDesc")."
\n"; print '
'; From fb7089322976629956bfda04a48ff31436ae37c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Nov 2019 21:29:49 +0100 Subject: [PATCH 13/13] Fix missing class reposition --- htdocs/adherents/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/comm/propal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php | 2 +- htdocs/contrat/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/expensereport/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/fichinter/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 2 +- .../template/core/tpl/linkedobjectblock_myobject.tpl.php | 2 +- htdocs/reception/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php | 2 +- htdocs/ticket/tpl/linkedobjectblock.tpl.php | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 7581108dd12..16b600bfeeb 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) } echo ''; echo ''; - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; echo ''; } diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index ccc62ab98c4..c28c3fe4587 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -68,7 +68,7 @@ foreach($linkedObjectBlock as $key => $objectlink) } print ''; print ''.$objectlink->getLibStatut(3).''; - print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } if (count($linkedObjectBlock) > 1) diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 459940dcc64..1b69e035fba 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink) echo ''; // For now, shipments must stay linked to order, so link is not deletable if($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index d2cad75ca77..d591c8b45f3 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -86,7 +86,7 @@ foreach($linkedObjectBlock as $key => $objectlink) } print ''; print ''.$objectlink->getLibStatut(3).''; - print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } if (count($linkedObjectBlock) > 1) diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index cb16ce407f8..9fe3a6f4c83 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -57,7 +57,7 @@ foreach($linkedObjectBlock as $key => $objectlink) } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) echo price($totalcontrat); } ?> getLibStatut(7); ?> - '.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + '.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) // For now, shipments must stay linked to order, so link is not deletable if($object->element != 'commande') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php index 43f612ea3f6..98a8351b26f 100644 --- a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php @@ -49,7 +49,7 @@ foreach($linkedObjectBlock as $key => $objectlink) echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) datev, 'day'); ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) } } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) date, 'day'); ?> getLibStatut(7); ?> - '.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + '.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) // For now, receptions must stay linked to order, so link is not deletable if ($object->element != 'order_supplier') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index c87bb46adf3..6c4bea3ba8b 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -53,7 +53,7 @@ foreach($linkedObjectBlock as $key => $objectlink) echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) // For now, shipments must stay linked to order, so link is not deletable if($object->element != 'shipping') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>