Add & Update pdf_stdmouvement.modules.php
Fix Bug Generate pdf
This commit is contained in:
parent
837821ebb6
commit
2ba7bb9d4e
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/core/modules/stock/doc/pdf_standard.modules.php
|
* \file htdocs/core/modules/stock/doc/pdf_stdmouvement.modules.php
|
||||||
* \ingroup societe
|
* \ingroup societe
|
||||||
* \brief File of class to build PDF documents for stocks/services
|
* \brief File of class to build PDF documents for stocks movements
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_stock.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/stock/modules_movement.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
|||||||
/**
|
/**
|
||||||
* Class to build documents using ODF templates generator
|
* Class to build documents using ODF templates generator
|
||||||
*/
|
*/
|
||||||
class pdf_stdmouvement extends ModelePDFMouvement
|
class pdf_stdmouvement extends ModelePDFMovement
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var DoliDb Database handler
|
* @var DoliDb Database handler
|
||||||
@ -59,9 +59,9 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array() Minimum version of PHP required by module.
|
* @var array() Minimum version of PHP required by module.
|
||||||
* e.g.: PHP ≥ 5.3 = array(5, 3)
|
* e.g.: PHP ≥ 5.4 = array(5, 4)
|
||||||
*/
|
*/
|
||||||
public $phpmin = array(5, 2);
|
public $phpmin = array(5, 4);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dolibarr version of the loaded document
|
* Dolibarr version of the loaded document
|
||||||
@ -69,15 +69,46 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
*/
|
*/
|
||||||
public $version = 'dolibarr';
|
public $version = 'dolibarr';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int page_largeur
|
||||||
|
*/
|
||||||
public $page_largeur;
|
public $page_largeur;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int page_hauteur
|
||||||
|
*/
|
||||||
public $page_hauteur;
|
public $page_hauteur;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array format
|
||||||
|
*/
|
||||||
public $format;
|
public $format;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_gauche
|
||||||
|
*/
|
||||||
public $marge_gauche;
|
public $marge_gauche;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_droite
|
||||||
|
*/
|
||||||
public $marge_droite;
|
public $marge_droite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_haute
|
||||||
|
*/
|
||||||
public $marge_haute;
|
public $marge_haute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int marge_basse
|
||||||
|
*/
|
||||||
public $marge_basse;
|
public $marge_basse;
|
||||||
|
|
||||||
public $emetteur; // Objet societe qui emet
|
/**
|
||||||
|
* Issuer
|
||||||
|
* @var Societe
|
||||||
|
*/
|
||||||
|
public $emetteur;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,8 +120,8 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
{
|
{
|
||||||
global $conf,$langs,$mysoc;
|
global $conf,$langs,$mysoc;
|
||||||
|
|
||||||
$langs->load("main");
|
// Load traductions files requiredby by page
|
||||||
$langs->load("companies");
|
$langs->loadLangs(array("main", "companies"));
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->name = "stdmouvement";
|
$this->name = "stdmouvement";
|
||||||
@ -119,7 +150,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
// Define position of columns
|
// Define position of columns
|
||||||
$this->wref = 15;
|
$this->wref = 15;
|
||||||
$this->posxidref = $this->marge_gauche;
|
$this->posxidref = $this->marge_gauche;
|
||||||
$this->posxdatemouv = $this->marge_gauche+8;;
|
$this->posxdatemouv = $this->marge_gauche+8;
|
||||||
$this->posxdesc=37;
|
$this->posxdesc=37;
|
||||||
$this->posxlabel=50;
|
$this->posxlabel=50;
|
||||||
$this->posxtva=80;
|
$this->posxtva=80;
|
||||||
@ -149,6 +180,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Function to build a document on disk using the generic odt module.
|
* Function to build a document on disk using the generic odt module.
|
||||||
*
|
*
|
||||||
@ -162,19 +194,15 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
*/
|
*/
|
||||||
function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
|
||||||
{
|
{
|
||||||
|
// phpcs:enable
|
||||||
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
|
||||||
|
|
||||||
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 (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||||
|
|
||||||
$outputlangs->load("main");
|
// Load traductions files requiredby by page
|
||||||
$outputlangs->load("dict");
|
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "stocks", "orders", "deliveries"));
|
||||||
$outputlangs->load("companies");
|
|
||||||
$outputlangs->load("bills");
|
|
||||||
$outputlangs->load("stocks");
|
|
||||||
$outputlangs->load("orders");
|
|
||||||
$outputlangs->load("deliveries");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: get from object
|
* TODO: get from object
|
||||||
@ -219,7 +247,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label('movement');
|
$extralabels = $extrafields->fetch_name_optionals_label('movement');
|
||||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
$search_array_options=$extrafields->getOptionalsFromPost('movement','','search_');
|
||||||
|
|
||||||
$productlot=new ProductLot($db);
|
$productlot=new ProductLot($db);
|
||||||
$productstatic=new Product($db);
|
$productstatic=new Product($db);
|
||||||
@ -344,7 +372,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
// Definition of $dir and $file
|
// Definition of $dir and $file
|
||||||
if ($object->specimen)
|
if ($object->specimen)
|
||||||
{
|
{
|
||||||
$dir = $conf->stock->dir_output . "/mouvement";
|
$dir = $conf->stock->dir_output . "/movement";
|
||||||
$file = $dir . "/SPECIMEN.pdf";
|
$file = $dir . "/SPECIMEN.pdf";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -352,7 +380,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
|
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
|
||||||
if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
|
if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
|
||||||
$dir = $conf->stock->dir_output . "/mouvement/" . $objectref;
|
$dir = $conf->stock->dir_output . "/movement/" . $objectref;
|
||||||
$file = $dir . "/" . $objectref . ".pdf";
|
$file = $dir . "/" . $objectref . ".pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,6 +474,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
|
|
||||||
$totalunit=0;
|
$totalunit=0;
|
||||||
$totalvalue=$totalvaluesell=0;
|
$totalvalue=$totalvaluesell=0;
|
||||||
|
$arrayofuniqueproduct = array();
|
||||||
|
|
||||||
//dol_syslog('List products', LOG_DEBUG);
|
//dol_syslog('List products', LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
@ -684,7 +713,6 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
// Total Qty
|
// Total Qty
|
||||||
$pdf->SetXY($this->postotalht, $curY);
|
$pdf->SetXY($this->postotalht, $curY);
|
||||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $totalunit, 0, 'R', 0);
|
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $totalunit, 0, 'R', 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -904,7 +932,6 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
$pdf->SetLineStyle(array('dash'=>'0','color'=>array(220,26,26)));
|
||||||
$pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11);
|
$pdf->line($this->marge_gauche, $tab_top+11, $this->page_largeur-$this->marge_droite, $tab_top+11);
|
||||||
$pdf->SetLineStyle(array('dash'=>0));
|
$pdf->SetLineStyle(array('dash'=>0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -921,12 +948,9 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
{
|
{
|
||||||
global $conf,$langs,$db,$hookmanager;
|
global $conf,$langs,$db,$hookmanager;
|
||||||
|
|
||||||
$outputlangs->load("main");
|
// Load traductions files requiredby by page
|
||||||
$outputlangs->load("bills");
|
$outputlangs->loadLangs(array("main", "propal", "companies", "bills", "orders", "stocks"));
|
||||||
$outputlangs->load("propal");
|
|
||||||
$outputlangs->load("companies");
|
|
||||||
$outputlangs->load("orders");
|
|
||||||
$outputlangs->load("stocks");
|
|
||||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||||
|
|
||||||
if ($object->type == 1) $titlekey='ServiceSheet';
|
if ($object->type == 1) $titlekey='ServiceSheet';
|
||||||
@ -1154,6 +1178,4 @@ class pdf_stdmouvement extends ModelePDFMouvement
|
|||||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||||
return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user