diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index eb8ad31030c..b54eb38ebd4 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -227,7 +227,6 @@ class BOM extends CommonObject public $unit_cost = 0; - /** * Constructor * @@ -628,34 +627,34 @@ class BOM extends CommonObject } // Insert line - $this->line = new BOMLine($this->db); + $line = new BOMLine($this->db); - $this->line->context = $this->context; + $line->context = $this->context; - $this->line->fk_bom = $this->id; - $this->line->fk_product = $fk_product; - $this->line->qty = $qty; - $this->line->qty_frozen = $qty_frozen; - $this->line->disable_stock_change = $disable_stock_change; - $this->line->efficiency = $efficiency; - $this->line->fk_bom_child = $fk_bom_child; - $this->line->import_key = $import_key; - $this->line->position = $rankToUse; - $this->line->fk_unit = $fk_unit; - $this->line->fk_default_workstation = $fk_default_workstation; + $line->fk_bom = $this->id; + $line->fk_product = $fk_product; + $line->qty = $qty; + $line->qty_frozen = $qty_frozen; + $line->disable_stock_change = $disable_stock_change; + $line->efficiency = $efficiency; + $line->fk_bom_child = $fk_bom_child; + $line->import_key = $import_key; + $line->position = $rankToUse; + $line->fk_unit = $fk_unit; + $line->fk_default_workstation = $fk_default_workstation; if (is_array($array_options) && count($array_options) > 0) { - $this->line->array_options = $array_options; + $line->array_options = $array_options; } - $result = $this->line->create($user); + $result = $line->create($user); if ($result > 0) { $this->calculateCosts(); $this->db->commit(); return $result; } else { - $this->error = $this->line->error; + $this->setErrorsFromObject($line); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -724,8 +723,7 @@ class BOM extends CommonObject $staticLine = clone $line; $line->oldcopy = $staticLine; - $this->line = $line; - $this->line->context = $this->context; + $line->context = $this->context; // Rank to use $rankToUse = (int) $position; @@ -743,32 +741,32 @@ class BOM extends CommonObject } - $this->line->fk_bom = $this->id; - $this->line->qty = $qty; - $this->line->qty_frozen = $qty_frozen; - $this->line->disable_stock_change = $disable_stock_change; - $this->line->efficiency = $efficiency; - $this->line->import_key = $import_key; - $this->line->position = $rankToUse; + $line->fk_bom = $this->id; + $line->qty = $qty; + $line->qty_frozen = $qty_frozen; + $line->disable_stock_change = $disable_stock_change; + $line->efficiency = $efficiency; + $line->import_key = $import_key; + $line->position = $rankToUse; if (!empty($fk_unit)) { - $this->line->fk_unit = $fk_unit; + $line->fk_unit = $fk_unit; } if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options foreach ($array_options as $key => $value) { - $this->line->array_options[$key] = $array_options[$key]; + $line->array_options[$key] = $array_options[$key]; } } - $result = $this->line->update($user); + $result = $line->update($user); if ($result > 0) { $this->calculateCosts(); $this->db->commit(); return $result; } else { - $this->error = $this->line->error; + $this->setErrorsFromObject($line); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -803,10 +801,9 @@ class BOM extends CommonObject $staticLine = clone $line; $line->oldcopy = $staticLine; - $this->line = $line; - $this->line->context = $this->context; + $line->context = $this->context; - $result = $this->line->delete($user, $notrigger); + $result = $line->delete($user, $notrigger); //Positions (rank) reordering foreach ($this->lines as $bl) { @@ -821,7 +818,7 @@ class BOM extends CommonObject $this->db->commit(); return $result; } else { - $this->error = $this->line->error; + $this->setErrorsFromObject($line); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 1c203365953..0fc2d733a38 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1038,9 +1038,10 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl if (!empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) { $arrayfields["ef.".$key] = array( 'label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key], - 'checked'=>(($extrafields->attributes[$contactstatic->table_element]['list'][$key] < 0) ? 0 : 1), + 'checked'=>((dol_eval($extrafields->attributes[$contactstatic->table_element]['list'][$key], 1, 1, '1') < 0) ? 0 : 1), 'position'=>1000 + $extrafields->attributes[$contactstatic->table_element]['pos'][$key], - 'enabled'=>(abs($extrafields->attributes[$contactstatic->table_element]['list'][$key]) != 3 && $extrafields->attributes[$contactstatic->table_element]['perms'][$key])); + 'enabled' => (abs((int) dol_eval($extrafields->attributes[$contactstatic->table_element]['list'][$key], 1)) != 3 && dol_eval($extrafields->attributes[$contactstatic->table_element]['perms'][$key], 1, 1, '1')) + ); } } } diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index dc02a2c4b5f..1b65074a82e 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -18,7 +18,7 @@ insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, left insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 16__+MAX_llx_menu__, 'bom|mrp', 'isModEnabled("bom") || isModEnabled("mrp")', __HANDLER__, 'top', 'mrp', '', 0, '/mrp/index.php?mainmenu=mrp&leftmenu=', 'MRP', -1, 'mrp', '$user->hasRight("bom","read")||$user->hasRight("mrp","read")', '', 0, 31, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 7__+MAX_llx_menu__, 'projet', 'isModEnabled("project")', __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&leftmenu=', 'Projects', -1, 'projects', '$user->hasRight("projet","lire")', '', 2, 32, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 5__+MAX_llx_menu__, 'propal|commande|fournisseur|supplier_order|supplier_invoice|contrat|ficheinter', 'isModEnabled("propal") || isModEnabled("commande") || isModEnabled("supplier_order") || isModEnabled("contrat") || isModEnabled("ficheinter")', __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&leftmenu=', 'Commercial', -1, 'commercial', '$user->hasRight("societe","lire") || $user->hasRight("societe","contact","lire")', '', 2, 40, __ENTITY__); -insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->hasRight("banque","lire") || ($user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire', '', 2, 50, __ENTITY__); +insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 6__+MAX_llx_menu__, 'facture|don|tax|salaries|loan|banque', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("facture") || isModEnabled("don") || isModEnabled("tax") || isModEnabled("salaries") || isModEnabled("supplier_invoice") || isModEnabled("loan") || isModEnabled("banque")', __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire || $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->hasRight("banque","lire") || $user->rights->fournisseur->facture->lire || $user->rights->supplier_invoice->lire', '', 2, 50, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 14__+MAX_llx_menu__, 'banque|prelevement', 'isModEnabled("banque") || isModEnabled("prelevement")', __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->hasRight("banque","lire") || $user->hasRight("prelevement","bons","lire")', '', 0, 52, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 9__+MAX_llx_menu__, 'comptabilite|accounting|asset', 'isModEnabled("comptabilite") || isModEnabled("accounting") || isModEnabled("asset")', __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&leftmenu=accountancy', 'MenuAccountancy', -1, 'main', '$user->hasRight("compta","resultat","lire") || $user->hasRight("accounting","mouvements","lire") || $user->hasRight("asset","read")', '', 2, 54, __ENTITY__); insert into llx_menu (rowid, module, enabled, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ( 8__+MAX_llx_menu__, '', '', __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); diff --git a/htdocs/reception/class/api_receptions.class.php b/htdocs/reception/class/api_receptions.class.php index c9f4cba44cc..b24a8dbef11 100644 --- a/htdocs/reception/class/api_receptions.class.php +++ b/htdocs/reception/class/api_receptions.class.php @@ -709,7 +709,7 @@ class Receptions extends DolibarrApi private function _validate($data) { $reception = array(); - foreach (Shipments::$FIELDS as $field) { + foreach (Receptions::$FIELDS as $field) { if (!isset($data[$field])) { throw new RestException(400, "$field field missing"); }