|
@@ -160,7 +160,7 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
$this->watermark = ''; |
|
161
|
161
|
|
|
162
|
162
|
if ($mysoc === null) { |
|
163
|
|
- dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'. getCallerInfoString(), LOG_ERR); |
|
|
163
|
+ dol_syslog(get_class($this).'::__construct() Global $mysoc should not be null.'.getCallerInfoString(), LOG_ERR); |
|
164
|
164
|
return; |
|
165
|
165
|
} |
|
166
|
166
|
|
|
@@ -344,7 +344,7 @@ discard block |
|
|
block discarded – undo |
|
344
|
344
|
if (!getDolGlobalString('INVOICE_NO_PAYMENT_DETAILS') && $nbpayments > 0) { |
|
345
|
345
|
$this->heightforinfotot += (4 * $nbpayments); |
|
346
|
346
|
} |
|
347
|
|
- $this->heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page |
|
|
347
|
+ $this->heightforfreetext = getDolGlobalInt('MAIN_PDF_FREETEXT_HEIGHT', 5); // Height reserved to output the free text on last page |
|
348
|
348
|
$this->heightforfooter = $this->marge_basse + (!getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS') ? 12 : 22); // Height reserved to output the footer (value include bottom margin) |
|
349
|
349
|
|
|
350
|
350
|
$heightforqrinvoice = 0; |
|
@@ -367,7 +367,7 @@ discard block |
|
|
block discarded – undo |
|
367
|
367
|
if (!empty($conf->mycompany->multidir_output[$object->entity ?? $conf->entity])) { |
|
368
|
368
|
$logodir = $conf->mycompany->multidir_output[$object->entity ?? $conf->entity]; |
|
369
|
369
|
} |
|
370
|
|
- $pagecount = $pdf->setSourceFile($logodir.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
|
370
|
+ $pagecount = $pdf->setSourceFile($logodir.'/'.getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); |
|
371
|
371
|
$tplidx = $pdf->importPage(1); |
|
372
|
372
|
} |
|
373
|
373
|
|
|
@@ -464,7 +464,7 @@ discard block |
|
|
block discarded – undo |
|
464
|
464
|
// $pdf->GetY() here can't be used. It is bottom of the second address box but first one may be higher |
|
465
|
465
|
|
|
466
|
466
|
// $this->tab_top is y where we must continue content (90 = 42 + 48: 42 is height of logo and ref, 48 is address blocks) |
|
467
|
|
- $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
|
467
|
+ $this->tab_top = 90 + $top_shift + $shipp_shift; // top_shift is an addition for linked objects or addons (0 in most cases) |
|
468
|
468
|
$this->tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 + $top_shift : 10); |
|
469
|
469
|
|
|
470
|
470
|
// You can add more thing under header here, if you increase $extra_under_address_shift too. |
|
@@ -898,7 +898,7 @@ discard block |
|
|
block discarded – undo |
|
898
|
898
|
$extrafieldValue = $this->getExtrafieldContent($object->lines[$i], $extrafieldColKey, $outputlangs); |
|
899
|
899
|
$this->printStdColumnContent($pdf, $curY, $extrafieldColKey, $extrafieldValue); |
|
900
|
900
|
|
|
901
|
|
- $this->setAfterColsLinePositionsData('options_' . $extrafieldColKey, $pdf->GetY(), $pdf->getPage()); |
|
|
901
|
+ $this->setAfterColsLinePositionsData('options_'.$extrafieldColKey, $pdf->GetY(), $pdf->getPage()); |
|
902
|
902
|
} |
|
903
|
903
|
} |
|
904
|
904
|
} |
|
@@ -977,14 +977,14 @@ discard block |
|
|
block discarded – undo |
|
977
|
977
|
if (!isset($this->tva[$vatrate])) { |
|
978
|
978
|
$this->tva[$vatrate] = 0; |
|
979
|
979
|
} |
|
980
|
|
- $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
|
980
|
+ $this->tva[$vatrate] += $tvaligne; // ->tva is abandoned, we use now ->tva_array that is more complete |
|
981
|
981
|
$vatcode = $object->lines[$i]->vat_src_code; |
|
982
|
982
|
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) { |
|
983
|
983
|
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0; |
|
984
|
984
|
} |
|
985
|
985
|
if (getDolGlobalInt('PDF_INVOICE_SHOW_VAT_ANALYSIS')) { |
|
986
|
986
|
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'])) { |
|
987
|
|
- $this->tva_array[$vatrate . ($vatcode ? ' (' . $vatcode . ')' : '')]['tot_ht'] = 0; |
|
|
987
|
+ $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] = 0; |
|
988
|
988
|
} |
|
989
|
989
|
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne, 'tot_ht' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['tot_ht'] + $object->lines[$i]->total_ht); |
|
990
|
990
|
} else { |
|
@@ -1091,7 +1091,7 @@ discard block |
|
|
block discarded – undo |
|
1091
|
1091
|
|
|
1092
|
1092
|
// Add number of pages in footer |
|
1093
|
1093
|
if (method_exists($pdf, 'AliasNbPages')) { |
|
1094
|
|
- $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
|
1094
|
+ $pdf->AliasNbPages(); // @phan-suppress-current-line PhanUndeclaredMethod |
|
1095
|
1095
|
} |
|
1096
|
1096
|
// Add terms to sale |
|
1097
|
1097
|
if (!empty($mysoc->termsofsale) && getDolGlobalInt('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')) { |
|
@@ -1347,7 +1347,7 @@ discard block |
|
|
block discarded – undo |
|
1347
|
1347
|
foreach ($this->tva_array as $tvakey => $tvaval) { |
|
1348
|
1348
|
$pdf->SetFont('', '', $default_font_size - 2); |
|
1349
|
1349
|
$pdf->SetXY($this->marge_gauche, $posy); |
|
1350
|
|
- $titre = round((float) $tvakey, 2) . "%"; |
|
|
1350
|
+ $titre = round((float) $tvakey, 2)."%"; |
|
1351
|
1351
|
$pdf->MultiCell(25, 4, $titre, 0, 'L'); |
|
1352
|
1352
|
|
|
1353
|
1353
|
$pdf->SetFont('', '', $default_font_size - 2); |
|
@@ -1388,8 +1388,8 @@ discard block |
|
|
block discarded – undo |
|
1388
|
1388
|
$posy = $pdf->GetY() + 4; |
|
1389
|
1389
|
} |
|
1390
|
1390
|
|
|
1391
|
|
- $posxval = 52; // Position of values of properties shown on left side |
|
1392
|
|
- $posxend = 110; // End of x for text on left side |
|
|
1391
|
+ $posxval = 52; // Position of values of properties shown on left side |
|
|
1392
|
+ $posxend = 110; // End of x for text on left side |
|
1393
|
1393
|
if ($this->page_largeur < 210) { // To work with US executive format |
|
1394
|
1394
|
$posxend -= 10; |
|
1395
|
1395
|
} |
|
@@ -1398,13 +1398,13 @@ discard block |
|
|
block discarded – undo |
|
1398
|
1398
|
if ($object->status > Facture::STATUS_DRAFT && getDolGlobalInt('PDF_INVOICE_SHOW_BALANCE_SUMMARY')) { |
|
1399
|
1399
|
// All customer previous invoices |
|
1400
|
1400
|
$sql = "SELECT f.rowid, f.datef, f.total_ttc"; |
|
1401
|
|
- $sql.= " FROM " . MAIN_DB_PREFIX . "facture as f"; |
|
1402
|
|
- $sql.= " WHERE f.fk_soc = " . ((int) $object->socid); |
|
1403
|
|
- $sql.= " AND f.entity IN (" . getEntity('invoice') . ")"; |
|
1404
|
|
- $sql.= " AND f.datef <= '" . $this->db->idate($object->date) . "'"; |
|
1405
|
|
- $sql.= " AND f.rowid < " . ((int) $object->id); |
|
1406
|
|
- $sql.= " AND f.fk_statut > 0"; |
|
1407
|
|
- $sql.= " ORDER BY f.datef ASC"; |
|
|
1401
|
+ $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; |
|
|
1402
|
+ $sql .= " WHERE f.fk_soc = ".((int) $object->socid); |
|
|
1403
|
+ $sql .= " AND f.entity IN (".getEntity('invoice').")"; |
|
|
1404
|
+ $sql .= " AND f.datef <= '".$this->db->idate($object->date)."'"; |
|
|
1405
|
+ $sql .= " AND f.rowid < ".((int) $object->id); |
|
|
1406
|
+ $sql .= " AND f.fk_statut > 0"; |
|
|
1407
|
+ $sql .= " ORDER BY f.datef ASC"; |
|
1408
|
1408
|
|
|
1409
|
1409
|
$old_balance = 0; |
|
1410
|
1410
|
$invoices = array(); |
|
@@ -1419,12 +1419,12 @@ discard block |
|
|
block discarded – undo |
|
1419
|
1419
|
|
|
1420
|
1420
|
// All payments before current date |
|
1421
|
1421
|
$sql_payments = "SELECT p.datep, pf.fk_facture, pf.amount"; |
|
1422
|
|
- $sql_payments.= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf"; |
|
1423
|
|
- $sql_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement"; |
|
1424
|
|
- $sql_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture"; |
|
1425
|
|
- $sql_payments.= " WHERE f.fk_soc = " . ((int) $object->socid); |
|
1426
|
|
- $sql_payments.= " AND p.datep < '" . $this->db->idate($object->date) . "'"; |
|
1427
|
|
- $sql_payments.= " ORDER BY p.datep ASC"; |
|
|
1422
|
+ $sql_payments .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf"; |
|
|
1423
|
+ $sql_payments .= " INNER JOIN ".MAIN_DB_PREFIX."paiement as p ON p.rowid = pf.fk_paiement"; |
|
|
1424
|
+ $sql_payments .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = pf.fk_facture"; |
|
|
1425
|
+ $sql_payments .= " WHERE f.fk_soc = ".((int) $object->socid); |
|
|
1426
|
+ $sql_payments .= " AND p.datep < '".$this->db->idate($object->date)."'"; |
|
|
1427
|
+ $sql_payments .= " ORDER BY p.datep ASC"; |
|
1428
|
1428
|
|
|
1429
|
1429
|
$total_payments = 0; |
|
1430
|
1430
|
$resql_payments = $this->db->query($sql_payments); |
|
@@ -1437,11 +1437,11 @@ discard block |
|
|
block discarded – undo |
|
1437
|
1437
|
|
|
1438
|
1438
|
// Payments made on current invoice date (including current invoice) |
|
1439
|
1439
|
$sql_current_date_payments = "SELECT p.datep, pf.fk_facture, pf.amount"; |
|
1440
|
|
- $sql_current_date_payments.= " FROM " . MAIN_DB_PREFIX . "paiement_facture as pf"; |
|
1441
|
|
- $sql_current_date_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as p ON p.rowid = pf.fk_paiement"; |
|
1442
|
|
- $sql_current_date_payments.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = pf.fk_facture"; |
|
1443
|
|
- $sql_current_date_payments.= " WHERE f.fk_soc = " . ((int) $object->socid); |
|
1444
|
|
- $sql_current_date_payments.= " AND DATE(p.datep) = DATE('" . $this->db->idate($object->date) . "')"; |
|
|
1440
|
+ $sql_current_date_payments .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf"; |
|
|
1441
|
+ $sql_current_date_payments .= " INNER JOIN ".MAIN_DB_PREFIX."paiement as p ON p.rowid = pf.fk_paiement"; |
|
|
1442
|
+ $sql_current_date_payments .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = pf.fk_facture"; |
|
|
1443
|
+ $sql_current_date_payments .= " WHERE f.fk_soc = ".((int) $object->socid); |
|
|
1444
|
+ $sql_current_date_payments .= " AND DATE(p.datep) = DATE('".$this->db->idate($object->date)."')"; |
|
1445
|
1445
|
|
|
1446
|
1446
|
$current_date_payments = 0; |
|
1447
|
1447
|
$resql_current_date = $this->db->query($sql_current_date_payments); |
|
@@ -1465,7 +1465,7 @@ discard block |
|
|
block discarded – undo |
|
1465
|
1465
|
$pdf->MultiCell($posxval - $this->marge_gauche + 8, 4, $titre, 0, 'L', true); |
|
1466
|
1466
|
|
|
1467
|
1467
|
$pdf->SetFont('', '', $default_font_size - 2); |
|
1468
|
|
- $pdf->SetXY($posxval+8, $posy); |
|
|
1468
|
+ $pdf->SetXY($posxval + 8, $posy); |
|
1469
|
1469
|
$titre = $outputlangs->transnoentities("NewBalance").' : '.price($new_balance); |
|
1470
|
1470
|
$pdf->MultiCell($posxend - $posxval - 8, 4, $titre, 0, 'L', true); |
|
1471
|
1471
|
|
|
@@ -1497,7 +1497,7 @@ discard block |
|
|
block discarded – undo |
|
1497
|
1497
|
|
|
1498
|
1498
|
$pdf->SetFont('', '', $default_font_size - 2); |
|
1499
|
1499
|
$pdf->SetXY($posxval, $posy); |
|
1500
|
|
- $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
|
1500
|
+ $categoryOfOperationLabel = $outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
1501
|
1501
|
$pdf->MultiCell($posxend - $posxval, 4, $categoryOfOperationLabel, 0, 'L'); |
|
1502
|
1502
|
|
|
1503
|
1503
|
$posy = $pdf->GetY() + 3; // for 2 lines |
|
@@ -1675,7 +1675,7 @@ discard block |
|
|
block discarded – undo |
|
1675
|
1675
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions_be.lib.php'; |
|
1676
|
1676
|
$invoicePaymentKey = dolBECalculateStructuredCommunication($object->ref, $object->type); |
|
1677
|
1677
|
|
|
1678
|
|
- $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": " . $outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', false); |
|
|
1678
|
+ $pdf->MultiCell(100, 3, $outputlangs->transnoentities('StructuredCommunication').": ".$outputlangs->convToOutputCharset($invoicePaymentKey), 0, 'L', false); |
|
1679
|
1679
|
} |
|
1680
|
1680
|
} |
|
1681
|
1681
|
} |
|
@@ -2361,7 +2361,7 @@ discard block |
|
|
block discarded – undo |
|
2361
|
2361
|
if (empty($hidetop)) { |
|
2362
|
2362
|
// Show category of operations |
|
2363
|
2363
|
if (getDolGlobalInt('INVOICE_CATEGORY_OF_OPERATION') == 1 && $this->categoryOfOperation >= 0) { |
|
2364
|
|
- $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations") . ' : ' . $outputlangs->transnoentities("MentionCategoryOfOperations" . $this->categoryOfOperation); |
|
|
2364
|
+ $categoryOfOperations = $outputlangs->transnoentities("MentionCategoryOfOperations").' : '.$outputlangs->transnoentities("MentionCategoryOfOperations".$this->categoryOfOperation); |
|
2365
|
2365
|
$pdf->SetXY($this->marge_gauche, $tab_top - 4); |
|
2366
|
2366
|
$pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations); |
|
2367
|
2367
|
} |
|
@@ -2478,7 +2478,7 @@ discard block |
|
|
block discarded – undo |
|
2478
|
2478
|
} |
|
2479
|
2479
|
if ($this->situationinvoice) { |
|
2480
|
2480
|
$outputlangs->loadLangs(array("other")); |
|
2481
|
|
- $title = $outputlangs->transnoentities("PDFInvoiceSituation") . " " . $outputlangs->transnoentities("NumberingShort") . $object->situation_counter . " -"; |
|
|
2481
|
+ $title = $outputlangs->transnoentities("PDFInvoiceSituation")." ".$outputlangs->transnoentities("NumberingShort").$object->situation_counter." -"; |
|
2482
|
2482
|
$subtitle = $outputlangs->transnoentities("PDFSituationTitle", (string) $object->situation_counter); |
|
2483
|
2483
|
} |
|
2484
|
2484
|
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) { |
|
@@ -2763,7 +2763,7 @@ discard block |
|
|
block discarded – undo |
|
2763
|
2763
|
$idaddressshipping = $object->getIdContact('external', 'SHIPPING'); |
|
2764
|
2764
|
|
|
2765
|
2765
|
if (!empty($idaddressshipping)) { |
|
2766
|
|
- $object->fetch_contact($idaddressshipping[0]); // Load $object->contact |
|
|
2766
|
+ $object->fetch_contact($idaddressshipping[0]); // Load $object->contact |
|
2767
|
2767
|
$companystatic = new Societe($this->db); |
|
2768
|
2768
|
$companystatic->fetch($object->contact->fk_soc); |
|
2769
|
2769
|
$carac_client_name_shipping = pdfBuildThirdpartyName($object->contact, $outputlangs); |
|
@@ -2775,7 +2775,7 @@ discard block |
|
|
block discarded – undo |
|
2775
|
2775
|
if (!empty($carac_client_shipping)) { |
|
2776
|
2776
|
$posy += $hautcadre; |
|
2777
|
2777
|
|
|
2778
|
|
- $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
|
2778
|
+ $hautcadre -= 10; // Height for the shipping address does not need to be as high as main box |
|
2779
|
2779
|
|
|
2780
|
2780
|
// Show shipping frame |
|
2781
|
2781
|
$pdf->SetXY($posx + 2, $posy - 5); |