Browse Source

MMIDocuments : Gestion affichage exonération de TVA documents PDF

Mathieu Moulin 2 years ago
parent
commit
504efb697c

+ 22 - 4
htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php

@@ -959,12 +959,30 @@ class pdf_eratosthene extends ModelePDFCommandes
 
 		$pdf->SetFont('', '', $default_font_size - 1);
 
-		// If France, show VAT mention if not applicable
-		if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
+		// MMI Mathieu Moulin iProspective
+		// Replacement for VAT exempt notice
+		global $hookmanager;
+		$parameters = array(
+			'object' => $object,
+			'outputlangs' => $outputlangs,
+			'mysoc' => $mysoc,
+		);
+		$reshook = $hookmanager->executeHooks('VATNotificationOnPDF', $parameters, $this); // Note that $object may have been modified by hook
+		//var_dump($hookmanager); die();
+		//var_dump($reshook); die();
+		if ($reshook < 0) {
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+		} elseif (empty($reshook)) {
+			// If France, show VAT mention if not applicable
+			if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
+				$vat_info = $outputlangs->transnoentities("VATIsNotUsedForInvoice");
+		} else {
+			$vat_info = $hookmanager->resPrint;
+		}
+		if (!empty($vat_info)) {
 			$pdf->SetFont('', 'B', $default_font_size - 2);
 			$pdf->SetXY($this->marge_gauche, $posy);
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
-
+			$pdf->MultiCell(100, 3, $vat_info, 0, 'L', 0);
 			$posy = $pdf->GetY() + 4;
 		}
 

+ 25 - 8
htdocs/core/modules/facture/doc/pdf_sponge.modules.php

@@ -1193,16 +1193,33 @@ class pdf_sponge extends ModelePDFFactures
 
 		$pdf->SetFont('', '', $default_font_size - 1);
 
-		// If France, show VAT mention if not applicable
-		if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
+		// MMI Mathieu Moulin iProspective
+		// Replacement for VAT exempt notice
+		global $hookmanager;
+		$parameters = array(
+			'object' => $object,
+			'outputlangs' => $outputlangs,
+			'mysoc' => $mysoc,
+		);
+		$reshook = $hookmanager->executeHooks('VATNotificationOnPDF', $parameters, $this); // Note that $object may have been modified by hook
+		//var_dump($hookmanager); die();
+		//var_dump($reshook); die();
+		if ($reshook < 0) {
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+		} elseif (empty($reshook)) {
+			// If France, show VAT mention if not applicable
+			if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
+				if ($mysoc->forme_juridique_code == 92)
+					$vat_info = $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso");
+				else
+					$vat_info = $outputlangs->transnoentities("VATIsNotUsedForInvoice");
+		} else {
+			$vat_info = $hookmanager->resPrint;
+		}
+		if (!empty($vat_info)) {
 			$pdf->SetFont('', 'B', $default_font_size - 2);
 			$pdf->SetXY($this->marge_gauche, $posy);
-			if ($mysoc->forme_juridique_code == 92) {
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', 0);
-			} else {
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
-			}
-
+			$pdf->MultiCell(100, 3, $vat_info, 0, 'L', 0);
 			$posy = $pdf->GetY() + 4;
 		}
 

+ 23 - 5
htdocs/core/modules/propale/doc/pdf_cyan.modules.php

@@ -1048,13 +1048,31 @@ class pdf_cyan extends ModelePDFPropales
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
 
 		$pdf->SetFont('', '', $default_font_size - 1);
-
-		// If France, show VAT mention if not applicable
-		if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj)) {
+		
+		// MMI Mathieu Moulin iProspective
+		// Replacement for VAT exempt notice
+		global $hookmanager;
+		$parameters = array(
+			'object' => $object,
+			'outputlangs' => $outputlangs,
+			'mysoc' => $mysoc,
+		);
+		$reshook = $hookmanager->executeHooks('VATNotificationOnPDF', $parameters, $this); // Note that $object may have been modified by hook
+		//var_dump($hookmanager); die();
+		//var_dump($reshook); die();
+		if ($reshook < 0) {
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+		} elseif (empty($reshook)) {
+			// If France, show VAT mention if not applicable
+			if ($this->emetteur->country_code == 'FR' && empty($mysoc->tva_assuj))
+				$vat_info = $outputlangs->transnoentities("VATIsNotUsedForInvoice");
+		} else {
+			$vat_info = $hookmanager->resPrint;
+		}
+		if (!empty($vat_info)) {
 			$pdf->SetFont('', 'B', $default_font_size - 2);
 			$pdf->SetXY($this->marge_gauche, $posy);
-			$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
-
+			$pdf->MultiCell(100, 3, $vat_info, 0, 'L', 0);
 			$posy = $pdf->GetY() + 4;
 		}
 

+ 1 - 1
htdocs/custom/mmidocuments

@@ -1 +1 @@
-Subproject commit 293fc84cecd362db5a421010ea79e660e27539c0
+Subproject commit f47693ec52315a859c00434f9ff22bd93361ddef