Add shipping address

This commit is contained in:
Anthony Berton 2022-11-13 23:18:44 +01:00
parent 5573630146
commit 7ba582ee66
2 changed files with 46 additions and 4 deletions

View File

@ -579,7 +579,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->useTemplate($tplidx);
}
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
}
$pdf->setPage($pageposbefore + 1);
@ -622,7 +623,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->useTemplate($tplidx);
}
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
}
$pdf->setPage($pageposafter + 1);
}
@ -798,7 +800,8 @@ class pdf_crabe extends ModelePDFFactures
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
}
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
@ -818,7 +821,8 @@ class pdf_crabe extends ModelePDFFactures
}
$pagenb++;
if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) {
$this->_pagehead($pdf, $object, 0, $outputlangs);
$top_shift = $this->_pagehead($pdf, $object, 0, $outputlangs);
$tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10);
}
}
}
@ -2056,6 +2060,43 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetXY($posx + 2, $posy);
$pdf->MultiCell($widthrecbox - 2, 4, $carac_client, 0, $ltrdirection);
// Show shipping address
if (getDolGlobalInt('DOC_SHOW_SHIPPING_ADDRESS')) {
$idaddressshipping = $object->getIdContact('external', 'SHIPPING');
if (!empty($idaddressshipping)) {
$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
$object->fetch_thirdparty($object->contact->fk_soc);
$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, $usecontact, 'target', $object);
} else {
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);;
}
if (!empty($carac_client_shipping) && (isset($object->contact->socid) && $object->contact->socid != $object->socid)) {
$posy += $hautcadre;
// Show shipping frame
$pdf->SetXY($posx + 2, $posy - 5);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->MultiCell($widthrecbox, '', $langs->trans('ShippingTo'), 0, 'L', 0);
$pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
// Show shipping name
$pdf->SetXY($posx + 2, $posy + 3);
$pdf->SetFont('', 'B', $default_font_size);
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_name_shipping, '', 'L');
$posy = $pdf->getY();
// Show shipping information
$pdf->SetXY($posx+2, $posy);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
$top_shift += $hautcadre;
}
}
}
$pdf->SetTextColor(0, 0, 0);

View File

@ -162,6 +162,7 @@ ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved=This part or ano
ErrorInvoiceIsNotLastOfSameType=Error: The date of invoice %s is %s. It must be posterior or equal to last date for same type invoices (%s). Please change the invoice date.
BillFrom=From
BillTo=To
ShippingTo=Shipping to
ActionsOnBill=Actions on invoice
RecurringInvoiceTemplate=Template / Recurring invoice
NoQualifiedRecurringInvoiceTemplateFound=No recurring template invoice qualified for generation.