From 20522148f227e8eb909a412ef7a69f3f172af39c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 11:03:20 +0100 Subject: [PATCH 1/4] Fix: regression, the product discount overwrites the default customer discount ! --- htdocs/core/tpl/objectline_add.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index 2abeb380f75..a575034aa1e 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -80,8 +80,8 @@ if (! empty($conf->margin->enabled)) { 'origin_price_ht_cache' => 'price_ht', 'origin_tva_tx_cache' => 'tva_tx', 'origin_price_ttc_cache' => 'price_ttc', - 'qty' => 'qty', - 'remise_percent' => 'discount' + 'qty' => 'qty' + //'remise_percent' => 'discount' ), 'update_textarea' => array( 'product_desc' => 'desc' @@ -242,7 +242,7 @@ $(document).ready(function() { $('#select_type').val(data.type).attr('disabled','disabled').trigger('change'); //$('#price_base_type_area').show(); $('#qty').val(data.qty); - $('#remise_percent').val(data.discount); + //$('#remise_percent').val(data.discount); if (typeof CKEDITOR == "object" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances['product_desc'] != "undefined") { CKEDITOR.instances['product_desc'].setData(data.desc).focus(); From 3b45cffafa91eaf55180ad628578cd0f01fbd81b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 11:25:29 +0100 Subject: [PATCH 2/4] Fix: hide blocs with multi-page --- .../livraison/pdf/pdf_typhon.modules.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index 2be7a5afc63..a88d2ca06f4 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -490,17 +490,18 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetXY($this->posxqty-1, $tab_top+1); $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); - // Modif Seb cadres signatures - $pdf->SetFont('','', $default_font_size); - $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; - $pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); - $pdf->SetXY($this->marge_gauche + 2, $tab_top + $tab_height + 5); - $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L'); - - $pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); - $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5); - $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L'); + if (!empty($hidebottom)) { + // Modif Seb cadres signatures + $pdf->SetFont('','', $default_font_size); + $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; + $pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); + $pdf->SetXY($this->marge_gauche + 2, $tab_top + $tab_height + 5); + $pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L'); + $pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25); + $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5); + $pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L'); + } } /** From dd7411593e3438d5dad6758178d82a0953256514 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 12:21:49 +0100 Subject: [PATCH 3/4] Fix: wrong hidden --- htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index a88d2ca06f4..f402045a471 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -323,11 +323,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -355,12 +355,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 1); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 1); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } From b5d2a378fad6ffddf31b1b9446ba8847371b2173 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 22 Feb 2013 13:14:04 +0100 Subject: [PATCH 4/4] Fix: pdf models are unstable and time consuming. --- .../livraison/pdf/pdf_typhon.modules.php | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index f402045a471..0e65800698a 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -214,7 +214,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $tab_top = 90; - $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?22:10); $tab_height = 130; $tab_height_newpage = 150; @@ -252,7 +252,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of product line @@ -323,11 +323,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -355,12 +355,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1; } @@ -472,25 +472,32 @@ class pdf_typhon extends ModelePDFDeliveryOrder // Rect prend une longueur en 3eme param $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); // line prend une position y en 3eme param - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); + if (empty($hidetop)) + $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->posxdesc-1, $tab_top+1); - $pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L'); + if (empty($hidetop)) { + $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L'); + } // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); - $pdf->SetXY($this->posxcomm, $tab_top+1); - $pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L'); + if (empty($hidetop)) { + $pdf->SetXY($this->posxcomm, $tab_top+1); + $pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L'); + } // Qty $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); - $pdf->SetXY($this->posxqty-1, $tab_top+1); - $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + if (empty($hidetop)) { + $pdf->SetXY($this->posxqty-1, $tab_top+1); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); + } - if (!empty($hidebottom)) { + if (empty($hidebottom)) { // Modif Seb cadres signatures $pdf->SetFont('','', $default_font_size); $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;