Fix: uniformize code

This commit is contained in:
Regis Houssin 2010-12-15 07:38:17 +00:00
parent 502bb75d2c
commit acf3996547
5 changed files with 18 additions and 24 deletions

View File

@ -238,7 +238,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
if ($element == 'contract') { $element = $subelement = 'contrat'; } if ($element == 'contract') { $element = $subelement = 'contrat'; }
if ($element == 'order_supplier') { $element = 'fourn'; $subelement = 'fournisseur.commande'; } if ($element == 'order_supplier') { $element = 'fourn'; $subelement = 'fournisseur.commande'; }
$facfou->origin = $_POST['origin']; $facfou->origin = $_POST['origin'];
$facfou->origin_id = $_POST['originid']; $facfou->origin_id = $_POST['originid'];
$facid = $facfou->create($user); $facid = $facfou->create($user);
@ -254,10 +254,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
$result=$srcobject->fetch($_POST['originid']); $result=$srcobject->fetch($_POST['originid']);
if ($result > 0) if ($result > 0)
{ {
// TODO mutualiser $lines = $srcobject->lines;
$lines = $srcobject->lignes;
if (sizeof($srcobject->lines)) $lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lignes')) $lines = $srcobject->fetch_lignes();
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
for ($i = 0 ; $i < sizeof($lines) ; $i++) for ($i = 0 ; $i < sizeof($lines) ; $i++)

View File

@ -98,7 +98,7 @@ class box_contracts extends ModeleBoxes {
$contractstatic->statut=$objp->fk_statut; $contractstatic->statut=$objp->fk_statut;
$contractstatic->id=$objp->rowid; $contractstatic->id=$objp->rowid;
$result=$contractstatic->fetch_lignes(); $result=$contractstatic->fetch_lines();
// fin_validite is no more on contract but on services // fin_validite is no more on contract but on services
// if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); }

View File

@ -149,11 +149,11 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
$lignes=$this->line_per_page; // There is no line in such PDF. $lines=$this->line_per_page; // There is no line in such PDF.
$pages = intval($lignes / $this->line_per_page); $pages = intval($lines / $this->line_per_page);
if (($lignes % $this->line_per_page)>0) if (($lines % $this->line_per_page)>0)
{ {
$pages++; $pages++;
} }
@ -333,38 +333,38 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$page_hauteur=$this->page_hauteur; $page_hauteur=$this->page_hauteur;
// Line of free text // Line of free text
$ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):""; $line=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
$pdf->SetFont('','',7); $pdf->SetFont('','',7);
$pdf->SetDrawColor(224,224,224); $pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$nbofligne=dol_nboflines_bis($ligne,0,$outputlangs->charset_output); $nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output);
//print 'e'.$ligne.'t'.dol_nboflines($ligne);exit; //print 'e'.$line.'t'.dol_nboflines($line);exit;
$posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0); $posy=$marge_basse + ($nbofline*3) + ($line1?3:0) + ($line2?3:0);
if ($ligne) // Free text if ($line) // Free text
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(20000, 3, $ligne, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. $pdf->MultiCell(20000, 3, $line, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
$posy-=($nbofligne*3); // 6 of ligne + 3 of MultiCell $posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell
} }
$pdf->SetY(-$posy); $pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy); $pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--; $posy--;
if ($ligne1) if ($line1)
{ {
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); $pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
} }
if ($ligne2) if ($line2)
{ {
$posy-=3; $posy-=3;
$pdf->SetXY($marge_gauche,-$posy); $pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); $pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
} }
$pdf->SetXY(-20,-$posy); $pdf->SetXY(-20,-$posy);

View File

@ -78,7 +78,6 @@ Class pdf_expedition_merou extends ModelePdfExpedition
global $user,$conf,$langs,$mysoc; global $user,$conf,$langs,$mysoc;
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if (empty($object->lines)) $object->lines=$object->lignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
@ -353,7 +352,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$tab4_top = 60; $tab4_top = 60;
$tab4_hl = 6; $tab4_hl = 6;
$tab4_sl = 4; $tab4_sl = 4;
$ligne = 2; $line = 2;
//*********************LOGO**************************** //*********************LOGO****************************
$pdf->SetXY(11,7); $pdf->SetXY(11,7);

View File

@ -220,8 +220,6 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if (empty($object->lines)) $object->lines=$object->lignes;
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1'; if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';