New: Work on document generation for third parties
This commit is contained in:
parent
bcaaf8e053
commit
5723bce76a
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -328,13 +328,14 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||||||
$name = substr($file, 4, strlen($file) -16);
|
$name = substr($file, 4, strlen($file) -16);
|
||||||
$classname = substr($file, 0, strlen($file) -12);
|
$classname = substr($file, 0, strlen($file) -12);
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'><td width="100">';
|
|
||||||
echo "$name";
|
|
||||||
print "</td><td>\n";
|
|
||||||
|
|
||||||
require_once($dir.'/'.$file);
|
require_once($dir.'/'.$file);
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
print $module->description;
|
|
||||||
|
print '<tr '.$bc[$var].'><td width="100">';
|
||||||
|
echo $module->name;
|
||||||
|
print "</td><td>\n";
|
||||||
|
if (method_exists($module,'info')) print $module->info($langs);
|
||||||
|
else print $module->description;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Active
|
// Active
|
||||||
|
|||||||
@ -34,7 +34,6 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
|||||||
* \class odt_generic
|
* \class odt_generic
|
||||||
* \brief Classe permettant de generer les projets au modele Baleine
|
* \brief Classe permettant de generer les projets au modele Baleine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class odt_generic extends ModeleDocProjects
|
class odt_generic extends ModeleDocProjects
|
||||||
{
|
{
|
||||||
var $emetteur; // Objet societe qui emet
|
var $emetteur; // Objet societe qui emet
|
||||||
@ -51,7 +50,7 @@ class odt_generic extends ModeleDocProjects
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "odt";
|
$this->name = "Generic";
|
||||||
$this->description = $langs->trans("DocumentModelOdt");
|
$this->description = $langs->trans("DocumentModelOdt");
|
||||||
|
|
||||||
// Dimension page pour format A4
|
// Dimension page pour format A4
|
||||||
@ -64,21 +63,48 @@ class odt_generic extends ModeleDocProjects
|
|||||||
$this->marge_haute=0;
|
$this->marge_haute=0;
|
||||||
$this->marge_basse=0;
|
$this->marge_basse=0;
|
||||||
|
|
||||||
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
|
|
||||||
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
|
|
||||||
$this->option_codeproduitservice = 1; // Affiche code produit-service
|
|
||||||
|
|
||||||
// Recupere emmetteur
|
// Recupere emmetteur
|
||||||
$this->emetteur=$mysoc;
|
$this->emetteur=$mysoc;
|
||||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||||
|
|
||||||
// Defini position des colonnes
|
|
||||||
$this->posxdesc=$this->marge_gauche+1;
|
|
||||||
$this->posxcomm=120;
|
|
||||||
|
|
||||||
$this->params=array('COMPANY_ADDON_PDF_ODT'=>array('type'=>'TEXTAREA','default'=>''));
|
$this->params=array('COMPANY_ADDON_PDF_ODT'=>array('type'=>'TEXTAREA','default'=>''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief Renvoi la description du module
|
||||||
|
* \return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info($langs)
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$texte = $this->description."<br>\n";
|
||||||
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$texte.= '<input type="hidden" name="action" value="updateModule">';
|
||||||
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
|
// List of directories area
|
||||||
|
$texte.= '<tr><td>'.$langs->trans("ListOfDirectories").':<br>';
|
||||||
|
$texte.= '<textarea class="flat" cols="80" name="COMPANY_ADDON_PDF_ODTPATH">';
|
||||||
|
$texte.=$conf->global->COMPANY_ADDON_PDF_ODTPATH;
|
||||||
|
$texte.= '</textarea>';
|
||||||
|
$texte.= '</tr>';
|
||||||
|
|
||||||
|
// Example
|
||||||
|
$texte.= '<tr><td>'.$langs->trans("ExampleOfDirectories").':';
|
||||||
|
$texte.= '</br>';
|
||||||
|
$texte.= '</tr>';
|
||||||
|
|
||||||
|
$texte.= '</table>';
|
||||||
|
$texte.= '</form>';
|
||||||
|
|
||||||
|
return $texte;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Fonction generant le projet sur le disque
|
* \brief Fonction generant le projet sur le disque
|
||||||
* \param delivery Object project a generer
|
* \param delivery Object project a generer
|
||||||
@ -105,7 +131,7 @@ class odt_generic extends ModeleDocProjects
|
|||||||
if (! is_object($object))
|
if (! is_object($object))
|
||||||
{
|
{
|
||||||
$id = $object;
|
$id = $object;
|
||||||
$object = new Project($this->db);
|
$object = new Societe($this->db);
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -114,8 +140,6 @@ class odt_generic extends ModeleDocProjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$nblignes = sizeof($object->lignes);
|
|
||||||
|
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
$dir = $conf->projet->dir_output;
|
$dir = $conf->projet->dir_output;
|
||||||
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
|
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
|
||||||
@ -132,141 +156,11 @@ class odt_generic extends ModeleDocProjects
|
|||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Protection et encryption du pdf
|
// $file
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
|
||||||
{
|
|
||||||
$pdf=new FPDI_Protection('P','mm',$this->format);
|
|
||||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
|
||||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
|
||||||
$pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
|
|
||||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$pdf=new FPDI('P','mm',$this->format);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Complete object by loading several other informations
|
|
||||||
$task = new Task($this->db);
|
|
||||||
$tasksarray = $task->getTasksArray(0,0,$object->id);
|
|
||||||
|
|
||||||
$pdf->Open();
|
|
||||||
$pagenb=0;
|
|
||||||
$pdf->SetDrawColor(128,128,128);
|
|
||||||
|
|
||||||
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
|
|
||||||
$pdf->SetSubject($outputlangs->transnoentities("Project"));
|
|
||||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
|
||||||
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname));
|
|
||||||
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
|
|
||||||
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
|
|
||||||
|
|
||||||
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
|
|
||||||
$pdf->SetAutoPageBreak(1,0);
|
|
||||||
|
|
||||||
// New page
|
|
||||||
$pdf->AddPage();
|
|
||||||
$pagenb++;
|
|
||||||
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
|
||||||
$pdf->SetFont('Arial','', 9);
|
|
||||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
|
||||||
|
|
||||||
$tab_top = 90;
|
|
||||||
$tab_height = 150;
|
|
||||||
|
|
||||||
// Affiche notes
|
|
||||||
if (! empty($object->note_public))
|
|
||||||
{
|
|
||||||
$tab_top = 88;
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
|
||||||
$pdf->SetXY ($this->posxdesc-1, $tab_top);
|
|
||||||
$pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($object->note_public), 0, 'J');
|
|
||||||
$nexY = $pdf->GetY();
|
|
||||||
$height_note=$nexY-$tab_top;
|
|
||||||
|
|
||||||
// Rect prend une longueur en 3eme param
|
|
||||||
$pdf->SetDrawColor(192,192,192);
|
|
||||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
|
|
||||||
|
|
||||||
$tab_height = $tab_height - $height_note;
|
|
||||||
$tab_top = $nexY+6;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$height_note=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$iniY = $tab_top + 7;
|
|
||||||
$curY = $tab_top + 7;
|
|
||||||
$nexY = $tab_top + 7;
|
|
||||||
|
|
||||||
// Boucle sur les lignes
|
|
||||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
|
||||||
{
|
|
||||||
$curY = $nexY;
|
|
||||||
|
|
||||||
// Description de la ligne produit
|
|
||||||
$libelleproduitservice=pdf_getlinedesc($object->lignes[$i],$outputlangs);
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
|
||||||
|
|
||||||
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
|
|
||||||
$nexY = $pdf->GetY();
|
|
||||||
|
|
||||||
// Quantity
|
|
||||||
$pdf->SetXY ($this->posxqty, $curY);
|
|
||||||
$pdf->MultiCell(30, 3, $object->lignes[$i]->qty_shipped, 0, 'R');
|
|
||||||
|
|
||||||
$nexY+=2; // Passe espace entre les lignes
|
|
||||||
|
|
||||||
// Cherche nombre de lignes a venir pour savoir si place suffisante
|
|
||||||
if ($i < ($nblignes - 1)) // If it's not last line
|
|
||||||
{
|
|
||||||
//on recupere la description du produit suivant
|
|
||||||
$follow_descproduitservice = $object->lignes[$i+1]->desc;
|
|
||||||
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
|
|
||||||
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4);
|
|
||||||
}
|
|
||||||
else // If it's last line
|
|
||||||
{
|
|
||||||
$nblineFollowDesc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
|
|
||||||
{
|
|
||||||
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
|
|
||||||
|
|
||||||
$this->_pagefoot($pdf, $object, $outputlangs);
|
|
||||||
|
|
||||||
// New page
|
|
||||||
$pdf->AddPage();
|
|
||||||
$pagenb++;
|
|
||||||
$this->_pagehead($pdf, $object, 0, $outputlangs);
|
|
||||||
$pdf->SetFont('Arial','', 9);
|
|
||||||
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
|
||||||
|
|
||||||
$nexY = $tab_top_newpage + 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show square
|
|
||||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
|
||||||
$bottomlasttab=$tab_top + $tab_height + 1;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Pied de page
|
|
||||||
*/
|
|
||||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
|
||||||
$pdf->AliasNbPages();
|
|
||||||
|
|
||||||
$pdf->Close();
|
|
||||||
|
|
||||||
$pdf->Output($file);
|
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
@ -283,214 +177,6 @@ class odt_generic extends ModeleDocProjects
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* \brief Affiche la grille des lignes
|
|
||||||
* \param pdf objet PDF
|
|
||||||
*/
|
|
||||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
|
||||||
{
|
|
||||||
global $conf,$mysoc;
|
|
||||||
|
|
||||||
// Montants exprimes en (en tab_top - 1)
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
|
||||||
$pdf->SetFont('Arial','',8);
|
|
||||||
//$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie));
|
|
||||||
//$pdf->Text($this->page_largeur - $this->marge_droite - $pdf->GetStringWidth($titre), $tab_top-1, $titre);
|
|
||||||
|
|
||||||
$pdf->SetDrawColor(128,128,128);
|
|
||||||
|
|
||||||
// Rect prend une longueur en 3eme param
|
|
||||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
|
||||||
// line prend une position y en 3eme param
|
|
||||||
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','',10);
|
|
||||||
|
|
||||||
$pdf->SetXY ($this->posxdesc-1, $tab_top+2);
|
|
||||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Task"),'','L');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Affiche en-tete bon livraison
|
|
||||||
* \param pdf objet PDF
|
|
||||||
* \param delivery object delivery
|
|
||||||
* \param showadress 0=non, 1=oui
|
|
||||||
*/
|
|
||||||
function _pagehead(&$pdf, $object, $showadress=1, $outputlangs)
|
|
||||||
{
|
|
||||||
global $langs,$conf,$mysoc;
|
|
||||||
|
|
||||||
pdf_pagehead($pdf,$outputlangs,$pdf->page_hauteur);
|
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
|
||||||
$pdf->SetFont('Arial','B',13);
|
|
||||||
|
|
||||||
$posy=$this->marge_haute;
|
|
||||||
|
|
||||||
$pdf->SetXY($this->marge_gauche,$posy);
|
|
||||||
|
|
||||||
// Logo
|
|
||||||
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
|
||||||
if ($mysoc->logo)
|
|
||||||
{
|
|
||||||
if (is_readable($logo))
|
|
||||||
{
|
|
||||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, 24);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$pdf->SetTextColor(200,0,0);
|
|
||||||
$pdf->SetFont('Arial','B',8);
|
|
||||||
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
|
||||||
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else $pdf->MultiCell(100, 4, $this->emetteur->nom, 0, 'L');
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','B',13);
|
|
||||||
$pdf->SetXY(100,$posy);
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
|
||||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '' , 'R');
|
|
||||||
$pdf->SetFont('Arial','',12);
|
|
||||||
|
|
||||||
$posy+=6;
|
|
||||||
$pdf->SetXY(100,$posy);
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
|
||||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateStart")." : " . dol_print_date($object->date_start,'day',false,$outputlangs,true), '', 'R');
|
|
||||||
$posy+=6;
|
|
||||||
$pdf->SetXY(100,$posy);
|
|
||||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DateEnd")." : " . dol_print_date($object->date_end,'day',false,$outputlangs,true), '', 'R');
|
|
||||||
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
|
||||||
|
|
||||||
// Add list of linked orders
|
|
||||||
$object->load_object_linked();
|
|
||||||
|
|
||||||
if ($conf->commande->enabled)
|
|
||||||
{
|
|
||||||
$outputlangs->load('orders');
|
|
||||||
foreach($object->linked_object as $key => $val)
|
|
||||||
{
|
|
||||||
if ($val['type'] == 'commande')
|
|
||||||
{
|
|
||||||
$newobject=new Commande($this->db);
|
|
||||||
$result=$newobject->fetch($val['linkid']);
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
$posy+=4;
|
|
||||||
$pdf->SetXY(100,$posy);
|
|
||||||
$pdf->SetFont('Arial','',9);
|
|
||||||
$text=$newobject->ref;
|
|
||||||
if ($newobject->ref_client) $text.=' ('.$newobject->ref_client.')';
|
|
||||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($showadress)
|
|
||||||
{
|
|
||||||
// Emetteur
|
|
||||||
$posy=42;
|
|
||||||
$hautcadre=40;
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
|
||||||
$pdf->SetFont('Arial','',8);
|
|
||||||
$pdf->SetXY($this->marge_gauche,$posy-5);
|
|
||||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":");
|
|
||||||
|
|
||||||
|
|
||||||
$pdf->SetXY($this->marge_gauche,$posy);
|
|
||||||
$pdf->SetFillColor(230,230,230);
|
|
||||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
|
||||||
|
|
||||||
|
|
||||||
$pdf->SetXY($this->marge_gauche+2,$posy+3);
|
|
||||||
|
|
||||||
// Nom emetteur
|
|
||||||
$pdf->SetTextColor(0,0,60);
|
|
||||||
$pdf->SetFont('Arial','B',11);
|
|
||||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->nom), 0, 'L');
|
|
||||||
|
|
||||||
// Sender properties
|
|
||||||
$carac_emetteur = '';
|
|
||||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
|
|
||||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->cp).' '.$outputlangs->convToOutputCharset($this->emetteur->ville);
|
|
||||||
$carac_emetteur .= "\n";
|
|
||||||
// Tel
|
|
||||||
if ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($this->emetteur->tel);
|
|
||||||
// Fax
|
|
||||||
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\n") : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($this->emetteur->fax);
|
|
||||||
// EMail
|
|
||||||
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($this->emetteur->email);
|
|
||||||
// Web
|
|
||||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','',9);
|
|
||||||
$pdf->SetXY($this->marge_gauche+2,$posy+9);
|
|
||||||
$pdf->MultiCell(80, 3, $carac_emetteur);
|
|
||||||
|
|
||||||
// Client destinataire
|
|
||||||
$posy=42;
|
|
||||||
$pdf->SetTextColor(0,0,0);
|
|
||||||
$pdf->SetFont('Arial','',8);
|
|
||||||
$pdf->SetXY(102,$posy-5);
|
|
||||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":");
|
|
||||||
|
|
||||||
// Cadre client destinataire
|
|
||||||
$pdf->rect(100, $posy, 100, $hautcadre);
|
|
||||||
|
|
||||||
$object->fetch_client();
|
|
||||||
|
|
||||||
// Nom client
|
|
||||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
|
|
||||||
|
|
||||||
// Nom du contact facturation si c'est une societe
|
|
||||||
$arrayidcontact = $object->getIdContact('external','PROJECTLEADER');
|
|
||||||
if (sizeof($arrayidcontact) > 0)
|
|
||||||
{
|
|
||||||
$object->fetch_contact($arrayidcontact[0]);
|
|
||||||
// On verifie si c'est une societe ou un particulier
|
|
||||||
if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) )
|
|
||||||
{
|
|
||||||
$carac_client .= "\n".$outputlangs->convToOutputCharset($object->contact->getFullName($outputlangs,1,1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Caracteristiques client
|
|
||||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->address);
|
|
||||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->cp) . " " . $outputlangs->convToOutputCharset($object->client->ville)."\n";
|
|
||||||
if ($object->client->pays_code && $object->client->pays_code != $this->emetteur->pays_code) $carac_client.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->client->pays_code))."\n";
|
|
||||||
|
|
||||||
// Numero TVA intracom
|
|
||||||
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($object->client->tva_intra);
|
|
||||||
|
|
||||||
|
|
||||||
// Show customer/recipient
|
|
||||||
$pdf->SetXY(102,$posy+3);
|
|
||||||
$pdf->SetFont('Arial','B',11);
|
|
||||||
$pdf->MultiCell(106,4, $carac_client_name, 0, 'L');
|
|
||||||
|
|
||||||
$pdf->SetFont('Arial','',9);
|
|
||||||
$pdf->SetXY(102,$posy+8);
|
|
||||||
$pdf->MultiCell(86,4, $carac_client);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Show footer of page
|
|
||||||
* \param pdf PDF factory
|
|
||||||
* \param object Object invoice
|
|
||||||
* \param outputlangs Object lang for output
|
|
||||||
* \remarks Need this->emetteur object
|
|
||||||
*/
|
|
||||||
function _pagefoot(&$pdf,$object,$outputlangs)
|
|
||||||
{
|
|
||||||
return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user