Work on BOM

This commit is contained in:
Laurent Destailleur 2019-03-04 14:01:30 +01:00
parent d8259f94e1
commit ca9449c70e
2 changed files with 17 additions and 4 deletions

View File

@ -44,7 +44,7 @@ class BOM extends CommonObject
/** /**
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/ */
public $ismultientitymanaged = 0; public $ismultientitymanaged = 1;
/** /**
* @var int Does bom support extrafields ? 0=No, 1=Yes * @var int Does bom support extrafields ? 0=No, 1=Yes
@ -57,6 +57,9 @@ class BOM extends CommonObject
public $picto = 'bom'; public $picto = 'bom';
public $table_element_line = 'bom_bomline';
/** /**
* 'type' if the field format. * 'type' if the field format.
* 'label' the translation key. * 'label' the translation key.
@ -588,6 +591,7 @@ class BOM extends CommonObject
public function initAsSpecimen() public function initAsSpecimen()
{ {
$this->initAsSpecimenCommon(); $this->initAsSpecimenCommon();
$this->date = $this->date_creation;
} }

View File

@ -7455,9 +7455,18 @@ abstract class CommonObject
*/ */
public function initAsSpecimenCommon() public function initAsSpecimenCommon()
{ {
$this->id = 0; global $user;
// TODO... $this->id = 0;
if (array_key_exists('label', $this->fields)) $this->label='This is label';
if (array_key_exists('note_public', $this->fields)) $this->note_public='Public note';
if (array_key_exists('note_private', $this->fields)) $this->note_private='Private note';
if (array_key_exists('date_creation', $this->fields)) $this->date_creation=(dol_now()-3600*24);
if (array_key_exists('date_modification', $this->fields)) $this->date_modification=(dol_now()-3600*24);
if (array_key_exists('fk_user_creat', $this->fields)) $this->fk_user_creat=$user->id;
if (array_key_exists('fk_user_modif', $this->fields)) $this->fk_user_modif=$user->id;
if (array_key_exists('date', $this->fields)) $this->date=dol_now();
// ...
} }