dolibarr 25.0.0-alpha
stocktransfer.tpl.php
1<?php
2/* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2026 Jose Martinez <jose.martinez@pichinov.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
35// Protection to avoid direct call of template
36if (empty($conf) || !is_object($conf)) {
37 print "Error, template page can't be called as URL";
38 exit(1);
39}
40
41'
42@phan-var-force Entrepot|Product|MouvementStock $object
43@phan-var-force FormProduct $formproduct
44@phan-var-force string $backtopage
45';
46
47?>
48
49<!-- BEGIN PHP TEMPLATE PRODUCT/STOCK/TPL/STOCKTRANSFER.TPL.PHP -->
50<?php
51$productref = '';
52if ($object->element == 'product') {
54 $productref = (string) $object->ref;
55}
56
57$langs->load("productbatch");
58
59if (empty($id)) {
60 $id = $object->id;
61}
62
63$pdluoid = GETPOSTINT('pdluoid');
64
65$pdluo = new Productbatch($db);
66
67if ($pdluoid > 0) {
68 $result = $pdluo->fetch($pdluoid);
69 if ($result > 0) {
70 $pdluoid = $pdluo->id;
71 } else {
72 dol_print_error($db, $pdluo->error, $pdluo->errors);
73 }
74}
75
76print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
77
78print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
79
80print dol_get_fiche_head(array(), '', '', 0, '', 0, '', '', 0, '', 0, 'marginbottomonly');
81
82print '<input type="hidden" name="token" value="'.newToken().'">';
83print '<input type="hidden" name="action" value="transfert_stock">';
84print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
85if ($pdluoid) {
86 print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
87}
88print '<table class="border centpercent">';
89
90// Source product or stock movement
91print '<tr>';
92if ($object->element == 'product') {
94 print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
95 print '<td>';
96 print img_picto('', 'stock', 'class="pictofixedwidth"');
97 $selected = (GETPOST("dwid") ? GETPOSTINT("dwid") : (GETPOST('id_entrepot') ? GETPOSTINT('id_entrepot') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone')));
98 $warehousestatus = 'warehouseopen,warehouseinternal';
99 print $formproduct->selectWarehouses($selected, 'id_entrepot', $warehousestatus, 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
100 print '</td>';
101}
102if ($object->element == 'stockmouvement') {
104 print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
105 print '<td>';
106 print img_picto('', 'product', 'class="pictofixedwidth"');
107 $form->select_produits(GETPOSTINT('product_id'), 'product_id', (!getDolGlobalString('STOCK_SUPPORTS_SERVICES') ? '0' : ''), 0, 0, -1, 2, '', 0, array(), 0, 1, 0, 'maxwidth500');
108 print '</td>';
109}
110
111print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
112print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth75 maxwidth300 widthcentpercentminusx');
113print '</td></tr>';
114print '<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>';
115print '</tr>';
116
117// Serial / Eat-by date
118if (isModEnabled('productbatch') &&
119(($object->element == 'product' && $object->hasbatch())
120|| ($object->element == 'stockmouvement'))
121) {
123 print '<tr>';
124 print '<td'.($object->element == 'stockmouvement' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
125 if ($pdluoid > 0) {
126 // If form was opened for a specific pdluoid, field is disabled
127 print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
128 print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ? GETPOST('batch_number') : $pdluo->batch).'">';
129 } else {
130 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).'">';
131 }
132 print '</td>';
133 print '</tr>';
134
135 print '<tr>';
136 if (!getDolGlobalString('PRODUCT_DISABLE_SELLBY')) {
137 print '<td>'.$langs->trans("SellByDate").'</td><td>';
138 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
139 print '</td>';
140 }
141 if (!getDolGlobalString('PRODUCT_DISABLE_EATBY')) {
142 print '<td>'.$langs->trans("EatByDate").'</td><td>';
143 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
144 print '</td>';
145 }
146 print '</tr>';
147}
148
149// Label
150$valformovementlabel = (GETPOST("label") ? GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
151print '<tr>';
152print '<td>'.$langs->trans("MovementLabel").'</td>';
153print '<td>';
154print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
155print '</td>';
156print '<td>'.$langs->trans("InventoryCode").'</td>';
157print '<td>';
158// Prefix the default inventory code so transfers can be told apart from other movement batches
159print '<input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET("inventorycode") ? GETPOST("inventorycode", 'alpha') : getDolGlobalString('STOCK_TRANSFER_CODE_PREFIX', 'TRA-').dol_print_date(dol_now(), '%Y%m%d%H%M%S')).'">';
160print '</td>';
161print '</tr>';
162
163print '</table>';
164
165print dol_get_fiche_end();
166
167print '<div class="center">';
168print '<input type="submit" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
169print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
170print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
171print '</div>';
172
173print '<br>';
174
175print '</form>';
176?>
177<!-- END PHP STOCKCORRECTION.TPL.PHP -->
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Manage record for batch number management.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:519
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:717
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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...
Definition html.lib.php:172
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string