WIP LNE
This commit is contained in:
parent
e47925af7c
commit
8e005b19c0
6 changed files with 73 additions and 14 deletions
|
|
@ -846,6 +846,39 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add legal mention
|
||||
*
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Translate $outputlangs Object lang
|
||||
* @param Societe $seller Seller company
|
||||
* @param int $default_font_size Default font size
|
||||
* @param float $posy Y position
|
||||
* @param CommonDocGenerator $pdftemplate PDF template
|
||||
* @return int 0 if nothing done, 1 if a mention was printed
|
||||
*/
|
||||
function pdfLegalMention(&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
|
||||
|
||||
$result = 0;
|
||||
|
||||
if (in_array($seller->country_code, array('FR')) && isALNEQualifiedVersion()) { // If necessary, we could replace with "if isALNERunningVersion()"
|
||||
$outputlangs->load("blockedlog");
|
||||
$blockedlog_mention = $outputlangs->trans("InvoiceGeneratedWithLNECertifiedPOSSystem");
|
||||
if ($blockedlog_mention) {
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($pdftemplate->marge_gauche, $posy);
|
||||
$pdf->MultiCell(100, 3, $blockedlog_mention, 0, 'L', false);
|
||||
$posy = $pdf->GetY();
|
||||
$result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show bank information for PDF generation
|
||||
*
|
||||
|
|
@ -860,8 +893,6 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
|
|||
*/
|
||||
function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
|
||||
{
|
||||
global $mysoc, $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
|
||||
|
||||
$diffsizetitle = getDolGlobalInt('PDF_DIFFSIZE_TITLE', 3);
|
||||
|
|
@ -1460,7 +1491,7 @@ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w,
|
|||
*/
|
||||
function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align = 'J')
|
||||
{
|
||||
global $db, $conf, $langs, $hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$reshook = 0;
|
||||
$result = '';
|
||||
|
|
@ -2077,7 +2108,7 @@ function pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails = 0)
|
|||
*/
|
||||
function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$sign = 1;
|
||||
if (isset($object->type) && $object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) {
|
||||
|
|
@ -2120,7 +2151,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0)
|
|||
*/
|
||||
function pdf_getlineupwithtax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $hookmanager, $conf;
|
||||
global $hookmanager;
|
||||
|
||||
$sign = 1;
|
||||
if (isset($object->type) && $object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) {
|
||||
|
|
@ -2411,7 +2442,6 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
|||
if (empty($hookmanager)) {
|
||||
global $hookmanager;
|
||||
}
|
||||
global $conf;
|
||||
|
||||
$reshook = 0;
|
||||
$result = '';
|
||||
|
|
@ -2459,7 +2489,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
|||
*/
|
||||
function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
global $hookmanager;
|
||||
|
||||
$sign = 1;
|
||||
if (isset($object->type) && $object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) {
|
||||
|
|
@ -2515,7 +2545,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0)
|
|||
*/
|
||||
function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $hookmanager, $conf;
|
||||
global $hookmanager;
|
||||
|
||||
$sign = 1;
|
||||
if (isset($object->type) && $object->type == 2 && getDolGlobalString('INVOICE_POSITIVE_CREDIT_NOTE')) {
|
||||
|
|
|
|||
|
|
@ -1154,7 +1154,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs, $outputlangsbis)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $mysoc, $hookmanager;
|
||||
global $mysoc;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
|
|
@ -1223,19 +1223,28 @@ class pdf_crabe extends ModelePDFFactures
|
|||
}
|
||||
|
||||
// If France, show VAT mention if applicable
|
||||
$showvatmention = 0;
|
||||
if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) {
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
if (empty($mysoc->tva_assuj)) {
|
||||
if (!empty($mysoc->tva_assuj)) {
|
||||
if ($mysoc->forme_juridique_code == 92) {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoiceAsso"), 0, 'L', false);
|
||||
} else {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', false);
|
||||
}
|
||||
$showvatmention++;
|
||||
} elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', false);
|
||||
$showvatmention++;
|
||||
}
|
||||
$posy = $pdf->GetY() + 4;
|
||||
$posy = $pdf->GetY();
|
||||
}
|
||||
|
||||
$showvatmention += pdfLegalMention($pdf, $outputlangs, $this->emetteur, $default_font_size, $posy, $this);
|
||||
|
||||
if ($showvatmention) {
|
||||
$posy += 3;
|
||||
}
|
||||
|
||||
$posxval = 52;
|
||||
|
|
|
|||
|
|
@ -1456,6 +1456,7 @@ class pdf_octopus extends ModelePDFFactures
|
|||
}
|
||||
|
||||
// If France, show VAT mention if applicable
|
||||
$showvatmention = 0;
|
||||
if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) {
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
|
@ -1465,12 +1466,21 @@ class pdf_octopus extends ModelePDFFactures
|
|||
} else {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', false);
|
||||
}
|
||||
$showvatmention++;
|
||||
} elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', false);
|
||||
$showvatmention++;
|
||||
}
|
||||
$posy = $pdf->GetY() + 4;
|
||||
$posy = $pdf->GetY();
|
||||
}
|
||||
|
||||
$showvatmention += pdfLegalMention($pdf, $outputlangs, $this->emetteur, $default_font_size, $posy, $this);
|
||||
|
||||
if ($showvatmention) {
|
||||
$posy += 3;
|
||||
}
|
||||
|
||||
|
||||
$posxval = 52; // Position of values of properties shown on left side
|
||||
$posxend = 110; // End of x for text on left side
|
||||
if ($this->page_largeur < 210) { // To work with US executive format
|
||||
|
|
|
|||
|
|
@ -1375,6 +1375,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
}
|
||||
|
||||
// If France, show VAT mention if applicable
|
||||
$showvatmention = 0;
|
||||
if (in_array($this->emetteur->country_code, array('FR')) && empty($object->total_tva)) {
|
||||
$pdf->SetFont('', '', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
|
@ -1384,10 +1385,18 @@ class pdf_sponge extends ModelePDFFactures
|
|||
} else {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', false);
|
||||
}
|
||||
$showvatmention++;
|
||||
} elseif (getDolGlobalString("INVOICE_VAT_SHOW_REVERSE_CHARGE_MENTION") && $this->emetteur->country_code != $object->thirdparty->country_code && $this->emetteur->isInEEC() && $object->thirdparty->isInEEC()) {
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedReverseChargeProcedure"), 0, 'L', false);
|
||||
$showvatmention++;
|
||||
}
|
||||
$posy = $pdf->GetY() + 4;
|
||||
$posy = $pdf->GetY();
|
||||
}
|
||||
|
||||
$showvatmention += pdfLegalMention($pdf, $outputlangs, $this->emetteur, $default_font_size, $posy, $this);
|
||||
|
||||
if ($showvatmention) {
|
||||
$posy += 3;
|
||||
}
|
||||
|
||||
$posxval = 52; // Position of values of properties shown on left side
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ UnlaterableDataOfEvent=Unalterable data of event
|
|||
YourCountryCode=Your country code
|
||||
DisablingBlockedLogIsNotallowedOnceUsedExceptOnFullreset=Disabling %s module is not allowed once it has been used, except for a full database reset. Ask your integrator or reseller if you need such a reset.
|
||||
LNECertifiedPOSSystem=LNE Certified POS system
|
||||
InvoiceGeneratedWithLNECertifiedPOSSystem=Invoice generated with a LNE certified POS system
|
||||
|
||||
## logTypes
|
||||
logBILL_DELETE=Customer invoice logically deleted
|
||||
|
|
|
|||
|
|
@ -485,7 +485,7 @@ if (getDolGlobalString('TAKEPOS_FOOTER') || getDolGlobalString($constFreeText))
|
|||
print $newfreetext;
|
||||
}
|
||||
|
||||
if (isALNEQualifiedVersion('')) {
|
||||
if (isALNEQualifiedVersion()) { // If necessary, we could replace with "if isALNERunningVersion()"
|
||||
$langs->load("blockedlog");
|
||||
print '<center class="small"><i>'.$langs->trans("LNECertifiedPOSSystem")."</i></center><br>\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue