diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index dcca69c47a8..87dda7698c2 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("mrp", "other")); @@ -89,7 +91,6 @@ $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($ $upload_dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1]; - /* * Actions */ @@ -582,47 +583,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print "\n"; - ?> - - - + + + + array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), @@ -8571,7 +8569,6 @@ class Form $sql = $possiblelink['sql']; $resqllist = $this->db->query($sql); - if ($resqllist) { $num = $this->db->num_rows($resqllist); $i = 0; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index a686e2892f6..f3df78af869 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -675,7 +675,6 @@ class Mo extends CommonObject } $resultline = $moline->create($user, false); // Never use triggers here - if ($resultline <= 0) { $error++; $this->error = $moline->error; @@ -1206,7 +1205,7 @@ class Mo extends CommonObject /** * Create an array of lines - * + * @param string $rolefilter * @return array|int array of lines if OK, <0 if KO */ public function getLinesArray($rolefilter = '') @@ -1694,9 +1693,7 @@ class MoLine extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index fc6ae99ad55..2b6e7f5dbe4 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("mrp", "other")); @@ -112,7 +114,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { $error = 0; @@ -130,14 +131,11 @@ if (empty($reshook)) { if ($cancel && !empty($backtopageforcancel)) { $backtopage = $backtopageforcancel; } - - - $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - if ($action == 'add' && empty($id)) { + if ($action == 'add' && empty($id) && !empty($TBomLineId)) { $noback = ""; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -281,48 +279,11 @@ if ($action == 'create') { print dol_get_fiche_end(); + print mrpCollapseBomManagement(); + ?>