|
@@ -2279,6 +2279,10 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$useshippingcontact = true;
|
|
|
$result = $object->fetch_contact($arrayidcontact[0]);
|
|
|
}
|
|
|
+ // If Maîtrise d'oeuvre defined, we use it
|
|
|
+ if (!empty($object->array_options['options_appeloffre_maitrise'])) {
|
|
|
+ $usemaitrisecontact = true;
|
|
|
+ }
|
|
|
// If CUSTOMER/BILLING contact defined, we use it
|
|
|
$usebillingcontact = false;
|
|
|
$arrayidcontact = $object->getIdContact('external', 'BILLING');
|
|
@@ -2286,7 +2290,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$usebillingcontact = true;
|
|
|
$result = $object->fetch_contact($arrayidcontact[0]);
|
|
|
}
|
|
|
- if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && $useshippingcontact)
|
|
|
+ if ($twocontacts = !empty($conf->global->MMI_DOCUMENT_PDF_SEPARATE_CONTACTS) && ($useshippingcontact || $usemaitrisecontact))
|
|
|
$widthrecbox = 60;
|
|
|
|
|
|
// Show sender frame
|
|
@@ -2324,6 +2328,16 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$arrayidcontact = $object->getIdContact('external', 'SHIPPING');
|
|
|
if (count($arrayidcontact) > 0) {
|
|
|
$usecontact = true;
|
|
|
+ $recipient_type = 'SHIPPING';
|
|
|
+ $address_type_label = $outputlangs->transnoentities("DeliveryAddress");
|
|
|
+ $result = $object->fetch_contact($arrayidcontact[0]);
|
|
|
+ }
|
|
|
+ // If Maîtrise d'oeuvre defined, we use it
|
|
|
+ $arrayidcontact = $object->getIdContact('external', 'MGMT');
|
|
|
+ if (count($arrayidcontact) > 0) {
|
|
|
+ $usecontact = true;
|
|
|
+ $recipient_type = 'MGMT';
|
|
|
+ $address_type_label = $outputlangs->transnoentities("ProjectManagementAddress");
|
|
|
$result = $object->fetch_contact($arrayidcontact[0]);
|
|
|
}
|
|
|
|
|
@@ -2334,7 +2348,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$thirdparty = $object->thirdparty;
|
|
|
}
|
|
|
|
|
|
- $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
|
|
+ $carac_client_name = $recipient_type != 'MGMT' ?pdfBuildThirdpartyName($thirdparty, $outputlangs) :'';
|
|
|
|
|
|
$mode = 'target';
|
|
|
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), $usecontact, $mode, $object);
|
|
@@ -2357,7 +2371,7 @@ class pdf_sponge extends ModelePDFFactures
|
|
|
$pdf->SetTextColor(0, 0, 0);
|
|
|
$pdf->SetFont('', '', $default_font_size - 2);
|
|
|
$pdf->SetXY($posx + 2, $posy - 5);
|
|
|
- $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("DeliveryAddress"), 0, $ltrdirection);
|
|
|
+ $pdf->MultiCell($widthrecbox, 5, $address_type_label, 0, $ltrdirection);
|
|
|
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
|
|
|
|
|
|
// Show recipient name
|