From ec7446762c7c20be0d3a3d7fc26a373fe10d3864 Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 24 Jun 2019 14:36:06 +0200 Subject: [PATCH] Fix travis --- htdocs/compta/facture/card.php | 9 +++--- htdocs/compta/facture/class/facture.class.php | 18 +++++------ htdocs/compta/facture/list.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/lib/pdf.lib.php | 7 ++--- .../modules/facture/doc/pdf_crabe.modules.php | 12 ++++---- .../facture/doc/pdf_sponge.modules.php | 30 +++++++++---------- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 5a987c4b542..e105535ee89 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4102,7 +4102,7 @@ elseif ($id > 0 || ! empty($ref)) // Check if this situation invoice is 100% for real if(!empty($object->situation_final) && !empty($object->lines)){ $displayWarranty = true; - foreach( $object->lines as $i => $line ){ + foreach($object->lines as $i => $line){ if($line->product_type < 2 && $line->situation_percent < 100){ $displayWarranty = false; break; @@ -4136,7 +4136,7 @@ elseif ($id > 0 || ! empty($ref)) { print price($object->retained_warranty).'%'; } - print ''; + print ''; // Retained warranty payment term print ''; @@ -4174,7 +4174,7 @@ elseif ($id > 0 || ! empty($ref)) print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); } } - print ''; + print ''; @@ -4203,7 +4203,7 @@ elseif ($id > 0 || ! empty($ref)) print '
'; print ''; print ''; - print ''; + print ''; print ''; print '
'; } @@ -4213,7 +4213,6 @@ elseif ($id > 0 || ! empty($ref)) } print ''; } - } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b10b4183223..a19843452b8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4387,8 +4387,8 @@ class Facture extends CommonInvoice /** * @return number or -1 if not available */ - function getRetainedWarrantyAmount() { - + public function getRetainedWarrantyAmount() + { if(empty($this->retained_warranty) ){ return -1; } @@ -4401,11 +4401,11 @@ class Facture extends CommonInvoice $displayWarranty = true; // Check if this situation invoice is 100% for real if(!empty($this->lines)){ - foreach( $this->lines as $i => $line ){ + foreach($this->lines as $i => $line ){ if($line->product_type < 2 && $line->situation_percent < 100){ $displayWarranty = false; break; - } + } } } @@ -4425,7 +4425,6 @@ class Facture extends CommonInvoice else{ return -1; } - } else { @@ -4442,7 +4441,7 @@ class Facture extends CommonInvoice * @param float $value value of retained warranty * @return int >0 if OK, <0 if KO */ - function setRetainedWarranty($value) + public function setRetainedWarranty($value) { dol_syslog(get_class($this).'::setRetainedWarranty('.$value.')'); if ($this->statut >= 0) @@ -4476,17 +4475,18 @@ class Facture extends CommonInvoice /** * Change the retained_warranty_date_limit * - * @param timestamp $value value of retained warranty + * @param int $timestamp date limit of retained warranty in timestamp format + * @param string $dateYmd date limit of retained warranty in Y m d format * @return int >0 if OK, <0 if KO */ - function setRetainedWarrantyDateLimit($timestamp,$dateYmd=false) + public function setRetainedWarrantyDateLimit($timestamp, $dateYmd = false) { if(!$timestamp && $dateYmd){ $timestamp = $this->db->jdate($dateYmd); } - dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$value.')'); + dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$timestamp.')'); if ($this->statut >= 0) { $fieldname = 'retained_warranty_date_limit'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d586125785a..01693645435 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -916,7 +916,7 @@ if ($resql) if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder); // Extra fields diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d6d82f5c363..92234a31301 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2059,7 +2059,7 @@ abstract class CommonObject * @param int $id Id of new payment terms * @return int >0 if OK, <0 if KO */ - function setRetainedWarrantyPaymentTerms($id) + public function setRetainedWarrantyPaymentTerms($id) { dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')'); if ($this->statut >= 0 || $this->element == 'societe') diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index a4954c07f39..3e792035e5b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2216,8 +2216,7 @@ function pdf_getSizeForImage($realpath) * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines) * @return string Return total of line excl tax */ - -function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails=0) +function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0) { global $conf, $hookmanager; $sign=1; @@ -2243,7 +2242,7 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails=0 $action=''; - if( $hookmanager->executeHooks('getlinetotalremise',$parameters,$object,$action)>0) + if( $hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action)>0) { return $hookmanager->resPrint; // Note that $action and $object may have been modified by some hooks } @@ -2252,4 +2251,4 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails=0 if (empty($hidedetails) || $hidedetails > 1) return $sign * ( ($object->lines[$i]->subprice * $object->lines[$i]->qty) - $object->lines[$i]->total_ht ); } return ''; -} \ No newline at end of file +} diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e5c5b64e809..7922f96d94f 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1349,10 +1349,12 @@ class pdf_crabe extends ModelePDFFactures // Retained warranty if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) ) { + $displayWarranty = false; + // Check if this situation invoice is 100% for real if(!empty($object->lines)){ $displayWarranty = true; - foreach( $object->lines as $i => $line ){ + foreach($object->lines as $i => $line ){ if($line->product_type < 2 && $line->situation_percent < 100){ $displayWarranty = false; break; @@ -1361,8 +1363,8 @@ class pdf_crabe extends ModelePDFFactures } if($displayWarranty){ - $pdf->SetTextColor(40,40,40); - $pdf->SetFillColor(255,255,255); + $pdf->SetTextColor(40, 40, 40); + $pdf->SetFillColor(255, 255, 255); $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100; $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ; @@ -1373,7 +1375,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty) , $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); // retained warranty $index++; @@ -1384,7 +1386,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty) , $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 0e5f9a69819..1e16c4439dd 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1278,7 +1278,7 @@ class pdf_sponge extends ModelePDFFactures foreach ($TPreviousIncoice as &$fac){ if($posy > $this->page_hauteur - 4 ) { - $this->_pagefoot($pdf,$object,$outputlangs,1); + $this->_pagefoot($pdf, $object, $outputlangs, 1); $pdf->addPage(); $pdf->setY($this->marge_haute); $posy = $pdf->GetY(); @@ -1286,11 +1286,11 @@ class pdf_sponge extends ModelePDFFactures // cumul TVA précédent $index++; - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $pdf->SetXY($col2x,$posy); + $pdf->SetXY($col2x, $posy); $facSign = ''; if($i>1){ @@ -1306,15 +1306,14 @@ class pdf_sponge extends ModelePDFFactures $posy += $tab2_hl; $pdf->setY($posy); - } // Display curent total - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $pdf->SetXY($col2x,$posy); + $pdf->SetXY($col2x, $posy); $facSign = ''; if($i>1){ $facSign = $object->total_ht>=0?'+':''; // gestion d'un cas particulier client @@ -1332,7 +1331,7 @@ class pdf_sponge extends ModelePDFFactures // Display all total $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $posy); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1); @@ -1367,7 +1366,7 @@ class pdf_sponge extends ModelePDFFactures } if($total_line_remise > 0) { if (! empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) { - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount"), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl); @@ -1377,7 +1376,7 @@ class pdf_sponge extends ModelePDFFactures } // Show total NET before discount if (! empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) { - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount"), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + 0); @@ -1388,7 +1387,7 @@ class pdf_sponge extends ModelePDFFactures } // Total HT - $pdf->SetFillColor(255,255,255); + $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); @@ -1417,7 +1416,7 @@ class pdf_sponge extends ModelePDFFactures //{ foreach($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; foreach($localtax_rate as $tvakey => $tvaval) { @@ -1637,6 +1636,7 @@ class pdf_sponge extends ModelePDFFactures if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) ) { $displayWarranty = false; + // Check if this situation invoice is 100% for real if(!empty($object->situation_final)){ $displayWarranty = true; @@ -1644,7 +1644,7 @@ class pdf_sponge extends ModelePDFFactures elseif(!empty($object->lines) && $object->status == Facture::STATUS_DRAFT ){ // $object->situation_final need validation to be done so this test is need for draft $displayWarranty = true; - foreach( $object->lines as $i => $line ){ + foreach($object->lines as $i => $line ){ if($line->product_type < 2 && $line->situation_percent < 100){ $displayWarranty = false; break; @@ -1665,7 +1665,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty) , $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); // retained warranty $index++; @@ -1676,13 +1676,13 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty) , $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); } } } } - $pdf->SetTextColor(0,0,0); + $pdf->SetTextColor(0, 0, 0); $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); $depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);