Fix modulebuilder templates

This commit is contained in:
Laurent Destailleur 2020-01-06 14:01:18 +01:00
parent c02a27ba77
commit 804f7f3e1e
4 changed files with 25 additions and 24 deletions

View File

@ -1248,6 +1248,7 @@ AskForPreferredShippingMethod=Ask for preferred shipping method for Third Partie
FieldEdition=Edition of field %s
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
GetBarCode=Get barcode
NumberingModules=Numbering models
##### Module password generation
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
PasswordGenerationNone=Do not suggest a generated password. Password must be typed in manually.

View File

@ -21,12 +21,12 @@
*/
/**
* \file htdocs/core/modules/bom/mod_bom_advanced.php
* \ingroup bom
* \file htdocs/core/modules/mymodule/mod_myobject_advanced.php
* \ingroup mymodule
* \brief File containing class for advanced numbering model of MyObject
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';
dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php');
/**
@ -71,15 +71,15 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
$texte.= '<input type="hidden" name="maskconstBom" value="MYMODULE_MYOBJECT_ADVANCED_MASK">';
$texte.= '<table class="nobordernopadding" width="100%">';
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Bom"), $langs->transnoentities("Bom"));
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject"));
$tooltip.=$langs->trans("GenericMaskCodes2");
$tooltip.=$langs->trans("GenericMaskCodes3");
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Bom"), $langs->transnoentities("Bom"));
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject"));
$tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskBom" value="'.$conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMyObject" value="'.$conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte.= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
@ -137,9 +137,9 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
return 0;
}
$date = ($object->date_bom ? $object->date_bom : $object->date);
$date = $object->date;
$numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date);
$numFinal=get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', null, $date);
return $numFinal;
}

View File

@ -18,11 +18,12 @@
*/
/**
* \file htdocs/core/modules/bom/mod_bom_standard.php
* \ingroup bom
* \file htdocs/core/modules/mymodule/mod_myobject_standard.php
* \ingroup mymodule
* \brief File of class to manage MyObject numbering rules standard
*/
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php';
dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php');
/**
* Class to manage customer order numbering rules standard
@ -85,7 +86,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bom";
$sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity;
@ -119,7 +120,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
// D'abord on recupere la valeur max
$posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom";
$sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity;
@ -132,7 +133,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
}
else
{
dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG);
dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG);
return -1;
}
@ -143,7 +144,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
else $num = sprintf("%04s", $max+1);
dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
dol_syslog("mod_myobject_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num;
}
}

View File

@ -23,10 +23,9 @@
*/
/**
* \file htdocs/core/modules/bom/modules_bom.php
* \ingroup bom
* \brief File that contains parent class for boms models
* and parent class for boms numbering models
* \file htdocs/core/modules/mymodule/modules_myobject.php
* \ingroup mymodule
* \brief File that contains parent class for myobjects document models and parent class for myobjects numbering models
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
@ -34,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
/**
* Parent class for boms models
* Parent class for documents models
*/
abstract class ModelePDFMyObject extends CommonDocGenerator
{
@ -52,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
// phpcs:enable
global $conf;
$type = 'bom';
$type = 'mymodule_myobject';
$list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -65,7 +64,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
/**
* Parent class to manage numbering of BOMs
* Parent class to manage numbering of MyObject
*/
abstract class ModeleNumRefMyObject
{
@ -92,7 +91,7 @@ abstract class ModeleNumRefMyObject
public function info()
{
global $langs;
$langs->load("mrp");
$langs->load("mymodule@mymodule");
return $langs->trans("NoDescription");
}
@ -104,7 +103,7 @@ abstract class ModeleNumRefMyObject
public function getExample()
{
global $langs;
$langs->load("mrp");
$langs->load("mymodule@mymodule");
return $langs->trans("NoExample");
}