28 include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
51 $this->rights_class =
'bom';
55 $this->family =
"products";
57 $this->module_position =
'65';
62 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
64 $this->
description =
"Module to define your Bills Of Materials (BOM). Can be used for Manufacturing Resource Planning by the module Manufacturing Orders (MO)";
66 $this->descriptionlong =
"Bill of Materials definitions. They can be used to make Manufacturing Resource Planning";
69 $this->version =
'dolibarr';
74 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
81 $this->module_parts = array(
100 $this->dirs = array(
"/bom/temp");
103 $this->config_page_url = array(
"bom.php");
106 $this->hidden =
false;
107 $this->depends = array(
'modProduct');
108 $this->requiredby = array(
'modMrp');
109 $this->conflictwith = array();
110 $this->langfiles = array(
"mrp");
112 $this->need_dolibarr_version = array(9, 0);
113 $this->warnings_activation = array();
114 $this->warnings_activation_ext = array();
123 $this->
const = array(
124 1=>array(
'BOM_ADDON_PDF',
'chaine',
'generic_bom_odt',
'Name of PDF model of BOM', 0),
125 2=>array(
'BOM_ADDON',
'chaine',
'mod_bom_standard',
'Name of numbering rules of BOM', 0),
126 3=>array(
'BOM_ADDON_PDF_ODT_PATH',
'chaine',
'DOL_DATA_ROOT/doctemplates/boms',
'', 0)
135 if (!isset($conf->bom) || !isset($conf->bom->enabled))
137 $conf->bom =
new stdClass();
138 $conf->bom->enabled = 0;
143 $this->tabs = array();
172 $this->dictionaries = array();
191 $this->boxes = array(
192 0=>array(
'file' =>
'box_boms.php',
'note' =>
'',
'enabledbydefaulton' =>
'Home')
198 $this->cronjobs = array(
207 $this->rights = array();
210 $this->rights[$r][0] = $this->numero + $r;
211 $this->rights[$r][1] =
'Read bom of Bom';
212 $this->rights[$r][3] = 0;
213 $this->rights[$r][4] =
'read';
214 $this->rights[$r][5] =
'';
217 $this->rights[$r][0] = $this->numero + $r;
218 $this->rights[$r][1] =
'Create/Update bom of Bom';
219 $this->rights[$r][3] = 0;
220 $this->rights[$r][4] =
'write';
221 $this->rights[$r][5] =
'';
224 $this->rights[$r][0] = $this->numero + $r;
225 $this->rights[$r][1] =
'Delete bom of Bom';
226 $this->rights[$r][3] = 0;
227 $this->rights[$r][4] =
'delete';
228 $this->rights[$r][5] =
'';
232 $this->menu = array();
288 $this->export_code[$r] = $this->rights_class.
'_'.$r;
289 $this->export_label[$r] =
'BomAndBomLines';
290 $this->export_icon[$r] =
'bom';
291 $keyforclass =
'BOM'; $keyforclassfile =
'/bom/class/bom.class.php'; $keyforelement =
'bom';
292 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
293 $keyforclass =
'BOMLine'; $keyforclassfile =
'/bom/class/bom.class.php'; $keyforelement =
'bomline'; $keyforalias =
'tl';
294 include DOL_DOCUMENT_ROOT.
'/core/commonfieldsinexport.inc.php';
295 unset($this->export_fields_array[$r][
'tl.fk_bom']);
296 $keyforselect =
'bom_bom'; $keyforaliasextra =
'extra'; $keyforelement =
'bom';
297 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
298 $keyforselect =
'bom_bomline'; $keyforaliasextra =
'extraline'; $keyforelement =
'bomline';
299 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
300 $this->export_dependencies_array[$r] = array(
'bomline'=>
'tl.rowid');
301 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
302 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'bom_bom as t';
303 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bom_bom_extrafields as extra on (t.rowid = extra.fk_object)';
304 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bom_bomline as tl ON tl.fk_bom = t.rowid';
305 $this->export_sql_end[$r] .=
' WHERE 1 = 1';
306 $this->export_sql_end[$r] .=
' AND t.entity IN ('.getEntity(
'bom').
')';
319 public function init($options =
'')
321 global $conf, $langs;
324 if ($result < 0)
return -1;
337 $this->
remove($options);
342 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/boms/template_bom.odt';
343 $dirodt = DOL_DATA_ROOT.
'/doctemplates/boms';
344 $dest = $dirodt.
'/template_bom.odt';
346 if (file_exists($src) && !file_exists($dest))
348 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
350 $result =
dol_copy($src, $dest, 0, 0);
353 $langs->load(
"errors");
354 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
364 return $this->
_init($sql, $options);
375 public function remove($options =
'')
379 return $this->
_remove($sql, $options);
init($options= '')
Function called when module is enabled.
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
Copy a file to another file.
</td > param sortfield sortorder printFieldListOption< tdclass="liste_titremaxwidthsearchright"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration center DesiredStock p desiredstock right StockLimitShort p seuil_stock_alerte right stock_physique right stock_real_warehouse right Ordered right StockToBuy right SupplierRef right param sortfield sortorder printFieldListTitle warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow StockTooLow help help help< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"> stock</td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.
_remove($array_sql, $options= '')
Disable function.
_init($array_sql, $options= '')
Enables a module.
__construct($db)
Constructor.
Description and activation class for module Bom.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
_load_tables($reldir)
Create tables and keys required by module.