Skip to content

Commit

Permalink
Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.…
Browse files Browse the repository at this point in the history
…git into develop
  • Loading branch information
hregis committed Sep 13, 2012
2 parents f902fed + 46ee00f commit 968380b
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 93 deletions.
8 changes: 3 additions & 5 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -357,7 +357,6 @@ function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img
$tag='td';
if ($notabs == 2) $tag='div';
if ($notabs == 3) $tag='span';

// Sanitize tooltip
$htmltext=str_replace("\\","\\\\",$htmltext);
$htmltext=str_replace("\r","",$htmltext);
Expand All @@ -368,12 +367,11 @@ function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img
else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
if ($tooltipon == 1 || $tooltipon == 3) $paramfortooltiptd=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip
else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag

$s="";
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.'&nbsp;</'.$tag.'>';
if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">&nbsp;'.$img.'</'.$tag.'>';
if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.'</'.$tag.'>';
if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.(($direction < 0)?'&nbsp;':'').$text.(($direction > 0)?'&nbsp;':'').'</'.$tag.'>';
if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.'</'.$tag.'>';
if (empty($notabs)) $s.='</tr></table>';

return $s;
Expand Down
190 changes: 112 additions & 78 deletions htdocs/core/modules/expedition/doc/pdf_expedition_merou.modules.php
Expand Up @@ -49,7 +49,6 @@ function __construct($db=0)

$this->db = $db;
$this->name = "merou";
//$this->description = "Modele Merou A5";
$this->description = $langs->trans("DocumentModelMerou");

$this->type = 'pdf';
Expand All @@ -62,7 +61,7 @@ function __construct($db=0)
$this->marge_haute=10;
$this->marge_basse=10;

$this->option_logo = 1; // Affiche logo
$this->option_logo = 1;

// Recupere emmetteur
$this->emetteur=$mysoc;
Expand Down Expand Up @@ -94,13 +93,9 @@ function write_file(&$object, $outputlangs)
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("propal");
$outputlangs->load("sendings");
$outputlangs->load("deliveries");
$outputlangs->load("sendings");

//Generation de la fiche
$this->expe = $object;

//Verification de la configuration
if ($conf->expedition->dir_output)
{
$object->fetch_thirdparty();
Expand All @@ -120,7 +115,6 @@ function write_file(&$object, $outputlangs)
$this->livreur = new User($this->db);
if ($idcontact[0]) $this->livreur->fetch($idcontact[0]);


// Definition de $dir et $file
if ($object->specimen)
{
Expand All @@ -138,17 +132,17 @@ function write_file(&$object, $outputlangs)
{
if (dol_mkdir($dir) < 0)
{
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}

//Si le dossier existe
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format,'mm','l');
$heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
$heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
$nblignes = count($object->lines);

$pdf=pdf_getInstance($this->format,'mm','l');
$heightforfooter = 28; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);

if (class_exists('TCPDF'))
Expand All @@ -168,7 +162,8 @@ function write_file(&$object, $outputlangs)
$pagenb=0;
$pdf->SetDrawColor(128,128,128);

//Generation de l entete du fichier
$pdf->AliasNbPages();

$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
Expand All @@ -178,80 +173,116 @@ function write_file(&$object, $outputlangs)

$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right

$pdf->SetFont('','', $default_font_size - 3);

// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->expe, 1, $outputlangs);
$this->_pagehead($pdf, $object, 1, $outputlangs, $hookmanager);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);

//Initialisation des coordonnees
$tab_top = 53;
$tab_height = $this->page_hauteur - 78;
$tab_top = 52;
$tab_top_newpage = 10;
$tab_height = $this->page_hauteur - $tab_top - $heightforfooter;
$tab_height_newpage = $this->page_hauteur - $tab_top_newpage - $heightforfooter;

$pdf->SetFillColor(240,240,240);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(10, $tab_top + 5);
$iniY = $pdf->GetY();
$curY = $pdf->GetY();
$nexY = $pdf->GetY();
//Generation du tableau
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);

$nblignes = count($object->lines);

$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;

for ($i = 0 ; $i < $nblignes ; $i++)
$num=count($object->lines);
for ($i = 0; $i < $num; $i++)
{
// Description de la ligne produit
$curY = $nexY;

//Creation des cases a cocher
$pdf->Rect(10+3, $curY+1, 3, 3);
$pdf->Rect(20+3, $curY+1, 3, 3);
//Insertion de la reference du produit
$pdf->SetXY(30, $curY+1);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0);
//Insertion du libelle
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(50, $curY+1);
//$libelleproduitservice=pdf_getlinedesc($object->$origin,$i,$outputlangs);
$libelleproduitservice = pdf_writelinedesc($pdf,$object->$origin,$i,$outputlangs,90,3,50,$curY+1,1);
//$pdf->writeHTMLCell(90, 3, 50, $curY+1, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'L', 0);
//Insertion de la quantite commandee

$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();

// Description de la ligne produit
$libelleproduitservice = pdf_writelinedesc($pdf,$object,$i,$outputlangs,90,3,50,$curY,0,1);

$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.

// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore) {
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
}

$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(140, $curY+1);

