FIX
This commit is contained in:
parent
b5d2e0f4bc
commit
cc5a5e40d9
@ -553,10 +553,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$res = $object->fetchLinesbytypeproduct(0);
|
$res = $object->fetchLinesbytypeproduct(0);
|
||||||
$object->calculateCosts();
|
$object->calculateCosts();
|
||||||
|
|
||||||
if ($res > 0) {
|
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
|
||||||
print load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
|
|
||||||
|
|
||||||
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
|
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
|
||||||
<input type="hidden" name="token" value="' . newToken() . '">
|
<input type="hidden" name="token" value="' . newToken() . '">
|
||||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
||||||
<input type="hidden" name="mode" value="">
|
<input type="hidden" name="mode" value="">
|
||||||
@ -564,95 +563,92 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
<input type="hidden" name="id" value="' . $object->id . '">
|
<input type="hidden" name="id" value="' . $object->id . '">
|
||||||
';
|
';
|
||||||
|
|
||||||
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||||
}
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
|
||||||
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($object->lines)) {
|
|
||||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Form to add new line
|
|
||||||
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
|
|
||||||
if ($action != 'editline') {
|
|
||||||
// Add products form
|
|
||||||
|
|
||||||
|
|
||||||
$parameters = array();
|
|
||||||
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
if (empty($reshook))
|
|
||||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print "</form>\n";
|
|
||||||
|
|
||||||
mrpCollapseBomManagement();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||||
|
print '<table id="tablelines" class="noborder noshadow" width="100%">';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object->lines)) {
|
||||||
|
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form to add new line
|
||||||
|
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
|
||||||
|
if ($action != 'editline') {
|
||||||
|
// Add products form
|
||||||
|
|
||||||
|
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
if (empty($reshook))
|
||||||
|
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||||
|
print '</table>';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print "</form>\n";
|
||||||
|
|
||||||
|
mrpCollapseBomManagement();
|
||||||
|
|
||||||
|
|
||||||
//Services
|
//Services
|
||||||
$filtertype = 1;
|
$filtertype = 1;
|
||||||
$res = $object->fetchLinesbytypeproduct(1);
|
$res = $object->fetchLinesbytypeproduct(1);
|
||||||
$object->calculateCosts();
|
$object->calculateCosts();
|
||||||
|
|
||||||
if ($res > 0) {
|
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');
|
||||||
print load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');
|
|
||||||
|
|
||||||
|
print ' <form name="addservice" id="addservice" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
|
||||||
|
<input type="hidden" name="token" value="' . newToken() . '">
|
||||||
|
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
||||||
|
<input type="hidden" name="mode" value="">
|
||||||
|
<input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id . '">
|
||||||
|
';
|
||||||
|
|
||||||
print ' <form name="addservice" id="addservice" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '') . '" method="POST">
|
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
||||||
<input type="hidden" name="token" value="' . newToken() . '">
|
$tagidfortablednd = 'tablelinesservice';
|
||||||
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
|
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||||
<input type="hidden" name="mode" value="">
|
|
||||||
<input type="hidden" name="page_y" value="">
|
|
||||||
<input type="hidden" name="id" value="' . $object->id . '">
|
|
||||||
';
|
|
||||||
|
|
||||||
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
|
|
||||||
$tagidfortablednd = 'tablelinesservice';
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
|
||||||
print '<table id="tablelinesservice" class="noborder noshadow" width="100%">';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($object->lines)) {
|
|
||||||
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Form to add new line
|
|
||||||
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
|
|
||||||
if ($action != 'editline') {
|
|
||||||
// Add services form
|
|
||||||
$parameters = array();
|
|
||||||
$reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
||||||
if (empty($reshook))
|
|
||||||
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
|
||||||
print '</table>';
|
|
||||||
}
|
|
||||||
print '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||||
|
print '<table id="tablelinesservice" class="noborder noshadow" width="100%">';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object->lines)) {
|
||||||
|
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form to add new line
|
||||||
|
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
|
||||||
|
if ($action != 'editline') {
|
||||||
|
// Add services form
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
if (empty($reshook))
|
||||||
|
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
|
||||||
|
print '</table>';
|
||||||
|
}
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res = $object->fetchLines();
|
||||||
|
|
||||||
// Buttons for actions
|
// Buttons for actions
|
||||||
|
|
||||||
|
|||||||
@ -444,7 +444,7 @@ class BOM extends CommonObject
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return $num_rows;
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->errors[] = $this->error;
|
$this->errors[] = $this->error;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user