Fix break page on pdf for projects

This commit is contained in:
Laurent Destailleur 2010-08-14 00:17:46 +00:00
parent 382c74fec2
commit fcf5723183

View File

@ -26,8 +26,8 @@
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php");
require_once(DOL_DOCUMENT_ROOT."/projet/project.class.php"); require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/projet/tasks/task.class.php"); require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
@ -75,9 +75,11 @@ class pdf_baleine extends ModelePDFProjects
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 // Defini position des colonnes
$this->posxdesc=$this->marge_gauche+1; $this->posxref=$this->marge_gauche+1;
$this->posxcomm=120; $this->posxlabel=$this->marge_gauche+25;
$this->posxprogress=$this->marge_gauche+140;
$this->posxdatestart=$this->marge_gauche+150;
$this->posxdateend=$this->marge_gauche+170;
} }
@ -162,7 +164,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Project")); $pdf->SetSubject($outputlangs->transnoentities("Project"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname)); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project")); $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Project"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false); if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
@ -178,22 +180,22 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$tab_top = 50; $tab_top = 50;
$tab_height = 210; $tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
// Affiche notes // Affiche notes
if (! empty($object->note_public)) if (! empty($object->note_public))
{ {
$tab_top = 48; $pdf->SetFont('Arial','', 9);
$pdf->SetXY ($this->posxref-1, $tab_top-2);
$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'); $pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($object->note_public), 0, 'J');
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
$height_note=$nexY-$tab_top; $height_note=$nexY-($tab_top-2);
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192,192,192); $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); $pdf->Rect($this->marge_gauche, $tab_top-3, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1);
$tab_height = $tab_height - $height_note; $tab_height = $tab_height - $height_note;
$tab_top = $nexY+6; $tab_top = $nexY+6;
@ -215,11 +217,24 @@ class pdf_baleine extends ModelePDFProjects
// Description of ligne // Description of ligne
$ref=$object->lines[$i]->ref; $ref=$object->lines[$i]->ref;
$libelleline=$object->lines[$i]->label; $libelleline=$object->lines[$i]->label;
$progress=$object->lines[$i]->progress.'%';
$datestart=dol_print_date($object->lines[$i]->date_start,'day');
$dateend=dol_print_date($object->lines[$i]->date_end,'day');
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page $pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($ref), 0, 1); $pdf->SetXY($this->posxref, $curY);
$pdf->writeHTMLCell(108, 3, $this->posxdesc+10, $curY, $outputlangs->convToOutputCharset($libelleline), 0, 1); $pdf->MultiCell(60, 3, $outputlangs->convToOutputCharset($ref), 0, 'L');
$pdf->SetXY($this->posxlabel, $curY);
$pdf->MultiCell(108, 3, $outputlangs->convToOutputCharset($libelleline), 0, 'L');
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell(16, 3, $progress, 0, 'L');
$pdf->SetXY($this->posxdatestart, $curY);
$pdf->MultiCell(20, 3, $datestart, 0, 'L');
$pdf->SetXY($this->posxdateend, $curY);
$pdf->MultiCell(20, 3, $dateend, 0, 'L');
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut $pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
@ -253,7 +268,10 @@ class pdf_baleine extends ModelePDFProjects
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3 $pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 7; $tab_top=$tab_top_newpage;
$tab_height=$tab_height_newpage;
$nexY = $tab_top + 7;
} }
} }
@ -310,7 +328,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$pdf->SetXY ($this->posxdesc-1, $tab_top+2); $pdf->SetXY ($this->posxref-1, $tab_top+2);
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Tasks"),'','L'); $pdf->MultiCell(80,2, $outputlangs->transnoentities("Tasks"),'','L');
} }
@ -350,7 +368,7 @@ class pdf_baleine extends ModelePDFProjects
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
} }
} }
else $pdf->MultiCell(100, 4, $this->emetteur->nom, 0, 'L'); else $pdf->MultiCell(100, 4, $outputlangs->transnoentities($this->emetteur->nom), 0, 'L');
$pdf->SetFont('Arial','B',13); $pdf->SetFont('Arial','B',13);
$pdf->SetXY(100,$posy); $pdf->SetXY(100,$posy);
@ -397,73 +415,6 @@ class pdf_baleine extends ModelePDFProjects
} }
} }
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 = pdf_build_address($outputlangs,$this->emetteur);
$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();
// Recipient name
if (! empty($usecontact))
{
// On peut utiliser le nom de la societe du contact
if ($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) $socname = $object->contact->socname;
else $socname = $object->client->nom;
$carac_client_name=$outputlangs->convToOutputCharset($socname);
}
else
{
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
}
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// 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);
*/ }
} }
/** /**