Skip to content

Commit

Permalink
Merge pull request #5090 from atm-maxime/fix_pdffoot_details
Browse files Browse the repository at this point in the history
PDF foot details
  • Loading branch information
eldy committed May 5, 2016
2 parents c795803 + 02aa3f5 commit d50e9cd
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 20 deletions.
19 changes: 18 additions & 1 deletion htdocs/admin/pdf.php
Expand Up @@ -63,6 +63,7 @@
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'',$conf->entity);

header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
Expand Down Expand Up @@ -94,6 +95,13 @@
$formother=new FormOther($db);
$formadmin=new FormAdmin($db);

$arraydetailsforpdffoot = array(
0 => $langs->trans('NoDetails'),
1 => $langs->trans('DisplayCompanyInfo'),
2 => $langs->trans('DisplayManagersInfo'),
3 => $langs->trans('DisplayCompanyInfoAndManagers')
);

print load_fiche_titre($langs->trans("PDF"),'','title_setup');

print $langs->trans("PDFDesc")."<br>\n";
Expand Down Expand Up @@ -253,7 +261,11 @@
print '<tr '.$bc[$var].'><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1);
print '</td></tr>';


$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
print '</td></tr>';

print '</table>';

Expand Down Expand Up @@ -455,6 +467,11 @@
print '<tr '.$bc[$var].'><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td colspan="2">';
print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1);
print '</td></tr>';

$var=!$var;
print '<tr '.$bc[$var].'><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td><td colspan="2">';
print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS];
print '</td></tr>';

print '</table>';

Expand Down
10 changes: 5 additions & 5 deletions htdocs/core/lib/pdf.lib.php
Expand Up @@ -803,7 +803,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// First line of company infos
$line1=""; $line2=""; $line3=""; $line4="";

if ($showdetails)
if ($showdetails == 1 || $showdetails == 3)
{
// Company name
if ($fromcompany->name)
Expand All @@ -813,7 +813,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Address
if ($fromcompany->address)
{
$line1.=($line1?" - ":"").$fromcompany->address;
$line1.=($line1?" - ":"").str_replace("\n", ", ", $fromcompany->address);
}
// Zip code
if ($fromcompany->zip)
Expand All @@ -828,12 +828,12 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Phone
if ($fromcompany->phone)
{
$line1.=($line1?" - ":"").$outputlangs->transnoentities("Phone").": ".$fromcompany->phone;
$line2.=($line2?" - ":"").$outputlangs->transnoentities("Phone").": ".$fromcompany->phone;
}
// Fax
if ($fromcompany->fax)
{
$line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax;
$line2.=($line2?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax;
}

// URL
Expand All @@ -847,7 +847,7 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$line2.=($line2?" - ":"").$fromcompany->email;
}
}
if ($showdetails || ($fromcompany->country_code == 'DE'))
if ($showdetails == 2 || $showdetails == 3 || ($fromcompany->country_code == 'DE'))
{
// Managers
if ($fromcompany->managers)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/cheque/doc/pdf_blochet.class.php
Expand Up @@ -376,7 +376,7 @@ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);

//$showdetails=0;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
$paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT';
$marge_basse=$this->marge_basse;
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -1354,7 +1354,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="Order"
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/contract/doc/pdf_strato.modules.php
Expand Up @@ -667,7 +667,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'CONTRACT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
Expand Up @@ -975,7 +975,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
Expand Up @@ -837,7 +837,8 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'EXPENSEREPORT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/facture/doc/pdf_crabe.modules.php
Expand Up @@ -1650,7 +1650,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
Expand Up @@ -661,7 +661,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
Expand Up @@ -897,7 +897,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/project/doc/pdf_baleine.modules.php
Expand Up @@ -488,7 +488,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/project/doc/pdf_beluga.modules.php
Expand Up @@ -618,7 +618,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}
}
3 changes: 2 additions & 1 deletion htdocs/core/modules/propale/doc/pdf_azur.modules.php
Expand Up @@ -1559,7 +1559,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'PROPOSAL_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
Expand Up @@ -1152,7 +1152,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf, $object, $outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
Expand Up @@ -1204,7 +1204,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down
Expand Up @@ -1389,7 +1389,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
$showdetails=0;
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_PROPOSAL_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

Expand Down

0 comments on commit d50e9cd

Please sign in to comment.