From 190cc7b13c661c0e7cf4dfd8ee5283d5f6d1589c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2012 14:43:31 +0100 Subject: [PATCH 1/6] Fix: uniformize structure --- htdocs/admin/fichinter.php | 6 +++--- .../fichinter/{ => doc}/pdf_soleil.modules.php | 11 ++++++----- htdocs/core/modules/fichinter/modules_fichinter.php | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) rename htdocs/core/modules/fichinter/{ => doc}/pdf_soleil.modules.php (96%) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 13dc63c2c6b..5202a00667d 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2011 Philippe Grand @@ -107,7 +107,7 @@ if ($action == 'specimen') $inter->initAsSpecimen(); // Charge le modele - $dir = "/core/modules/fichinter/"; + $dir = "/core/modules/fichinter/doc/"; $file = "pdf_".$modele.".modules.php"; $file = dol_buildpath($dir.$file); if (file_exists($file)) @@ -363,7 +363,7 @@ clearstatcache(); $var=true; foreach ($conf->file->dol_document_root as $dirroot) { - $dir = $dirroot . "/core/modules/fichinter/"; + $dir = $dirroot . "/core/modules/fichinter/doc/"; if (is_dir($dir)) { diff --git a/htdocs/core/modules/fichinter/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php similarity index 96% rename from htdocs/core/modules/fichinter/pdf_soleil.modules.php rename to htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 5f2570fe10c..e399cde7cc1 100644 --- a/htdocs/core/modules/fichinter/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2008 Raphael Bertrand (Resultic) - * Copyright (C) 2011 Fabrice CHERRIER (12/05/2011) http://www.fcinc.fr +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2011 Fabrice CHERRIER * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +21,7 @@ */ /** - * \file htdocs/core/modules/fichinter/pdf_soleil.modules.php + * \file htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php * \ingroup ficheinter * \brief Fichier de la classe permettant de generer les fiches d'intervention au modele Soleil */ diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index be891eb3deb..f7ebef61859 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -145,7 +145,7 @@ function fichinter_create($db, $object, $modele='', $outputlangs='') global $conf,$langs; $langs->load("ficheinter"); - $dir = "/core/modules/fichinter/"; + $dir = "/core/modules/fichinter/doc/"; // Positionne modele sur le nom du modele de facture a utiliser if (! dol_strlen($modele)) From a29565f6281819d910029aa52f86735bbdb8499c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Jan 2012 16:38:57 +0100 Subject: [PATCH 2/6] Fix: uniformize code --- .../fichinter/doc/pdf_soleil.modules.php | 475 ++++++++++++------ 1 file changed, 330 insertions(+), 145 deletions(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index e399cde7cc1..64a9563d0f7 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -39,10 +39,11 @@ class pdf_soleil extends ModelePDFFicheinter { /** - * \brief Constructeur - * \param db Handler acces base de donnee + * Constructor + * + * @param DoliDB $DB Database handler */ - function pdf_soleil($db=0) + function pdf_soleil($db) { global $conf,$langs,$mysoc; @@ -78,12 +79,13 @@ class pdf_soleil extends ModelePDFFicheinter } /** - * \brief Fonction generant la fiche d'intervention sur le disque - * \param fichinter Object fichinter - * \param outputlangs Lang output object - * \return int 1=ok, 0=ko + * Function to build pdf onto disk + * + * @param object $object Object to generate + * @param object $outputlangs Lang output object + * @return int 1=ok, 0=ko */ - function write_file($fichinter,$outputlangs) + function write_file($object,$outputlangs) { global $user,$langs,$conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -99,24 +101,12 @@ class pdf_soleil extends ModelePDFFicheinter if ($conf->ficheinter->dir_output) { - // If $fichinter is id instead of object - if (! is_object($fichinter)) - { - $id = $fichinter; - $fichinter = new Fichinter($this->db); - $result=$fichinter->fetch($id); - if ($result < 0) - { - dol_print_error($this->db,$fichinter->error); - } - } + $object->fetch_thirdparty(); - $fichinter->fetch_thirdparty(); - - $fichref = dol_sanitizeFileName($fichinter->ref); + $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->ficheinter->dir_output; - if (! preg_match('/specimen/i',$fichref)) $dir.= "/" . $fichref; - $file = $dir . "/" . $fichref . ".pdf"; + if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; + $file = $dir . "/" . $objectref . ".pdf"; if (! file_exists($dir)) { @@ -141,6 +131,13 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->Open(); $pagenb=0; $pdf->SetDrawColor(128,128,128); + + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); + $pdf->SetSubject($outputlangs->transnoentities("InterventionCard")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("InterventionCard")); + 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); @@ -148,116 +145,27 @@ class pdf_soleil extends ModelePDFFicheinter // New page $pdf->AddPage(); $pagenb++; + $this->_pagehead($pdf, $object, 1, $outputlangs); $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 - // Pagehead - - //Affiche le filigrane brouillon - Print Draft Watermark - if($fichinter->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) - { - pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK); - } - - $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('','B', $default_font_size - 2); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); - } - } - - // Nom emetteur - $posy=40; - $hautcadre=40; - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','', $default_font_size - 2); - - $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); - - // Sender name - $pdf->SetTextColor(0,0,60); - $pdf->SetFont('','B', $default_font_size); - $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - - // Sender properties - $carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); - - $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche+2,$posy+9); - $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); - - $object=$fichinter; - - // 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'); - - // Client destinataire - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','B', $default_font_size); - $fichinter->fetch_thirdparty(); - $pdf->SetXY(102,42); - $pdf->MultiCell(86,4, $carac_client_name, 0, 'L'); - $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY(102,$pdf->GetY()); - $pdf->MultiCell(66,4, $carac_client, 0, 'L'); - $pdf->rect(100, 40, 100, 40); - - - $pdf->SetTextColor(0,0,100); - $pdf->SetFont('','B', $default_font_size + 2); - $pdf->SetXY(10,86); - $pdf->MultiCell(120, 4, $outputlangs->transnoentities("InterventionCard")." : ".$outputlangs->convToOutputCharset($fichinter->ref), 0, 'L'); - - $pdf->SetFillColor(220,220,220); - $pdf->SetTextColor(0,0,0); - $pdf->SetFont('','', $default_font_size); - - $tab_top = 100; + $tab_top_middlepage = 50; $tab_top_newpage = 50; $tab_height = 110; $tab_height_newpage = 150; + $tab_height_middlepage = 200; + $tab_height_endpage = 170; // Affiche notes - if (! empty($fichinter->note_public)) + if (! empty($object->note_public)) { - $tab_top = 98; + $tab_top = 88; $pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page $pdf->SetXY($this->posxdesc-1, $tab_top); - $pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($fichinter->note_public), 0, 'L'); + $pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($object->note_public), 0, 'L'); $nexY = $pdf->GetY(); $height_note=$nexY-$tab_top; @@ -272,7 +180,11 @@ class pdf_soleil extends ModelePDFFicheinter { $height_note=0; } - + + $iniY = $tab_top + 7; + $curY = $tab_top + 7; + $nexY = $tab_top + 7; +/* $pdf->SetXY($this->marge_gauche, $tab_top); $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8 ); @@ -281,10 +193,10 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetXY($this->marge_gauche, $tab_top + 8 ); - $text=$fichinter->description; - if ($fichinter->duree > 0) + $text=$object->description; + if ($object->duree > 0) { - $totaltime=ConvertSecondToTime($fichinter->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); + $totaltime=ConvertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; } $desc=dol_htmlentitiesbr($text,1); @@ -296,37 +208,84 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also. - - //dol_syslog("desc=".dol_htmlentitiesbr($fichinter->description)); - $nblignes = count($fichinter->lines); - - $curY = $pdf->GetY(); - $nexY = $pdf->GetY(); +*/ + $nblines = count($object->lines); // Loop on each lines - for ($i = 0 ; $i < $nblignes ; $i++) + for ($i = 0; $i < $nblines; $i++) { - $fichinterligne = $fichinter->lines[$i]; + $objectligne = $object->lines[$i]; - $valide = $fichinterligne->id ? $fichinterligne->fetch($fichinterligne->id) : 0; - if ($valide>0 || $fichinter->specimen) + $valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0; + if ($valide > 0 || $object->specimen) { - $curY = $nexY+3; + $curY = $nexY; $pdf->SetXY($this->marge_gauche, $curY); - $txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($fichinterligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration),1,$outputlangs->charset_output); + $txt=dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($objectligne->duration),1,$outputlangs->charset_output); $pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY, $txt, 0, 1, 0); $nexY = $pdf->GetY(); $pdf->SetXY($this->marge_gauche, $curY + 3); - $desc = dol_htmlentitiesbr($fichinterligne->desc,1); + $desc = dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY + 3, $desc, 0, 1, 0); - $nexY+=dol_nboflines_bis($fichinterligne->desc,52,$outputlangs->charset_output)*3; + //$nexY+=dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)*3; + + $nexY+=2; // Passe espace entre les lignes + + // Cherche nombre de lignes a venir pour savoir si place suffisante + if ($i < ($nblines - 1) && empty($hidedesc)) // If it's not last line + { + //on recupere la description du produit suivant + $follow_descproduitservice = $objectligne->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)*3); + } + else // If it's last line + { + $nblineFollowDesc = 0; + } + + // Test if a new page is required + if ($pagenb == 1) + { + $tab_top_in_current_page=$tab_top; + $tab_height_in_current_page=$tab_height; + } + else + { + $tab_top_in_current_page=$tab_top_newpage; + $tab_height_in_current_page=$tab_height_middlepage; + } + if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblines - 1)) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs); + } + + $this->_pagefoot($pdf,$object,$outputlangs); + + // New page + $pdf->AddPage(); + $pagenb++; + $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->SetFont('','', $default_font_size - 1); + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0,0,0); + + $nexY = $tab_top_newpage + 7; + } } } //$pdf->line(10, $tab_top+$tab_height+3, 200, $tab_top+$tab_height+3); // Rectangle for title and all lines + /* $pdf->Rect($this->marge_gauche, $tab_top, ($this->page_largeur-$this->marge_gauche-$this->marge_droite), $tab_height+3); $pdf->SetXY($this->marge_gauche, $pdf->GetY() + 20); $pdf->MultiCell(60, 5, '', 0, 'J', 0); @@ -342,10 +301,10 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetXY(110,225); $pdf->MultiCell(80,30, '', 1); - +*/ $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut - $this->_pagefoot($pdf,$fichinter,$outputlangs); + $this->_pagefoot($pdf,$object,$outputlangs); $pdf->AliasNbPages(); $pdf->Close(); @@ -370,13 +329,239 @@ class pdf_soleil extends ModelePDFFicheinter $this->error=$langs->trans("ErrorUnknown"); return 0; // Erreur par defaut } + + /** + * Affiche la grille des lignes d'intervention + * + * @param object $pdf Object PDF + */ + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) + { + global $conf; + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $pdf->SetXY($this->marge_gauche, $tab_top); + $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); + $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8 ); + + $pdf->SetFont('','', $default_font_size - 1); + + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetXY($this->marge_gauche, $tab_top + 8 ); + $text=$object->description; + if ($object->duree > 0) + { + $totaltime=ConvertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); + $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; + } + $desc=dol_htmlentitiesbr($text,1); + //print $outputlangs->convToOutputCharset($desc); exit; + + $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); + $nexY = $pdf->GetY(); + + $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); + + $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also. + + $pdf->Rect($this->marge_gauche, $tab_top, ($this->page_largeur-$this->marge_gauche-$this->marge_droite), $tab_height+3); + $pdf->SetXY($this->marge_gauche, $pdf->GetY() + 20); + $pdf->MultiCell(60, 5, '', 0, 'J', 0); + + $pdf->SetXY(20,220); + $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); + + $pdf->SetXY(20,225); + $pdf->MultiCell(80,30, '', 1); + + $pdf->SetXY(110,220); + $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); + + $pdf->SetXY(110,225); + $pdf->MultiCell(80,30, '', 1); + } + + /** + * Show header of document + * + * @param object $pdf Object PDF + * @param object $object Object fichinter + * @param int $showaddress 0=no, 1=yes + * @param object $outputlangs Object lang for output + */ + function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + { + global $conf,$langs; + $default_font_size = pdf_getPDFFontSize($outputlangs); + + $outputlangs->load("main"); + $outputlangs->load("dict"); + $outputlangs->load("companies"); + $outputlangs->load("interventions"); + + pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); + + //Affiche le filigrane brouillon - Print Draft Watermark + if($object->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) + { + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK); + } + + //Prepare la suite + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('','B', $default_font_size + 3); + + $posx=$this->page_largeur-$this->marge_droite-100; + $posy=$this->marge_haute; + + $pdf->SetXY($this->marge_gauche,$posy); + + // Logo + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + if ($this->emetteur->logo) + { + if (is_readable($logo)) + { + $pdf->Image($logo, $this->marge_gauche, $posy, 0, 24); + } + else + { + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('','B',$default_font_size - 2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + } + } + else + { + $text=$this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + } + + $pdf->SetFont('','B',$default_font_size + 3); + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $title=$outputlangs->transnoentities("InterventionCard"); + $pdf->MultiCell(100, 4, $title, '', 'R'); + + $pdf->SetFont('','B',$default_font_size + 2); + + $posy+=5; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); + + $posy+=1; + $pdf->SetFont('','', $default_font_size); + + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); + + if ($object->client->code_client) + { + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + } + + if ($showaddress) + { + // Sender properties + $carac_emetteur=''; + // Add internal contact of proposal if defined + $arrayidcontact=$object->getIdContact('internal','INTERREPFOLL'); + if (count($arrayidcontact) > 0) + { + $object->fetch_user($arrayidcontact[0]); + $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + } + + $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); + + // Show sender + $posy=42; + $posx=$this->marge_gauche; + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; + $hautcadre=40; + + // Show sender frame + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('','', $default_font_size - 2); + $pdf->SetXY($posx,$posy-5); + $pdf->SetXY($posx,$posy); + $pdf->SetFillColor(230,230,230); + $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); + + // Show sender name + $pdf->SetXY($posx+2,$posy+3); + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('','B',$default_font_size); + $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + + // Show sender information + $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetXY($posx+2,$posy+8); + $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + + + // If CUSTOMER contact defined, we use it + $usecontact=false; + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); + if (count($arrayidcontact) > 0) + { + $usecontact=true; + $result=$object->fetch_contact($arrayidcontact[0]); + } + + // 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 recipient + $posy=42; + $posx=$this->page_largeur-$this->marge_droite-100; + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; + + // Show recipient frame + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('','', $default_font_size - 2); + $pdf->SetXY($posx,$posy-5); + $pdf->rect($posx, $posy, 100, $hautcadre); + $pdf->SetTextColor(0,0,0); + + // Show recipient name + $pdf->SetXY($posx+2,$posy+3); + $pdf->SetFont('','B', $default_font_size); + $pdf->MultiCell(100,4, $carac_client_name, 0, 'L'); + + // Show recipient information + $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetXY($posx+2,$posy+8); + $pdf->MultiCell(100,4, $carac_client, 0, 'L'); + } + } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page + * + * @param object $pdf Object PDF + * @param object $object Object fichinter + * @param object $outputlangs Object lang for output + * \remarks Need this->emetteur object */ function _pagefoot(&$pdf,$object,$outputlangs) { From f352f5cba2f19e141796d06c4fea1447bb5c9e00 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jan 2012 01:40:17 +0800 Subject: [PATCH 3/6] Fix: add current entity if not defined --- htdocs/core/ajax/constantonoff.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index 1231b4ff9eb..277d62191c3 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -45,17 +45,21 @@ top_httphead(); print ''."\n"; // Registering the location of boxes -if((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) +if ((isset($_GET['action']) && ! empty($_GET['action'])) && (isset($_GET['name']) && ! empty($_GET['name'])) ) { + $entity = (GETPOST('entity','int') ? GETPOST('entity','int') : $conf->entity); + $action = GETPOST('action', 'alpha'); + $name = GETPOST('name', 'alpha'); + if ($user->admin) { - if ($_GET['action'] == 'set') + if ($action == 'set') { - dolibarr_set_const($db, GETPOST('name','alpha'), 1, 'chaine', 0, '', GETPOST('entity','int')); + dolibarr_set_const($db, $name, 1, 'chaine', 0, '', $entity); } - else if ($_GET['action'] == 'del') + else if ($action == 'del') { - dolibarr_del_const($db, GETPOST('name','alpha'), GETPOST('entity','int')); + dolibarr_del_const($db, $name, $entity); } } } From d596920898458823d6273699ce58aaa23ce3e501 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 23 Jan 2012 18:43:30 +0100 Subject: [PATCH 4/6] Doxygen --- htdocs/core/modules/action/rapport.pdf.php | 8 +- .../modules/cheque/pdf/pdf_blochet.class.php | 11 +- .../modules/commande/pdf_edison.modules.php | 53 +++---- .../modules/commande/pdf_einstein.modules.php | 65 +++++---- .../doc/pdf_expedition_merou.modules.php | 37 +++-- .../doc/pdf_expedition_rouget.modules.php | 39 +++-- .../modules/facture/doc/pdf_crabe.modules.php | 46 +++--- .../facture/doc/pdf_oursin.modules.php | 63 ++++---- .../fichinter/doc/pdf_soleil.modules.php | 136 +++++++++--------- .../livraison/pdf/pdf_sirocco.modules.php | 34 +++-- .../livraison/pdf/pdf_typhon.modules.php | 41 +++--- .../project/pdf/pdf_baleine.modules.php | 37 +++-- .../modules/propale/doc/pdf_azur.modules.php | 57 ++++---- .../modules/propale/doc/pdf_jaune.modules.php | 57 ++++---- .../modules/rapport/pdf_paiement.class.php | 13 +- .../pdf/pdf_canelle.modules.php | 49 ++++--- .../pdf/pdf_muscadet.modules.php | 50 ++++--- 17 files changed, 451 insertions(+), 345 deletions(-) diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 6420a923f37..8fb95fb1153 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -232,12 +232,12 @@ class CommActionRapport } /** - * Show page head + * Show top header of page. * - * @param PDF &$pdf Object PDF - * @param Translate $outputlangs Object langs + * @param PDF &$pdf Object PDF + * @param Translate $outputlangs Object lang for output * @param int $pagenb Page nb - * @return int Pos y + * @return void */ function _pagehead(&$pdf, $outputlangs, $pagenb) { diff --git a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php index 4672b95dbce..f6c0163b2cb 100644 --- a/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/pdf/pdf_blochet.class.php @@ -333,11 +333,12 @@ class BordereauChequeBlochet extends ModeleChequeReceipts /** - * \brief Show footer of page - * \param pdf Object PDF - * \param object Object cheque receipt - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/commande/pdf_edison.modules.php b/htdocs/core/modules/commande/pdf_edison.modules.php index f3bcde89aff..1d8993ececd 100644 --- a/htdocs/core/modules/commande/pdf_edison.modules.php +++ b/htdocs/core/modules/commande/pdf_edison.modules.php @@ -88,7 +88,7 @@ class pdf_edison extends ModelePDFCommandes /** * Function to build pdf onto disk - * + * * @param int $object Id of object to generate * @param object $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file @@ -182,7 +182,7 @@ class pdf_edison extends ModelePDFCommandes $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY(10, $tab_top + 10 ); + $pdf->SetXY(10, $tab_top + 10); $iniY = $pdf->GetY(); $curY = $pdf->GetY(); @@ -307,12 +307,13 @@ class pdf_edison extends ModelePDFCommandes } /** - * \brief Affiche infos divers - * \param pdf Objet PDF - * \param object Objet commande - * \param posy Position depart - * \param outputlangs Objet langs - * \return y Position pour suite + * Show miscellaneous information (payment mode, payment term, ...) + * + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -441,13 +442,14 @@ class pdf_edison extends ModelePDFCommandes } /** - * Enter description here... + * Show table for lines * - * @param $pdf - * @param $tab_top - * @param $tab_height - * @param $nexY - * @param $outputlangs + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -494,14 +496,15 @@ class pdf_edison extends ModelePDFCommandes /** - * Show header of page + * Show top header of page. * - * @param pdf Objet PDF - * @param object Objet commande - * @param showaddress 0=no, 1=yes - * @param outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs,$mysoc; $langs->load("orders"); @@ -624,12 +627,12 @@ class pdf_edison extends ModelePDFCommandes } /** - * Show footer of page - * Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param pdf PDF factory - * @param object Object invoice - * @param outputlangs Object lang for output + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/commande/pdf_einstein.modules.php b/htdocs/core/modules/commande/pdf_einstein.modules.php index 6a9b444deae..22f56fad988 100644 --- a/htdocs/core/modules/commande/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/pdf_einstein.modules.php @@ -119,7 +119,7 @@ class pdf_einstein extends ModelePDFCommandes /** * Function to build pdf onto disk - * + * * @param int $object Id of object to generate * @param object $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file @@ -433,13 +433,13 @@ class pdf_einstein extends ModelePDFCommandes /** - * Affiche infos divers - * - * @param pdf Object PDF - * @param object Object order - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * Show miscellaneous information (payment mode, payment term, ...) + * + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -567,14 +567,14 @@ class pdf_einstein extends ModelePDFCommandes /** - * Affiche le total a payer - * - * @param pdf Objet PDF - * @param object Objet commande - * @param deja_regle Montant deja regle - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * Show total to pay + * + * @param PDF &$pdf Object PDF + * @param Facture $object Object invoice + * @param int $deja_regle Montant deja regle + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -763,8 +763,14 @@ class pdf_einstein extends ModelePDFCommandes } /** - * \brief Affiche la grille des lignes de commandes - * \param pdf objet PDF + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -822,14 +828,15 @@ class pdf_einstein extends ModelePDFCommandes } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object order - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; @@ -981,12 +988,12 @@ class pdf_einstein extends ModelePDFCommandes } /** - * Show footer of page - * Need this->emetteur object + * Show footer of page. Need this->emetteur object * - * @param pdf PDF factory - * @param object Object invoice - * @param outputlangs Object lang for output + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php index 8e94f6c1c74..713f7004df0 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php @@ -270,9 +270,16 @@ Class pdf_expedition_merou extends ModelePdfExpedition } - //******************************** - // Generation du tableau - //******************************** + /** + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void + */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { global $langs; @@ -300,11 +307,12 @@ Class pdf_expedition_merou extends ModelePdfExpedition } /** - * Show footer of page - * - * @param pdf PDF factory - * @param object Object invoice - * @param outputlangs Object lang for output + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf, $object, $outputlangs) { @@ -327,14 +335,15 @@ Class pdf_expedition_merou extends ModelePdfExpedition /** - * Show header of page + * Show top header of page. * - * @param pdf Object PDF - * @param object Object invoice - * @param showaddress 0=no, 1=yes - * @param outputlang Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf, $langs; diff --git a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php index 43b8a09b10e..8f9c21ed7d2 100644 --- a/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php @@ -39,8 +39,9 @@ Class pdf_expedition_rouget extends ModelePdfExpedition /** - * \brief Constructeur - * \param db Database handler + * Constructor + * + * @param db Database handler */ function pdf_expedition_rouget($db=0) { @@ -260,8 +261,14 @@ Class pdf_expedition_rouget extends ModelePdfExpedition } /** - * Build table - * @param pdf objet PDF + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -292,14 +299,15 @@ Class pdf_expedition_rouget extends ModelePdfExpedition } /** - * Show header of document + * Show top header of page. * - * @param pdf Object PDF - * @param object Object commercial proposal - * @param showaddress 0=no, 1=yes - * @param outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -526,11 +534,12 @@ Class pdf_expedition_rouget extends ModelePdfExpedition } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 3938852a89a..760b175a42f 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -559,13 +559,13 @@ class pdf_crabe extends ModelePDFFactures /** - * Show other information + * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF - * @param Facture $object Object invoice - * @param int $posy Position start - * @param Translate $outputlangs Object langs - * @return int Position pour suite + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -689,7 +689,7 @@ class pdf_crabe extends ModelePDFFactures } } } - + return $posy; } @@ -918,9 +918,14 @@ class pdf_crabe extends ModelePDFFactures } /** - * Show the lines of invoice + * Show table for lines * - * @param PDF $pdf object PDF + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -979,14 +984,15 @@ class pdf_crabe extends ModelePDFFactures } /** - * Show header of page + * Show top header of page. * - * @param pdf Object PDF - * @param object Object invoice - * @param showaddress 0=no, 1=yes - * @param outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; @@ -1231,12 +1237,12 @@ class pdf_crabe extends ModelePDFFactures } /** - * Show footer of page + * Show footer of page. Need this->emetteur object * - * \param pdf PDF factory - * \param object Object invoice - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/facture/doc/pdf_oursin.modules.php b/htdocs/core/modules/facture/doc/pdf_oursin.modules.php index 7e4d8a5260d..26ae580d4d3 100755 --- a/htdocs/core/modules/facture/doc/pdf_oursin.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_oursin.modules.php @@ -442,12 +442,13 @@ class pdf_oursin extends ModelePDFFactures } /** - * \brief Affiche infos divers - * \param pdf Objet PDF - * \param object Objet facture - * \param posy Position depart - * \param outputlangs Objet langs - * \return y Position pour suite + * Show miscellaneous information (payment mode, payment term, ...) + * + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -578,14 +579,14 @@ class pdf_oursin extends ModelePDFFactures /** - * Affiche le total a payer + * Show total to pay * - * @param pdf Objet PDF - * @param object Objet facture - * @param deja_regle Montant deja regle - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * @param PDF &$pdf Object PDF + * @param Facture $object Object invoice + * @param int $deja_regle Montant deja regle + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -726,9 +727,15 @@ class pdf_oursin extends ModelePDFFactures return ($tab2_top + ($tab2_hl * $index)); } - /* - * Affiche la grille des lignes de factures - * @param pdf objet PDF + /** + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $object, $outputlangs) { @@ -777,13 +784,16 @@ class pdf_oursin extends ModelePDFFactures return $pdf->GetY(); } - /* - * Affiche en-tete facture + /** + * Show top header of page. * - * @param pdf objet PDF - * @param fac objet facture + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=0, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf; $langs->load("main"); @@ -1028,11 +1038,12 @@ class pdf_oursin extends ModelePDFFactures } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlang Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf, $object, $outputlangs) { diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 64a9563d0f7..72146ee7f60 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -41,7 +41,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler */ function pdf_soleil($db) { @@ -131,7 +131,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->Open(); $pagenb=0; $pdf->SetDrawColor(128,128,128); - + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); $pdf->SetSubject($outputlangs->transnoentities("InterventionCard")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); @@ -180,7 +180,7 @@ class pdf_soleil extends ModelePDFFicheinter { $height_note=0; } - + $iniY = $tab_top + 7; $curY = $tab_top + 7; $nexY = $tab_top + 7; @@ -230,9 +230,9 @@ class pdf_soleil extends ModelePDFFicheinter $desc = dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 3, $this->marge_gauche, $curY + 3, $desc, 0, 1, 0); //$nexY+=dol_nboflines_bis($objectligne->desc,52,$outputlangs->charset_output)*3; - + $nexY+=2; // Passe espace entre les lignes - + // Cherche nombre de lignes a venir pour savoir si place suffisante if ($i < ($nblines - 1) && empty($hidedesc)) // If it's not last line { @@ -245,7 +245,7 @@ class pdf_soleil extends ModelePDFFicheinter { $nblineFollowDesc = 0; } - + // Test if a new page is required if ($pagenb == 1) { @@ -267,9 +267,9 @@ class pdf_soleil extends ModelePDFFicheinter { $this->_tableau($pdf, $tab_top_newpage, $tab_height_middlepage, $nexY, $outputlangs); } - + $this->_pagefoot($pdf,$object,$outputlangs); - + // New page $pdf->AddPage(); $pagenb++; @@ -277,7 +277,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetFont('','', $default_font_size - 1); $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0,0,0); - + $nexY = $tab_top_newpage + 7; } } @@ -329,25 +329,30 @@ class pdf_soleil extends ModelePDFFicheinter $this->error=$langs->trans("ErrorUnknown"); return 0; // Erreur par defaut } - + /** - * Affiche la grille des lignes d'intervention + * Show table for lines * - * @param object $pdf Object PDF + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); - + $pdf->SetXY($this->marge_gauche, $tab_top); $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8 ); - + $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); + $pdf->SetFont('','', $default_font_size - 1); - + $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetXY($this->marge_gauche, $tab_top + 8 ); + $pdf->SetXY($this->marge_gauche, $tab_top + 8); $text=$object->description; if ($object->duree > 0) { @@ -356,66 +361,67 @@ class pdf_soleil extends ModelePDFFicheinter } $desc=dol_htmlentitiesbr($text,1); //print $outputlangs->convToOutputCharset($desc); exit; - + $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); $nexY = $pdf->GetY(); - + $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); - + $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also. - + $pdf->Rect($this->marge_gauche, $tab_top, ($this->page_largeur-$this->marge_gauche-$this->marge_droite), $tab_height+3); $pdf->SetXY($this->marge_gauche, $pdf->GetY() + 20); $pdf->MultiCell(60, 5, '', 0, 'J', 0); - + $pdf->SetXY(20,220); $pdf->MultiCell(66,5, $outputlangs->transnoentities("NameAndSignatureOfInternalContact"),0,'L',0); - + $pdf->SetXY(20,225); $pdf->MultiCell(80,30, '', 1); - + $pdf->SetXY(110,220); $pdf->MultiCell(80,5, $outputlangs->transnoentities("NameAndSignatureOfExternalContact"),0,'L',0); - + $pdf->SetXY(110,225); $pdf->MultiCell(80,30, '', 1); } - + /** - * Show header of document + * Show top header of page. * - * @param object $pdf Object PDF - * @param object $object Object fichinter - * @param int $showaddress 0=no, 1=yes - * @param object $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; $default_font_size = pdf_getPDFFontSize($outputlangs); - + $outputlangs->load("main"); $outputlangs->load("dict"); $outputlangs->load("companies"); $outputlangs->load("interventions"); - + pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); - + //Affiche le filigrane brouillon - Print Draft Watermark if($object->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) { pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->FICHINTER_DRAFT_WATERMARK); } - + //Prepare la suite $pdf->SetTextColor(0,0,60); $pdf->SetFont('','B', $default_font_size + 3); - + $posx=$this->page_largeur-$this->marge_droite-100; $posy=$this->marge_haute; - + $pdf->SetXY($this->marge_gauche,$posy); - + // Logo $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) @@ -437,28 +443,28 @@ class pdf_soleil extends ModelePDFFicheinter $text=$this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } - + $pdf->SetFont('','B',$default_font_size + 3); $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $title=$outputlangs->transnoentities("InterventionCard"); $pdf->MultiCell(100, 4, $title, '', 'R'); - + $pdf->SetFont('','B',$default_font_size + 2); - + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); - + $posy+=1; $pdf->SetFont('','', $default_font_size); - + $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); - + if ($object->client->code_client) { $posy+=4; @@ -466,7 +472,7 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); } - + if ($showaddress) { // Sender properties @@ -478,15 +484,15 @@ class pdf_soleil extends ModelePDFFicheinter $object->fetch_user($arrayidcontact[0]); $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; } - + $carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur); - + // Show sender $posy=42; $posx=$this->marge_gauche; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; $hautcadre=40; - + // Show sender frame $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); @@ -494,19 +500,19 @@ class pdf_soleil extends ModelePDFFicheinter $pdf->SetXY($posx,$posy); $pdf->SetFillColor(230,230,230); $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); - + // Show sender name $pdf->SetXY($posx+2,$posy+3); $pdf->SetTextColor(0,0,60); $pdf->SetFont('','B',$default_font_size); $pdf->MultiCell(80, 3, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); - + // Show sender information $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($posx+2,$posy+8); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); - - + + // If CUSTOMER contact defined, we use it $usecontact=false; $arrayidcontact=$object->getIdContact('external','CUSTOMER'); @@ -515,7 +521,7 @@ class pdf_soleil extends ModelePDFFicheinter $usecontact=true; $result=$object->fetch_contact($arrayidcontact[0]); } - + // Recipient name if (! empty($usecontact)) { @@ -528,26 +534,26 @@ class pdf_soleil extends ModelePDFFicheinter { $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); } - + $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); - + // Show recipient $posy=42; $posx=$this->page_largeur-$this->marge_droite-100; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->marge_gauche; - + // Show recipient frame $pdf->SetTextColor(0,0,0); $pdf->SetFont('','', $default_font_size - 2); $pdf->SetXY($posx,$posy-5); $pdf->rect($posx, $posy, 100, $hautcadre); $pdf->SetTextColor(0,0,0); - + // Show recipient name $pdf->SetXY($posx+2,$posy+3); $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell(100,4, $carac_client_name, 0, 'L'); - + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($posx+2,$posy+8); @@ -556,12 +562,12 @@ class pdf_soleil extends ModelePDFFicheinter } /** - * Show footer of page - * - * @param object $pdf Object PDF - * @param object $object Object fichinter - * @param object $outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php index 8f0d75ac593..302c83c37d1 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_sirocco.modules.php @@ -294,8 +294,14 @@ class pdf_sirocco extends ModelePDFDeliveryOrder } /** - * \brief Affiche la grille des lignes - * \param pdf objet PDF + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -313,14 +319,15 @@ class pdf_sirocco extends ModelePDFDeliveryOrder } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object delivery - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -444,11 +451,12 @@ class pdf_sirocco extends ModelePDFDeliveryOrder } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php index ce32fa45bf9..46aa78e38f1 100644 --- a/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/pdf/pdf_typhon.modules.php @@ -345,7 +345,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // TODO doit etre modifie //$waitingDelivery = $object->getRemainingDelivered(); $waitingDelivery=''; - + if (is_array($waitingDelivery) & !empty($waitingDelivery)) { $pdf->AddPage('P', 'A4'); @@ -385,7 +385,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf-> SetY(40); - + $num = count($header); for($i = 0; $i < $num; $i++) { @@ -422,9 +422,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder } - /* - * \brief Affiche la grille des lignes - * \param pdf objet PDF + /** + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -468,14 +474,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object order - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -649,12 +656,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder } /** - * Show footer of page - * Need this->emetteur object - * - * @param pdf PDF factory - * @param object Object invoice - * @param outputlangs Object lang for output + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php index d5c163c12c6..0cb6d713362 100644 --- a/htdocs/core/modules/project/pdf/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/pdf/pdf_baleine.modules.php @@ -289,9 +289,15 @@ class pdf_baleine extends ModelePDFProjects } - /* - * \brief Affiche la grille des lignes - * \param pdf objet PDF + /** + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -315,14 +321,15 @@ class pdf_baleine extends ModelePDFProjects } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object project - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; @@ -399,12 +406,12 @@ class pdf_baleine extends ModelePDFProjects } /** - * Show footer of page - * Need this->emetteur object - * - * @param pdf PDF factory - * @param object Object invoice - * @param outputlangs Object lang for output + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 0a13926af35..dd738f59f97 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -427,13 +427,13 @@ class pdf_azur extends ModelePDFPropales /** - * Affiche infos divers + * Show miscellaneous information (payment mode, payment term, ...) * - * @param pdf Objet PDF - * @param object Objet facture - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -581,12 +581,12 @@ class pdf_azur extends ModelePDFPropales /** * Show total to pay * - * @param pdf Objet PDF - * @param object Objet propale - * @param deja_regle Montant deja regle - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * @param PDF &$pdf Object PDF + * @param Facture $object Object invoice + * @param int $deja_regle Montant deja regle + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -792,9 +792,14 @@ class pdf_azur extends ModelePDFPropales } /** - * Affiche la grille des lignes de propales + * Show table for lines * - * @param pdf objet PDF + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -852,14 +857,15 @@ class pdf_azur extends ModelePDFPropales } /** - * Show header of document + * Show top header of page. * - * @param pdf Object PDF - * @param object Object commercial proposal - * @param showaddress 0=no, 1=yes - * @param outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1041,11 +1047,12 @@ class pdf_azur extends ModelePDFPropales } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/propale/doc/pdf_jaune.modules.php b/htdocs/core/modules/propale/doc/pdf_jaune.modules.php index d37eeb8a2b3..a21936d62cf 100644 --- a/htdocs/core/modules/propale/doc/pdf_jaune.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_jaune.modules.php @@ -427,13 +427,13 @@ class pdf_jaune extends ModelePDFPropales /** - * Affiche infos divers + * Show miscellaneous information (payment mode, payment term, ...) * - * @param pdf Objet PDF - * @param object Objet facture - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -581,12 +581,12 @@ class pdf_jaune extends ModelePDFPropales /** * Show total to pay * - * @param pdf Objet PDF - * @param object Objet propale - * @param deja_regle Montant deja regle - * @param posy Position depart - * @param outputlangs Objet langs - * @return y Position pour suite + * @param PDF &$pdf Object PDF + * @param Facture $object Object invoice + * @param int $deja_regle Montant deja regle + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -792,9 +792,14 @@ class pdf_jaune extends ModelePDFPropales } /** - * Affiche la grille des lignes de propales + * Show table for lines * - * @param pdf objet PDF + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -852,14 +857,15 @@ class pdf_jaune extends ModelePDFPropales } /** - * Show header of document + * Show top header of page. * - * @param pdf Object PDF - * @param object Object commercial proposal - * @param showaddress 0=no, 1=yes - * @param outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1041,11 +1047,12 @@ class pdf_jaune extends ModelePDFPropales } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlangs Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf,$object,$outputlangs) { diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 238655ab18c..ff1522267de 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -205,14 +205,15 @@ class pdf_paiement } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $page, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $page, $showaddress, $outputlangs) { global $langs; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index dd039c62ccc..62f182c6ab8 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -357,7 +357,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $amount_credit_notes_included=0; $amount_deposits_included=0; - + if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); @@ -391,11 +391,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } /** - * \brief Show total to pay - * \param pdf Object PDF - * \param object Object invoice - * \param deja_regle Amount payed - * \return y Next position + * Show total to pay + * + * @param PDF &$pdf Object PDF + * @param Facture $object Object invoice + * @param int $deja_regle Montant deja regle + * @param int $posy Position depart + * @param Translate $outputlangs Objet langs + * @return int Position pour suite */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -579,8 +582,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } /** - * Show the lines of invoice - * @param pdf object PDF + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -718,14 +727,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object order - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; @@ -871,11 +881,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } /** - * \brief Show footer of page - * \param pdf PDF factory - * \param object Object invoice - * \param outputlang Object lang for output - * \remarks Need this->emetteur object + * Show footer of page. Need this->emetteur object + * + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf, $object, $outputlangs) { diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index fcf2d243037..2b6bc096644 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010 Juanjo Menent @@ -427,13 +427,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders /** - * Show other information + * Show miscellaneous information (payment mode, payment term, ...) * - * @param PDF &$pdf Object PDF - * @param Facture $object Object invoice - * @param int $posy Position start - * @param Translate $outputlangs Object langs - * @return int Position pour suite + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $posy Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau_info(&$pdf, $object, $posy, $outputlangs) { @@ -571,7 +571,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param int $deja_regle Montant deja regle * @param int $posy Position depart * @param Translate $outputlangs Objet langs - * @return int Position pour suite + * @return int Position pour suite */ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { @@ -761,9 +761,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } /** - * Show the lines of order - - * @param PDF $pdf object PDF + * Show table for lines + * + * @param PDF &$pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y + * @param Translate $outputlangs Langs object + * @return void */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { @@ -822,14 +827,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } /** - * Show header of page + * Show top header of page. * - * @param $pdf Object PDF - * @param $object Object order - * @param $showaddress 0=no, 1=yes - * @param $outputlangs Object lang for output + * @param PDF &$pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @return void */ - function _pagehead(&$pdf, $object, $showaddress=1, $outputlangs) + function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $langs,$conf,$mysoc; @@ -984,12 +990,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } /** - * Show footer of page + * Show footer of page. Need this->emetteur object * - * \param pdf PDF factory - * \param object Object invoice - * \param outputlang Object lang for output - * \remarks Need this->emetteur object + * @param PDF &$pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @return void */ function _pagefoot(&$pdf, $object, $outputlangs) { From 7e5c347bb85666d22f50a19056c8013a6cf85bd2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jan 2012 05:23:00 +0800 Subject: [PATCH 5/6] Fix: correct reorder childrens of lines --- htdocs/core/ajax/row.php | 18 ++----- htdocs/core/class/commonobject.class.php | 60 +++++++++++++++++++++--- htdocs/core/tpl/ajaxrow.tpl.php | 42 ++++++++--------- 3 files changed, 79 insertions(+), 41 deletions(-) diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 882a28f9c42..c7761cdfd27 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,11 +35,6 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php"); * View */ -// Ajout directives pour resoudre bug IE -//header('Cache-Control: Public, must-revalidate'); -//header('Pragma: public'); - -//top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header. top_httphead(); print ''."\n"; @@ -52,21 +47,16 @@ if((isset($_GET['roworder']) && !empty($_GET['roworder'])) && (isset($_GET['tabl foreach($roworder as $value) { - if (!empty($value)) - { - $newroworder[] = $value; - } + if (! empty($value)) $newroworder[] = $value; } - $roworder = implode(',',$newroworder); - - dol_syslog("AjaxRow roworder=".$_GET['roworder']." neworder=".$roworder." element=".$_GET['element'], LOG_DEBUG); + dol_syslog("AjaxRow roworder=".$_GET['roworder']." fk_element=".$_GET['fk_element'], LOG_DEBUG); $row=new GenericObject($db); $row->table_element_line = $_GET['table_element_line']; $row->fk_element = $_GET['fk_element']; $row->id = $_GET['element_id']; - $result=$row->line_ajaxorder($roworder); + $result=$row->line_ajaxorder($newroworder); $result=$row->line_order(true); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 076cd861ddb..9549eaf371d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -890,25 +890,75 @@ abstract class CommonObject } if ($nl > 0) { + $rows=array(); + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; + $sql.= ' AND fk_parent_line IS NULL'; $sql.= ' ORDER BY rang ASC, rowid '.$rowidorder; dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { + $i=0; $num = $this->db->num_rows($resql); - $i = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); - $this->updateRangOfLine($row[0], ($i+1)); + $rows[] = $row[0]; + $childrens = $this->getChildrensOfLine($row[0]); + if (! empty($childrens)) + { + foreach($childrens as $child) + { + array_push($rows, $child); + } + } $i++; } + + if (! empty($rows)) + { + foreach($rows as $key => $row) + { + $this->updateRangOfLine($row, ($key+1)); + } + } } } } + + /** + * Get childrens of line + * + * @param int $id Id of parent line + */ + function getChildrensOfLine($id) + { + $rows=array(); + + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; + $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; + $sql.= ' AND fk_parent_line = '.$id; + $sql.= ' ORDER BY rang ASC'; + + dol_syslog(get_class($this)."::getChildrenOfLines sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) + { + $i=0; + $num = $this->db->num_rows($resql); + while ($i < $num) + { + $row = $this->db->fetch_row($resql); + $rows[$i] = $row[0]; + $i++; + } + } + + return $rows; + } /** * Update a line to have a lower rank @@ -966,13 +1016,11 @@ abstract class CommonObject /** * Update position of line with ajax (rang) * - * @param int $roworder + * @param array $rows Array of rows */ - function line_ajaxorder($roworder) + function line_ajaxorder($rows) { - $rows = explode(',',$roworder); $num = count($rows); - for ($i = 0 ; $i < $num ; $i++) { $this->updateRangOfLine($rows[$i], ($i+1)); diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index ca7dee493b2..59dc7b8ed78 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2010-2011 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -21,22 +21,22 @@ lines) > 1 && $_GET['action'] != 'editline') { ?> From 114a1793a53954ce262425f532fc09f76bd4cada Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 24 Jan 2012 07:05:06 +0100 Subject: [PATCH 6/6] Fix: phpunit error --- test/phpunit/BuildDocTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php index e2b23ef9cde..bd2a80350a8 100644 --- a/test/phpunit/BuildDocTest.php +++ b/test/phpunit/BuildDocTest.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +43,7 @@ require_once dirname(__FILE__).'/../../htdocs/core/modules/propale/doc/pdf_jaune require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/pdf_edison.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/commande/pdf_einstein.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/project/pdf/pdf_baleine.modules.php'; -require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/pdf_soleil.modules.php'; +require_once dirname(__FILE__).'/../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php'; require_once dirname(__FILE__).'/../../htdocs/core/modules/expedition/doc/pdf_expedition_rouget.modules.php'; // Mother classes of pdf generators