NEW - Invoice - Show Category of operations

This commit is contained in:
VESSILLER 2022-12-16 14:41:45 +01:00
parent ab26aada31
commit c77e065050
8 changed files with 65 additions and 12 deletions

View File

@ -743,7 +743,7 @@ print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
$langs->loadLangs(array('admin', 'companies', 'languages', 'members', 'other', 'products', 'stocks', 'trips'));
if (!$user->admin) {
accessforbidden();
@ -276,7 +276,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
if (empty($selected)) {

View File

@ -5,6 +5,7 @@
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2022 Anthony Berton <bertonanthony@gmail.com>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
$langs->loadLangs(array('admin', 'bills', 'companies', 'languages', 'members', 'other', 'products', 'receptions', 'stocks', 'trips'));
if (!$user->admin) {
accessforbidden();
@ -69,6 +70,9 @@ if ($action == 'update') {
dolibarr_set_const($db, "INVOICE_ADD_SWISS_QR_CODE", GETPOST("INVOICE_ADD_SWISS_QR_CODE", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_del_const($db, "INVOICE_ADD_ZATCA_QR_CODE", $conf->entity);
}
if (GETPOSTISSET('INVOICE_CATEGORY_OF_OPERATION')) {
dolibarr_set_const($db, "INVOICE_CATEGORY_OF_OPERATION", GETPOST("INVOICE_CATEGORY_OF_OPERATION", 'int'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('INVOICE_SHOW_SHIPPING_ADDRESS')) {
dolibarr_set_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", GETPOST("INVOICE_SHOW_SHIPPING_ADDRESS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_del_const($db, "INVOICE_SHOW_SHIPPING_ADDRESS", $conf->entity);
@ -135,7 +139,7 @@ if (isModEnabled('facture')) {
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore"));
@ -159,11 +163,21 @@ if (isModEnabled('facture')) {
}
print '</td></tr>';
// Mention category of operations
// French Decret n°2099-1299 2022-10-07
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("INVOICE_SHOW_SHIPPING_ADDRESS"), $langs->trans("INVOICE_SHOW_SHIPPING_ADDRESSMore"));
print $form->textwithpicto($langs->trans("InvoiceOptionCategoryOfOperations"), $langs->trans('InvoiceOptionCategoryOfOperationsHelp'), 1);
print '</td><td>';
$arrval = array('0'=>$langs->trans("No"),
'1'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes1"),
'2'=>$langs->trans("InvoiceOptionCategoryOfOperationsYes2")
);
print $form->selectarray("INVOICE_CATEGORY_OF_OPERATION", $arrval, $conf->global->INVOICE_CATEGORY_OF_OPERATION, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS');
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS);
@ -181,7 +195,7 @@ if (isModEnabled('reception')) {
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>';
print $langs->trans("RECEPTION_PDF_HIDE_ORDERED");

View File

@ -61,9 +61,9 @@ function pdf_admin_prepare_head()
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'pdf_admin');
if (isModEnabled("propal")) {
if (isModEnabled("propal") || isModEnabled('facture') || isModEnabled('reception')) {
$head[$h][0] = DOL_URL_ROOT.'/admin/pdf_other.php';
$head[$h][1] = $langs->trans("Other");
$head[$h][1] = $langs->trans("Others");
$head[$h][2] = 'other';
$h++;
}

View File

@ -10,6 +10,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1289,6 +1290,16 @@ class pdf_sponge extends ModelePDFFactures
$posy = $pdf->GetY();
}
// Show category of operations
if ($conf->global->INVOICE_CATEGORY_OF_OPERATION == 2) {
$nbCategoryOfOperations = 0;
$categoryOfOperations = $outputlangs->trans("MentionCategoryOfOperations") . ': ' . $outputlangs->trans("MentionCategoryOfOperations" . $nbCategoryOfOperations);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->writeHTMLCell(80, 5, '', '', $outputlangs->transnoentities($categoryOfOperations), 0, 1);
$posy = $pdf->GetY() + 1;
}
// Show if Option VAT debit option is on also if transmitter is french
// Decret n°2099-1299 2022-10-07
// French mention : "Option pour le paiement de la taxe d'après les débits"
@ -1947,9 +1958,10 @@ class pdf_sponge extends ModelePDFFactures
* @param int $hidebottom Hide bottom bar of array
* @param string $currency Currency code
* @param Translate $outputlangsbis Langs object bis
* @param Facture $object Object to show
* @return void
*/
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null)
protected function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '', $outputlangsbis = null, $object)
{
global $conf;
@ -1967,6 +1979,21 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 2);
if (empty($hidetop)) {
// Show category of operations
if ($conf->global->INVOICE_CATEGORY_OF_OPERATION == 1) {
$nbCategoryOfOperations = 0;
if (count($object->product_type == 0) >= 1) {
$nbCategoryOfOperations = 0;
} elseif (count($object->product_type == 1) >= 1) {
$nbCategoryOfOperations = 1;
} elseif (count($object->product_type == 0) >= 1 && count($object->product_type == 1) >= 1) {
$nbCategoryOfOperations = 2;
}
$categoryOfOperations = $outputlangs->trans("MentionCategoryOfOperations") . ': ' . $outputlangs->trans("MentionCategoryOfOperations" . $nbCategoryOfOperations);
$pdf->SetXY($this->marge_gauche, $tab_top - 4);
$pdf->MultiCell(($pdf->GetStringWidth($categoryOfOperations)) + 4, 2, $categoryOfOperations);
}
$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE) && is_object($outputlangsbis)) {
$titre .= ' - '.$outputlangsbis->transnoentities("AmountInCurrency", $outputlangsbis->transnoentitiesnoconv("Currency".$currency));

View File

@ -1442,6 +1442,10 @@ SuppliersPayment=Vendor payments
SupplierPaymentSetup=Vendor payments setup
InvoiceCheckPosteriorDate=Check facture date before validation
InvoiceCheckPosteriorDateHelp=Validating an invoice will be forbidden if its date is anterior to the date of last invoice of same type.
InvoiceOptionCategoryOfOperations=Display the mention "category of operations" on the invoice.
InvoiceOptionCategoryOfOperationsHelp=Depending on the situation, the mention will appear in the form:<br>- Category of operations: Delivery of goods<br>- Category of operations: Provision of services<br>- Category of operations: Mixed - Delivery of goods & provision of services
InvoiceOptionCategoryOfOperationsYes1=Yes, below the address block
InvoiceOptionCategoryOfOperationsYes2=Yes, in the lower left-hand corner
##### Proposals #####
PropalSetup=Commercial proposals module setup
ProposalsNumberingModules=Commercial proposal numbering models

View File

@ -627,3 +627,7 @@ SendEmailsRemindersOnInvoiceDueDate=Send reminder by email for unpaid invoices
MakePaymentAndClassifyPayed=Record payment
BulkPaymentNotPossibleForInvoice=Bulk payment is not possible for invoice %s (bad type or status)
MentionVATDebitOptionIsOn=Option to pay tax based on debits
MentionCategoryOfOperations=Category of operations
MentionCategoryOfOperations0=Delivery of goods
MentionCategoryOfOperations1=Provision of services
MentionCategoryOfOperations2=Mixed - Delivery of goods & provision of services

View File

@ -215,9 +215,13 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) {
$conf->global->MAIN_INVERT_SENDER_RECIPIENT = 1;
}
if ($mysoc->country_code == 'FR' && !isset($conf->global->MAIN_PROFID1_IN_ADDRESS)) {
// For FR, default value of option to show profid SIRET is on by default
// For FR, default value of option to show profid SIRET is on by default. Decret n°2099-1299 2022-10-07
$conf->global->MAIN_PROFID1_IN_ADDRESS = 1;
}
if ($mysoc->country_code == 'FR' && (!isset($conf->global->INVOICE_CATEGORY_OF_OPERATION) || empty($conf->global->INVOICE_CATEGORY_OF_OPERATION))) {
// For FR, default value of option to show category of operations is on by default. Decret n°2099-1299 2022-10-07
$conf->global->INVOICE_CATEGORY_OF_OPERATION = 1;
}
}