FIX ODT generation of BOM document
This commit is contained in:
parent
34199cf0fb
commit
c9eda09964
@ -91,7 +91,7 @@ if ($action == 'updateMask') {
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf");
|
||||
return;
|
||||
} else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
setEventMessages($module->error, $module->errors, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
@ -174,7 +174,7 @@ $head = bomAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans("BOMs"), -1, 'bom');
|
||||
|
||||
/*
|
||||
* BOMs Numbering model
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("BOMsNumberingModules"), '', '');
|
||||
@ -200,10 +200,11 @@ foreach ($dirmodels as $reldir) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
$classname = $file;
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
@ -218,7 +219,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
@ -275,13 +276,13 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
|
||||
print "<br>\n";
|
||||
print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
@ -305,8 +306,8 @@ if ($resql) {
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
@ -362,13 +363,13 @@ foreach ($dirmodels as $reldir) {
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.$name.'">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -377,7 +378,7 @@ foreach ($dirmodels as $reldir) {
|
||||
if ($conf->global->BOM_ADDON_PDF == $name) {
|
||||
print img_picto($langs->trans("Default"), 'on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -419,12 +420,12 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*/
|
||||
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
|
||||
@ -128,11 +128,9 @@ function doc_getlinedesc($line, $outputlangs, $hideref = 0, $hidedesc = 0, $issu
|
||||
} else {
|
||||
$ref_prodserv = $prodser->ref; // Show local ref only
|
||||
}
|
||||
|
||||
$ref_prodserv .= " - ";
|
||||
}
|
||||
|
||||
$libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||
$libelleproduitservice = $prefix_prodserv.$ref_prodserv.($libelleproduitservice ? " - " : "").$libelleproduitservice;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
|
||||
// Show list of found files
|
||||
foreach ($listoffiles as $file) {
|
||||
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=boms&file=invoices/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>';
|
||||
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=boms/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>';
|
||||
}
|
||||
$texte .= '</div>';
|
||||
}
|
||||
@ -406,10 +406,22 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
$foundtagforlines = 0;
|
||||
dol_syslog($e->getMessage(), LOG_INFO);
|
||||
}
|
||||
|
||||
if ($foundtagforlines) {
|
||||
$linenumber = 0;
|
||||
foreach ($object->lines as $line) {
|
||||
$linenumber++;
|
||||
|
||||
if ($line->fk_product > 0) {
|
||||
$line->fetch_product();
|
||||
|
||||
$line->product_ref = $line->product->ref;
|
||||
$line->product_desc = $line->product->description;
|
||||
$line->product_label = $line->product->label;
|
||||
$line->product_type = $line->product->type;
|
||||
$line->product_barcode = $line->product->barcode;
|
||||
}
|
||||
|
||||
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user