瀏覽代碼

MMIProject : Fix management display

Mathieu Moulin 1 年之前
父節點
當前提交
e8fea62ad8

+ 3 - 16
htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php

@@ -1684,24 +1684,11 @@ class pdf_eratosthene extends ModelePDFCommandes
 
 			// Added by MMI Mathieu Moulin iProspective
 			// If CUSTOMER/SHIPPING contact defined, we use it
-			$useshippingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
-			if (count($arrayidcontact) > 0) {
-				$usecontact = true;
-				$useshippingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$useshippingcontact = !empty($object->getIdContact('external', 'SHIPPING'));
 			// If Maîtrise d'oeuvre defined, we use it
-			if (!empty($object->array_options['options_appeloffre_maitrise'])) {
-				$usemaitrisecontact = true;
-			}
+			$usemaitrisecontact = !empty($object->getIdContact('external', 'MGMT'));
 			// If CUSTOMER/BILLING contact defined, we use it
-			$usebillingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'BILLING');
-			if (count($arrayidcontact) > 0) {
-				$usebillingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$usebillingcontact = !empty($object->getIdContact('external', 'BILLING'));
 			// MMI Hack size
 			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
 				$widthrecbox = 60;

+ 4 - 16
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -2272,24 +2272,11 @@ class pdf_sponge extends ModelePDFFactures
 			// Added by MMI Mathieu Moulin iProspective
 			// Multiple contacts shipping & invoice
 			// If CUSTOMER/SHIPPING contact defined, we use it
-			$useshippingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
-			if (count($arrayidcontact) > 0) {
-				$usecontact = true;
-				$useshippingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$useshippingcontact = !empty($object->getIdContact('external', 'SHIPPING'));
 			// If Maîtrise d'oeuvre defined, we use it
-			if (!empty($object->array_options['options_appeloffre_maitrise'])) {
-				$usemaitrisecontact = true;
-			}
+			$usemaitrisecontact = !empty($object->getIdContact('external', 'MGMT'));
 			// If CUSTOMER/BILLING contact defined, we use it
-			$usebillingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'BILLING');
-			if (count($arrayidcontact) > 0) {
-				$usebillingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$usebillingcontact = !empty($object->getIdContact('external', 'BILLING'));
 			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
 				$widthrecbox = 60;
 
@@ -2333,6 +2320,7 @@ class pdf_sponge extends ModelePDFFactures
 					$result = $object->fetch_contact($arrayidcontact[0]);
 				}
 				// If Maîtrise d'oeuvre defined, we use it
+				$usemaitrisecontact = false;
 				$arrayidcontact = $object->getIdContact('external', 'MGMT');
 				if (count($arrayidcontact) > 0) {
 					$usecontact = true;

+ 4 - 15
htdocs/core/modules/propale/doc/pdf_cyan.modules.php

@@ -1776,23 +1776,11 @@ class pdf_cyan extends ModelePDFPropales
 
 			// Added by MMI Mathieu Moulin iProspective
 			// If CUSTOMER/SHIPPING contact defined, we use it
-			$useshippingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
-			if (count($arrayidcontact) > 0) {
-				$useshippingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$useshippingcontact = !empty($object->getIdContact('external', 'SHIPPING'));
 			// If Maîtrise d'oeuvre defined, we use it
-			if (!empty($object->array_options['options_appeloffre_maitrise'])) {
-				$usemaitrisecontact = true;
-			}
+			$usemaitrisecontact = !empty($object->getIdContact('external', 'MGMT'));
 			// If CUSTOMER/BILLING contact defined, we use it
-			$usebillingcontact = false;
-			$arrayidcontact = $object->getIdContact('external', 'BILLING');
-			if (count($arrayidcontact) > 0) {
-				$usebillingcontact = true;
-				$result = $object->fetch_contact($arrayidcontact[0]);
-			}
+			$usebillingcontact = !empty($object->getIdContact('external', 'BILLING'));
 			if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
 				$widthrecbox = 60;
 
@@ -1837,6 +1825,7 @@ class pdf_cyan extends ModelePDFPropales
 				}
 				// If Maîtrise d'oeuvre defined, we use it
 				$arrayidcontact = $object->getIdContact('external', 'MGMT');
+				$usemaitrisecontact = false;
 				if (count($arrayidcontact) > 0) {
 					$usecontact = true;
 					$recipient_type = 'MGMT';