From 7ec3b30b7071b2047d2cb495458c54d746204d8e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Sep 2024 11:12:51 +0200 Subject: [PATCH 1/9] Fix showing SPF record --- htdocs/admin/mails.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 25d6264bca6..3dcf26fea0a 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1059,20 +1059,18 @@ if ($action == 'edit') { } // Test SPF default automatic email from $defaultnoreplyemail = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if ($defaultnoreplyemail != $companyemail) { // We show if email differs - $dnsinfo = false; - if (!empty($defaultnoreplyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { - $arrayofemailparts = explode('@', $defaultnoreplyemail); - if (count($arrayofemailparts) == 2) { - $domain = $arrayofemailparts[1]; - $dnsinfo = dns_get_record($domain, DNS_TXT); - } + $dnsinfo = false; + if (!empty($defaultnoreplyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { + $arrayofemailparts = explode('@', $defaultnoreplyemail); + if (count($arrayofemailparts) == 2) { + $domain = $arrayofemailparts[1]; + $dnsinfo = dns_get_record($domain, DNS_TXT); } - if (!empty($dnsinfo) && is_array($dnsinfo)) { - foreach ($dnsinfo as $info) { - if (strpos($info['txt'], 'v=spf') !== false) { - $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']); - } + } + if (!empty($dnsinfo) && is_array($dnsinfo)) { + foreach ($dnsinfo as $info) { + if (strpos($info['txt'], 'v=spf') !== false) { + $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']); } } } From c8d6281b3e4beb8079081d6a6927fcdaab354c2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Sep 2024 11:16:52 +0200 Subject: [PATCH 2/9] Revert "Fix showing SPF record" This reverts commit 7ec3b30b7071b2047d2cb495458c54d746204d8e. --- htdocs/admin/mails.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 3dcf26fea0a..25d6264bca6 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1059,18 +1059,20 @@ if ($action == 'edit') { } // Test SPF default automatic email from $defaultnoreplyemail = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - $dnsinfo = false; - if (!empty($defaultnoreplyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { - $arrayofemailparts = explode('@', $defaultnoreplyemail); - if (count($arrayofemailparts) == 2) { - $domain = $arrayofemailparts[1]; - $dnsinfo = dns_get_record($domain, DNS_TXT); + if ($defaultnoreplyemail != $companyemail) { // We show if email differs + $dnsinfo = false; + if (!empty($defaultnoreplyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { + $arrayofemailparts = explode('@', $defaultnoreplyemail); + if (count($arrayofemailparts) == 2) { + $domain = $arrayofemailparts[1]; + $dnsinfo = dns_get_record($domain, DNS_TXT); + } } - } - if (!empty($dnsinfo) && is_array($dnsinfo)) { - foreach ($dnsinfo as $info) { - if (strpos($info['txt'], 'v=spf') !== false) { - $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']); + if (!empty($dnsinfo) && is_array($dnsinfo)) { + foreach ($dnsinfo as $info) { + if (strpos($info['txt'], 'v=spf') !== false) { + $text .= ($text ? '

