Merge pull request #2222 from KreizIT/batch_improvement
Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
This commit is contained in:
commit
f7dd4a1357
@ -7,6 +7,8 @@ English Dolibarr ChangeLog
|
|||||||
For users:
|
For users:
|
||||||
- New: Use new combobox.
|
- New: Use new combobox.
|
||||||
- New: Add hidden option MAXTABS_IN_CARD.
|
- New: Add hidden option MAXTABS_IN_CARD.
|
||||||
|
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
|
||||||
|
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Update language files.
|
- Update language files.
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador.gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador.gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2014 Cédric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2014-2015 Cédric Gross <c.gross@kreiz-it.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -239,7 +239,45 @@ if ($action == "transfert_stock" && ! $cancel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save'))
|
||||||
|
{
|
||||||
|
|
||||||
|
$pdluo = new Productbatch($db);
|
||||||
|
$result=$pdluo->fetch(GETPOST('pdluoid','int'));
|
||||||
|
|
||||||
|
if ($result>0)
|
||||||
|
{
|
||||||
|
if ($pdluo->id)
|
||||||
|
{
|
||||||
|
if ((! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) {
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("atleast1batchfield")), 'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']);
|
||||||
|
$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']);
|
||||||
|
$pdluo->batch=GETPOST("batch_number",'san_alpha');
|
||||||
|
$pdluo->eatby=$d_eatby;
|
||||||
|
$pdluo->sellby=$d_sellby;
|
||||||
|
$result=$pdluo->update($user);
|
||||||
|
if ($result<0)
|
||||||
|
{
|
||||||
|
setEventMessages($pdluo->error,$pdluo->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans('BatchInformationNotfound'),null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($pdluo->error,null, 'errors');
|
||||||
|
}
|
||||||
|
header("Location: product.php?id=".$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -663,12 +701,33 @@ if ($resql)
|
|||||||
if ($details<0) dol_print_error($db);
|
if ($details<0) dol_print_error($db);
|
||||||
foreach ($details as $pdluo)
|
foreach ($details as $pdluo)
|
||||||
{
|
{
|
||||||
print "\n".'<tr><td></td>';
|
if ( $action == 'editline' && GETPOST('lineid',int)==$pdluo->id )
|
||||||
print '<td align="right">'.$pdluo->batch.'</td>';
|
{ //Current line edit
|
||||||
print '<td align="right">'. dol_print_date($pdluo->eatby,'day') .'</td>';
|
print "\n".'<tr><td colspan="9">';
|
||||||
print '<td align="right">'. dol_print_date($pdluo->sellby,'day') .'</td>';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST"><input type="hidden" name="pdluoid" value="'.$pdluo->id.'"><input type="hidden" name="action" value="updateline"><input type="hidden" name="id" value="'.$id.'"><table class="noborder" width="100%"><tr><td width="10%"></td>';
|
||||||
print '<td align="right">'.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').'</td>';
|
print '<td align="right" width="10%"><input type="text" name="batch_number" value="'.$pdluo->batch.'"></td>';
|
||||||
print '<td colspan="4"></td></tr>';
|
print '<td align="right" width="10%">';
|
||||||
|
$form->select_date($pdluo->eatby,'eatby','','',1,"");
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" width="10%">';
|
||||||
|
$form->select_date($pdluo->sellby,'sellby','','',1,"");
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="right" width="10%">'.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').'</td>';
|
||||||
|
print '<td colspan="4"><input type="submit" class="button" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
|
||||||
|
print '<input type="submit" class="button" id="cancellinebutton" name="Cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||||
|
print '</table></form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "\n".'<tr><td align="right">';
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=editline&lineid='.$pdluo->id.'#'.$pdluo->id.'">';
|
||||||
|
print img_edit().'</a></td>';
|
||||||
|
print '<td align="right">'.$pdluo->batch.'</td>';
|
||||||
|
print '<td align="right">'. dol_print_date($pdluo->eatby,'day') .'</td>';
|
||||||
|
print '<td align="right">'. dol_print_date($pdluo->sellby,'day') .'</td>';
|
||||||
|
print '<td align="right">'.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').'</td>';
|
||||||
|
print '<td colspan="4"></td></tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user