From 8690b5e70e2593d00546c0adcb7d5755463eeb6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 12 Jul 2015 16:22:06 +0200 Subject: [PATCH] FIX #3173 Overlapping of shipment ref --- htdocs/core/lib/pdf.lib.php | 32 ++++++++++++------- .../modules/facture/doc/pdf_crabe.modules.php | 30 +++++++++-------- htdocs/langs/en_US/admin.lang | 4 +-- htdocs/langs/en_US/sendings.lang | 6 ++-- htdocs/langs/en_US/stocks.lang | 2 +- 5 files changed, 43 insertions(+), 31 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5ca77722dd4..6be81524373 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -643,12 +643,12 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $pdf->SetXY($curx, $cury); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0); $cury+=3; - + if ($diffsizecontent <= 2) $cury+=1; } $pdf->SetFont('','',$default_font_size - $diffsizecontent); - + if (empty($onlynumber) && ! empty($account->domiciliation)) { $pdf->SetXY($curx, $cury); @@ -659,7 +659,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $tmpy=$pdf->getStringHeight(100, $val); $cury+=$tmpy; } - + if (! empty($account->proprio)) { $pdf->SetXY($curx, $cury); @@ -668,9 +668,9 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $tmpy=$pdf->getStringHeight(100, $val); $cury+=$tmpy; } - + else if (! $usedetailedbban) $cury+=1; - + // Use correct name of bank id according to country $ibankey="IBANNumber"; if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; @@ -1735,12 +1735,22 @@ function pdf_getLinkedObjects($object,$outputlangs) $objects[$i]->fetchObjectLinked(); $order = $objects[$i]->linkedObjects['commande'][0]; - $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); - $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + if (! empty($object->linkedObjects['commande'])) // There is already a link to order so we show only info of shipment + { + $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); + $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); + $linkedobjects[$objecttype]['date_value'].= dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + } + else // We show both info of order and shipment + { + $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + } } } } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index aa9fbf65ed2..a38d64ba826 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1423,8 +1423,10 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetTextColor(0,0,60); $pdf->SetFont('','B', $default_font_size + 3); + $w = 110; + $posy=$this->marge_haute; - $posx=$this->page_largeur-$this->marge_droite-100; + $posx=$this->page_largeur-$this->marge_droite-$w; $pdf->SetXY($this->marge_gauche,$posy); @@ -1441,14 +1443,14 @@ class pdf_crabe extends ModelePDFFactures { $pdf->SetTextColor(200,0,0); $pdf->SetFont('','B',$default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } else { $text=$this->emetteur->name; - $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } $pdf->SetFont('','B', $default_font_size + 3); @@ -1459,14 +1461,14 @@ class pdf_crabe extends ModelePDFFactures if ($object->type == 2) $title=$outputlangs->transnoentities("InvoiceAvoir"); if ($object->type == 3) $title=$outputlangs->transnoentities("InvoiceDeposit"); if ($object->type == 4) $title=$outputlangs->transnoentities("InvoiceProFormat"); - $pdf->MultiCell(100, 3, $title, '', 'R'); + $pdf->MultiCell($w, 3, $title, '', 'R'); $pdf->SetFont('','B',$default_font_size); $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->MultiCell($w, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); $posy+=1; $pdf->SetFont('','', $default_font_size - 2); @@ -1476,7 +1478,7 @@ class pdf_crabe extends ModelePDFFactures $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } $objectidnext=$object->getIdReplacingInvoice('validated'); @@ -1488,7 +1490,7 @@ class pdf_crabe extends ModelePDFFactures $posy+=3; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementByInvoice").' : '.$outputlangs->convToOutputCharset($objectreplacing->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementByInvoice").' : '.$outputlangs->convToOutputCharset($objectreplacing->ref), '', 'R'); } if ($object->type == 1) { @@ -1498,7 +1500,7 @@ class pdf_crabe extends ModelePDFFactures $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ReplacementInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R'); } if ($object->type == 2) { @@ -1508,20 +1510,20 @@ class pdf_crabe extends ModelePDFFactures $posy+=3; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'R'); } $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateInvoice")." : " . dol_print_date($object->date,"day",false,$outputlangs), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateInvoice")." : " . dol_print_date($object->date,"day",false,$outputlangs), '', 'R'); if ($object->type != 2) { $posy+=3; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'R'); } if ($object->thirdparty->code_client) @@ -1529,13 +1531,13 @@ class pdf_crabe extends ModelePDFFactures $posy+=3; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); } $posy+=1; // Show list of linked objects - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, 3, 'R', $default_font_size); if ($showaddress) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3bf2d5a14b5..67750a18aae 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1454,7 +1454,7 @@ FixedEmailTarget=Fixed email target SendingsSetup=Sending module setup SendingsReceiptModel=Sending receipt model SendingsNumberingModules=Sendings numbering modules -SendingsAbility=Support shipment sheets for customer deliveries +SendingsAbility=Support shipping sheets for customer deliveries NoNeedForDeliveryReceipts=In most cases, sendings receipts are used both as sheets for customer deliveries (list of products to send) and sheets that is recevied and signed by customer. So product deliveries receipts is a duplicated feature and is rarely activated. FreeLegalTextOnShippings=Free text on shipments ##### Deliveries ##### @@ -1658,7 +1658,7 @@ UnicodeCurrency=Enter here between braces, list of byte number that represent th PositionIntoComboList=Position of line into combo lists SellTaxRate=Sale tax rate RecuperableOnly=Yes for VAT "Non Perçue Récupérable" dedicated for some state in France. Keep value to "No" in all other cases. -UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipment, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card. +UrlTrackingDesc=If the provider or transport service offer a page or web site to check status of your shipping, you can enter it here. You can use the key {TRACKID} into URL parameters so the system will replace it with value of tracking number user entered into shipment card. OpportunityPercent=When you create an opportunity, you will defined an estimated amount of project/lead. According to status of opportunity, this amount may be multiplicated by this rate to evaluate global amount all your opportunities may generate. Value is percent (between 0 and 100). TemplateForElement=This template record is dedicated to which element TypeOfTemplate=Type of template diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 1dc182c6fdc..4d4aca48cd9 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -5,7 +5,7 @@ Sendings=Shipments AllSendings=All Shipments Shipment=Shipment Shipments=Shipments -ShowSending=Show Sending +ShowSending=Show Shipments Receivings=Receipts SendingsArea=Shipments area ListOfSendings=List of shipments @@ -26,8 +26,8 @@ QtyToShip=Qty to ship QtyReceived=Qty received KeepToShip=Remain to ship OtherSendingsForSameOrder=Other shipments for this order -DateSending=Date sending order -DateSendingShort=Date sending order +DateSending=Shipping date +DateSendingShort=Shipping date SendingsForSameOrder=Shipments for this order SendingsAndReceivingForSameOrder=Shipments and receivings for this order SendingsToValidate=Shipments to validate diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 69b0027139b..4db67dc6335 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -57,7 +57,7 @@ RuleForStockManagementDecrease=Rule for stock management decrease RuleForStockManagementIncrease=Rule for stock management increase DeStockOnBill=Decrease real stocks on customers invoices/credit notes validation DeStockOnValidateOrder=Decrease real stocks on customers orders validation -DeStockOnShipment=Decrease real stocks on shipment validation +DeStockOnShipment=Decrease real stocks on shipping validation ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receiving -- GitLab