2
0
forked from Wavyzz/dolibarr

Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2024-09-05 12:40:15 +02:00
12 changed files with 161 additions and 27 deletions

View File

@@ -1089,7 +1089,7 @@ if ($action == 'edit') {
if ($text) { if ($text) {
print info_admin($text); print info_admin($text, 0, 0, '1', '');
} }
} }

View File

@@ -5935,7 +5935,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
*/ */
function dol_print_error($db = null, $error = '', $errors = null) function dol_print_error($db = null, $error = '', $errors = null)
{ {
global $conf, $langs, $argv; global $conf, $langs, $user, $argv;
global $dolibarr_main_prod; global $dolibarr_main_prod;
$out = ''; $out = '';
@@ -5963,6 +5963,9 @@ function dol_print_error($db = null, $error = '', $errors = null)
if (isset($conf->global->MAIN_FEATURES_LEVEL)) { if (isset($conf->global->MAIN_FEATURES_LEVEL)) {
$out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".getDolGlobalInt('MAIN_FEATURES_LEVEL')."<br>\n"; $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".getDolGlobalInt('MAIN_FEATURES_LEVEL')."<br>\n";
} }
if ($user instanceof User) {
$out .= "<b>".$langs->trans("Login").":</b> ".$user->login."<br>\n";
}
if (function_exists("phpversion")) { if (function_exists("phpversion")) {
$out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n"; $out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
} }

View File

@@ -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'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
// Load translation files required by the page // 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 $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->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); $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)) { 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')); $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->date = $datefacture;
$objecttmp->origin = 'shipping'; $objecttmp->origin_type = 'shipping';
$objecttmp->origin_id = $id_sending; $objecttmp->origin_id = $id_sending;
$objecttmp->array_options = $expd->array_options; // Copy extrafields $objecttmp->array_options = $expd->array_options; // Copy extrafields
@@ -344,13 +344,13 @@ if (empty($reshook)) {
$desc = ($lines[$i]->desc ? $lines[$i]->desc : ''); $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 we build one invoice for several sendings, we must put the ref of sending on the invoice line
if (!empty($createbills_onebythird)) { 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)) { if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) {
// Negative line, we create a discount line // Negative line, we create a discount line
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$discount->fk_soc = $objecttmp->socid; $discount->socid = $objecttmp->socid;
$discount->amount_ht = abs($lines[$i]->total_ht); $discount->amount_ht = abs($lines[$i]->total_ht);
$discount->amount_tva = abs($lines[$i]->total_tva); $discount->amount_tva = abs($lines[$i]->total_tva);
$discount->amount_ttc = abs($lines[$i]->total_ttc); $discount->amount_ttc = abs($lines[$i]->total_ttc);

View File

@@ -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) 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 // Test if we can run a first install process
if (!is_writable($conffile)) { if (!is_writable($conffile)) {

View File

@@ -592,9 +592,11 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
print DOL_VERSION; print DOL_VERSION;
print '</div><br>'; print '</div><br>';
print '<span class="titre">'.$langs->trans("DolibarrSetup"); print '<span class="titre">';
if ($subtitle) { if ($subtitle) {
print ' - '.$subtitle; print $subtitle;
} else {
print $langs->trans("DolibarrSetup");
} }
print '</span>'."\n"; print '</span>'."\n";

View File

@@ -73,13 +73,11 @@ if (!is_object($conf)) {
* View * View
*/ */
pHeader('', "upgrade2", GETPOST('action', 'aZ09')); pHeader($langs->trans("Repair"), "upgrade2", GETPOST('action', 'aZ09'));
// Action to launch the repair script // Action to launch the repair script
$actiondone = 1; $actiondone = 1;
print '<h3>'.$langs->trans("Repair").'</h3>';
print '<div class="warning" style="padding-top: 10px">'; print '<div class="warning" style="padding-top: 10px">';
print $langs->trans("SetAtLeastOneOptionAsUrlParameter"); print $langs->trans("SetAtLeastOneOptionAsUrlParameter");
print '</div>'; print '</div>';
@@ -1298,16 +1296,54 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) {
if ($force_utf8_on_tables == 'confirmed') { if ($force_utf8_on_tables == 'confirmed') {
$sql = 'SET FOREIGN_KEY_CHECKS=0'; $sql = 'SET FOREIGN_KEY_CHECKS=0';
print '<!-- '.$sql.' -->'; print '<!-- '.$sql.' -->';
print '<tr><td colspan="2">'.$sql.'</td></tr>';
$resql = $db->query($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 '<tr><td colspan="2">'.$table[0].' is a '.$table[1].' <span class="opacitymedium">(Skipped)</span></td></tr>';
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 '<tr><td colspan="2">';
$sqltmp = 'ALTER TABLE '.$table[0].' DROP FOREIGN KEY '.$foreignkeyname;
print $sqltmp;
if ($force_utf8_on_tables == 'confirmed') {
$resqltmp = $db->query($sqltmp);
} else {
print ' - <span class="opacitymedium">Disabled</span>';
}
print '</td></tr>';
$foreignkeystorestore[$tmptable] = $foreignkeyname;
}
}
}
foreach ($listoftables as $table) { foreach ($listoftables as $table) {
// do not convert llx_const if mysql encrypt/decrypt is used // do not convert llx_const if mysql encrypt/decrypt is used
if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table[0])) { if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table[0])) {
continue; continue;
} }
if ($table[1] == 'VIEW') { if ($table[1] == 'VIEW') {
print '<tr><td colspan="2">'.$table[0].' is a '.$table[1].' (Skipped)</td></tr>'; print '<tr><td colspan="2">'.$table[0].' is a '.$table[1].' <span class="opacitymedium">(Skipped)</span></td></tr>';
continue; continue;
} }
@@ -1324,17 +1360,45 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) {
} else { } else {
$resql2 = false; $resql2 = false;
} }
print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; print ' - Done '.(($resql1 && $resql2) ? '<span class="opacitymedium">(OK)</span>' : '<span class="error" title="'.dol_escape_htmltag($db->lasterror).'">(KO)</span>');
} else { } else {
print ' - Disabled'; print ' - <span class="opacitymedium">Disabled</span>';
} }
print '</td></tr>'; print '</td></tr>';
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."<br>\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 '<tr><td colspan="2">';
print $line;
print ' - Done '.($resqltmp ? '<span class="opacitymedium">(OK)</span>' : '<span class="error" title="'.dol_escape_htmltag($db->lasterror).'">(KO)</span>');
print '</td></tr>';
break;
}
}
fclose($handle);
}
flush();
ob_flush();
} }
// Enable foreign key checking // Enable foreign key checking
if ($force_utf8_on_tables == 'confirmed') { if ($force_utf8_on_tables == 'confirmed') {
$sql = 'SET FOREIGN_KEY_CHECKS=1'; $sql = 'SET FOREIGN_KEY_CHECKS=1';
print '<!-- '.$sql.' -->'; print '<!-- '.$sql.' -->';
print '<tr><td colspan="2">'.$sql.'</td></tr>';
$resql = $db->query($sql); $resql = $db->query($sql);
} }
} else { } else {
@@ -1349,22 +1413,61 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) {
if ($db->type == "mysql" || $db->type == "mysqli") { if ($db->type == "mysql" || $db->type == "mysqli") {
$force_utf8mb4_on_tables = GETPOST('force_utf8mb4_on_tables', 'alpha'); $force_utf8mb4_on_tables = GETPOST('force_utf8mb4_on_tables', 'alpha');
$listoftables = $db->DDLListTablesFull($db->database_name); $listoftables = $db->DDLListTablesFull($db->database_name);
// Disable foreign key checking for avoid errors // Disable foreign key checking for avoid errors
if ($force_utf8mb4_on_tables == 'confirmed') { if ($force_utf8mb4_on_tables == 'confirmed') {
$sql = 'SET FOREIGN_KEY_CHECKS=0'; $sql = 'SET FOREIGN_KEY_CHECKS=0';
print '<!-- '.$sql.' -->'; print '<!-- '.$sql.' -->';
print '<tr><td colspan="2">'.$sql.'</td></tr>';
$resql = $db->query($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 '<tr><td colspan="2">'.$table[0].' is a '.$table[1].' <span class="opacitymedium">(Skipped)</span></td></tr>';
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 '<tr><td colspan="2">';
$sqltmp = 'ALTER TABLE '.$table[0].' DROP FOREIGN KEY '.$foreignkeyname;
print $sqltmp;
if ($force_utf8mb4_on_tables == 'confirmed') {
$resqltmp = $db->query($sqltmp);
} else {
print ' - <span class="opacitymedium">Disabled</span>';
}
print '</td></tr>';
$foreignkeystorestore[$tmptable] = $foreignkeyname;
}
}
}
foreach ($listoftables as $table) { foreach ($listoftables as $table) {
// do not convert llx_const if mysql encrypt/decrypt is used // do not convert llx_const if mysql encrypt/decrypt is used
if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table[0])) { if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table[0])) {
continue; continue;
} }
if ($table[1] == 'VIEW') { if ($table[1] == 'VIEW') {
print '<tr><td colspan="2">'.$table[0].' is a '.$table[1].' (Skipped)</td></tr>'; print '<tr><td colspan="2">'.$table[0].' is a '.$table[1].' <span class="opacitymedium">(Skipped)</span></td></tr>';
continue; continue;
} }
@@ -1381,19 +1484,45 @@ if ($ok && GETPOST('force_utf8mb4_on_tables', 'alpha')) {
} else { } else {
$resql2 = false; $resql2 = false;
} }
print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; print ' - Done '.(($resql1 && $resql2) ? '<span class="opacitymedium">(OK)</span>' : '<span class="error" title="'.dol_escape_htmltag($db->lasterror).'">(KO)</span>');
} else { } else {
print ' - Disabled'; print ' - <span class="opacitymedium">Disabled</span>';
} }
print '</td></tr>'; print '</td></tr>';
flush(); flush();
ob_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."<br>\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 '<tr><td colspan="2">';
print $line;
print ' - Done '.($resqltmp ? '<span class="opacitymedium">(OK)</span>' : '<span class="error" title="'.dol_escape_htmltag($db->lasterror).'">(KO)</span>');
print '</td></tr>';
break;
}
}
fclose($handle);
}
flush();
ob_flush();
}
// Enable foreign key checking // Enable foreign key checking
if ($force_utf8mb4_on_tables == 'confirmed') { if ($force_utf8mb4_on_tables == 'confirmed') {
$sql = 'SET FOREIGN_KEY_CHECKS=1'; $sql = 'SET FOREIGN_KEY_CHECKS=1';
print '<!-- '.$sql.' -->'; print '<!-- '.$sql.' -->';
print '<tr><td colspan="2">'.$sql.'</td></tr>';
$resql = $db->query($sql); $resql = $db->query($sql);
} }
} else { } else {
@@ -1439,9 +1568,9 @@ if ($ok && GETPOST('force_collation_from_conf_on_tables', 'alpha')) {
} else { } else {
$resql2 = false; $resql2 = false;
} }
print ' - Done ('.(($resql1 && $resql2) ? 'OK' : 'KO').')'; print ' - Done '.(($resql1 && $resql2) ? '<span class="opacitymedium">(OK)</span>' : '<span class="error" title="'.dol_escape_htmltag($db->lasterror).'">(KO)</span>');
} else { } else {
print ' - Disabled'; print ' - <span class="opacitymedium">Disabled</span>';
} }
print '</td></tr>'; print '</td></tr>';
} }

