dolibarr  13.0.2
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  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  *
18  * $object must be defined
19  * $backtopage
20  */
21 
22 // Protection to avoid direct call of template
23 if (empty($conf) || !is_object($conf)) {
24  print "Error, template page can't be called as URL";
25  exit;
26 }
27 
28 ?>
29 
30 <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP -->
31 <?php
32 $productref = '';
33 if ($object->element == 'product') $productref = $object->ref;
34 
35 $langs->load("productbatch");
36 
37 if (empty($id)) $id = $object->id;
38 
39 $pdluoid = GETPOST('pdluoid', 'int');
40 
41 $pdluo = new Productbatch($db);
42 
43 if ($pdluoid > 0)
44 {
45  $result = $pdluo->fetch($pdluoid);
46  if ($result > 0)
47  {
48  $pdluoid = $pdluo->id;
49  } else {
50  dol_print_error($db, $pdluo->error, $pdluo->errors);
51  }
52 }
53 
54 print load_fiche_titre($langs->trans("StockTransfer"), '', 'generic');
55 
56 print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n";
57 
59 
60 print '<input type="hidden" name="token" value="'.newToken().'">';
61 print '<input type="hidden" name="action" value="transfert_stock">';
62 print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
63 if ($pdluoid)
64 {
65  print '<input type="hidden" name="pdluoid" value="'.$pdluoid.'">';
66 }
67 print '<table class="border centpercent">';
68 
69 // Source warehouse or product
70 print '<tr>';
71 if ($object->element == 'product') {
72  print '<td class="fieldrequired">'.$langs->trans("WarehouseSource").'</td>';
73  print '<td>';
74  print img_picto('', 'stock').$formproduct->selectWarehouses((GETPOST("dwid") ?GETPOST("dwid", 'int') : (GETPOST('id_entrepot') ?GETPOST('id_entrepot', 'int') : ($object->element == 'product' && $object->fk_default_warehouse ? $object->fk_default_warehouse : 'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1);
75  print '</td>';
76 }
77 if ($object->element == 'stock') {
78  print '<td class="fieldrequired">'.$langs->trans("Product").'</td>';
79  print '<td>';
80  print img_picto('', 'product');
81  $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');
82  print '</td>';
83 }
84 
85 print '<td class="fieldrequired">'.$langs->trans("WarehouseTarget").'</td><td>';
86 print img_picto('', 'stock').$formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1);
87 print '</td></tr>';
88 print '<tr><td class="fieldrequired">'.$langs->trans("NumberOfUnit").'</td><td colspan="3"><input type="text" name="nbpiece" size="10" value="'.dol_escape_htmltag(GETPOST("nbpiece")).'"></td>';
89 print '</tr>';
90 
91 // Serial / Eat-by date
92 if (!empty($conf->productbatch->enabled) &&
93 (($object->element == 'product' && $object->hasbatch())
94 || ($object->element == 'stock'))
95 )
96 {
97  print '<tr>';
98  print '<td'.($object->element == 'stock' ? '' : ' class="fieldrequired"').'>'.$langs->trans("batch_number").'</td><td colspan="3">';
99  if ($pdluoid > 0)
100  {
101  // If form was opened for a specific pdluoid, field is disabled
102  print '<input type="text" name="batch_number_bis" size="40" disabled="disabled" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
103  print '<input type="hidden" name="batch_number" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
104  } else {
105  print '<input type="text" name="batch_number" size="40" value="'.(GETPOST('batch_number') ?GETPOST('batch_number') : $pdluo->batch).'">';
106  }
107  print '</td>';
108  print '</tr>';
109 
110  print '<tr>';
111  if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
112  print '<td>'.$langs->trans("EatByDate").'</td><td>';
113  print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
114  print '</td>';
115  }
116  if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
117  print '<td>'.$langs->trans("SellByDate").'</td><td>';
118  print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
119  print '</td>';
120  }
121  print '</tr>';
122 }
123 
124 // Label
125 $valformovementlabel = (GETPOST("label") ?GETPOST("label") : $langs->trans("MovementTransferStock", $productref));
126 print '<tr>';
127 print '<td>'.$langs->trans("MovementLabel").'</td>';
128 print '<td>';
129 print '<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($valformovementlabel).'">';
130 print '</td>';
131 print '<td>'.$langs->trans("InventoryCode").'</td><td><input class="maxwidth100onsmartphone" name="inventorycode" id="inventorycode" value="'.(GETPOSTISSET("inventorycode") ? GETPOST("inventorycode", 'alpha') : dol_print_date(dol_now(), '%y%m%d%H%M%S')).'"></td>';
132 print '</tr>';
133 
134 print '</table>';
135 
137 
138 print '<div class="center">';
139 print '<input type="submit" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
140 print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
141 print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
142 print '</div>';
143 
144 print '</form>';
145 ?>
146 <!-- 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.
dol_now($mode= 'auto')
Return date for now.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
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&#39;s its name (generic function)
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
Manage record for batch number management.
print
Draft customers invoices.
Definition: index.php:89
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...