dolibarr 21.0.0-alpha
stocktransfer.tpl.php
1<?php
2/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 *
19 * $object must be defined
20 * $backtopage
21 */
22
23// Protection to avoid direct call of template
24if (empty($conf) || !is_object($conf)) {
25 print "Error, template page can't be called as URL";
26 exit(1);
27}
28
29'
30@phan-var-force Entrepot|MouvementStock $object
31@phan-var-force FormProduct $formproduct
32@phan-var-force string $backtopage
33';
34
35?>
36
37<!-- BEGIN PHP TEMPLATE STOCKTRANSFER.TPL.PHP -->
38<?php
39$productref = '';
40if ($object->element == 'product') {
41 $productref = $object->ref;
42}
43
44$langs->load("productbatch");
45
46if (empty($id)) {
47 $id = $object->id;
48}
49
50$pdluoid = GETPOSTINT('pdluoid');
51
52$pdluo = new Productbatch($db);
53
54if ($pdluoid > 0) {
55 $result = $pdluo->fetch($pdluoid);
56 if ($result > 0) {
57 $pdluoid = $pdluo->id;
58 } else {
59 dol_print_error($db, $pdluo->error, $pdluo->errors);
60 }
61}
62
63print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
64
65print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
66
67print dol_get_fiche_head();
68
69print '<input type="hidden" name="token" value="'.newToken().'">';
70print '<input type="hidden" name="action" value="transfert_stock">';
71print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
72if ($pdluoid) {
73 print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
74}
75print '<table class="border centpercent">';
76
77// Source warehouse or product
78print '<tr>';
79if ($object->element == 'product') {
80 print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
81 print '<td>';
82 print img_picto('', 'stock');
83 $selected = (GETPOST("dwid") ? GETPOSTINT("dwid") : (GETPOST('id_entrepot') ? GETPOSTINT('id_entrepot') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
84 $warehousestatus = 'warehouseopen,warehouseinternal';
85 print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
86 print '</td>';
87}
88if ($object->element == 'stockmouvement') {
89 print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
90 print '<td>';
91 print img_picto('', 'product');
92 $form->select_produits(GETPOSTINT('product_id'), 'product_id', (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') ? '0' : ''), 0, 0, -1, 2, '', 0, array(), 0, 1, 0, 'maxwidth500');
93 print '</td>';
94}
95
96print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
97print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
98print '</td></tr>';
99print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" class="center maxwidth75" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
100print '</tr>';
101
102// Serial / Eat-by date
103if (isModEnabled('productbatch') &&
104(($object->element == 'product' && $object->hasbatch())
105|| ($object->element == 'stockmouvement'))
106) {
107 print '<tr>';
108 print '<td'.($object->element == 'stockmouvement' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
109 if ($pdluoid > 0) {
110 // If form was opened for a specific pdluoid, field is disabled
111 print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
112 print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
113 } else {
114 print img_picto('', 'barcode', 'class="pictofixedwidth"').'<input type="text" name="batch_number" class="minwidth300 widthcentpercentminusx maxwidth300" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
115 }
116 print '</td>';
117 print '</tr>';
118
119 print '<tr>';
120 if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) {
121 print '<td>'.$langs->trans("SellByDate").'</td><td>';
122 print $form->selectDate((!empty($d_sellby) ? $d_sellby : $pdluo->sellby), 'sellby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
123 print '</td>';
124 }
125 if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) {
126 print '<td>'.$langs->trans("EatByDate").'</td><td>';
127 print $form->selectDate((!empty($d_eatby) ? $d_eatby : $pdluo->eatby), 'eatby', 0, 0, 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
128 print '</td>';
129 }
130 print '</tr>';
131}
132
133// Label
134$valformovementlabel = (GETPOST("label") ? GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
135print '<tr>';
136print '<td>'.$langs->trans("MovementLabel").'</td>';
137print '<td>';
138print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
139print '</td>';
140print '<td>'.$langs->trans("InventoryCode").'</td>';
141print '<td>';
142print '<input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET("inventorycode") ? GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%Y%m%d%H%M%S')).'">';
143print '</td>';
144print '</tr>';
145
146print '</table>';
147
148print dol_get_fiche_end();
149
150print '<div class="center">';
151print '<input type="submit" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
152print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
153print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
154print '</div>';
155
156print '</form>';
157?>
158<!-- END PHP STOCKCORRECTION.TPL.PHP -->
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Manage record for batch number management.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_now($mode='auto')
Return date for now.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...