FIX compatibility mysql 8. rank is reserved
FIX Permission for BOM menu
This commit is contained in:
parent
69db6e6aa7
commit
e5d34de877
@ -889,7 +889,7 @@ class BOM extends CommonObject
|
||||
$this->lines=array();
|
||||
|
||||
$objectline = new BOMLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
|
||||
|
||||
if (is_numeric($result))
|
||||
{
|
||||
@ -1044,7 +1044,7 @@ class BOMLine extends CommonObject
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
public $rowid;
|
||||
@ -1053,7 +1053,7 @@ class BOMLine extends CommonObject
|
||||
public $description;
|
||||
public $qty;
|
||||
public $efficiency;
|
||||
public $rank;
|
||||
public $position;
|
||||
public $import_key;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
@ -2443,9 +2443,9 @@ abstract class CommonObject
|
||||
*/
|
||||
public function updateRangOfLine($rowid, $rang)
|
||||
{
|
||||
$fieldposition = 'rang'; // @TODO Rename 'rang' and 'position' into 'rank'
|
||||
$fieldposition = 'rang'; // @TODO Rename 'rang' into 'position'
|
||||
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
|
||||
if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'rank';
|
||||
if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'position';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
|
||||
$sql.= ' WHERE rowid = '.$rowid;
|
||||
|
||||
@ -1579,7 +1579,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
{
|
||||
$langs->load("mrp");
|
||||
|
||||
$newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->service->lire, '', $mainmenu, 'service');
|
||||
$newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom');
|
||||
$newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write);
|
||||
$newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read);
|
||||
}
|
||||
|
||||
@ -252,12 +252,13 @@ CREATE TABLE llx_bom_bomline(
|
||||
import_key varchar(14),
|
||||
qty double(24,8) NOT NULL,
|
||||
efficiency double(8,4) NOT NULL DEFAULT 1,
|
||||
rank integer NOT NULL
|
||||
position integer NOT NULL
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN efficiency double(8,4) DEFAULT 1;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN fk_bom_child integer NULL;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL;
|
||||
|
||||
create table llx_bom_bomline_extrafields
|
||||
(
|
||||
|
||||
@ -23,6 +23,6 @@ CREATE TABLE llx_bom_bomline(
|
||||
import_key varchar(14),
|
||||
qty double(24,8) NOT NULL,
|
||||
efficiency double(8,4) NOT NULL DEFAULT 1,
|
||||
rank integer NOT NULL
|
||||
position integer NOT NULL
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -696,7 +696,7 @@ class MyObject extends CommonObject
|
||||
$this->lines=array();
|
||||
|
||||
$objectline = new MyObjectLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_myobject = '.$this->id));
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_myobject = '.$this->id));
|
||||
|
||||
if (is_numeric($result))
|
||||
{
|
||||
@ -781,5 +781,5 @@ class MyObject extends CommonObject
|
||||
class MyObjectLine
|
||||
{
|
||||
// To complete with content of an object MyObjectLine
|
||||
// We should have a field rowid, fk_myobject and rank
|
||||
// We should have a field rowid, fk_myobject and position
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user