소스 검색

feat: Upgrade default PDF models to the 'new' ones (eproved since 4 dolibarr versions from now)

Florian HENRY 2 년 전
부모
커밋
93551c8e64

+ 2 - 2
htdocs/admin/delivery.php

@@ -165,7 +165,7 @@ if ($action == 'set') {
 if ($action == 'del') {
 	$ret = delDocumentModel($value, $type);
 	if ($ret > 0) {
-		if ($conf->global->DELIVERY_ADDON_PDF == "$value") {
+		if (getDolGlobalString('DELIVERY_ADDON_PDF') == $value) {
 			dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity);
 		}
 	}
@@ -420,7 +420,7 @@ if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) {
 
 								// Default
 								print "<td align=\"center\">";
-								if ($conf->global->DELIVERY_ADDON_PDF == "$name") {
+								if (getDolGlobalString('DELIVERY_ADDON_PDF') == "$name") {
 									print img_picto($langs->trans("Default"), 'on');
 								} else {
 									print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';

+ 2 - 2
htdocs/core/modules/delivery/mod_delivery_saphir.php

@@ -83,7 +83,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
 
 		// Parametrage du prefix
 		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
-		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdelivery" value="'.$conf->global->DELIVERY_SAPHIR_MASK.'">', $tooltip, 1, 1).'</td>';
+		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskdelivery" value="'.getDolGlobalString('DELIVERY_SAPHIR_MASK').'">', $tooltip, 1, 1).'</td>';
 
 		$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
 
@@ -130,7 +130,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder
 		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 
 		// On defini critere recherche compteur
-		$mask = $conf->global->DELIVERY_SAPHIR_MASK;
+		$mask = getDolGlobalString('DELIVERY_SAPHIR_MASK');
 
 		if (!$mask) {
 			$this->error = 'NotConfigured';

+ 2 - 2
htdocs/core/modules/project/mod_project_universal.php

@@ -88,7 +88,7 @@ class mod_project_universal extends ModeleNumRefProjects
 
 		// Parametrage du prefix
 		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
-		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskproject" value="'.$conf->global->PROJECT_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';
+		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskproject" value="'.getDolGlobalString('PROJECT_UNIVERSAL_MASK').'">', $tooltip, 1, 1).'</td>';
 
 		$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
 
@@ -134,7 +134,7 @@ class mod_project_universal extends ModeleNumRefProjects
 		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 
 		// On defini critere recherche compteur
-		$mask = $conf->global->PROJECT_UNIVERSAL_MASK;
+		$mask = getDolGlobalString('PROJECT_UNIVERSAL_MASK');
 
 		if (!$mask) {
 			$this->error = 'NotConfigured';

+ 2 - 2
htdocs/core/modules/project/task/mod_task_universal.php

@@ -83,7 +83,7 @@ class mod_task_universal extends ModeleNumRefTask
 
 		// Parametrage du prefix
 		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
-		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="masktask" value="'.$conf->global->PROJECT_TASK_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';
+		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="masktask" value="'.getDolGlobalString('PROJECT_TASK_UNIVERSAL_MASK').'">', $tooltip, 1, 1).'</td>';
 
 		$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
 
@@ -128,7 +128,7 @@ class mod_task_universal extends ModeleNumRefTask
 
 		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 
-		$mask = !empty($conf->global->PROJECT_TASK_UNIVERSAL_MASK) ? $conf->global->PROJECT_TASK_UNIVERSAL_MASK : '';
+		$mask = getDolGlobalString('PROJECT_TASK_UNIVERSAL_MASK');
 
 		if (!$mask) {
 			$this->error = 'NotConfigured';

+ 1 - 1
htdocs/delivery/class/delivery.class.php

@@ -986,7 +986,7 @@ class Delivery extends CommonObject
 
 		$i = 0;
 		$line = new DeliveryLine($this->db);
-		$line->fk_product     = $prodids[0];
+		$line->fk_product     = reset($prodids);
 		$line->qty_asked      = 10;
 		$line->qty_shipped    = 9;
 		$line->ref            = 'REFPROD';

+ 13 - 0
htdocs/install/mysql/migration/17.0.0-18.0.0.sql

@@ -411,3 +411,16 @@ CREATE TABLE llx_c_invoice_subtype (
 
 ALTER TABLE llx_c_invoice_subtype ADD UNIQUE INDEX uk_c_invoice_subtype (entity, code);
 
+-- Upgrade default PDF models to the 'new' ones (eproved since 4 dolibarr versions from now)
+UPDATE llx_const SET value="eratosthene" WHERE name="COMMANDE_ADDON_PDF" and value="einstein";
+DELETE FROM llx_document_model WHERE name="einstein" AND type="order";
+UPDATE llx_const SET value="sponge" WHERE name="FACTURE_ADDON_PDF" and value="crabe";
+DELETE FROM llx_document_model WHERE name="crabe" AND type="invoice";
+UPDATE llx_const SET value="espadon" WHERE name="EXPEDITION_ADDON_PDF" and value="merou";
+DELETE FROM llx_document_model WHERE name="merou" AND type="shipping";
+UPDATE llx_const SET value="cyan" WHERE name="PROPALE_ADDON_PDF" and value="azur";
+DELETE FROM llx_document_model WHERE name="azur" AND type="propal";
+UPDATE llx_const SET value="storm" WHERE name IN ("DELIVERY_ADDON_PDF","LIVRAISON_ADDON_PDF") and value="typhon";
+DELETE FROM llx_document_model WHERE name="typhon" AND type="delivery";
+UPDATE llx_const SET value="cornas" WHERE name="COMMANDE_SUPPLIER_ADDON_PDF" and value="muscadet";
+DELETE FROM llx_document_model WHERE name="muscadet" AND type="order_supplier";