23if (empty($conf) || !is_object($conf)) {
24 print
"Error, template page can't be called as URL";
30<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
33if ($object->element ==
'product') {
34 $productref = $object->ref;
37$langs->load(
"productbatch");
44$pdluoid =
GETPOST(
'pdluoid',
'int');
49 $result = $pdluo->fetch($pdluoid);
51 $pdluoid = $pdluo->id;
57print
'<script type="text/javascript">
58 jQuery(document).ready(function() {
61 if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
62 else jQuery("#unitprice").prop("disabled", true);
65 jQuery("#mouvement").change(function() {
66 console.log("We change the direction of movement");
69 jQuery("#nbpiece").keyup(function(event) {
70 console.log("We enter a qty on "+event.key);
71 if ( event.key == "-" ) { /* char - */
72 console.log("We set direction to value 1");
73 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("-", ""));
74 jQuery("#mouvement option").removeAttr("selected").change();
75 jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change");
76 jQuery("#mouvement").trigger("change");
77 } else if ( event.key == "+" ) { /* char + */
78 console.log("We set direction to value 0");
79 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("+", ""));
80 jQuery("#mouvement option").removeAttr("selected").change();
81 jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change");
82 jQuery("#mouvement").trigger("change");
91print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'" method="post">'.
"\n";
95print
'<input type="hidden" name="token" value="'.newToken().
'">';
96print
'<input type="hidden" name="action" value="correct_stock">';
97print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
99 print
'<input type="hidden" name="pdluoid" value="'.$pdluoid.
'">';
101print
'<table class="border centpercent">';
105if ($object->element ==
'product') {
106 print
'<td class="fieldrequired">'.$langs->trans(
"Warehouse").
'</td>';
108 $ident = (
GETPOST(
"dwid") ?
GETPOST(
"dwid",
'int') : (
GETPOST(
'id_entrepot') ?
GETPOST(
'id_entrepot',
'int') : ($object->element ==
'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse :
'ifone')));
110 $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE;
112 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($ident,
'id_entrepot',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0,
null,
'minwidth100 maxwidth300 widthcentpercentminusx');
115if ($object->element ==
'stock') {
116 print
'<td class="fieldrequired">'.$langs->trans(
"Product").
'</td>';
119 $form->select_produits(
GETPOST(
'product_id',
'int'),
'product_id', (!
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES') ?
'0' :
''), 0, 0, -1, 2,
'', 0, null, 0, 1, 0,
'maxwidth500');
122print
'<td class="fieldrequired">'.$langs->trans(
"NumberOfUnit").
'</td>';
124if ($object->element ==
'product' || $object->element ==
'stock') {
125 print
'<select name="mouvement" id="mouvement" class="minwidth100 valignmiddle">';
126 print
'<option value="0">'.$langs->trans(
"Add").
'</option>';
127 print
'<option value="1"'.(GETPOST(
'mouvement') ?
' selected="selected"' :
'').
'>'.$langs->trans(
"Delete").
'</option>';
131print
'<input name="nbpiece" id="nbpiece" class="center valignmiddle maxwidth75" value="'.GETPOST(
"nbpiece").
'">';
136if (
getDolGlobalString(
'PRODUIT_SOUSPRODUITS') && $object->element ==
'product' && $object->hasFatherOrChild(1)) {
139 print
'<td colspan="3">';
140 print
'<input type="checkbox" name="disablesubproductstockchange" id="disablesubproductstockchange" value="1"'.(GETPOST(
'disablesubproductstockchange') ?
' checked="checked"' :
'').
'">';
141 print
' <label for="disablesubproductstockchange">'.$langs->trans(
"DisableStockChangeOfSubProduct").
'</label>';
147if (ismodEnabled(
'productbatch') &&
148(($object->element ==
'product' && $object->hasbatch())
149|| ($object->element ==
'stock'))
152 print
'<td'.($object->element ==
'stock' ?
'' :
' class="fieldrequired"').
'>'.$langs->trans(
"batch_number").
'</td><td colspan="3">';
155 print
'<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST(
'batch_number') ?
GETPOST(
'batch_number') : $pdluo->batch).
'">';
156 print
'<input type="hidden" name="batch_number" value="'.(GETPOST(
'batch_number') ?
GETPOST(
'batch_number') : $pdluo->batch).
'">';
158 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"').
'<input type="text" name="batch_number" class="minwidth300" value="'.(
GETPOST(
'batch_number') ?
GETPOST(
'batch_number') : $pdluo->batch).
'">';
165 print
'<td>'.$langs->trans(
"SellByDate").
'</td><td>';
168 print $form->selectDate(($pdluo->id > 0 ? $pdluo->sellby : $sellbyselected),
'sellby',
'',
'', 1,
"", 1, 0, ($pdluoid > 0 ? 1 : 0));
172 print
'<td>'.$langs->trans(
"EatByDate").
'</td><td>';
175 print $form->selectDate(($pdluo->id > 0 ? $pdluo->eatby : $eatbyselected),
'eatby',
'',
'', 1,
"", 1, 0, ($pdluoid > 0 ? 1 : 0));
183print
'<td>'.$langs->trans(
"UnitPurchaseValue").
'</td>';
184print
'<td colspan="'.(isModEnabled(
'project') ?
'1' :
'3').
'"><input name="unitprice" id="unitprice" size="10" value="'.
GETPOST(
"unitprice").
'"></td>';
185if (isModEnabled(
'project')) {
186 print
'<td>'.$langs->trans(
'Project').
'</td>';
189 $formproject->select_projects(-1,
'',
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth300 widthcentpercentminusx');
195$valformovementlabel = ((
GETPOST(
"label") && (
GETPOST(
'label') != $langs->trans(
"MovementCorrectStock",
''))) ?
GETPOST(
"label") : $langs->trans(
"MovementCorrectStock", $productref));
197print
'<td>'.$langs->trans(
"MovementLabel").
'</td>';
199print
'<input type="text" name="label" class="minwidth400" value="'.dol_escape_htmltag($valformovementlabel).
'">';
201print
'<td>'.$langs->trans(
"InventoryCode").
'</td>';
203print
'<input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET(
"inventorycode") ?
GETPOST(
"inventorycode",
'alpha') :
dol_print_date(
dol_now(),
'%Y%m%d%H%M%S')).
'">';
211print
'<div class="center">';
212print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
213print
' ';
214print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
219<!-- END PHP STOCKCORRECTION.TPL.PHP -->
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Manage record for batch number management.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.