From 969da828facceefade15f3c8a21cb98da055512c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Jan 2020 02:30:53 +0100 Subject: [PATCH] Debug inventory --- htdocs/product/inventory/inventory.php | 53 +++++++++++++++++++------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 646b5d0bc6e..f43f1fc3b1c 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -101,13 +101,7 @@ if (empty($reshook)) $error = 0; $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; - - if (empty($backtopage) || ($cancel && empty($id))) { - //var_dump($backurlforlist);exit; - if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; - else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__'); - } - + $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id; // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -153,7 +147,7 @@ jQuery(document).ready(function() { // Part to show record -if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) +if ($object->id > 0) { $res = $object->fetch_optionals(); @@ -260,7 +254,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Buttons for actions - if ($action != 'presend' && $action != 'editline') { + if ($action == 'edit') { + print '
'; + print ''; + print ''; + print ''; + if ($backtopage) print ''; + + print '
'; + print ''.$langs->trans("InventoryDesc").'
'; + print ''; + print '   '; + print ''; + print '
'; + print '
'; + } + else { print '
'."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -268,11 +277,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { + if ($object->status == Inventory::STATUS_DRAFT) + { + if ($permissiontoadd) + { + print ''.$langs->trans("Edit").''."\n"; + } + else + { + print ''.$langs->trans('Edit').''."\n"; + } + } + if ($object->status == Inventory::STATUS_DRAFT) { if ($permissiontoadd) { - print ''.$langs->trans("Validate").''."\n"; + print ''.$langs->trans("Validate").''."\n"; } else { @@ -280,7 +301,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - if ($object->status == Inventory::STATUS_VALIDATED) + /*if ($object->status == Inventory::STATUS_VALIDATED) { if ($permissiontoadd) { @@ -290,14 +311,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans('RecordVerb').''."\n"; } - } + }*/ } print '
'."\n"; } print '
'; - print '
'; + //print '
'; print '
'; //print load_fiche_titre($langs->trans('Consumption'), '', ''); @@ -399,8 +420,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print '
'; + //print '
'; print '
'; - print ''; + + if ($action == 'edit') { + print '
'; + } } // End of page