23 if (empty($conf) || !is_object($conf)) {
24 print
"Error, template page can't be called as URL";
30 <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
33 if ($object->element ==
'product') {
34 $productref = $object->ref;
37 $langs->load(
"productbatch");
44 print
'<script type="text/javascript">
45 jQuery(document).ready(function() {
48 if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
49 else jQuery("#unitprice").prop("disabled", true);
52 jQuery("#mouvement").change(function() {
53 console.log("We change the direction of movement");
56 jQuery("#nbpiece").keyup(function(event) {
57 console.log("We enter a qty on "+event.which);
58 if ( event.which == 54 ) { /* char - */
59 console.log("We set direction to value 1");
60 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("-", ""));
62 jQuery("#mouvement option").removeAttr("selected").change();
63 jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change");
64 jQuery("#mouvement").trigger("change");
65 } else if ( event.which == 187 ) { /* char + */
66 console.log("We set direction to value 0");
67 jQuery("#mouvement option").removeAttr("selected").change();
68 jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change");
69 jQuery("#mouvement").trigger("change");
78 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'" method="post">'.
"\n";
82 print
'<input type="hidden" name="token" value="'.newToken().
'">';
83 print
'<input type="hidden" name="action" value="correct_stock">';
84 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
85 print
'<table class="border centpercent">';
89 if ($object->element ==
'product') {
90 print
'<td class="fieldrequired">'.$langs->trans(
"Warehouse").
'</td>';
92 $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')));
93 if (empty($ident) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) {
94 $ident = $conf->global->MAIN_DEFAULT_WAREHOUSE;
96 print
img_picto(
'',
'stock').$formproduct->selectWarehouses($ident,
'id_entrepot',
'warehouseopen,warehouseinternal', 1, 0, 0,
'', 0, 0, null,
'minwidth100');
99 if ($object->element ==
'stock') {
100 print
'<td class="fieldrequired">'.$langs->trans(
"Product").
'</td>';
103 $form->select_produits(
GETPOST(
'product_id',
'int'),
'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES) ?
'0' :
''), 0, 0, -1, 2,
'', 0, null, 0, 1, 0,
'maxwidth500');
106 print
'<td class="fieldrequired">'.$langs->trans(
"NumberOfUnit").
'</td>';
108 if ($object->element ==
'product' || $object->element ==
'stock') {
109 print
'<select name="mouvement" id="mouvement" class="minwidth125 valignmiddle">';
110 print
'<option value="0">'.$langs->trans(
"Add").
'</option>';
111 print
'<option value="1"'.(GETPOST(
'mouvement') ?
' selected="selected"' :
'').
'>'.$langs->trans(
"Delete").
'</option>';
115 print
'<input name="nbpiece" id="nbpiece" class="center valignmiddle maxwidth75" value="'.GETPOST(
"nbpiece").
'">';
120 if (!empty($conf->global->PRODUIT_SOUSPRODUITS) && $object->element ==
'product' && $object->hasFatherOrChild(1)) {
123 print
'<td colspan="3">';
124 print
'<input type="checkbox" name="disablesubproductstockchange" id="disablesubproductstockchange" value="1"'.(GETPOST(
'disablesubproductstockchange') ?
' checked="checked"' :
'').
'">';
125 print
' <label for="disablesubproductstockchange">'.$langs->trans(
"DisableStockChangeOfSubProduct").
'</label>';
131 if (!empty($conf->productbatch->enabled) &&
132 (($object->element ==
'product' && $object->hasbatch())
133 || ($object->element ==
'stock'))
136 print
'<td'.($object->element ==
'stock' ?
'' :
' class="fieldrequired"').
'>'.$langs->trans(
"batch_number").
'</td><td colspan="3">';
137 print
'<input type="text" name="batch_number" class="minwidth300" value="'.GETPOST(
"batch_number").
'">';
141 if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
142 print
'<td>'.$langs->trans(
"SellByDate").
'</td><td>';
144 print
$form->selectDate($sellbyselected,
'sellby',
'',
'', 1,
"");
147 if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
148 print
'<td>'.$langs->trans(
"EatByDate").
'</td><td>';
150 print
$form->selectDate($eatbyselected,
'eatby',
'',
'', 1,
"");
158 print
'<td>'.$langs->trans(
"UnitPurchaseValue").
'</td>';
159 print
'<td colspan="'.(!empty($conf->project->enabled) ?
'1' :
'3').
'"><input name="unitprice" id="unitprice" size="10" value="'.
GETPOST(
"unitprice").
'"></td>';
160 if (!empty($conf->project->enabled)) {
161 print
'<td>'.$langs->trans(
'Project').
'</td>';
164 $formproject->select_projects(-1,
'',
'projectid', 0, 0, 1, 0, 0, 0, 0,
'', 0, 0,
'maxwidth300 widthcentpercentminusx');
170 $valformovementlabel = ((
GETPOST(
"label") && (
GETPOST(
'label') != $langs->trans(
"MovementCorrectStock",
''))) ?
GETPOST(
"label") : $langs->trans(
"MovementCorrectStock", $productref));
172 print
'<td>'.$langs->trans(
"MovementLabel").
'</td>';
174 print
'<input type="text" name="label" class="minwidth400" value="'.dol_escape_htmltag($valformovementlabel).
'">';
176 print
'<td>'.$langs->trans(
"InventoryCode").
'</td>';
178 print
'<input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET(
"inventorycode") ?
GETPOST(
"inventorycode",
'alpha') :
dol_print_date(
dol_now(),
'%Y%m%d%H%M%S')).
'">';
186 print
'<div class="center">';
187 print
'<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'">';
188 print
' ';
189 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans(
"Cancel")).
'">';
194 <!-- END PHP STOCKCORRECTION.TPL.PHP -->
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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...
dol_now($mode= 'auto')
Return date for now.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve', $idforemptyvalue= '-1')
Convert a html select field into an ajax combobox.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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_get_fiche_end($notab=0)
Return tab footer of a card.