37 print
"Error, template page can't be called as URL";
42@phan-var-force Entrepot|MouvementStock $object
43@phan-var-force FormProduct $formproduct
44@phan-var-force FormProjets $formproject
45@phan-var-force string $backtopage
50<!-- BEGIN PHP TEMPLATE PRODUCT/STOCK/TPL/STOCKCORRECTION.TPL.PHP -->
54if (
$object->element ==
'product') {
56 $productref = (string)
$object->ref;
59$langs->load(
"productbatch");
71 $result = $pdluo->fetch($pdluoid);
73 $pdluoid = $pdluo->id;
75 dol_print_error($db, $pdluo->error, $pdluo->errors);
96print
'<script type="text/javascript">
97 jQuery(document).ready(function() {
100 if (jQuery("#mouvement").val() == \'0\') jQuery("#unitprice").removeAttr("disabled");
101 else jQuery("#unitprice").prop("disabled", true);
104 jQuery("#mouvement").change(function() {
105 console.log("We change the direction of movement");
108 jQuery("#nbpiece").keyup(function(event) {
109 console.log("We enter a qty on "+event.key);
110 if ( event.key == "-" ) { /* char - */
111 console.log("We set direction to value 1");
112 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("-", ""));
113 jQuery("#mouvement option").removeAttr("selected").change();
114 jQuery("#mouvement option[value=1]").attr("selected","selected").trigger("change");
115 jQuery("#mouvement").trigger("change");
116 } else if ( event.key == "+" ) { /* char + */
117 console.log("We set direction to value 0");
118 jQuery("#nbpiece").val(jQuery("#nbpiece").val().replace("+", ""));
119 jQuery("#mouvement option").removeAttr("selected").change();
120 jQuery("#mouvement option[value=0]").attr("selected","selected").trigger("change");
121 jQuery("#mouvement").trigger("change");
125if ($disableSellBy == 0 || $disableEatBy == 0) {
127 var disableSellBy = \''.dol_escape_js((
string) $disableSellBy).
'\';
128 var disableEatBy = \
''.dol_escape_js((
string) $disableSellBy).
'\';
129 jQuery(
"#batch_number").change(
function(event) {
130 var batch = jQuery(
this).val();
131 jQuery.getJSON(
"'.DOL_URL_ROOT.'/product/ajax/product_lot.php?action=search&token='.currentToken().'&product_id='.$id.'&batch="+batch,
function(data) {
132 if (data.length > 0) {
133 var productLot = data[0];
134 if (disableSellBy == 0) {
135 jQuery(
"#sellby").val(productLot.sellby);
137 if (disableEatBy == 0) {
138 jQuery(
"#eatby").val(productLot.eatby);
148print load_fiche_titre($langs->trans("StockCorrection"), '', 'generic');
150print '<form action=
"'.$_SERVER["PHP_SELF
"].'?id='.$id.'" method=
"post">
'."\n";
152print dol_get_fiche_head(array(), '', '', 0, '', 0, '', '', 0, '', 0, 'marginbottomonly
');
154print '<input
type=
"hidden" name=
"token" value=
"'.newToken().'">
';
155print '<input
type=
"hidden" name=
"action" value=
"correct_stock">
';
156print '<input
type=
"hidden" name=
"backtopage" value=
"'.$backtopage.'">
';
158 print '<input
type=
"hidden" name=
"pdluoid" value=
"'.$pdluoid.'">
';
160print '<
table class=
"border centpercent">
';
162// Warehouse or product
164if ($object->element == 'product
') {
166 print '<td
class=
"fieldrequired">
'.$langs->trans("Warehouse").'</td>
';
168 $ident = (GETPOST("dwid") ? GETPOSTINT("dwid") : (GETPOST('id_entrepot
') ? GETPOSTINT('id_entrepot
') : ($object->element == 'product
' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone
')));
169 if (empty($ident) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE
')) {
170 $ident = getDolGlobalString('MAIN_DEFAULT_WAREHOUSE
');
172 print img_picto('', 'stock
', 'class=
"pictofixedwidth"').$formproduct->selectWarehouses($ident, 'id_entrepot
', 'warehouseopen,warehouseinternal
', 1, 0, 0, '', 0, 0, array(), 'minwidth100 maxwidth300 widthcentpercentminusx
');
175if ($object->element == 'stockmouvement
') {
177 print '<td
class=
"fieldrequired">
'.$langs->trans("Product").'</td>
';
179 print img_picto('', 'product
');
180 $form->select_produits(GETPOSTINT('product_id
'), 'product_id
', (!getDolGlobalString('STOCK_SUPPORTS_SERVICES
') ? '0
' : ''), 0, 0, -1, 2, '', 0, array(), 0, 1, 0, 'maxwidth500
');
183print '<td
class=
"fieldrequired">
'.$langs->trans("NumberOfUnit").'</td>
';
185if ($object->element == 'product
' || $object->element == 'stockmouvement
') {
187 print '<select
name=
"mouvement" id=
"mouvement" class=
"minwidth100 valignmiddle">
';
188 print '<option value=
"0">
'.$langs->trans("Add").'</option>
';
189 print '<option value=
"1"'.(GETPOST('mouvement
') ? ' selected=
"selected"' : '').'>
'.$langs->trans("Delete").'</option>
';
191 print ajax_combobox("mouvement");
193print '<input
name=
"nbpiece" id=
"nbpiece" class=
"center valignmiddle maxwidth75" value=
"'.GETPOST("nbpiece
").'">
';
197// If product is a Kit, we ask if we must disable stock change of subproducts
198if (getDolGlobalString('PRODUIT_SOUSPRODUITS
') && $object->element == 'product
' && $object->hasFatherOrChild(1)) {
202 print '<td colspan=
"3">
';
203 print '<input
type=
"checkbox" name=
"disablesubproductstockchange" id=
"disablesubproductstockchange" value=
"1"'.(GETPOST('disablesubproductstockchange
') ? ' checked=
"checked"' : '').'">';
204 print ' <label for="disablesubproductstockchange
">'.$langs->trans("DisableStockChangeOfSubProduct
").'</label>';
209// Serial / Eat-by date
210if (isModEnabled('productbatch') &&
211(($object->element == 'product' && $object->hasbatch())
212|| ($object->element == 'stockmouvement'))
216 print '<td'.($object->element == 'stockmouvement' ? '' : ' class="fieldrequired
"').'>'.$langs->trans("batch_number
").'</td><td colspan="3
">';
218 // If form was opened for a specific pdluoid, field is disabled
219 print '<input type="text
" name="batch_number_bis
" size="40
" disabled="disabled" value="'.(GETPOST('batch_number
') ? GETPOST('batch_number
') : $pdluo->batch).'">';
220 print '<input type="hidden
" name="batch_number
" value="'.(GETPOST('batch_number
') ? GETPOST('batch_number
') : $pdluo->batch).'">';
222 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 if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) {
229 // print '<td'.($sellByCss ? ' class="'.$sellByCss.'"' : '').'>'.$langs->trans("SellByDate
").'</td><td>';
230 print '<td>'.$langs->trans("SellByDate
").'</td><td>';
231 $sellbyselected = dol_mktime(0, 0, 0, GETPOSTINT('sellbymonth'), GETPOSTINT('sellbyday'), GETPOSTINT('sellbyyear'));
232 // If form was opened for a specific pdluoid, field is disabled
233 print $form->selectDate(($pdluo->id > 0 ? $pdluo->sellby : $sellbyselected), 'sellby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0));
236 if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) {
237 // print '<td'.($eatByCss ? ' class="'.$eatByCss.'"' : '').'>'.$langs->trans("EatByDate
").'</td><td>';
238 print '<td>'.$langs->trans("EatByDate
").'</td><td>';
239 $eatbyselected = dol_mktime(0, 0, 0, GETPOSTINT('eatbymonth'), GETPOSTINT('eatbyday'), GETPOSTINT('eatbyyear'));
240 // If form was opened for a specific pdluoid, field is disabled
241 print $form->selectDate(($pdluo->id > 0 ? $pdluo->eatby : $eatbyselected), 'eatby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0));
247// Purchase price and project
249print '<td>'.$langs->trans("UnitPurchaseValue
").'</td>';
250print '<td colspan="'.(isModEnabled('project
') ? '1
' : '3
').'"><input name="unitprice
" id="unitprice
" size="10
" value="'.GETPOST("unitprice").'"></td>';
251if (isModEnabled('project')) {
252 print '<td>'.$langs->trans('Project').'</td>';
254 print img_picto('', 'project');
255 $formproject->select_projects(-1, '', 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, 'maxwidth300 widthcentpercentminusx');
260// Label for movement of id of inventory
261$valformovementlabel = ((GETPOST("label
") && (GETPOST('label') != $langs->trans("MovementCorrectStock
", ''))) ? GETPOST("label
") : $langs->trans("MovementCorrectStock
", $productref));
263print '<td>'.$langs->trans("MovementLabel
").'</td>';
265print '<input type="text
" name="label
" class="minwidth400
" value="'.dol_escape_htmltag($valformovementlabel).'">';
267print '<td>'.$langs->trans("InventoryCode
").'</td>';
269// Prefix the default inventory code so corrections can be told apart from other movement batches
270print '<input class="maxwidth100onsmartphone
" name="inventorycode
" id="inventorycode
" value="'.(GETPOSTISSET("inventorycode") ? GETPOST("inventorycode", 'alpha
') : getDolGlobalString('STOCK_CORRECTION_CODE_PREFIX
', 'COR-
').dol_print_date(dol_now(), '%Y%m%d%H%M%S
')).'">';
276print dol_get_fiche_end();
278print '<div class="center
">';
279print '<input type="submit
" class="button button-save
" name="save
" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
280print ' ';
281print '<input type="submit
" class="button button-cancel
" name="cancel
" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
288<!-- END PHP STOCKCORRECTION.TPL.PHP -->
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
Manage record for batch number management.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
multi select button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
treeview li table
No Email.
if(!defined( 'CSRFCHECK_WITH_TOKEN'))
$conf db name
Only used if Module[ID]Name translation string is not found.