Removed deprecated FPDI option and reorganise PDF setup page

This commit is contained in:
Laurent Destailleur 2018-04-30 09:28:24 +02:00
parent 6a76242611
commit 55f982e504
20 changed files with 76 additions and 63 deletions

View File

@ -133,7 +133,7 @@ if ($action == 'edit') // Edit
// Misc options
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">';
@ -168,7 +168,7 @@ if ($action == 'edit') // Edit
// Addresses
print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">';
@ -255,14 +255,15 @@ if ($action == 'edit') // Edit
print '</table>';
print '</div>';
print '<br>';
// Localtaxes
$locales ='';
$text='';
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
@ -279,31 +280,39 @@ if ($action == 'edit') // Edit
$text.= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
$title = $langs->trans("PDFRulesForSalesTax");
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$title.=' - '.$langs->trans("PDFLocaltax",$locales);
}
print load_fiche_titre($title,'','');
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Hide any information on Sale tax / VAT
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
print '</td></tr>';
// Locataxes
print $text;
print '</table>';
print '<br>';
// Other
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
print load_fiche_titre($langs->trans("Other"),'','');
print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
// Hide any PDF informations
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1);
print '</td></tr>';
//Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
@ -491,11 +500,10 @@ else // Show
print '<br>';
// Localtaxes
$locales ='';
$text='';
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2))
{
$locales ='';
$text='';
if ($mysoc->useLocalTax(1))
{
$locales = $langs->transcountry("LT1",$mysoc->country_code);
@ -513,16 +521,27 @@ else // Show
$text.= '</td></tr>';
}
print load_fiche_titre($langs->trans("PDFLocaltax",$locales),'','');
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print $text;
print '</table>';
print '<br>';
}
// Sales TAX / VAT information
$title=$langs->trans("PDFRulesForSalesTax",$locales);
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) $title.=' - '.$langs->trans("PDFLocaltax",$locales);
print load_fiche_titre($title,'','');
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
print '</td></tr>';
print $text;
print '</table>';
print '<br>';
// Other
print load_fiche_titre($langs->trans("Other"),'','');
@ -558,12 +577,6 @@ else // Show
print "</td>";
print '</tr>';
// Hide any PDF informations
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td colspan="2">';
print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1);
print '</td></tr>';
//Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td colspan="2">';
@ -601,7 +614,7 @@ else // Show
*/
print '<br>';
print load_fiche_titre($langs->trans("Library"));
print load_fiche_titre($langs->trans("Library"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">'."\n";

View File

@ -124,7 +124,6 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
// We need to instantiate tcpdi object (instead of tcpdf) to use merging features. But we can disable it (this will break all merge features).
if (empty($conf->global->MAIN_DISABLE_TCPDI)) require_once TCPDI_PATH.'tcpdi.php';
else if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once FPDI_PATH.'fpdi.php';
//$arrayformat=pdf_getFormat();
//$format=array($arrayformat['width'],$arrayformat['height']);

View File

@ -97,7 +97,7 @@ class pdf_einstein extends ModelePDFCommandes
public function __construct($db)
{
global $conf,$langs,$mysoc;
// Translations
$langs->loadLangs(array("main", "bills", "products"));
@ -189,7 +189,7 @@ class pdf_einstein extends ModelePDFCommandes
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
// Translations
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "orders", "deliveries"));
@ -252,7 +252,7 @@ class pdf_einstein extends ModelePDFCommandes
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
@ -1209,7 +1209,7 @@ class pdf_einstein extends ModelePDFCommandes
function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle")
{
global $conf,$langs,$hookmanager;
// Translations
$outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies"));
@ -1308,7 +1308,7 @@ class pdf_einstein extends ModelePDFCommandes
{
$top_shift = $pdf->getY() - $current_y;
}
if ($showaddress)
{
// Sender properties

View File

@ -183,7 +183,7 @@ class pdf_strato extends ModelePDFContract
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -165,7 +165,7 @@ class pdf_merou extends ModelePdfExpedition
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -228,7 +228,7 @@ class pdf_rouget extends ModelePdfExpedition
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -226,7 +226,7 @@ class pdf_standard extends ModeleExpenseReport
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -301,7 +301,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -173,7 +173,7 @@ class pdf_soleil extends ModelePDFFicheinter
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -197,7 +197,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -203,7 +203,7 @@ class pdf_standard extends ModelePDFProduct
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -161,7 +161,7 @@ class pdf_baleine extends ModelePDFProjects
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -179,7 +179,7 @@ class pdf_beluga extends ModelePDFProjects
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -160,7 +160,7 @@ class pdf_timespent extends ModelePDFProjects
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -283,7 +283,7 @@ class pdf_azur extends ModelePDFPropales
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -219,7 +219,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -269,7 +269,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -226,7 +226,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -299,7 +299,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
if (! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
{
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);

View File

@ -374,7 +374,8 @@ NoSmsEngine=No SMS sender manager available. SMS sender manager are not installe
PDF=PDF
PDFDesc=You can set each global options related to the PDF generation
PDFAddressForging=Rules to forge address boxes
HideAnyVATInformationOnPDF=Hide all information related to VAT on generated PDF
HideAnyVATInformationOnPDF=Hide all information related to Sales tax / VAT on generated PDF
PDFRulesForSalesTax=Rules for Sales Tax / VAT
PDFLocaltax=Rules for %s
HideLocalTaxOnPDF=Hide %s rate into pdf column tax sale
HideDescOnPDF=Hide products description on generated PDF