2
0
forked from Wavyzz/dolibarr

Use a database flag

This commit is contained in:
ldestailleur
2025-04-01 20:36:55 +02:00
parent 5832f1807c
commit de75d13c7a

View File

@@ -53,6 +53,7 @@ require_once $dolibarr_main_document_root.'/commande/class/commande.class.php';
require_once $dolibarr_main_document_root.'/fourn/class/fournisseur.commande.class.php'; require_once $dolibarr_main_document_root.'/fourn/class/fournisseur.commande.class.php';
require_once $dolibarr_main_document_root.'/core/lib/price.lib.php'; require_once $dolibarr_main_document_root.'/core/lib/price.lib.php';
require_once $dolibarr_main_document_root.'/core/class/menubase.class.php'; require_once $dolibarr_main_document_root.'/core/class/menubase.class.php';
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
require_once $dolibarr_main_document_root.'/core/lib/files.lib.php'; require_once $dolibarr_main_document_root.'/core/lib/files.lib.php';
global $langs; global $langs;
@@ -5077,12 +5078,13 @@ function migrate_invoice_export_models()
{ {
global $db, $langs; global $db, $langs;
$lock = DOL_DATA_ROOT.'/invoice_models_migrated.lock'; $lock = getDolGlobalInt('MIGRATION_INVOICE_MODELS_V20');
$firstInstallVersion = getDolGlobalString('MAIN_VERSION_FIRST_INSTALL', DOL_VERSION); $firstInstallVersion = getDolGlobalString('MAIN_VERSION_FIRST_INSTALL', DOL_VERSION);
$migrationNeeded = versioncompare(explode('.', $firstInstallVersion, 3), array(20, 0, -5)) < 0 && !file_exists($lock); $migrationNeeded = versioncompare(explode('.', $firstInstallVersion, 3), array(20, 0, -5)) < 0 && !file_exists($lock);
if (! $migrationNeeded) { if (! $migrationNeeded) {
touch($lock); dolibarr_set_const($db, 'MIGRATION_INVOICE_MODELS_V20', 1, 'chaine', 0, 'To flag the upgrade of invoice template has been set', 0);
return; return;
} }
@@ -5091,11 +5093,7 @@ function migrate_invoice_export_models()
$db->begin(); $db->begin();
$sql1 = " $sql1 = "UPDATE ".$db->prefix()."export_model SET type = 'facture_0' WHERE type = 'facture_1'";
UPDATE ".$db->prefix()."export_model
SET type = 'facture_0'
WHERE type = 'facture_1'
";
$resql1 = $db->query($sql1); $resql1 = $db->query($sql1);
@@ -5112,11 +5110,7 @@ function migrate_invoice_export_models()
$db->free($resql1); $db->free($resql1);
$sql2 = " $sql2 = "UPDATE ".$db->prefix()."export_model SET type = 'facture_1' WHERE type = 'facture_2'";
UPDATE ".$db->prefix()."export_model
SET type = 'facture_1'
WHERE type = 'facture_2'
";
$resql2 = $db->query($sql2); $resql2 = $db->query($sql2);