' : '').$langs->trans("ActualMailSPFRecordFound", $defaultnoreplyemail, $info['txt']); + } } } } From ed81c3f8757e51ce348962ab5b184395c01f3155 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Sep 2024 11:20:06 +0200 Subject: [PATCH 3/9] Fix info on smartphone --- htdocs/admin/mails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 25d6264bca6..dfa6fab2782 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1079,7 +1079,7 @@ if ($action == 'edit') { if ($text) { - print info_admin($text); + print info_admin($text, 0, 0, '1', ''); } } From 6e19d09a66efeeef1e658332377f4b3fcaf6f577 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Sep 2024 16:52:39 +0200 Subject: [PATCH 4/9] More info to help debug --- htdocs/core/lib/functions.lib.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 15555ee19b7..0824379ab79 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5810,7 +5810,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss */ function dol_print_error($db = null, $error = '', $errors = null) { - global $conf, $langs, $argv; + global $conf, $langs, $user, $argv; global $dolibarr_main_prod; $out = ''; @@ -5838,6 +5838,9 @@ function dol_print_error($db = null, $error = '', $errors = null) if (isset($conf->global->MAIN_FEATURES_LEVEL)) { $out .= "".$langs->trans("LevelOfFeature").": ".getDolGlobalInt('MAIN_FEATURES_LEVEL')."
\n"; } + if ($user instanceof User) { + $out .= "".$langs->trans("Login").": ".$user->login."
\n"; + } if (function_exists("phpversion")) { $out .= "".$langs->trans("PHP").": ".phpversion()."
\n"; } From 02e6c3da2e28e282840a479be0c7074064dff628 Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller <45882981+Hystepik@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:18:54 +0200 Subject: [PATCH 5/9] Fix #30628 currency convertion rate error (#30849) Co-authored-by: Hystepik --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 18e9b95e329..0bede5a6b4d 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -454,7 +454,7 @@ if (empty($reshook)) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { // Multicurrency rate - $result = $object->setMulticurrencyRate(price2num(GETPOSTINT('multicurrency_tx')), GETPOSTINT('calculation_mode')); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha')), GETPOSTINT('calculation_mode')); } elseif ($action == 'setbankaccount' && $usercancreate) { // bank account $result = $object->setBankAccount(GETPOSTINT('fk_account')); From 575917a3c998d3e7e7350660fa6de1fa36a41dc3 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 4 Sep 2024 20:20:52 +0200 Subject: [PATCH 6/9] fix: create invoice from shipping list (20.0) (#30851) * fix: When create invoice from shipping list translation of mass action is wrong and invoice line desc is wrong * fix: translation * fix: translation * fix: translation --- htdocs/expedition/list.php | 10 +++++----- htdocs/langs/en_US/sendings.lang | 2 +- htdocs/langs/fr_FR/sendings.lang | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 4ac91b134e4..776e9d592c6 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Load translation files required by the page -$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills', 'products')); +$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills', 'products', 'orders')); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search @@ -268,7 +268,7 @@ if (empty($reshook)) { $objecttmp->fk_project = $expd->fk_project; $objecttmp->multicurrency_code = !empty($expdCmdSrc->multicurrency_code) ? $expdCmdSrc->multicurrency_code : (!empty($objecttmp->thirdparty->multicurrency_code) ? $objecttmp->thirdparty->multicurrency_code : $expd->multicurrency_code); if (empty($createbills_onebythird)) { - $objecttmp->ref_client = $expd->ref_client; + $objecttmp->ref_customer = $expd->ref_customer; } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); @@ -277,7 +277,7 @@ if (empty($reshook)) { } $objecttmp->date = $datefacture; - $objecttmp->origin = 'shipping'; + $objecttmp->origin_type = 'shipping'; $objecttmp->origin_id = $id_sending; $objecttmp->array_options = $expd->array_options; // Copy extrafields @@ -344,13 +344,13 @@ if (empty($reshook)) { $desc = ($lines[$i]->desc ? $lines[$i]->desc : ''); // If we build one invoice for several sendings, we must put the ref of sending on the invoice line if (!empty($createbills_onebythird)) { - $desc = dol_concatdesc($desc, $langs->trans("Order").' '.$expd->ref.' - '.dol_print_date($expd->date, 'day')); + $desc = dol_concatdesc($desc, $langs->trans("Order").': '.$expdCmdSrc->ref. ' - '. $langs->trans("Shipment").': '.$expd->ref.($expd->date_shipping ? ' - '.dol_print_date($expd->date_shipping, 'day'):'')); } if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) { // Negative line, we create a discount line $discount = new DiscountAbsolute($db); - $discount->fk_soc = $objecttmp->socid; + $discount->socid = $objecttmp->socid; $discount->amount_ht = abs($lines[$i]->total_ht); $discount->amount_tva = abs($lines[$i]->total_tva); $discount->amount_ttc = abs($lines[$i]->total_ttc); diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 71d4214c8a5..9f648d5f706 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -63,7 +63,7 @@ NoProductToShipFoundIntoStock=No product to ship found in warehouse %s. C WeightVolShort=Weight/Vol. ValidateOrderFirstBeforeShipment=You must first validate the order before being able to make shipments. NoLineGoOnTabToAddSome=No line, go on tab "%s" to add -CreateInvoiceForThisCustomerFromSendings=Bill sendings +CreateInvoiceForThisCustomerFromSendings=Create Bills IfValidateInvoiceIsNoSendingStayUnbilled=If invoice validation is 'No', the sending will remain to status 'Unbilled' until the invoice is validated. OptionToSetSendingBilledNotEnabled=Option from module Workflow, to set sending to 'Billed' automatically when invoice is validated, is not enabled, so you will have to set the status of sendings to 'Billed' manually after the invoice has been generated. diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index d102ba0b21b..8c1a84f562d 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -63,7 +63,7 @@ NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouvé dans WeightVolShort=Poids/vol. ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une expédition. NoLineGoOnTabToAddSome=Aucune ligne, allez sur l'onglet "%s" pour en ajouter -CreateInvoiceForThisCustomerFromSendings=Envois de factures +CreateInvoiceForThisCustomerFromSendings=Création de factures IfValidateInvoiceIsNoSendingStayUnbilled=Si la validation de la facture est "Non", l'envoi restera à l'état "Non facturé" jusqu'à ce que la facture soit validée. OptionToSetSendingBilledNotEnabled=L'option du module Workflow, qui permet de définir l'envoi comme "facturé" automatiquement lorsque la facture est validée, n'est pas activée. Vous devrez donc définir manuellement l'état des envois comme "facturé" après que la facture a été générée. From 9ea29c01a6d1cea677c7ee9dcb215bda32b35e00 Mon Sep 17 00:00:00 2001 From: hansemschnokeloch Date: Wed, 4 Sep 2024 21:18:11 +0200 Subject: [PATCH 7/9] Fix countable error (#30839) --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 11d5ebb187f..4a720a114fd 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1116,7 +1116,7 @@ if ($action == 'create') { // Document model include_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php'; $list = ModelePdfExpedition::liste_modeles($db); - if (count($list) > 1) { + if (is_countable($list) && count($list) > 1) { print "".$langs->trans("DefaultModel").""; print ''; print img_picto('', 'pdf', 'class="pictofixedwidth"'); From 3d3527d46665cdd5d35754b85a7e8ddce05f2169 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Sep 2024 11:49:33 +0200 Subject: [PATCH 8/9] Fix repair to convert charset utf8 utf8mb4 --- htdocs/install/fileconf.php | 2 +- htdocs/install/inc.php | 6 +- htdocs/install/repair.php | 151 +++++++++++++++++++++++++++++++++--- htdocs/install/step1.php | 2 +- htdocs/install/step2.php | 2 +- htdocs/install/step4.php | 2 +- htdocs/install/step5.php | 2 +- 7 files changed, 149 insertions(+), 18 deletions(-) diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 09aa559393f..17c054182ed 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -97,7 +97,7 @@ if (@file_exists($forcedfile)) { session_start(); // To be able to keep info into session (used for not losing pass during navigation. pass must not transit through parameters) -pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY.'/'), 'main-inside-bis'); +pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY.'/'), 'main-inside-bis'); // Test if we can run a first install process if (!is_writable($conffile)) { diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 46111f46912..bc8ffafb9d2 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -592,9 +592,11 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl print DOL_VERSION; print '
'; - print ''.$langs->trans("DolibarrSetup"); + print ''; if ($subtitle) { - print ' - '.$subtitle; + print $subtitle; + } else { + print $langs->trans("DolibarrSetup"); } print ''."\n"; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 845127210ca..16079946b6a 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -73,13 +73,11 @@ if (!is_object($conf)) { * View */ -pHeader('', "upgrade2", GETPOST('action', 'aZ09')); +pHeader($langs->trans("Repair"), "upgrade2", GETPOST('action', 'aZ09')); // Action to launch the repair script $actiondone = 1; -print '

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