//Creation des cases a cocher
$pdf->Rect(10+3, $curY, 3, 3);
$pdf->Rect(20+3, $curY, 3, 3);
//Insertion de la reference du produit
$pdf->SetXY(30, $curY);
$pdf->SetFont('','B', $default_font_size - 3);
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($object->lines[$i]->ref), 0, 'L', 0);

$pdf->SetXY(140, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_asked, 0, 'C', 0);
//Insertion de la quantite a envoyer
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY(170, $curY+1);

$pdf->SetXY(170, $curY);
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'C', 0);

//Generation de la page 2
$curY += (dol_nboflines_bis($libelleproduitservice,0,$outputlangs->charset_output)*3+1);
$nexY = $curY;
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1)
$nexY+=2; // Passe espace entre les lignes

// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();

$curY = $iniY;

$pdf->setPage($pagenb);
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
}
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
{
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1);
}
else
{
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1);
}
$this->_pagefoot($pdf,$object,$outputlangs);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->expe, 0, $outputlangs);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 3);
}
}
//Insertion du pied de page
$this->_pagefoot($pdf, $object, $outputlangs);

// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
}

// Pied de page
$this->_pagefoot($pdf, $object, $outputlangs);
$pdf->AliasNbPages();

$pdf->Close();
Expand Down Expand Up @@ -298,21 +329,24 @@ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0,
$langs->load("main");
$langs->load("bills");

$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY(10,$tab_top);
$pdf->MultiCell(10,5,"LS",0,'C',1);
$pdf->line(20, $tab_top, 20, $tab_top + $tab_height);
$pdf->SetXY(20,$tab_top);
$pdf->MultiCell(10,5,"LR",0,'C',1);
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
$pdf->SetXY(30,$tab_top);
$pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1);
$pdf->SetXY(50,$tab_top);
$pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
$pdf->SetXY(140,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1);
$pdf->SetXY(170,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1);
if (empty($hidetop))
{
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY(10,$tab_top);
$pdf->MultiCell(10,5,"LS",0,'C',1);
$pdf->line(20, $tab_top, 20, $tab_top + $tab_height);
$pdf->SetXY(20,$tab_top);
$pdf->MultiCell(10,5,"LR",0,'C',1);
$pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
$pdf->SetXY(30,$tab_top);
$pdf->MultiCell(20,5,$outputlangs->transnoentities("Ref"),0,'C',1);
$pdf->SetXY(50,$tab_top);
$pdf->MultiCell(90,5,$outputlangs->transnoentities("Description"),0,'L',1);
$pdf->SetXY(140,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyOrdered"),0,'C',1);
$pdf->SetXY(170,$tab_top);
$pdf->MultiCell(30,5,$outputlangs->transnoentities("QtyToShip"),0,'C',1);
}
$pdf->Rect(10, $tab_top, 190, $tab_height);
}

Expand Down
Expand Up @@ -128,7 +128,7 @@ function write_file(&$object, $outputlangs)
$nblignes = count($object->lines);

$pdf=pdf_getInstance($this->format);
$heightforinfotot = 80; // Height reserved to output the info and total part (value include bottom margin)
$heightforinfotot = 0; // Height reserved to output the info and total part (value include bottom margin)
$heightforfooter = 25; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0);

Expand All @@ -155,7 +155,7 @@ function write_file(&$object, $outputlangs)
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($fac->ref)." ".$outputlangs->transnoentities("Sending"));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);

$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
Expand All @@ -170,8 +170,8 @@ function write_file(&$object, $outputlangs)
$pdf->SetTextColor(0,0,0);

$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
$tab_top_newpage = 10;
$tab_height = 130;
$tab_height_newpage = 150;

if (! empty($object->note_public) || ! empty($object->tracking_number))
Expand Down Expand Up @@ -293,13 +293,13 @@ function write_file(&$object, $outputlangs)
// Show square
if ($pagenb == 1)
{
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforinfotot, 0, $outputlangs, 0, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforinfotot + 1;
}
else
{
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforinfotot + 1;
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforinfotot, 0, $outputlangs, 1, 0);
$bottomlasttab=$this->page_hauteur - $heightforfooter - $heightforinfotot + 1;
}

// Pied de page
Expand Down
4 changes: 2 additions & 2 deletions htdocs/expedition/fiche.php
Expand Up @@ -780,7 +780,7 @@
$quantityToBeDelivered = $quantityAsked - $quantityDelivered;

$defaultqty=0;
if (GETPOST('entrepot_id','int'))
if (GETPOST('entrepot_id','int') > 0)
{
//var_dump($product);
$stock = $product->stock_warehouse[GETPOST('entrepot_id','int')]->real;
Expand Down Expand Up @@ -810,7 +810,7 @@
$idl = "idl".$indiceAsked;
$tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product);
if ($tmpentrepot_id && $tmpentrepot_id == GETPOST('entrepot_id','int'))
if ($tmpentrepot_id > 0 && $tmpentrepot_id == GETPOST('entrepot_id','int'))
{
//print $stock.' '.$quantityToBeDelivered;
if ($stock < $quantityToBeDelivered)
Expand Down

0 comments on commit 968380b

Please sign in to comment.