Fix cancel and template to record stock movement/correction

This commit is contained in:
Laurent Destailleur 2018-03-05 21:16:01 +01:00
parent 6d13e58a23
commit 14d7ffa53b
3 changed files with 20 additions and 20 deletions

View File

@ -634,7 +634,7 @@ if ($resql)
/* */
/* ************************************************************************** */
if (empty($action) && $id > 0)
if ((empty($action) || $action == 'list') && $id > 0)
{
print "<div class=\"tabsAction\">\n";

View File

@ -68,8 +68,8 @@ if (empty($conf) || ! is_object($conf))
print '<tr>';
if ($object->element == 'product')
{
print '<td width="20%" class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td width="30%">';
print '<td class="fieldrequired">'.$langs->trans("Warehouse").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100');
print ' &nbsp; <select name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
@ -79,28 +79,28 @@ if (empty($conf) || ! is_object($conf))
}
if ($object->element == 'stock')
{
print '<td width="20%" class="fieldrequired" colspan="2">'.$langs->trans("Product").'</td>';
print '<td width="30%">';
print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 20, 0, -1);
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 20, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print ' &nbsp; <select name="mouvement" id="mouvement">';
print '<option value="0">'.$langs->trans("Add").'</option>';
print '<option value="1"'.(GETPOST('mouvement')?' selected="selected"':'').'>'.$langs->trans("Delete").'</option>';
print '</select>';
print '</td>';
}
print '<td width="20%" class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td width="30%"><input name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
print '<td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td>';
print '<td><input name="nbpiece" id="nbpiece" size="10" value="'.GETPOST("nbpiece").'"></td>';
print '</tr>';
// Purchase price
print '<tr>';
print '<td width="25%">'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td>'.$langs->trans("UnitPurchaseValue").'</td>';
print '<td colspan="'.(!empty($conf->projet->enabled) ? '1' : '3').'"><input name="unitprice" id="unitprice" size="10" value="'.GETPOST("unitprice").'"></td>';
if (! empty($conf->projet->enabled))
{
print '<td>'.$langs->trans('Project').'</td>';
print '<td>';
$formproject->select_projects();
$formproject->select_projects(0, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300');
print '</td>';
}
print '</tr>';
@ -133,7 +133,7 @@ if (empty($conf) || ! is_object($conf))
print '<tr>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" size="60" value="'.$valformovementlabel.'">';
print '<input type="text" name="label" class="minwidth300" value="'.$valformovementlabel.'">';
print '</td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"])?GETPOST("inventorycode",'alpha'):dol_print_date(dol_now(),'%y%m%d%H%M%S')).'"></td>';
print '</tr>';

View File

@ -72,20 +72,20 @@ if (empty($conf) || ! is_object($conf))
print '<tr>';
if ($object->element == 'product')
{
print '<td width="20%" class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td width="30%">';
print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
print '<td>';
print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
print '</td>';
}
if ($object->element == 'stock')
{
print '<td width="20%" class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td width="30%">';
print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''));
print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
print '<td>';
print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':''), 20, 0, -1, 2, '', 0, null, 0, 1, 0, 'maxwidth500');
print '</td>';
}
print '<td width="20%" class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td width="30%">';
print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
print '</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
@ -125,11 +125,11 @@ if (empty($conf) || ! is_object($conf))
// Label
$valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref));
print '<tr>';
print '<td width="15%">'.$langs->trans("MovementLabel").'</td>';
print '<td>'.$langs->trans("MovementLabel").'</td>';
print '<td>';
print '<input type="text" name="label" size="60" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
print '</td>';
print '<td width="15%">'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"])?GETPOST("inventorycode",'alpha'):dol_print_date(dol_now(),'%y%m%d%H%M%S')).'"></td>';
print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(isset($_POST["inventorycode"])?GETPOST("inventorycode",'alpha'):dol_print_date(dol_now(),'%y%m%d%H%M%S')).'"></td>';
print '</tr>';
print '</table>';