36 print
"Error, template page can't be called as URL";
41@phan-var-force Entrepot|MouvementStock $object
42@phan-var-force FormProduct $formproduct
43@phan-var-force FormProjets $formproject
44@phan-var-force string $backtopage
49<!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
53if (
$object->element ==
'product') {
58$langs->load(
"productbatch");
70 $result = $pdluo->fetch($pdluoid);
72 $pdluoid = $pdluo->id;
95print
'<script type="text/javascript">
96 jQuery(document).ready(function() {
99 if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
100 else jQuery("#unitprice").prop("disabled", true);
103 jQuery("#mouvement").change(function() {
104 console.log("We change the direction of movement");
107 jQuery("#nbpiece").keyup(function(event) {
108 console.log("We enter a qty on "+event.key);
109 if ( event.key == "-" ) { /* char - */
110 console.log("We set direction to value 1");
111 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("-", ""));
112 jQuery("#mouvement option").removeAttr("selected").change();
113 jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change");
114 jQuery("#mouvement").trigger("change");
115 } else if ( event.key == "+" ) { /* char + */
116 console.log("We set direction to value 0");
117 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("+", ""));
118 jQuery("#mouvement option").removeAttr("selected").change();
119 jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change");
120 jQuery("#mouvement").trigger("change");
124if ($disableSellBy == 0 || $disableEatBy == 0) {
126 var disableSellBy = '.dol_escape_js((
string) $disableSellBy).
';
127 var disableEatBy = '.
dol_escape_js((
string) $disableSellBy).
';
128 jQuery("#batch_number").change(function(event) {
129 var batch = jQuery(this).val();
130 jQuery.getJSON("'.DOL_URL_ROOT.
'/product/ajax/product_lot.php?action=search&token='.
currentToken().
'&product_id='.
$id.
'&batch="+batch, function(data) {
131 if (data.length > 0) {
132 var productLot = data[0];
133 if (disableSellBy == 0) {
134 jQuery("#sellby").val(productLot.sellby);
136 if (disableEatBy == 0) {
137 jQuery("#eatby").val(productLot.eatby);
149print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$id.
'" method="post">'.
"\n";
153print
'<input type="hidden" name="token" value="'.newToken().
'">';
154print
'<input type="hidden" name="action" value="correct_stock">';
155print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
157 print
'<input type="hidden" name="pdluoid" value="'.$pdluoid.
'">';
159print
'<table class="border centpercent">';
163if (
$object->element ==
'product') {
165 print
'<td class="fieldrequired">'.$langs->trans(
"Warehouse").
'</td>';
171 print
img_picto(
'',
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($ident,
'id_entrepot',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, array(),
'minwidth100 maxwidth300 widthcentpercentminusx');
174if (
$object->element ==
'stockmouvement') {
176 print
'<td class="fieldrequired">'.$langs->trans(
"Product").
'</td>';
179 $form->select_produits(
GETPOSTINT(
'product_id'),
'product_id', (!
getDolGlobalString(
'STOCK_SUPPORTS_SERVICES') ?
'0' :
''), 0, 0, -1, 2,
'', 0, array(), 0, 1, 0,
'maxwidth500');
182print
'<td class="fieldrequired">'.$langs->trans(
"NumberOfUnit").
'</td>';
184if (
$object->element ==
'product' ||
$object->element ==
'stockmouvement') {
186 print
'<select name="mouvement" id="mouvement" class="minwidth100 valignmiddle">';
187 print
'<option value="0">'.$langs->trans(
"Add").
'</option>';
188 print
'<option value="1"'.(GETPOST(
'mouvement') ?
' selected="selected"' :
'').
'>'.$langs->trans(
"Delete").
'</option>';
192print
'<input name="nbpiece" id="nbpiece" class="center valignmiddle maxwidth75" value="'.GETPOST(
"nbpiece").
'">';
201 print
'<td colspan="3">';
202 print
'<input type="checkbox" name="disablesubproductstockchange" id="disablesubproductstockchange" value="1"'.(GETPOST(
'disablesubproductstockchange') ?
' checked="checked"' :
'').
'">';
203 print
' <label for="disablesubproductstockchange">'.$langs->trans(
"DisableStockChangeOfSubProduct").
'</label>';
209if (isModEnabled(
'productbatch') &&
211|| (
$object->element ==
'stockmouvement'))
215 print
'<td'.($object->element ==
'stockmouvement' ?
'' :
' class="fieldrequired"').
'>'.$langs->trans(
"batch_number").
'</td><td colspan="3">';
218 print
'<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST(
'batch_number') ?
GETPOST(
'batch_number') : $pdluo->batch).
'">';
219 print
'<input type="hidden" name="batch_number" value="'.(GETPOST(
'batch_number') ?
GETPOST(
'batch_number') : $pdluo->batch).
'">';
221 print
img_picto(
'',
'barcode',
'class="pictofixedwidth"').
'<input type="text" id="batch_number" name="batch_number" class="minwidth300" value="'.(
GETPOST(
'batch_number') ?
GETPOST(
'batch_number') : $pdluo->batch).
'">';
228 print
'<td'.($sellByCss ?
' class="'.$sellByCss.
'"' :
'').
'>'.$langs->trans(
"SellByDate").
'</td><td>';
231 print $form->selectDate(($pdluo->id > 0 ? $pdluo->sellby : $sellbyselected),
'sellby', 0, 0, 1,
"", 1, 0, ($pdluoid > 0 ? 1 : 0));
235 print
'<td'.($eatByCss ?
' class="'.$eatByCss.
'"' :
'').
'>'.$langs->trans(
"EatByDate").
'</td><td>';
238 print $form->selectDate(($pdluo->id > 0 ? $pdluo->eatby : $eatbyselected),
'eatby', 0, 0, 1,
"", 1, 0, ($pdluoid > 0 ? 1 : 0));
246print
'<td>'.$langs->trans(
"UnitPurchaseValue").
'</td>';
247print
'<td colspan="'.(isModEnabled(
'project') ?
'1' :
'3').
'"><input name="unitprice" id="unitprice" size="10" value="'.
GETPOST(
"unitprice").
'"></td>';
248if (isModEnabled(
'project')) {
249 print
'<td>'.$langs->trans(
'Project').
'</td>';
252 $formproject->select_projects(-1,
'',
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth300 widthcentpercentminusx');
258$valformovementlabel = ((
GETPOST(
"label") && (
GETPOST(
'label') != $langs->trans(
"MovementCorrectStock",
''))) ?
GETPOST(
"label") : $langs->trans(
"MovementCorrectStock", $productref));
260print
'<td>'.$langs->trans(
"MovementLabel").
'</td>';
262print
'<input type="text" name="label" class="minwidth400" value="'.dol_escape_htmltag($valformovementlabel).
'">';
264print
'<td>'.$langs->trans(
"InventoryCode").
'</td>';
266print
'<input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET(
"inventorycode") ?
GETPOST(
"inventorycode",
'alpha') :
dol_print_date(
dol_now(),
'%Y%m%d%H%M%S')).
'">';
274print
'<div class="center">';
275print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
276print
' ';
277print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
282<!-- END PHP STOCKCORRECTION.TPL.PHP -->
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...