'; - print '
'; print $langs->trans("SetAtLeastOneOptionAsUrlParameter"); print '
'; @@ -1298,16 +1296,54 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) { if ($force_utf8_on_tables == 'confirmed') { $sql = 'SET FOREIGN_KEY_CHECKS=0'; print ''; + print ''.$sql.''; $resql = $db->query($sql); } + $foreignkeystorestore = array(); + + // First loop to delete foreign keys + 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[0])) { + continue; + } + if ($table[1] == 'VIEW') { + print ''.$table[0].' is a '.$table[1].' (Skipped)'; + continue; + } + + // Special case of tables with foreign key on varchar fields + $arrayofforeignkey = array( + 'llx_accounting_account' => 'fk_accounting_account_fk_pcg_version', + 'llx_accounting_system' => 'fk_accounting_account_fk_pcg_version', + 'llx_c_type_contact' => 'fk_societe_commerciaux_fk_c_type_contact_code', + 'llx_societe_commerciaux' => 'fk_societe_commerciaux_fk_c_type_contact_code' + ); + + foreach ($arrayofforeignkey as $tmptable => $foreignkeyname) { + if ($table[0] == $tmptable) { + print ''; + $sqltmp = 'ALTER TABLE '.$table[0].' DROP FOREIGN KEY '.$foreignkeyname; + print $sqltmp; + if ($force_utf8_on_tables == 'confirmed') { + $resqltmp = $db->query($sqltmp); + } else { + print ' - Disabled'; + } + print ''; + $foreignkeystorestore[$tmptable] = $foreignkeyname; + } + } + } + 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[0])) { continue; } if ($table[1] == 'VIEW') { - print ''.$table[0].' is a '.$table[1].' (Skipped)'; + print ''.$table[0].' is a '.$table[1].' (Skipped)'; continue; } @@ -1324,17 +1360,45 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) { } else { $resql2 = false; } - print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; + print ' - Done '.(($resql1 && $resql2) ? '(OK)' : '(KO)'); } else { - print ' - Disabled'; + print ' - Disabled'; } print ''; + flush(); + ob_flush(); + } + + // Restore dropped foreign keys + foreach ($foreignkeystorestore as $tmptable => $foreignkeyname) { + $stringtofindinline = 'ALTER TABLE .* ADD CONSTRAINT '.$foreignkeyname; + $fileforkeys = DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$tmptable.'.key.sql'; + //print 'Search in '.$fileforkeys.' to get '.$stringtofindinline."
\n"; + + $handle = fopen($fileforkeys, 'r'); + if ($handle) { + while (($line = fgets($handle)) !== false) { + // Process the line read. + if (preg_match('/^'.$stringtofindinline.'/i', $line)) { + $resqltmp = $db->query($line); + print ''; + print $line; + print ' - Done '.($resqltmp ? '(OK)' : '(KO)'); + print ''; + break; + } + } + fclose($handle); + } + flush(); + ob_flush(); } // Enable foreign key checking if ($force_utf8_on_tables == 'confirmed') { $sql = 'SET FOREIGN_KEY_CHECKS=1'; print ''; + print ''.$sql.''; $resql = $db->query($sql); } } else { @@ -1349,22 +1413,61 @@ 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->DDLListTablesFull($db->database_name); // Disable foreign key checking for avoid errors if ($force_utf8mb4_on_tables == 'confirmed') { $sql = 'SET FOREIGN_KEY_CHECKS=0'; print ''; + print ''.$sql.''; $resql = $db->query($sql); } + $foreignkeystorestore = array(); + + // First loop to delete foreign keys + 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[0])) { + continue; + } + if ($table[1] == 'VIEW') { + print ''.$table[0].' is a '.$table[1].' (Skipped)'; + continue; + } + + // Special case of tables with foreign key on varchar fields + $arrayofforeignkey = array( + 'llx_accounting_account' => 'fk_accounting_account_fk_pcg_version', + 'llx_accounting_system' => 'fk_accounting_account_fk_pcg_version', + 'llx_c_type_contact' => 'fk_societe_commerciaux_fk_c_type_contact_code', + 'llx_societe_commerciaux' => 'fk_societe_commerciaux_fk_c_type_contact_code' + ); + + foreach ($arrayofforeignkey as $tmptable => $foreignkeyname) { + if ($table[0] == $tmptable) { + print ''; + $sqltmp = 'ALTER TABLE '.$table[0].' DROP FOREIGN KEY '.$foreignkeyname; + print $sqltmp; + if ($force_utf8mb4_on_tables == 'confirmed') { + $resqltmp = $db->query($sqltmp); + } else { + print ' - Disabled'; + } + print ''; + $foreignkeystorestore[$tmptable] = $foreignkeyname; + } + } + } + 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[0])) { continue; } if ($table[1] == 'VIEW') { - print ''.$table[0].' is a '.$table[1].' (Skipped)'; + print ''.$table[0].' is a '.$table[1].' (Skipped)'; continue; } @@ -1381,19 +1484,45 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) { } else { $resql2 = false; } - print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; + print ' - Done '.(($resql1 && $resql2) ? '(OK)' : '(KO)'); } else { - print ' - Disabled'; + print ' - Disabled'; } print ''; flush(); ob_flush(); } + // Restore dropped foreign keys + foreach ($foreignkeystorestore as $tmptable => $foreignkeyname) { + $stringtofindinline = 'ALTER TABLE .* ADD CONSTRAINT '.$foreignkeyname; + $fileforkeys = DOL_DOCUMENT_ROOT.'/install/mysql/tables/'.$tmptable.'.key.sql'; + //print 'Search in '.$fileforkeys.' to get '.$stringtofindinline."
\n"; + + $handle = fopen($fileforkeys, 'r'); + if ($handle) { + while (($line = fgets($handle)) !== false) { + // Process the line read. + if (preg_match('/^'.$stringtofindinline.'/i', $line)) { + $resqltmp = $db->query($line); + print ''; + print $line; + print ' - Done '.($resqltmp ? '(OK)' : '(KO)'); + print ''; + break; + } + } + fclose($handle); + } + flush(); + ob_flush(); + } + // Enable foreign key checking if ($force_utf8mb4_on_tables == 'confirmed') { $sql = 'SET FOREIGN_KEY_CHECKS=1'; print ''; + print ''.$sql.''; $resql = $db->query($sql); } } else { @@ -1439,9 +1568,9 @@ if ($ok && GETPOST('force_collation_from_conf_on_tables', 'alpha')) { } else { $resql2 = false; } - print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; + print ' - Done '.(($resql1 && $resql2) ? '(OK)' : '(KO)'); } else { - print ' - Disabled'; + print ' - Disabled'; } print ''; } diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 50d807803e5..615cd9cd142 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -162,7 +162,7 @@ $error = 0; dolibarr_install_syslog("--- step1: entering step1.php page"); -pHeader($langs->trans("ConfigurationFile"), "step2"); +pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("ConfigurationFile"), "step2"); // Test if we can run a first install process if (!is_writable($conffile)) { diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 76fccc5a621..78704659a3a 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -98,7 +98,7 @@ dolibarr_install_syslog("--- step2: entering step2.php page"); * View */ -pHeader($langs->trans("CreateDatabaseObjects"), "step4"); +pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("CreateDatabaseObjects"), "step4"); // Test if we can run a first install process if (!is_writable($conffile)) { diff --git a/htdocs/install/step4.php b/htdocs/install/step4.php index c93f4c815e1..dee25c701c9 100644 --- a/htdocs/install/step4.php +++ b/htdocs/install/step4.php @@ -59,7 +59,7 @@ $ok = 0; * View */ -pHeader($langs->trans("AdminAccountCreation"), "step5"); +pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("AdminAccountCreation"), "step5"); // Test if we can run a first install process if (!is_writable($conffile)) { diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 29166c03f5d..4d1764cc3cf 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -126,7 +126,7 @@ if ($action == "set") { $morehtml = ''; -pHeader($langs->trans("SetupEnd"), "step5", 'set', '', '', 'main-inside main-inside-borderbottom'); +pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("SetupEnd"), "step5", 'set', '', '', 'main-inside main-inside-borderbottom'); print '
'; // Test if we can run a first install process From c80d75c8b3daea42704fbc0d40626a38ce808030 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 5 Sep 2024 11:53:24 +0200 Subject: [PATCH 9/9] NEW Add gitleaks into pre-commit --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e7edb002653..79ec8b049e9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,6 +58,12 @@ repos: # Check that there are no files that have are the same when uppercased (conflict on windows) - id: check-case-conflict + # Beautify shell scripts + - repo: https://github.com/gitleaks/gitleaks.git + rev: v8.16.1 + hooks: + - id: gitleaks + # Beautify shell scripts - repo: https://github.com/lovesegfault/beautysh.git rev: v6.2.1