50 $this->family =
"products";
51 $this->module_position =
'39';
53 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
57 $this->version =
'dolibarr';
59 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
60 $this->picto =
'stock';
63 $this->dirs = array(
"/stock/temp");
65 $this->config_page_url = array(
"stock.php");
68 $this->hidden =
false;
69 $this->depends = array(
"modProduct");
70 $this->requiredby = array(
"modProductBatch");
71 $this->conflictwith = array();
72 $this->phpmin = array(7, 0);
73 $this->langfiles = array(
"stocks");
76 $this->
const = array();
79 $this->
const[$r] = array(
'STOCK_ALLOW_NEGATIVE_TRANSFER',
'chaine',
'1',
'', 1);
82 $this->
const[$r][0] =
"STOCK_ADDON_PDF";
83 $this->
const[$r][1] =
"chaine";
84 $this->
const[$r][2] =
"standard";
85 $this->
const[$r][3] =
'Name of PDF model of stock';
86 $this->
const[$r][4] = 0;
89 $this->
const[$r][0] =
"MOUVEMENT_ADDON_PDF";
90 $this->
const[$r][1] =
"chaine";
91 $this->
const[$r][2] =
"stdmovement";
92 $this->
const[$r][3] =
'Name of PDF model of stock movement';
93 $this->
const[$r][4] = 0;
96 $this->
const[$r][0] =
"STOCK_ADDON_PDF_ODT_PATH";
97 $this->
const[$r][1] =
"chaine";
98 $this->
const[$r][2] =
"DOL_DATA_ROOT/doctemplates/stocks";
99 $this->
const[$r][3] =
"";
100 $this->
const[$r][4] = 0;
103 $this->
const[$r][0] =
"MOUVEMENT_ADDON_PDF_ODT_PATH";
104 $this->
const[$r][1] =
"chaine";
105 $this->
const[$r][2] =
"DOL_DATA_ROOT/doctemplates/stocks/mouvements";
106 $this->
const[$r][3] =
"";
107 $this->
const[$r][4] = 0;
110 $this->boxes = array();
113 $this->rights = array();
114 $this->rights_class =
'stock';
118 $this->rights[$r][0] = 1001;
119 $this->rights[$r][1] =
'Read stocks';
120 $this->rights[$r][2] =
'r';
121 $this->rights[$r][3] = 0;
122 $this->rights[$r][4] =
'lire';
123 $this->rights[$r][5] =
'';
126 $this->rights[$r][0] = 1002;
127 $this->rights[$r][1] =
'Create/Modify stocks';
128 $this->rights[$r][2] =
'w';
129 $this->rights[$r][3] = 0;
130 $this->rights[$r][4] =
'creer';
131 $this->rights[$r][5] =
'';
134 $this->rights[$r][0] = 1003;
135 $this->rights[$r][1] =
'Delete stock';
136 $this->rights[$r][2] =
'd';
137 $this->rights[$r][3] = 0;
138 $this->rights[$r][4] =
'supprimer';
139 $this->rights[$r][5] =
'';
142 $this->rights[$r][0] = 1004;
143 $this->rights[$r][1] =
'Read stock movements';
144 $this->rights[$r][2] =
'r';
145 $this->rights[$r][3] = 0;
146 $this->rights[$r][4] =
'mouvement';
147 $this->rights[$r][5] =
'lire';
150 $this->rights[$r][0] = 1005;
151 $this->rights[$r][1] =
'Create/modify stock movements';
152 $this->rights[$r][2] =
'w';
153 $this->rights[$r][3] = 0;
154 $this->rights[$r][4] =
'mouvement';
155 $this->rights[$r][5] =
'creer';
158 $this->rights[$r][0] = 1011;
159 $this->rights[$r][1] =
'inventoryReadPermission';
160 $this->rights[$r][3] = 0;
161 $this->rights[$r][4] =
'inventory_advance';
162 $this->rights[$r][5] =
'read';
165 $this->rights[$r][0] = 1012;
166 $this->rights[$r][1] =
'inventoryCreatePermission';
167 $this->rights[$r][3] = 0;
168 $this->rights[$r][4] =
'inventory_advance';
169 $this->rights[$r][5] =
'write';
172 $this->rights[$r][0] = 1013;
173 $this->rights[$r][1] =
'inventoryDeletePermission';
174 $this->rights[$r][3] = 0;
175 $this->rights[$r][4] =
'inventory_advance';
176 $this->rights[$r][5] =
'delete';
180 $this->rights[$r][0] = 1014;
181 $this->rights[$r][1] =
'inventoryValidatePermission';
182 $this->rights[$r][3] = 0;
183 $this->rights[$r][4] =
'inventory_advance';
184 $this->rights[$r][5] =
'validate';
187 $this->rights[$r][0] = 1015;
188 $this->rights[$r][1] =
'inventoryChangePMPPermission';
189 $this->rights[$r][3] = 0;
190 $this->rights[$r][4] =
'inventory_advance';
191 $this->rights[$r][5] =
'changePMP';
195 $this->menu = array();
209 $this->export_code[$r] = $this->rights_class.
'_emplacement';
210 $this->export_label[$r] =
"Warehouses";
211 $this->export_icon[$r] =
"warehouse";
212 $this->export_permission[$r] = array(array(
"stock",
"lire"));
213 $this->export_fields_array[$r] = array(
214 'e.rowid'=>
'IdWarehouse',
'e.ref'=>
'LocationSummary',
'e.description'=>
'DescWareHouse',
'e.lieu'=>
'LieuWareHouse',
'e.address'=>
'Address',
'e.zip'=>
'Zip',
'e.town'=>
'Town',
215 'd.code_departement'=>
'Departement',
'c.code'=>
'CountryCode',
216 'e.phone'=>
'Phone',
'e.fax'=>
'Fax',
'e.statut'=>
'Status',
'pe.rowid'=>
'ParentWarehouse',
'pe.ref'=>
'LocationSummary'
218 $this->export_TypeFields_array[$r] = array(
219 'e.ref'=>
'Text',
'e.description'=>
'Text',
'e.lieu'=>
'Text',
'e.address'=>
'Text',
'e.zip'=>
'Text',
'e.town'=>
'Text',
220 'd.code_departement'=>
'List:c_departements:code_departement:code_departement:',
'c.code'=>
'List:c_country:code:code:',
221 'e.phone'=>
'Text',
'e.fax'=>
'Text',
'e.statut'=>
'Text',
'pe.rowid'=>
'List:entrepot:ref:rowid:stock',
'pe.ref'=>
'Text'
223 $this->export_entities_array[$r] = array();
224 $this->export_aggregate_array[$r] = array();
225 $keyforselect =
'warehouse';
226 $keyforelement =
'warehouse';
227 $keyforaliasextra =
'extra';
228 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
230 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
231 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'entrepot as e';
232 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_departements as d ON d.rowid = e.fk_departement';
233 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_country as c ON c.rowid = e.fk_pays';
234 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'entrepot as pe ON pe.rowid = e.fk_parent';
235 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'entrepot_extrafields as extra ON extra.fk_object = e.rowid';
236 $this->export_sql_end[$r] .=
' WHERE e.entity IN ('.getEntity(
'stock').
')';
240 $this->export_code[$r] = $this->rights_class.
'_emplacement_product';
241 $this->export_label[$r] =
"Stocks";
242 $this->export_icon[$r] =
"warehouse";
243 $this->export_permission[$r] = array(array(
"stock",
"lire"));
244 $this->export_fields_array[$r] = array(
245 'e.rowid'=>
'IdWarehouse',
'e.ref'=>
'LocationSummary',
'e.description'=>
'DescWareHouse',
'e.lieu'=>
'LieuWareHouse',
'e.address'=>
'Address',
'e.zip'=>
'Zip',
'e.town'=>
'Town',
246 'p.rowid'=>
"ProductId",
'p.ref'=>
"Ref",
'p.fk_product_type'=>
"Type",
'p.label'=>
"Label",
'p.description'=>
"Description",
'p.note'=>
"Note",
247 'p.price'=>
"Price",
'p.tva_tx'=>
'VAT',
'p.tosell'=>
"OnSell",
'p.tobuy'=>
'OnBuy',
'p.duration'=>
"Duration",
248 'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification',
'p.pmp'=>
'PMPValue',
'p.cost_price'=>
'CostPrice',
249 'p.seuil_stock_alerte'=>
'StockLimit',
'p.barcode'=>
'BarCode',
'bt.libelle'=>
'BarcodeType',
251 if (isModEnabled(
'barcode')) {
252 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
254 $this->export_TypeFields_array[$r] = array(
255 'e.rowid'=>
'List:entrepot:ref::stock',
'e.ref'=>
'Text',
'e.lieu'=>
'Text',
'e.address'=>
'Text',
'e.zip'=>
'Text',
'e.town'=>
'Text',
256 'p.rowid'=>
"Numeric",
'p.ref'=>
"Text",
'p.fk_product_type'=>
"Text",
'p.label'=>
"Text",
'p.description'=>
"Text",
'p.note'=>
"Text",
257 'p.price'=>
"Numeric",
'p.tva_tx'=>
'Numeric',
'p.tosell'=>
"Boolean",
'p.tobuy'=>
"Boolean",
'p.duration'=>
"Duree",
258 'p.datec'=>
'Date',
'p.tms'=>
'Date',
'p.pmp'=>
'Numeric',
'p.cost_price'=>
'Numeric',
259 'ps.reel'=>
'Numeric',
260 'p.seuil_stock_alerte'=>
'Numeric',
'p.barcode'=>
'Text',
'bt.libelle'=>
'List:c_barcode_type:libelle',
262 if (isModEnabled(
'barcode')) {
263 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode'=>
'Text'));
265 $this->export_entities_array[$r] = array(
266 'p.rowid'=>
"product",
'p.ref'=>
"product",
'p.fk_product_type'=>
"product",
'p.label'=>
"product",
'p.description'=>
"product",
'p.note'=>
"product",
267 'p.price'=>
"product",
'p.tva_tx'=>
'product',
'p.tosell'=>
"product",
'p.tobuy'=>
"product",
'p.duration'=>
"product",
268 'p.datec'=>
'product',
'p.tms'=>
'product',
'p.pmp'=>
'product',
'p.cost_price'=>
'product',
270 'p.seuil_stock_alerte'=>
'product',
'p.barcode'=>
'product',
'bt.libelle'=>
'c_barcode_type',
272 if (isModEnabled(
'barcode')) {
273 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'product'));
275 $this->export_aggregate_array[$r] = array(
'ps.reel'=>
'SUM');
276 $this->export_dependencies_array[$r] = array(
'stock'=>array(
'p.rowid',
'e.rowid'));
277 $keyforselect =
'product';
278 $keyforelement =
'product';
279 $keyforaliasextra =
'extra';
280 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
281 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'ps.reel'=>
'Stock'));
283 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
284 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
285 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON extra.fk_object = p.rowid';
286 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'c_barcode_type as bt ON bt.rowid = p.fk_barcode_type';
287 $this->export_sql_end[$r] .=
', '.MAIN_DB_PREFIX.
'product_stock as ps, '.MAIN_DB_PREFIX.
'entrepot as e';
288 $this->export_sql_end[$r] .=
' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
289 $this->export_sql_end[$r] .=
' AND e.entity IN ('.getEntity(
'stock').
')';
292 if (isModEnabled(
'productbatch')) {
293 $langs->load(
"productbatch");
298 $this->export_code[$r] = $this->rights_class.
'_emplacement_product_lot';
299 $this->export_label[$r] =
"StocksWithBatch";
300 $this->export_icon[$r] =
"warehouse";
301 $this->export_permission[$r] = array(array(
"stock",
"lire"));
302 $this->export_fields_array[$r] = array(
303 'e.rowid'=>
'IdWarehouse',
'e.ref'=>
'LocationSummary',
'e.description'=>
'DescWareHouse',
'e.lieu'=>
'LieuWareHouse',
'e.address'=>
'Address',
'e.zip'=>
'Zip',
'e.town'=>
'Town',
304 'p.rowid'=>
"ProductId",
'p.ref'=>
"Ref",
'p.fk_product_type'=>
"Type",
'p.label'=>
"Label",
'p.description'=>
"Description",
'p.note'=>
"Note",
305 'p.price'=>
"Price",
'p.tva_tx'=>
'VAT',
'p.tosell'=>
"OnSell",
'p.tobuy'=>
'OnBuy',
'p.duration'=>
"Duration",
306 'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification',
'p.pmp'=>
'PMPValue',
'p.cost_price'=>
'CostPrice',
307 'pb.rowid'=>
'Id',
'pb.batch'=>
'Batch',
'pb.qty'=>
'Qty',
308 'pl.eatby'=>
'EatByDate',
'pl.sellby'=>
'SellByDate'
310 if (isModEnabled(
'barcode')) {
311 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
313 $this->export_TypeFields_array[$r] = array(
314 'e.rowid'=>
'List:entrepot:ref::stock',
'e.ref'=>
'Text',
'e.lieu'=>
'Text',
'e.description'=>
'Text',
'e.address'=>
'Text',
'e.zip'=>
'Text',
'e.town'=>
'Text',
315 'p.rowid'=>
"Numeric",
'p.ref'=>
"Text",
'p.fk_product_type'=>
"Text",
'p.label'=>
"Text",
'p.description'=>
"Text",
'p.note'=>
"Text",
316 'p.price'=>
"Numeric",
'p.tva_tx'=>
'Numeric',
'p.tosell'=>
"Boolean",
'p.tobuy'=>
"Boolean",
'p.duration'=>
"Duree",
317 'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification',
'p.pmp'=>
'PMPValue',
'p.cost_price'=>
'CostPrice',
318 'pb.batch'=>
'Text',
'pb.qty'=>
'Numeric',
319 'pl.eatby'=>
'Date',
'pl.sellby'=>
'Date'
321 if (isModEnabled(
'barcode')) {
322 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode'=>
'Text'));
324 $this->export_entities_array[$r] = array(
325 'p.rowid'=>
"product",
'p.ref'=>
"product",
'p.fk_product_type'=>
"product",
'p.label'=>
"product",
'p.description'=>
"product",
'p.note'=>
"product",
326 'p.price'=>
"product",
'p.tva_tx'=>
'product',
'p.tosell'=>
"product",
'p.tobuy'=>
"product",
'p.duration'=>
"product",
327 'p.datec'=>
'product',
'p.tms'=>
'product',
'p.pmp'=>
'product',
'p.cost_price'=>
'product',
328 'pb.rowid'=>
'batch',
'pb.batch'=>
'batch',
'pb.qty'=>
'batch',
329 'pl.eatby'=>
'batch',
'pl.sellby'=>
'batch'
331 if (isModEnabled(
'barcode')) {
332 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'product'));
334 $this->export_aggregate_array[$r] = array(
'ps.reel'=>
'SUM');
335 $this->export_dependencies_array[$r] = array(
'stockbatch'=>array(
'pb.rowid'),
'batch'=>array(
'pb.rowid'));
336 $keyforselect =
'product_lot';
337 $keyforelement =
'batch';
338 $keyforaliasextra =
'extra';
339 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
341 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
342 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product_batch as pb';
343 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'product_stock as ps ON ps.rowid = pb.fk_product_stock';
344 $this->export_sql_end[$r] .=
' INNER JOIN '.MAIN_DB_PREFIX.
'product as p ON p.rowid = ps.fk_product';
345 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lot as pl ON pl.fk_product = p.rowid AND pl.batch = pb.batch';
346 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lot_extrafields as extra ON extra.fk_object = pl.rowid,';
347 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'entrepot as e';
348 $this->export_sql_end[$r] .=
' WHERE ps.fk_entrepot = e.rowid';
349 $this->export_sql_end[$r] .=
' AND e.entity IN ('.getEntity(
'stock').
')';
354 $this->export_code[$r] = $this->rights_class.
'_movement';
355 $this->export_label[$r] =
"StockMovements";
356 $this->export_icon[$r] =
"movement";
357 $this->export_permission[$r] = array(array(
"stock",
"lire"));
358 $this->export_fields_array[$r] = array(
359 'sm.rowid'=>
'MovementId',
'sm.value'=>
'Qty',
'sm.datem'=>
'DateMovement',
'sm.label'=>
'MovementLabel',
'sm.inventorycode'=>
'InventoryCode',
360 'e.rowid'=>
'IdWarehouse',
'e.ref'=>
'LocationSummary',
'e.description'=>
'DescWareHouse',
'e.lieu'=>
'LieuWareHouse',
'e.address'=>
'Address',
'e.zip'=>
'Zip',
'e.town'=>
'Town',
361 'p.rowid'=>
"ProductId",
'p.ref'=>
"Ref",
'p.fk_product_type'=>
"Type",
'p.label'=>
"Label",
'p.description'=>
"Description",
'p.note'=>
"Note",
362 'p.price'=>
"Price",
'p.tva_tx'=>
'VAT',
'p.tosell'=>
"OnSell",
'p.tobuy'=>
'OnBuy',
'p.duration'=>
"Duration",
'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification'
364 if (isModEnabled(
'barcode')) {
365 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
367 $this->export_TypeFields_array[$r] = array(
368 'sm.rowid'=>
'Numeric',
'sm.value'=>
'Numeric',
'sm.datem'=>
'Date',
'sm.batch'=>
'Text',
'sm.label'=>
'Text',
'sm.inventorycode'=>
'Text',
369 'e.rowid'=>
'List:entrepot:ref::stock',
'e.ref'=>
'Text',
'e.description'=>
'Text',
'e.lieu'=>
'Text',
'e.address'=>
'Text',
'e.zip'=>
'Text',
'e.town'=>
'Text',
370 'p.rowid'=>
"Numeric",
'p.ref'=>
"Text",
'p.fk_product_type'=>
"Text",
'p.label'=>
"Text",
'p.description'=>
"Text",
'p.note'=>
"Text",
371 'p.price'=>
"Numeric",
'p.tva_tx'=>
'Numeric',
'p.tosell'=>
"Boolean",
'p.tobuy'=>
"Boolean",
'p.duration'=>
"Duree",
'p.datec'=>
'Date',
'p.tms'=>
'Date'
373 if (isModEnabled(
'barcode')) {
374 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode'=>
'Text'));
376 $this->export_entities_array[$r] = array(
377 'e.rowid'=>
'warehouse',
'e.ref'=>
'warehouse',
'e.description'=>
'warehouse',
'e.lieu'=>
'warehouse',
'e.address'=>
'warehouse',
'e.zip'=>
'warehouse',
'e.town'=>
'warehouse',
378 'p.rowid'=>
"product",
'p.ref'=>
"product",
'p.fk_product_type'=>
"product",
'p.label'=>
"product",
'p.description'=>
"product",
'p.note'=>
"product",
379 'p.price'=>
"product",
'p.tva_tx'=>
'product',
'p.tosell'=>
"product",
'p.tobuy'=>
"product",
'p.duration'=>
"product",
'p.datec'=>
'product',
'p.tms'=>
'product'
381 if (isModEnabled(
'productbatch')) {
382 $this->export_fields_array[$r][
'sm.batch'] =
'Batch';
383 $this->export_TypeFields_array[$r][
'sm.batch'] =
'Text';
384 $this->export_entities_array[$r][
'sm.batch'] =
'movement';
386 if (isModEnabled(
'barcode')) {
387 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'product'));
389 $this->export_aggregate_array[$r] = array(
'sm.value'=>
'SUM');
390 $this->export_dependencies_array[$r] = array(
'movement'=>array(
'sm.rowid'));
392 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
393 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p, '.MAIN_DB_PREFIX.
'stock_mouvement as sm, '.MAIN_DB_PREFIX.
'entrepot as e';
394 $this->export_sql_end[$r] .=
' WHERE p.rowid = sm.fk_product AND sm.fk_entrepot = e.rowid';
395 $this->export_sql_end[$r] .=
' AND e.entity IN ('.getEntity(
'stock').
')';
404 $this->import_code[$r] = $this->rights_class.
'_'.$r;
405 $this->import_label[$r] =
"Warehouses";
406 $this->import_icon[$r] =
"warehouse";
407 $this->import_entities_array[$r] = array();
408 $this->import_tables_array[$r] = array(
'e'=>MAIN_DB_PREFIX.
'entrepot');
409 $this->import_tables_creator_array[$r] = array(
'e'=>
'fk_user_author');
410 $this->import_fields_array[$r] = array(
'e.ref'=>
"LocationSummary*",
411 'e.description'=>
"DescWareHouse",
412 'e.lieu'=>
"LieuWareHouse",
413 'e.address'=>
"Address",
415 'e.fk_departement'=>
'StateCode',
416 'e.fk_pays'=>
'CountryCode',
419 'e.statut'=>
'Status',
420 'e.fk_parent'=>
'ParentWarehouse'
423 $this->import_convertvalue_array[$r] = array(
424 'e.fk_departement'=>array(
'rule'=>
'fetchidfromcodeid',
'classfile'=>
'/core/class/cstate.class.php',
'class'=>
'Cstate',
'method'=>
'fetch',
'dict'=>
'DictionaryStateCode'),
425 'e.fk_pays'=>array(
'rule'=>
'fetchidfromcodeid',
'classfile'=>
'/core/class/ccountry.class.php',
'class'=>
'Ccountry',
'method'=>
'fetch',
'dict'=>
'DictionaryCountry'),
426 'e.fk_parent'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/stock/class/entrepot.class.php',
'class'=>
'Entrepot',
'method'=>
'fetch',
'element'=>
'ref')
428 $this->import_regex_array[$r] = array(
'e.statut'=>
'^[0|1]');
429 $this->import_examplevalues_array[$r] = array(
'e.ref'=>
"ALM001",
430 'e.description'=>
"Central Warehouse",
432 'e.address'=>
"Route 66",
434 'e.fk_departement'=>
'matches field "code_departement" in table "'.MAIN_DB_PREFIX.
'c_departements"',
435 'e.fk_pays'=>
'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.
'c_country"',
436 'e.phone'=>
'(+33)(0)123456789',
437 'e.fax'=>
'(+33)(0)123456790',
439 'e.fk_parent'=>
'id or ref of warehouse'
441 $this->import_updatekeys_array[$r] = array(
'p.ref'=>
'Ref');
445 $this->import_code[$r] = $this->rights_class.
'_'.$r;
446 $this->import_label[$r] =
"Stocks";
447 $this->import_icon[$r] =
"stock";
448 $this->import_entities_array[$r] = array();
449 $this->import_tables_array[$r] = array(
'ps'=>MAIN_DB_PREFIX.
'product_stock');
450 $this->import_fields_array[$r] = array(
'ps.fk_product'=>
"Product*",
'ps.fk_entrepot'=>
"Warehouse*",
'ps.reel'=>
"Stock*");
452 $this->import_convertvalue_array[$r] = array(
453 'ps.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'product'),
454 'ps.fk_entrepot'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/stock/class/entrepot.class.php',
'class'=>
'Entrepot',
'method'=>
'fetch',
'element'=>
'ref')
456 $this->import_examplevalues_array[$r] = array(
457 'ps.fk_product'=>
"id or ref of product",
'ps.fk_entrepot'=>
"id or ref of warehouse",
'ps.reel'=>
"10"
459 $this->import_updatekeys_array[$r] = array(
'ps.fk_product'=>
'Product',
'ps.fk_entrepot'=>
"Warehouse");
460 $this->import_run_sql_after_array[$r] = array(
461 'UPDATE '.MAIN_DB_PREFIX.
'product as p SET p.stock = (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.
'product_stock ps WHERE ps.fk_product = p.rowid);'