dolibarr 21.0.0-beta
stocktransfer.tpl.php
1<?php
2/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.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
34// Protection to avoid direct call of template
35if (empty($conf) || !is_object($conf)) {
36 print "Error, template page can't be called as URL";
37 exit(1);
38}
39
40'
41@phan-var-force Entrepot|MouvementStock $object
42@phan-var-force FormProduct $formproduct
43@phan-var-force string $backtopage
44';
45
46?>
47
48<!-- BEGIN PHP TEMPLATE STOCKTRANSFER.TPL.PHP -->
49<?php
50$productref = '';
51if ($object->element == 'product') {
53 $productref = $object->ref;
54}
55
56$langs->load("productbatch");
57
58if (empty($id)) {
59 $id = $object->id;
60}
61
62$pdluoid = GETPOSTINT('pdluoid');
63
64$pdluo = new Productbatch($db);
65
66if ($pdluoid > 0) {
67 $result = $pdluo->fetch($pdluoid);
68 if ($result > 0) {
69 $pdluoid = $pdluo->id;
70 } else {
71 dol_print_error($db, $pdluo->error, $pdluo->errors);
72 }
73}
74
75print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
76
77print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
78
79print dol_get_fiche_head();
80
81print '<input type="hidden" name="token" value="'.newToken().'">';
82print '<input type="hidden" name="action" value="transfert_stock">';
83print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
84if ($pdluoid) {
85 print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
86}
87print '<table class="border centpercent">';
88
89// Source warehouse or product
90print '<tr>';
91if ($object->element == 'product') {
93 print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
94 print '<td>';
95 print img_picto('', 'stock');
96 $selected = (GETPOST("dwid") ? GETPOSTINT("dwid") : (GETPOST('id_entrepot') ? GETPOSTINT('id_entrepot') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
97 $warehousestatus = 'warehouseopen,warehouseinternal';
98 print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
99 print '</td>';
100}
101if ($object->element == 'stockmouvement') {
103 print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
104 print '<td>';
105 print img_picto('', 'product');
106 $form->select_produits(GETPOSTINT('product_id'), 'product_id', (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') ? '0' : ''), 0, 0, -1, 2, '', 0, array(), 0, 1, 0, 'maxwidth500');
107 print '</td>';
108}
109
110print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
111print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
112print '</td></tr>';
113print '<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>';
114print '</tr>';
115
116// Serial / Eat-by date
117if (isModEnabled('productbatch') &&
118(($object->element == 'product' && $object->hasbatch())
119|| ($object->element == 'stockmouvement'))
120) {
122 print '<tr>';
123 print '<td'.($object->element == 'stockmouvement' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
124 if ($pdluoid > 0) {
125 // If form was opened for a specific pdluoid, field is disabled
126 print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
127 print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
128 } else {
129 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).'">';
130 }
131 print '</td>';
132 print '</tr>';
133
134 print '<tr>';
135 if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) {
136 print '<td>'.$langs->trans("SellByDate").'</td><td>';
137 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
138 print '</td>';
139 }
140 if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) {
141 print '<td>'.$langs->trans("EatByDate").'</td><td>';
142 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
143 print '</td>';
144 }
145 print '</tr>';
146}
147
148// Label
149$valformovementlabel = (GETPOST("label") ? GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
150print '<tr>';
151print '<td>'.$langs->trans("MovementLabel").'</td>';
152print '<td>';
153print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
154print '</td>';
155print '<td>'.$langs->trans("InventoryCode").'</td>';
156print '<td>';
157print '<input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET("inventorycode") ? GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%Y%m%d%H%M%S')).'">';
158print '</td>';
159print '</tr>';
160
161print '</table>';
162
163print dol_get_fiche_end();
164
165print '<div class="center">';
166print '<input type="submit" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
167print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
168print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
169print '</div>';
170
171print '</form>';
172?>
173<!-- END PHP STOCKCORRECTION.TPL.PHP -->
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79