From a52e7b1a570110a661442cf9209fd0e5c94167ca Mon Sep 17 00:00:00 2001 From: priojk Date: Wed, 12 Apr 2023 21:23:49 +0200 Subject: [PATCH 01/18] rename action from makeorder to createorder --- htdocs/fourn/commande/card.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index f79c9fe49b4..090a5d666e9 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -8,9 +8,10 @@ * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ion Agorria - * Copyright (C) 2018-2019 Frédéric France - * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2023 Joachim Kueter * * 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 @@ -1047,7 +1048,7 @@ if (empty($reshook)) { $action = ''; } elseif ($methodecommande <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("OrderMode")), null, 'errors'); - $action = 'makeorder'; + $action = 'createorder'; } } @@ -2437,7 +2438,7 @@ if ($action == 'create') { */ if ($user->socid == 0 && $action != 'delete') { - if ($action != 'makeorder' && $action != 'presend' && $action != 'editline') { + if ($action != 'createorder' && $action != 'presend' && $action != 'editline') { print '
'; $parameters = array(); @@ -2568,7 +2569,7 @@ if ($action == 'create') { if ($object->statut == CommandeFournisseur::STATUS_ACCEPTED) { if ($usercanorder) { - print ''; + print ''; } else { print ''; } @@ -2636,7 +2637,7 @@ if ($action == 'create') { print "
"; } - if ($usercanorder && $object->statut == CommandeFournisseur::STATUS_ACCEPTED && $action == 'makeorder') { + if ($usercanorder && $object->statut == CommandeFournisseur::STATUS_ACCEPTED && $action == 'createorder') { // Set status to ordered (action=commande) print ''."\n"; print '
'; @@ -2677,7 +2678,7 @@ if ($action == 'create') { $action = 'presend'; } - if ($action != 'makeorder' && $action != 'presend' ) { + if ($action != 'createorder' && $action != 'presend' ) { print '
'; // Generated documents From a43674477a9e58ff2ea427fd5f2f028a9ed7fa1c Mon Sep 17 00:00:00 2001 From: priojk Date: Wed, 12 Apr 2023 21:51:58 +0200 Subject: [PATCH 02/18] revert preliminary fix from v17 --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c0c22a94ec1..f13e00c3b8d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -20,6 +20,7 @@ * Copyright (C) 2022 Anthony Berton * Copyright (C) 2022 Ferran Marcet * Copyright (C) 2022 Charlene Benke + * Copyright (C) 2023 Joachim Kueter * * 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 @@ -619,7 +620,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } } if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { - if (!empty($_GET['action']) && (preg_match('/^create|^add_price|^make/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { + if (!empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { // Now search in setup to overwrite default values if (!empty($user->default_values)) { // $user->default_values defined from menu 'Setup - Default values' if (isset($user->default_values[$relativepathstring]['createform'])) { From 2fbfd4fe4c1716a1e5d56a6ff38895ee811cfe38 Mon Sep 17 00:00:00 2001 From: jyhere Date: Thu, 13 Apr 2023 14:27:27 +0200 Subject: [PATCH 03/18] FIX: undefined variable used in order billing mass action --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 49e6b0b3555..7263085337c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -511,7 +511,7 @@ if (empty($reshook)) { if ($result > 0) { $lineid = $result; if (!empty($createbills_onebythird)) //increment rang to keep order - $TFactThirdNbLines[$rcp->socid]++; + $TFactThirdNbLines[$cmd->socid]++; } else { $lineid = 0; $error++; From 50346a71197cb0c7ae07a6e236875d4f2925b40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 13 Apr 2023 16:58:16 +0200 Subject: [PATCH 04/18] Doc --- htdocs/product/class/productcustomerprice.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 6a6fe72a08a..2f50528e818 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -66,6 +66,7 @@ class Productcustomerprice extends CommonObject public $price_min; public $price_min_ttc; public $price_base_type; + public $default_vat_code; public $tva_tx; public $recuperableonly; public $localtax1_type; @@ -78,6 +79,9 @@ class Productcustomerprice extends CommonObject */ public $fk_user; + /** + * @var PriceByCustomerLine[] + */ public $lines = array(); From c37ca020645943fa43b29445edb043c2f3fceb4e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Thu, 13 Apr 2023 17:13:56 +0200 Subject: [PATCH 05/18] optimize section for add & remove apiFile --- htdocs/core/lib/modulebuilder.lib.php | 105 ++++++++++++++++++++++++++ htdocs/modulebuilder/index.php | 84 ++++----------------- 2 files changed, 120 insertions(+), 69 deletions(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index d5f2a6e50c8..83d06c43c55 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -742,3 +742,108 @@ function writePermsInAsciiDoc($file, $destfile) } return 1; } + +/** + * Add Object in ModuleApi File + * @param string $file path of file + * @param array $objects array of objects in the module + * @param string $modulename name of module + * @return int 1 if OK, -1 if KO + */ +function addObjectsToApiFile($file, $objects, $modulename) +{ + if (!file_exists($file)) { + return -1; + } + $content = file($file); + $includeClass = "dol_include_once('/mymodule/class/myobject.class.php');"; + $props = "public \$myobject;"; + $varcomented = "@var MyObject \$myobject {@type MyObject}"; + $constructObj = "\$this->myobject = new MyObject(\$this->db);"; + + // add properties and declare them in consturctor + foreach ($content as $lineNumber => &$lineContent) { + if (strpos($lineContent, $varcomented) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}". PHP_EOL; + } + //var_dump($lineContent);exit; + } + if (strpos($lineContent, $props) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "\tpublic \$".strtolower($object).";". PHP_EOL; + } + } + if (strpos($lineContent, $constructObj) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);". PHP_EOL; + } + } + if (strpos($lineContent, $includeClass) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');". PHP_EOL; + } + } + } + $allContent = implode("", $content); + file_put_contents($file, $allContent); + + //add methods for each object + $allContent = getFromFile($file, '/*begin methods CRUD*/', '/*end methods CRUD*/'); + foreach ($objects as $object) { + $contentReplaced =str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent); + dolReplaceInFile($file, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/')); + } + dolReplaceInFile($file, array($allContent => '','MyModule' => ucfirst($modulename))); + return 1; +} + +/** + * Remove Object variables and methods from API_Module File + * @param string $file file api module + * @param string $objectname name of object whant to remove + * @param string $modulename name of module + * @return int 1 if OK, -1 if KO + */ +function removeObjectFromApiFile($file, $objectname, $modulename) +{ + $begin = '/*CRUD FOR '.strtoupper($objectname).'*/'; + $end = '/*END CRUD FOR '.strtoupper($objectname).'*/'; + $includeClass = "dol_include_once('/".strtolower($modulename)."/class/".strtolower($objectname).".class.php');"; + $varcomentedDel = "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}"; + $propsDel = "\tpublic \$".strtolower($objectname).";"; + $constructObjDel = "\t\t\$this->".strtolower($objectname)." = new ".$objectname."(\$this->db);"; + + if (!file_exists($file)) { + return -1; + } + $content = file($file); + // for delete property and the initialization from the construct + foreach ($content as $lineNumber => &$lineContent) { + if (strpos($lineContent, $includeClass) !== false) { + $lineContent = ''; + } + if (strpos($lineContent, $varcomentedDel) !== false) { + $lineContent = ''; + } + if (strpos($lineContent, $propsDel) !== false) { + $lineContent = ''; + } + if (strpos($lineContent, $constructObjDel) !== false) { + $lineContent = ''; + } + } + $allContent = implode("", $content); + file_put_contents($file, $allContent); + // for delete methods of object + $allContent = getFromFile($file, $begin, $end); + $check = dolReplaceInFile($file, array($allContent => '')); + if ($check) { + dolReplaceInFile($file, array($begin => '', $end => '')); + } + return 1; +} diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 03483212860..ef929f15180 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -471,72 +471,10 @@ if ($dirins && in_array($action, array('initapi', 'initphpunit', 'initpagecontac ); if (count($objects) > 1) { - $file = $destfile; - $content = file($file); - $props = "public \$myobject;"; - $varcomented = "@var MyObject \$myobject {@type MyObject}"; - $constructObj = "\$this->myobject = new MyObject(\$this->db);"; - // add properties and declare them in consturctor - foreach ($content as $lineNumber => &$lineContent) { - if (strpos($lineContent, $varcomented) !== false) { - $lineContent = ''; - foreach ($objects as $object) { - $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}". PHP_EOL; - } - //var_dump($lineContent);exit; - } - if (strpos($lineContent, $props) !== false) { - $lineContent = ''; - foreach ($objects as $object) { - $lineContent .= "\tpublic \$".strtolower($object).";". PHP_EOL; - } - } - if (strpos($lineContent, $constructObj) !== false) { - $lineContent = ''; - foreach ($objects as $object) { - $lineContent .= "\t\t\$this->".strtolower($object)."= new ".$object."(\$this->db);". PHP_EOL; - } - } - } - $allContent = implode("", $content); - file_put_contents($destfile, $allContent); - } - if (count($objects) > 1) { - $search = "/*begin methods CRUD*/"; - // Open the file and read line by line - $handle = fopen($destfile, "r"); - $i = 1; - $lines = array(); - $props = " public \$myobject; "; - while (($line = fgets($handle)) !== false) { - //search line begin - if (strpos($line, $search) !== false) { - $start_line = $i; - - // Copy lines until the end on array - while (($line = fgets($handle)) !== false) { - if (strpos($line, "/*end methods CRUD*/") !== false) { - $end_line = $i; - break; - } - $lines[] = $line; - $i++; - } - break; - } - - $i++; - } - $allContent = implode("", $lines); - - foreach ($objects as $object) { - $contentReplaced = str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent); - dolReplaceInFile($destfile, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/')); - } - dolReplaceInFile($destfile, array($allContent => '')); - fclose($handle); + addObjectsToApiFile($destfile, $objects, $modulename); } else { dolReplaceInFile($destfile, $arrayreplacement); + dolReplaceInFile($destfile, array('/*begin methods CRUD*/' => '/*begin methods CRUD*/'."\n\t".'/*CRUD FOR '.strtoupper($objectname).'*/', '/*end methods CRUD*/' => '/*END CRUD FOR '.strtoupper($objectname).'*/'."\n\t".'/*end methods CRUD*/')); } if ($varnametoupdate) { @@ -938,17 +876,25 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) { $relativefilename = dol_sanitizePathName(GETPOST('file', 'restricthtml')); - // Get list of existing objects - $objects = dolGetListOfObjectClasses($destdir); - - // Now we delete the file if ($relativefilename) { $dirnametodelete = dirname($relativefilename); $filetodelete = $dirins.'/'.$relativefilename; $dirtodelete = $dirins.'/'.$dirnametodelete; - $result = dol_delete_file($filetodelete); + //check when we want delete api_file + if (strpos($relativefilename, 'api') !== false) { + $removeFile = removeObjectFromApiFile($file_api, $objectname, $module); + $var = getFromFile($file_api, '/*begin methods CRUD*/', '/*end methods CRUD*/'); + if (str_word_count($var) == 0) { + $result = dol_delete_file($filetodelete); + } + if ($removeFile) { + setEventMessages($langs->trans("ApiObjectDeleted"), null); + } + } else { + $result = dol_delete_file($filetodelete); + } if (!$result) { setEventMessages($langs->trans("ErrorFailToDeleteFile", basename($filetodelete)), null, 'errors'); } else { From 834cb830475471c4b8b1dcbc4cb2261cefe29622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 14 Apr 2023 10:06:10 +0200 Subject: [PATCH 06/18] NEW repair script skip views --- htdocs/core/db/Database.interface.php | 11 +++++++++ htdocs/core/db/mysqli.class.php | 32 +++++++++++++++++++++++++++ htdocs/core/db/pgsql.class.php | 28 +++++++++++++++++++++++ htdocs/core/db/sqlite3.class.php | 32 +++++++++++++++++++++++++++ htdocs/install/repair.php | 28 ++++++++++++++--------- 5 files changed, 121 insertions(+), 10 deletions(-) diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 180f928eac0..ac9d6134f9a 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -129,6 +129,17 @@ interface Database public function DDLListTables($database, $table = ''); // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * List tables into a database with table type + * + * @param string $database Name of database + * @param string $table Name of table filter ('xxx%') + * @return array List of tables in an array + */ + public function DDLListTablesFull($database, $table = ''); + // phpcs:enable + /** * Return last request executed with query() * diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index e36fc547fa0..091a9bb8cf6 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -716,6 +716,38 @@ class DoliDBMysqli extends DoliDB return $listtables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * List tables into a database + * + * @param string $database Name of database + * @param string $table Nmae of table filter ('xxx%') + * @return array List of tables in an array + */ + public function DDLListTablesFull($database, $table = '') + { + // phpcs:enable + $listtables = array(); + + $like = ''; + if ($table) { + $tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table); + + $like = "LIKE '".$this->escape($tmptable)."'"; + } + $tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database); + + $sql = "SHOW FULL TABLES FROM `".$tmpdatabase."` ".$like.";"; + + $result = $this->query($sql); + if ($result) { + while ($row = $this->fetch_row($result)) { + $listtables[] = $row; + } + } + return $listtables; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * List information of columns into a table. diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index fb18ed0f161..626a2ef6043 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -977,6 +977,34 @@ class DoliDBPgsql extends DoliDB return $listtables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * List tables into a database + * + * @param string $database Name of database + * @param string $table Name of table filter ('xxx%') + * @return array List of tables in an array + */ + public function DDLListTablesFull($database, $table = '') + { + // phpcs:enable + $listtables = array(); + + $escapedlike = ''; + if ($table) { + $tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table); + + $escapedlike = " AND table_name LIKE '".$this->escape($tmptable)."'"; + } + $result = pg_query($this->db, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'".$escapedlike." ORDER BY table_name"); + if ($result) { + while ($row = $this->fetch_row($result)) { + $listtables[] = $row; + } + } + return $listtables; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * List information of columns into a table. diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 40d0f10baa8..909676439ca 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -896,6 +896,38 @@ class DoliDBSqlite3 extends DoliDB return $listtables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * List tables into a database with table type + * + * @param string $database Name of database + * @param string $table Name of table filter ('xxx%') + * @return array List of tables in an array + */ + public function DDLListTablesFull($database, $table = '') + { + // phpcs:enable + $listtables = array(); + + $like = ''; + if ($table) { + $tmptable = preg_replace('/[^a-z0-9\.\-\_%]/i', '', $table); + + $like = "LIKE '".$this->escape($tmptable)."'"; + } + $tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database); + + $sql = "SHOW FULL TABLES FROM ".$tmpdatabase." ".$like.";"; + //print $sql; + $result = $this->query($sql); + if ($result) { + while ($row = $this->fetch_row($result)) { + $listtables[] = $row; + } + } + return $listtables; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * List information of columns into a table. diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 70be057b7b8..b5b408b00ca 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1244,7 +1244,7 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) { if ($db->type == "mysql" || $db->type == "mysqli") { $force_utf8_on_tables = GETPOST('force_utf8_on_tables', 'alpha'); - $listoftables = $db->DDLListTables($db->database_name); + $listoftables = $db->DDLListTablesFull($db->database_name); // Disable foreign key checking for avoid errors if ($force_utf8_on_tables == 'confirmed') { @@ -1255,14 +1255,18 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) { foreach ($listoftables as $table) { // do not convert llx_const if mysql encrypt/decrypt is used - if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) { + if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table[0])) { + continue; + } + if ($table[1] == 'VIEW') { + print ''.$table[0].' is a '.$table[1].' (Skipped)'; continue; } print ''; - print $table; - $sql1 = "ALTER TABLE ".$table." ROW_FORMAT=dynamic"; - $sql2 = "ALTER TABLE ".$table." CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + print $table[0]; + $sql1 = "ALTER TABLE ".$table[0]." ROW_FORMAT=dynamic"; + $sql2 = "ALTER TABLE ".$table[0]." CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci"; print ''; print ''; if ($force_utf8_on_tables == 'confirmed') { @@ -1297,7 +1301,7 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) { if ($db->type == "mysql" || $db->type == "mysqli") { $force_utf8mb4_on_tables = GETPOST('force_utf8mb4_on_tables', 'alpha'); - $listoftables = $db->DDLListTables($db->database_name); + $listoftables = $db->DDLListTablesFull($db->database_name); // Disable foreign key checking for avoid errors if ($force_utf8mb4_on_tables == 'confirmed') { @@ -1308,14 +1312,18 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) { foreach ($listoftables as $table) { // do not convert llx_const if mysql encrypt/decrypt is used - if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) { + if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table[0])) { + continue; + } + if ($table[1] == 'VIEW') { + print ''.$table[0].' is a '.$table[1].' (Skipped)'; continue; } print ''; - print $table; - $sql1 = "ALTER TABLE ".$table." ROW_FORMAT=dynamic"; - $sql2 = "ALTER TABLE ".$table." CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"; + print $table[0]; + $sql1 = "ALTER TABLE ".$table[0]." ROW_FORMAT=dynamic"; + $sql2 = "ALTER TABLE ".$table[0]." CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"; print ''; print ''; if ($force_utf8mb4_on_tables == 'confirmed') { From ccb88a9b76a61b79605f6759b3a447d724336b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 14 Apr 2023 10:10:28 +0200 Subject: [PATCH 07/18] NEW repair script skip views --- htdocs/core/db/pgsql.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 626a2ef6043..2295d659704 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -996,7 +996,7 @@ class DoliDBPgsql extends DoliDB $escapedlike = " AND table_name LIKE '".$this->escape($tmptable)."'"; } - $result = pg_query($this->db, "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'".$escapedlike." ORDER BY table_name"); + $result = pg_query($this->db, "SELECT table_name, table_type FROM information_schema.tables WHERE table_schema = 'public'".$escapedlike." ORDER BY table_name"); if ($result) { while ($row = $this->fetch_row($result)) { $listtables[] = $row; From 0c86eebcc7968a55e9b27e164ba9f4cfe4e344b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 14 Apr 2023 10:15:23 +0200 Subject: [PATCH 08/18] fix debug bar --- htdocs/debugbar/class/TraceableDB.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 8e28b0c59bd..3622558731f 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -205,6 +205,18 @@ class TraceableDB extends DoliDB return $this->db->DDLListTables($database, $table); } + /** + * List tables into a database with table info + * + * @param string $database Name of database + * @param string $table Nmae of table filter ('xxx%') + * @return array List of tables in an array + */ + public function DDLListTablesFull($database, $table = '') + { + return $this->db->DDLListTablesFull($database, $table); + } + /** * Return last request executed with query() * From 0c251d64bbf3f560581554c52f25a505ea8cffcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 01:35:33 +0300 Subject: [PATCH 09/18] Update llx_10_c_regions.sql Turkey regions added --- htdocs/install/mysql/data/llx_10_c_regions.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index f86fbe069b8..d319396e246 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -547,3 +547,11 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana'); +-- Turkiye (Turkey) Regions (id country=221) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22101, '', 0, 'Marmara'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22102, '', 0, 'İç Anadolu'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22103, '', 0, 'Ege'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22104, '', 0, 'Akdeniz'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22105, '', 0, 'Güneydoğu'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22106, '', 0, 'Karadeniz'); +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 221, 22107, '', 0, 'Doğu Anadolu'); From f0d4dc1caf85efa485347d8c9c148567a5d5c2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 01:41:37 +0300 Subject: [PATCH 10/18] Update llx_c_tva.sql Turkey Vat added --- htdocs/install/mysql/data/llx_c_tva.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 72cff6afde7..74e62e8acdc 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -403,3 +403,9 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (23 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2335,61, '0','0','No VAT',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2336,61, '10','0','VAT 10%',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2337,61, '18','0','VAT 18%',1); + +-- Turkiye (Turkey) (id country=221) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22101,221, '0','0','No VAT',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22102,221, '1','0','VAT 1%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22103,221, '8','0','VAT 8%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (22104,221, '18','0','VAT 18%',1); From 80a6d08e8438d37f9ce5c744c7029e3d91921bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 02:21:20 +0300 Subject: [PATCH 11/18] Update llx_20_c_departements.sql Turkiye cities added --- .../mysql/data/llx_20_c_departements.sql | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 9e93196c3d7..bff1a15fa93 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -1951,3 +1951,88 @@ insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom, active) values (12301, '45', '', 0, '宮崎', '宮崎県', 1); insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom, active) values (12301, '46', '', 0, '鹿児島', '鹿児島県', 1); insert into llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom, active) values (12301, '47', '', 0, '沖縄', '沖縄県', 1); + + +-- Turkiye (Turkey) (id country=221) + +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-01',22104,'Adana'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-02',22107,'Adıyaman'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-03',22103,'Afyon'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-04',22107,'Ağrı'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-05',22106,'Amasya'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-06',22102,'Ankara'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-07',22104,'Antalya'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-08',22106,'Artvin'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-09',22103,'Aydın'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-10',22101,'Balıkesir'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-11',22101,'Bilecik'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-12',22107,'Bingöl'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-13',22107,'Bitlis'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-14',22106,'Bolu'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-15',22104,'Burdur'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-16',22101,'Bursa'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-17',22101,'Çanakkale'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-18',22102,'Çankırı'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-19',22106,'Çorum'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-20',22104,'Denizli'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-21',22105,'Diyarbakır'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-22',22101,'Edirne'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-23',22107,'Elazığ'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-24',22107,'Erzincan'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-25',22107,'Erzurum'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-26',22102,'Eskişehir'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-27',22105,'Gaziantep'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-28',22106,'Giresun'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-29',22106,'Gümüşhane'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-30',22107,'Hakkari'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-31',22104,'Hatay'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-32',22104,'Isparta'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-33',22104,'İçel'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-34',22101,'İstanbul'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-35',22103,'İzmir'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-36',22107,'Kars'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-37',22106,'Kastamonu'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-38',22102,'Kayseri'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-39',22101,'Kırklareli'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-40',22102,'Kırşehir'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-41',22101,'Kocaeli'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-42',22102,'Konya'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-43',22103,'Kütahya'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-44',22107,'Malatya'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-45',22103,'Manisa'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-46',22104,'Kahramanmaraş'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-47',22105,'Mardin'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-48',22103,'Muğla'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-49',22107,'Muş'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-50',22102,'Nevşehir'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-51',22102,'Niğde'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-52',22106,'Ordu'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-53',22106,'Rize'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-54',22101,'Sakarya'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-55',22106,'Samsun'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-56',22105,'Siirt'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-57',22106,'Sinop'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-58',22102,'Sivas'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-59',22101,'Tekirdağ'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-60',22106,'Tokat'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-61',22106,'Trabzon'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-62',22107,'Tunceli'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-63',22105,'Şanlıurfa'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-63',22103,'Uşak'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-65',22107,'Van'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-66',22102,'Yozgat'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-67',22106,'Zonguldak'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-68',22102,'Aksaray'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-69',22106,'Bayburt'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-70',22102,'Karaman'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-71',22102,'Kırıkkale'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-72',22105,'Batman'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-73',22105,'Şırnak'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-74',22106,'Bartın'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-75',22107,'Ardahan'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-76',22107,'Iğdır'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-77',22101,'Yalova'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-78',22106,'Karabük'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-79',22105,'Kilis'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-80',22104,'Osmaniye'); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-81',22106,'Düzce); From ed4331ee1601d4007d1cc857c445591b6c21835f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 02:27:44 +0300 Subject: [PATCH 12/18] Update llx_c_currencies.sql Turkey Lira currency sign fixed --- htdocs/install/mysql/data/llx_c_currencies.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_currencies.sql b/htdocs/install/mysql/data/llx_c_currencies.sql index 04d17e98b6a..0c02c303c78 100644 --- a/htdocs/install/mysql/data/llx_c_currencies.sql +++ b/htdocs/install/mysql/data/llx_c_currencies.sql @@ -154,7 +154,7 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TWD' INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'THB', '[3647]', 1, 'Thailand Baht'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TTD', '[84,84,36]', 1, 'Trinidad and Tobago Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TND', NULL, 1, 'Tunisia Dinar'); -INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8356]', 1, 'Turkey Lira'); +INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TRY', '[8378]', 1, 'Turkey Lira'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'TVD', '[36]', 1, 'Tuvalu Dollar'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'UAH', '[8372]', 1, 'Ukraine Hryvna'); INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'AED', NULL, 1, 'United Arab Emirates Dirham'); From c58840d32bfdaef53c733869f7276764b1fa231a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 02:34:12 +0300 Subject: [PATCH 13/18] Update llx_20_c_departements.sql typo fixed --- htdocs/install/mysql/data/llx_20_c_departements.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index bff1a15fa93..ad647028c9a 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -2035,4 +2035,4 @@ INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-77 INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-78',22106,'Karabük'); INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-79',22105,'Kilis'); INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-80',22104,'Osmaniye'); -INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-81',22106,'Düzce); +INSERT INTO llx_c_departements (code_departement, fk_region, nom) VALUES ('TR-81',22106,'Düzce'); From f376fce8b58da19372f8ca32e5b1e1c2a05b9661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 03:02:42 +0300 Subject: [PATCH 14/18] Update llx_c_revenuestamp.sql Turkey Revenue stamp tax added --- htdocs/install/mysql/data/llx_c_revenuestamp.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_revenuestamp.sql b/htdocs/install/mysql/data/llx_c_revenuestamp.sql index 8f8eaca93ca..f19f40abe30 100644 --- a/htdocs/install/mysql/data/llx_c_revenuestamp.sql +++ b/htdocs/install/mysql/data/llx_c_revenuestamp.sql @@ -31,6 +31,10 @@ insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) -- MEXICO (id country=154) -- -insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1541, 154, 1.5, 'percent', 'Revenue stamp mexico', 1); +insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1541, 154, 1.5, 'percent', 'Revenue stamp mexico', 1); insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1542, 154, 3, 'percent', 'Revenue stamp mexico', 1); +-- Turkiye (Turkey) (id country=221) -- +insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (22101,221,0.00948,'percent','Mukavelenameler Damga Vergisi',1); +insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (22102,221,0.00189,'percent','Kira mukavelenameleri Damga Vergisi',1); + From 69bca5da4b4b3a3c3e09eb89a09d9405f93b26d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20G=C3=BCrb=C3=BCz?= <68557038+BayramGrbz45@users.noreply.github.com> Date: Mon, 17 Apr 2023 03:13:20 +0300 Subject: [PATCH 15/18] Update llx_c_revenuestamp.sql fix tipo --- htdocs/install/mysql/data/llx_c_revenuestamp.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_revenuestamp.sql b/htdocs/install/mysql/data/llx_c_revenuestamp.sql index f19f40abe30..ba4e316e2d0 100644 --- a/htdocs/install/mysql/data/llx_c_revenuestamp.sql +++ b/htdocs/install/mysql/data/llx_c_revenuestamp.sql @@ -31,7 +31,7 @@ insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) -- MEXICO (id country=154) -- -insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1541, 154, 1.5, 'percent', 'Revenue stamp mexico', 1); +insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1541, 154, 1.5, 'percent', 'Revenue stamp mexico', 1); insert into llx_c_revenuestamp(rowid,fk_pays,taux,revenuestamp_type,note,active) values (1542, 154, 3, 'percent', 'Revenue stamp mexico', 1); -- Turkiye (Turkey) (id country=221) -- From df909b515faec901b0e5be76e53eab1109b49d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 17 Apr 2023 13:42:05 +0200 Subject: [PATCH 16/18] Fix phpunit --- test/phpunit/ProductTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 79685e5fab5..93a5e4787ba 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -82,7 +82,7 @@ class ProductTest extends PHPUnit\Framework\TestCase { global $conf,$user,$langs,$db; - if (!isModEnabled('produit')) { + if (!isModEnabled('product')) { print __METHOD__." Module Product must be enabled.\n"; die(1); } From ce227bd78ef1e7f23cd89ad197051b0c672de795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 18 Apr 2023 10:46:24 +0200 Subject: [PATCH 17/18] use isModEnabled --- htdocs/user/class/user.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e7b9bdbf844..8767c70f2b1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2018 charlene Benke * Copyright (C) 2018-2021 Nicolas ZABOURI - * Copyright (C) 2019-2020 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2019 Abbes Bahfir * * This program is free software; you can redistribute it and/or modify @@ -2453,7 +2453,7 @@ class User extends CommonObject //print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id; $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword'; $url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id)); - if (!empty($conf->multicompany->enabled)) { + if (isModEnabled('multicompany')) { $url .= '&entity='.(!empty($this->entity) ? $this->entity : 1); } From e3d6933cf085283e0796e0d23c6b0f522d2af085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 18 Apr 2023 10:53:00 +0200 Subject: [PATCH 18/18] Update translate.class.php --- htdocs/core/class/translate.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 7379877753b..19cb66ad68d 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -459,7 +459,7 @@ class Translate // Enable caching of lang file in memory (not by default) $usecachekey = ''; // Using a memcached server - if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) { + if (isModEnabled('memcached') && !empty($conf->global->MEMCACHED_SERVER)) { $usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)