Skip to content

Commit

Permalink
Debug BOM/MO
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 5, 2019
1 parent 204475e commit 84a8d4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
18 changes: 7 additions & 11 deletions htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
Expand Up @@ -188,7 +188,7 @@ public function info($langs)
/**
* Function to build a document on disk using the generic odt module.
*
* @param Commande $object Object source to build document
* @param BOM $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
Expand Down Expand Up @@ -222,13 +222,13 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails

$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));

if ($conf->commande->dir_output)
if ($conf->bom->dir_output)
{
// If $object is id instead of object
if (! is_object($object))
{
$id = $object;
$object = new Commande($this->db);
$object = new Bom($this->db);
$result=$object->fetch($id);
if ($result < 0)
{
Expand All @@ -237,7 +237,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails
}
}

$dir = $conf->commande->multidir_output[$object->entity];
$dir = $conf->bom->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
Expand Down Expand Up @@ -309,11 +309,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails

// Make substitution
$substitutionarray=array(
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
'__QTY_TO_PRODUCE__' => $object->qty,
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
Expand All @@ -322,7 +318,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails

// Line of free text
$newfreetext='';
$paramfreetext='ORDER_FREE_TEXT';
$paramfreetext='BOM_FREE_TEXT';
if (! empty($conf->global->$paramfreetext))
{
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
Expand All @@ -334,7 +330,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails
$odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->commande->dir_temp,
'PATH_TO_TMP' => $conf->bom->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
Expand Down
20 changes: 8 additions & 12 deletions htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
Expand Up @@ -86,7 +86,7 @@ public function __construct($db)
$this->marge_basse=0;

$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION
$this->option_tva = 0; // Gere option tva
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
Expand Down Expand Up @@ -195,7 +195,7 @@ public function info($langs)
/**
* Function to build a document on disk using the generic odt module.
*
* @param Commande $object Object source to build document
* @param MO $object Object source to build document
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
Expand Down Expand Up @@ -229,13 +229,13 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails

$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));

if ($conf->commande->dir_output)
if ($conf->mrp->dir_output)
{
// If $object is id instead of object
if (! is_object($object))
{
$id = $object;
$object = new Commande($this->db);
$object = new MO($this->db);
$result=$object->fetch($id);
if ($result < 0)
{
Expand All @@ -244,7 +244,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails
}
}

$dir = $conf->commande->multidir_output[$object->entity];
$dir = $conf->mrp->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref);
if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref;
$file = $dir . "/" . $objectref . ".odt";
Expand Down Expand Up @@ -316,11 +316,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails

// Make substitution
$substitutionarray=array(
'__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat
'__QTY_TO_PRODUCE__' => $object->qty,
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
Expand All @@ -329,7 +325,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails

// Line of free text
$newfreetext='';
$paramfreetext='ORDER_FREE_TEXT';
$paramfreetext='MRP_MO_FREE_TEXT';
if (! empty($conf->global->$paramfreetext))
{
$newfreetext=make_substitutions($conf->global->$paramfreetext, $substitutionarray);
Expand All @@ -341,7 +337,7 @@ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails
$odfHandler = new odf(
$srctemplatepath,
array(
'PATH_TO_TMP' => $conf->commande->dir_temp,
'PATH_TO_TMP' => $conf->mrp->dir_temp,
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
'DELIMITER_LEFT' => '{',
'DELIMITER_RIGHT' => '}'
Expand Down

0 comments on commit 84a8d4e

Please sign in to comment.