Skip to content

Commit

Permalink
Prepare code to be able to choose what to show into footer
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 25, 2014
1 parent b602b70 commit 7cb283d
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 24 deletions.
17 changes: 11 additions & 6 deletions htdocs/core/lib/pdf.lib.php
Expand Up @@ -651,7 +651,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
* @param int $marge_gauche Margin left (no more used)
* @param int $page_hauteur Page height (no more used)
* @param Object $object Object shown in PDF
* @param int $showdetails Show company details into footer. This param seems to not be used by standard version.
* @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both)
* @param int $hidefreetext 1=Hide free text, 0=Show free text
* @return int Return height of bottom margin including footer text
*/
Expand Down Expand Up @@ -681,10 +681,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
}

// First line of company infos
$line1=""; $line2=""; $line3=""; $line4="";

if ($showdetails)
if ($showdetails && 1)
{
$line1="";
// Company name
if ($fromcompany->name)
{
Expand Down Expand Up @@ -716,7 +716,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$line1.=($line1?" - ":"").$outputlangs->transnoentities("Fax").": ".$fromcompany->fax;
}

$line2="";
// URL
if ($fromcompany->url)
{
Expand All @@ -728,9 +727,16 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
$line2.=($line2?" - ":"").$fromcompany->email;
}
}
if (($showdetails && 2) || ($fromcompany->country_code == 'DE'))
{
// Managers
if ($fromcompany->managers)
{
$line2.=($line2?" - ":"").$fromcompany->managers;
}
}

// Line 3 of company infos
$line3="";
// Juridical status
if ($fromcompany->forme_juridique_code)
{
Expand All @@ -757,7 +763,6 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
}

// Line 4 of company infos
$line4="";
// Prof Id 3
if ($fromcompany->idprof3)
{
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/cheque/pdf/pdf_blochet.class.php
Expand Up @@ -352,7 +352,8 @@ function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);

//return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
//$showdetails=0;
//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;
$marge_gauche=$this->marge_gauche;
Expand Down
3 changes: 2 additions & 1 deletion htdocs/core/modules/commande/doc/pdf_einstein.modules.php
Expand Up @@ -1271,7 +1271,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_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/commande/doc/pdf_proforma.modules.php
Expand Up @@ -1228,7 +1228,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_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 @@ -610,7 +610,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'CONTRACT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
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 @@ -657,7 +657,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'SHIPPING_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 @@ -1455,7 +1455,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_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 @@ -595,7 +595,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'FICHINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

}
Expand Down
7 changes: 4 additions & 3 deletions htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php
Expand Up @@ -358,7 +358,7 @@ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hid
//$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->posxremainingqty - $this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R');

// Remaining to ship
$pdf->SetXY($this->posxremainingqty, $curY);
$qtyRemaining = $object->lines[$i]->qty_asked - $object->commande->expeditions[$object->lines[$i]->fk_origin_line];
Expand Down Expand Up @@ -613,7 +613,7 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
}

// Modif SEB pour avoir une col en plus pour les commentaires clients
$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
if (empty($hidetop)) {
Expand Down Expand Up @@ -863,7 +863,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

}
Expand Down
7 changes: 4 additions & 3 deletions htdocs/core/modules/project/pdf/pdf_baleine.modules.php
Expand Up @@ -295,7 +295,7 @@ function write_file($object,$outputlangs)
$pdf->Close();

$pdf->Output($file,'F');

// Add pdfgeneration hook
if (! is_object($hookmanager))
{
Expand All @@ -306,7 +306,7 @@ function write_file($object,$outputlangs)
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks

if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));

Expand Down Expand Up @@ -454,7 +454,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'PROJECT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
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/propale/doc/pdf_azur.modules.php
Expand Up @@ -1362,7 +1362,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
}

}
Expand Down
Expand Up @@ -1052,7 +1052,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf, $object, $outputlangs,$hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_INVOICE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
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 @@ -701,7 +701,7 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
foreach( $this->localtax1 as $localtax_type => $localtax_rate )
{
if (in_array((string) $localtax_type, array('2','4','6'))) continue;

foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey != 0) // On affiche pas taux 0
Expand Down Expand Up @@ -733,7 +733,7 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
foreach( $this->localtax2 as $localtax_type => $localtax_rate )
{
if (in_array((string) $localtax_type, array('2','4','6'))) continue;

foreach( $localtax_rate as $tvakey => $tvaval )
{
if ($tvakey != 0) // On affiche pas taux 0
Expand Down Expand Up @@ -1105,7 +1105,8 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
*/
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext=0)
{
return pdf_pagefoot($pdf,$outputlangs,'SUPPLIER_ORDER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,0,$hidefreetext);
$showdetails=0;
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
1 change: 1 addition & 0 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -1082,6 +1082,7 @@ NotificationsDesc=EMails notifications feature allows you to silently send autom
ModelModules=Documents templates
DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS files for OpenOffice, KOffice, TextEdit,...)
WatermarkOnDraft=Watermark on draft document
JSOnPaimentBill=Activate feature to autofill payment lines on payment form
CompanyIdProfChecker=Rules on Professional Ids
MustBeUnique=Must be unique ?
MustBeMandatory=Mandatory to create third parties ?
Expand Down

0 comments on commit 7cb283d

Please sign in to comment.