View File

@@ -164,7 +164,7 @@ $error = 0;
dolibarr_install_syslog("--- step1: entering step1.php page"); 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 // Test if we can run a first install process
if (!is_writable($conffile)) { if (!is_writable($conffile)) {

View File

@@ -105,7 +105,7 @@ dolibarr_install_syslog("--- step2: entering step2.php page");
* View * View
*/ */
pHeader($langs->trans("CreateDatabaseObjects"), "step4"); pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("CreateDatabaseObjects"), "step4");
// Test if we can run a first install process // Test if we can run a first install process
if (!is_writable($conffile)) { if (!is_writable($conffile)) {

View File

@@ -59,7 +59,7 @@ $ok = 0;
* View * View
*/ */
pHeader($langs->trans("AdminAccountCreation"), "step5"); pHeader($langs->trans("DolibarrSetup").' - '.$langs->trans("AdminAccountCreation"), "step5");
// Test if we can run a first install process // Test if we can run a first install process
if (!is_writable($conffile)) { if (!is_writable($conffile)) {

View File

@@ -127,7 +127,7 @@ if ($action == "set") { // Test on permissions not required here
$morehtml = ''; $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 '<br>'; print '<br>';
// Test if we can run a first install process // Test if we can run a first install process

View File

@@ -63,7 +63,7 @@ NoProductToShipFoundIntoStock=No product to ship found in warehouse <b>%s</b>. C
WeightVolShort=Weight/Vol. WeightVolShort=Weight/Vol.
ValidateOrderFirstBeforeShipment=You must first validate the order before being able to make shipments. ValidateOrderFirstBeforeShipment=You must first validate the order before being able to make shipments.
NoLineGoOnTabToAddSome=No line, go on tab "%s" to add 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. 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. 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.

View File

@@ -63,7 +63,7 @@ NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouvé dans
WeightVolShort=Poids/vol. WeightVolShort=Poids/vol.
ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une expédition. 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 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. 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. 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.