53 $this->family =
"products";
54 $this->module_position =
'26';
56 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
60 $this->version =
'dolibarr';
62 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
63 $this->picto =
'product';
66 $this->dirs = array(
"/product/temp");
69 $this->hidden =
false;
70 $this->depends = array();
71 $this->requiredby = array(
"modStock",
"modBarcode",
"modProductBatch",
"modVariants",
"modBom");
72 $this->conflictwith = array();
73 $this->phpmin = array(7, 0);
76 $this->config_page_url = array(
"product.php@product");
77 $this->langfiles = array(
"products",
"companies",
"stocks",
"bills");
80 $this->
const = array();
83 $this->
const[$r][0] =
"PRODUCT_CODEPRODUCT_ADDON";
84 $this->
const[$r][1] =
"chaine";
85 $this->
const[$r][2] =
"mod_codeproduct_leopard";
86 $this->
const[$r][3] =
'Module to control product codes';
87 $this->
const[$r][4] = 0;
90 $this->
const[$r][0] =
"PRODUCT_PRICE_UNIQ";
91 $this->
const[$r][1] =
"chaine";
92 $this->
const[$r][2] =
"1";
93 $this->
const[$r][3] =
'pricing rule by default';
94 $this->
const[$r][4] = 0;
105 $this->boxes = array(
106 0=>array(
'file'=>
'box_produits.php',
'enabledbydefaulton'=>
'Home'),
107 1=>array(
'file'=>
'box_produits_alerte_stock.php',
'enabledbydefaulton'=>
'Home'),
108 2=>array(
'file'=>
'box_graph_product_distribution.php',
'enabledbydefaulton'=>
'Home')
112 $this->rights = array();
113 $this->rights_class =
'produit';
116 $this->rights[$r][0] = 31;
117 $this->rights[$r][1] =
'Read products';
118 $this->rights[$r][2] =
'r';
119 $this->rights[$r][3] = 0;
120 $this->rights[$r][4] =
'lire';
123 $this->rights[$r][0] = 32;
124 $this->rights[$r][1] =
'Create/modify products';
125 $this->rights[$r][2] =
'w';
126 $this->rights[$r][3] = 0;
127 $this->rights[$r][4] =
'creer';
130 $this->rights[$r][0] = 33;
131 $this->rights[$r][1] =
'Read prices products';
132 $this->rights[$r][2] =
'w';
133 $this->rights[$r][3] = 0;
134 $this->rights[$r][4] =
'product_advance';
135 $this->rights[$r][5] =
'read_prices';
138 $this->rights[$r][0] = 34;
139 $this->rights[$r][1] =
'Delete products';
140 $this->rights[$r][2] =
'd';
141 $this->rights[$r][3] = 0;
142 $this->rights[$r][4] =
'supprimer';
145 $this->rights[$r][0] = 38;
146 $this->rights[$r][1] =
'Export products';
147 $this->rights[$r][2] =
'r';
148 $this->rights[$r][3] = 0;
149 $this->rights[$r][4] =
'export';
152 $this->rights[$r][0] = 39;
153 $this->rights[$r][1] =
'Ignore minimum price';
154 $this->rights[$r][2] =
'r';
155 $this->rights[$r][3] = 0;
156 $this->rights[$r][4] =
'ignore_price_min_advance';
179 if (is_object($mysoc)) {
180 $usenpr = $mysoc->useNPR();
187 $alias_product_perentity = !
getDolGlobalString(
'MAIN_PRODUCT_PERENTITY_SHARED') ?
"p" :
"ppe";
190 $this->export_code[$r] = $this->rights_class.
'_'.$r;
191 $this->export_label[$r] =
"Products";
192 $this->export_permission[$r] = array(array(
"produit",
"export"));
193 $this->export_fields_array[$r] = array(
194 'p.rowid'=>
"Id",
'p.ref'=>
"Ref",
'p.label'=>
"Label",
195 'p.fk_product_type'=>
'Type',
'p.tosell'=>
"OnSell",
'p.tobuy'=>
"OnBuy",
196 'p.description'=>
"Description",
'p.url'=>
"PublicUrl",
197 'p.customcode'=>
'CustomCode',
'p.fk_country'=>
'IDCountry',
198 $alias_product_perentity .
'.accountancy_code_sell'=>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra'=>
"ProductAccountancySellIntraCode",
199 $alias_product_perentity .
'.accountancy_code_sell_export'=>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy'=>
"ProductAccountancyBuyCode",
200 $alias_product_perentity .
'.accountancy_code_buy_intra'=>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export'=>
"ProductAccountancyBuyExportCode",
201 'p.note'=>
"NotePrivate",
'p.note_public'=>
'NotePublic',
202 'p.weight'=>
"Weight",
'p.weight_units'=>
"WeightUnits",
'p.length'=>
"Length",
'p.length_units'=>
"LengthUnits",
'p.width'=>
"Width",
'p.width_units'=>
"WidthUnits",
'p.height'=>
"Height",
'p.height_units'=>
"HeightUnits",
203 'p.surface'=>
"Surface",
'p.surface_units'=>
"SurfaceUnits",
'p.volume'=>
"Volume",
'p.volume_units'=>
"VolumeUnits",
204 'p.duration'=>
"Duration",
205 'p.finished' =>
'Nature',
206 'p.price_base_type'=>
"PriceBase",
'p.price'=>
"UnitPriceHT",
'p.price_ttc'=>
"UnitPriceTTC",
207 'p.price_min'=>
"MinPriceHT",
'p.price_min_ttc'=>
"MinPriceTTC",
208 'p.tva_tx'=>
'VATRate',
209 'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification'
211 if (is_object($mysoc) && $usenpr) {
212 $this->export_fields_array[$r][
'p.recuperableonly'] =
'NPR';
214 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
215 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.cost_price'=>
'CostPrice'));
217 if (isModEnabled(
'stock')) {
218 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'e.ref'=>
'DefaultWarehouse',
'p.tobatch'=>
'ManageLotSerial',
'p.stock'=>
'Stock',
'p.seuil_stock_alerte'=>
'StockLimit',
'p.desiredstock'=>
'DesiredStock',
'p.pmp'=>
'PMPValue'));
220 if (isModEnabled(
'barcode')) {
221 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
223 $keyforselect =
'product';
224 $keyforelement =
'product';
225 $keyforaliasextra =
'extra';
226 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
227 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
228 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
's.nom'=>
'Supplier',
'pf.ref_fourn'=>
'SupplierRef',
'pf.quantity'=>
'QtyMin',
'pf.remise_percent'=>
'DiscountQtyMin',
'pf.unitprice'=>
'BuyingPrice',
'pf.delivery_time_days'=>
'NbDaysToDelivery'));
231 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'group_concat(cat.label)'=>
'Categories'));
234 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'l.lang'=>
'Language',
'l.label'=>
'TranslatedLabel',
'l.description'=>
'TranslatedDescription',
'l.note'=>
'TranslatedNote'));
237 $this->export_fields_array[$r][
'p.fk_unit'] =
'Unit';
239 $this->export_TypeFields_array[$r] = array(
240 'p.ref'=>
"Text",
'p.label'=>
"Text",
241 'p.fk_product_type'=>
'Numeric',
'p.tosell'=>
"Boolean",
'p.tobuy'=>
"Boolean",
242 'p.description'=>
"Text",
'p.url'=>
"Text",
243 $alias_product_perentity .
'.accountancy_code_sell'=>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra'=>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export'=>
"Text",
244 $alias_product_perentity .
'.accountancy_code_buy'=>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra'=>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export'=>
"Text",
245 'p.note'=>
"Text",
'p.note_public'=>
"Text",
246 'p.weight'=>
"Numeric",
'p.length'=>
"Numeric",
'p.width'=>
"Numeric",
'p.height'=>
"Numeric",
'p.surface'=>
"Numeric",
'p.volume'=>
"Numeric",
247 'p.customcode'=>
'Text',
248 'p.duration'=>
"Text",
249 'p.finished' =>
'Numeric',
250 'p.price_base_type'=>
"Text",
'p.price'=>
"Numeric",
'p.price_ttc'=>
"Numeric",
251 'p.price_min'=>
"Numeric",
'p.price_min_ttc'=>
"Numeric",
252 'p.tva_tx'=>
'Numeric',
253 'p.datec'=>
'Date',
'p.tms'=>
'Date'
255 if (isModEnabled(
'stock')) {
256 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'e.ref'=>
'Text',
'p.tobatch'=>
'Numeric',
'p.stock'=>
'Numeric',
'p.seuil_stock_alerte'=>
'Numeric',
'p.desiredstock'=>
'Numeric',
'p.pmp'=>
'Numeric',
'p.cost_price'=>
'Numeric'));
258 if (isModEnabled(
'barcode')) {
259 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode'=>
'Text'));
261 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
262 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
's.nom'=>
'Text',
'pf.ref_fourn'=>
'Text',
'pf.unitprice'=>
'Numeric',
'pf.quantity'=>
'Numeric',
'pf.remise_percent'=>
'Numeric',
'pf.delivery_time_days'=>
'Numeric'));
265 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'l.lang'=>
'Text',
'l.label'=>
'Text',
'l.description'=>
'Text',
'l.note'=>
'Text'));
268 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
"group_concat(cat.label)"=>
'Text'));
270 $this->export_entities_array[$r] = array();
272 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
"group_concat(cat.label)"=>
'category'));
274 if (isModEnabled(
'stock')) {
275 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock'=>
'product',
'p.pmp'=>
'product'));
277 if (isModEnabled(
'barcode')) {
278 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'product'));
280 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
281 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
's.nom'=>
'product_supplier_ref',
'pf.ref_fourn'=>
'product_supplier_ref',
'pf.unitprice'=>
'product_supplier_ref',
'pf.quantity'=>
'product_supplier_ref',
'pf.remise_percent'=>
'product_supplier_ref',
'pf.delivery_time_days'=>
'product_supplier_ref'));
284 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'l.lang'=>
'translation',
'l.label'=>
'translation',
'l.description'=>
'translation',
'l.note'=>
'translation'));
287 $this->export_dependencies_array[$r] = array(
'category'=>
'p.rowid');
289 if (isModEnabled(
'stock')) {
290 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock'=>
'product',
'p.pmp'=>
'product'));
292 if (isModEnabled(
'barcode')) {
293 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'product'));
295 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
296 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
's.nom'=>
'product_supplier_ref',
'pf.ref_fourn'=>
'product_supplier_ref',
'pf.unitprice'=>
'product_supplier_ref',
'pf.quantity'=>
'product_supplier_ref',
'pf.remise_percent'=>
'product_supplier_ref',
'pf.delivery_time_days'=>
'product_supplier_ref'));
299 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'l.lang'=>
'translation',
'l.label'=>
'translation',
'l.description'=>
'translation',
'l.note'=>
'translation'));
302 $this->export_dependencies_array[$r] = array(
'category'=>
'p.rowid');
304 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
305 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
307 $this->export_sql_end[$r] .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
310 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.
'categorie as cat ON cp.fk_categorie = cat.rowid';
313 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lang as l ON l.fk_product = p.rowid';
315 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object';
316 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
317 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.
'societe s ON s.rowid = pf.fk_soc';
319 if (isModEnabled(
'stock')) {
320 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'entrepot as e ON e.rowid = p.fk_default_warehouse';
322 $this->export_sql_end[$r] .=
' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity(
'product').
')';
324 $this->export_sql_order[$r] =
' GROUP BY p.rowid';
330 $this->export_code[$r] = $this->rights_class.
'_'.$r;
331 $this->export_label[$r] =
"ProductsMultiPrice";
332 $this->export_permission[$r] = array(array(
"produit",
"export"));
333 $this->export_fields_array[$r] = array(
'p.rowid'=>
"Id",
'p.ref'=>
"Ref",
'p.label'=>
"Label",
334 'pr.price_base_type'=>
"PriceBase",
'pr.price_level'=>
"PriceLevel",
335 'pr.price'=>
"PriceLevelUnitPriceHT",
'pr.price_ttc'=>
"PriceLevelUnitPriceTTC",
336 'pr.price_min'=>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc'=>
"MinPriceLevelUnitPriceTTC",
337 'pr.tva_tx'=>
'PriceLevelVATRate',
338 'pr.date_price'=>
'DateCreation');
339 if (is_object($mysoc) && $usenpr) {
340 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
348 $this->export_entities_array[$r] = array(
'p.rowid'=>
"product",
'p.ref'=>
"product",
'p.label'=>
"Label",
349 'pr.price_base_type'=>
"product",
'pr.price_level'=>
"product",
'pr.price'=>
"product",
350 'pr.price_ttc'=>
"product",
351 'pr.price_min'=>
"product",
'pr.price_min_ttc'=>
"product",
352 'pr.tva_tx'=>
'product',
353 'pr.recuperableonly'=>
'product',
354 'pr.date_price'=>
"product");
355 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
356 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
357 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity;
358 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
359 $this->export_sql_end[$r] .=
' AND pr.date_price = (SELECT MAX(pr2.date_price) FROM '.MAIN_DB_PREFIX.
'product_price as pr2 WHERE pr2.fk_product = pr.fk_product AND pr2.price_level = pr.price_level AND pr2.entity IN ('.
getEntity(
'product').
'))';
360 $this->export_sql_end[$r] .=
' ORDER BY p.ref, pr.price_level';
366 $this->export_code[$r] = $this->rights_class.
'_'.$r;
367 $this->export_label[$r] =
"ProductsPricePerCustomer";
368 $this->export_permission[$r] = array(array(
"produit",
"export"));
369 $this->export_fields_array[$r] = array(
'p.rowid'=>
"Id",
'p.ref'=>
"Ref",
'p.label'=>
"Label",
370 's.nom'=>
'ThirdParty',
371 's.code_client'=>
'CodeClient',
372 'pr.price_base_type'=>
"PriceBase",
373 'pr.price'=>
"PriceUnitPriceHT",
'pr.price_ttc'=>
"PriceUnitPriceTTC",
374 'pr.price_min'=>
"MinPriceUnitPriceHT",
'pr.price_min_ttc'=>
"MinPriceUnitPriceTTC",
375 'pr.tva_tx'=>
'PriceVATRate',
376 'pr.default_vat_code'=>
'PriceVATCode',
377 'pr.datec'=>
'DateCreation');
378 if (is_object($mysoc) && $usenpr) {
379 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
381 $this->export_entities_array[$r] = array(
'p.rowid'=>
"product",
'p.ref'=>
"product",
'p.label'=>
"Label",
383 's.code_client'=>
'company',
384 'pr.price_base_type'=>
"product",
'pr.price'=>
"product",
385 'pr.price_ttc'=>
"product",
386 'pr.price_min'=>
"product",
'pr.price_min_ttc'=>
"product",
387 'pr.tva_tx'=>
'product',
388 'pr.default_vat_code'=>
'product',
389 'pr.recuperableonly'=>
'product',
390 'pr.datec'=>
"product");
391 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
392 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
393 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity;
394 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON pr.fk_soc = s.rowid';
395 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
401 $this->export_code[$r] = $this->rights_class.
'_'.$r;
402 $this->export_label[$r] =
"AssociatedProducts";
403 $this->export_permission[$r] = array(array(
"produit",
"export"));
404 $this->export_fields_array[$r] = array(
405 'p.rowid'=>
"Id",
'p.ref'=>
"Ref",
'p.label'=>
"Label",
'p.description'=>
"Description",
'p.url'=>
"PublicUrl",
406 $alias_product_perentity .
'.accountancy_code_sell'=>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra'=>
"ProductAccountancySellIntraCode",
407 $alias_product_perentity .
'.accountancy_code_sell_export'=>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy'=>
"ProductAccountancyBuyCode",
408 $alias_product_perentity .
'.accountancy_code_buy_intra'=>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export'=>
"ProductAccountancyBuyExportCode",
409 'p.note'=>
"NotePrivate",
'p.note_public'=>
'NotePublic',
410 'p.weight'=>
"Weight",
'p.length'=>
"Length",
'p.surface'=>
"Surface",
'p.volume'=>
"Volume",
'p.customcode'=>
'CustomCode',
411 'p.price_base_type'=>
"PriceBase",
'p.price'=>
"UnitPriceHT",
'p.price_ttc'=>
"UnitPriceTTC",
'p.tva_tx'=>
'VATRate',
'p.tosell'=>
"OnSell",
412 'p.tobuy'=>
"OnBuy",
'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification'
414 if (isModEnabled(
'stock')) {
415 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.stock'=>
'Stock',
'p.seuil_stock_alerte'=>
'StockLimit',
'p.desiredstock'=>
'DesiredStock',
'p.pmp'=>
'PMPValue'));
417 if (isModEnabled(
'barcode')) {
418 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
420 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'pa.qty'=>
'Qty',
'pa.incdec'=>
'ComposedProductIncDecStock'));
421 $this->export_TypeFields_array[$r] = array(
422 'p.ref'=>
"Text",
'p.label'=>
"Text",
'p.description'=>
"Text",
'p.url'=>
"Text",
423 $alias_product_perentity .
'.accountancy_code_sell'=>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra'=>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export'=>
"Text",
424 $alias_product_perentity .
'.accountancy_code_buy'=>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra'=>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export'=>
"Text",
425 'p.note'=>
"Text",
'p.note_public'=>
"Text",
426 'p.weight'=>
"Numeric",
'p.length'=>
"Numeric",
'p.surface'=>
"Numeric",
'p.volume'=>
"Numeric",
'p.customcode'=>
'Text',
427 'p.price_base_type'=>
"Text",
'p.price'=>
"Numeric",
'p.price_ttc'=>
"Numeric",
'p.tva_tx'=>
'Numeric',
'p.tosell'=>
"Boolean",
'p.tobuy'=>
"Boolean",
428 'p.datec'=>
'Date',
'p.tms'=>
'Date'
430 if (isModEnabled(
'stock')) {
431 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.stock'=>
'Numeric',
'p.seuil_stock_alerte'=>
'Numeric',
'p.desiredstock'=>
'Numeric',
'p.pmp'=>
'Numeric',
'p.cost_price'=>
'Numeric'));
433 if (isModEnabled(
'barcode')) {
434 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode'=>
'Text'));
436 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'pa.qty'=>
'Numeric'));
437 $this->export_entities_array[$r] = array(
438 'p.rowid'=>
"virtualproduct",
'p.ref'=>
"virtualproduct",
'p.label'=>
"virtualproduct",
'p.description'=>
"virtualproduct",
'p.url'=>
"virtualproduct",
439 $alias_product_perentity .
'.accountancy_code_sell'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_intra'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_export'=>
'virtualproduct',
440 $alias_product_perentity .
'.accountancy_code_buy'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_intra'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_export'=>
'virtualproduct',
441 'p.note'=>
"virtualproduct",
'p.length'=>
"virtualproduct",
442 'p.surface'=>
"virtualproduct",
'p.volume'=>
"virtualproduct",
'p.weight'=>
"virtualproduct",
'p.customcode'=>
'virtualproduct',
443 'p.price_base_type'=>
"virtualproduct",
'p.price'=>
"virtualproduct",
'p.price_ttc'=>
"virtualproduct",
'p.tva_tx'=>
"virtualproduct",
444 'p.tosell'=>
"virtualproduct",
'p.tobuy'=>
"virtualproduct",
'p.datec'=>
"virtualproduct",
'p.tms'=>
"virtualproduct"
446 if (isModEnabled(
'stock')) {
447 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock'=>
'virtualproduct',
'p.seuil_stock_alerte'=>
'virtualproduct',
'p.desiredstock'=>
'virtualproduct',
'p.pmp'=>
'virtualproduct'));
449 if (isModEnabled(
'barcode')) {
450 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'virtualproduct'));
452 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'pa.qty'=>
"subproduct",
'pa.incdec'=>
'subproduct'));
453 $keyforselect =
'product';
454 $keyforelement =
'product';
455 $keyforaliasextra =
'extra';
456 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
457 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p2.rowid'=>
"Id",
'p2.ref'=>
"Ref",
'p2.label'=>
"Label",
'p2.description'=>
"Description"));
458 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p2.rowid'=>
"subproduct",
'p2.ref'=>
"subproduct",
'p2.label'=>
"subproduct",
'p2.description'=>
"subproduct"));
459 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
460 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
462 $this->export_sql_end[$r] .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
464 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object,';
465 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'product_association as pa, '.MAIN_DB_PREFIX.
'product as p2';
466 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
467 $this->export_sql_end[$r] .=
' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
477 $this->import_code[$r] = $this->rights_class.
'_'.$r;
478 $this->import_label[$r] =
"Products";
479 $this->import_icon[$r] = $this->picto;
480 $this->import_entities_array[$r] = array();
481 $this->import_tables_array[$r] = array(
'p'=>MAIN_DB_PREFIX.
'product',
'extra'=>MAIN_DB_PREFIX.
'product_extrafields');
482 $this->import_tables_creator_array[$r] = array(
'p'=>
'fk_user_author');
483 $this->import_fields_array[$r] = array(
485 'p.label' =>
"Label*",
486 'p.fk_product_type' =>
"Type*",
487 'p.tosell' =>
"OnSell*",
488 'p.tobuy' =>
"OnBuy*",
489 'p.description' =>
"Description",
490 'p.url' =>
"PublicUrl",
491 'p.customcode' =>
'CustomCode',
492 'p.fk_country' =>
'CountryCode',
493 'p.accountancy_code_sell' =>
"ProductAccountancySellCode",
494 'p.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
495 'p.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode",
496 'p.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
497 'p.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode",
498 'p.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
499 'p.note_public' =>
"NotePublic",
500 'p.note' =>
"NotePrivate",
501 'p.weight' =>
"Weight",
502 'p.weight_units' =>
"WeightUnits",
503 'p.length' =>
"Length",
504 'p.length_units' =>
"LengthUnits",
505 'p.width' =>
"Width",
506 'p.width_units' =>
"WidthUnits",
507 'p.height' =>
"Height",
508 'p.height_units' =>
"HeightUnits",
509 'p.surface' =>
"Surface",
510 'p.surface_units' =>
"SurfaceUnits",
511 'p.volume' =>
"Volume",
512 'p.volume_units' =>
"VolumeUnits",
513 'p.duration' =>
"Duration",
514 'p.finished' =>
'Nature',
515 'p.price' =>
"SellingPriceHT",
516 'p.price_min' =>
"MinPrice",
517 'p.price_ttc' =>
"SellingPriceTTC",
518 'p.price_min_ttc' =>
"SellingMinPriceTTC",
519 'p.price_base_type' =>
"PriceBaseType",
520 'p.tva_tx' =>
'VATRate',
521 'p.datec' =>
'DateCreation',
522 'p.cost_price' =>
"CostPrice"
525 $this->import_convertvalue_array[$r] = array(
526 'p.weight_units' => array(
527 'rule' =>
'fetchscalefromcodeunits',
528 'classfile' =>
'/core/class/cunits.class.php',
532 'dict' =>
'DictionaryMeasuringUnits'
534 'p.length_units' => array(
535 'rule' =>
'fetchscalefromcodeunits',
536 'classfile' =>
'/core/class/cunits.class.php',
540 'dict' =>
'DictionaryMeasuringUnits'
542 'p.width_units' => array(
543 'rule' =>
'fetchscalefromcodeunits',
544 'classfile' =>
'/core/class/cunits.class.php',
548 'dict' =>
'DictionaryMeasuringUnits'
550 'p.height_units' => array(
551 'rule' =>
'fetchscalefromcodeunits',
552 'classfile' =>
'/core/class/cunits.class.php',
556 'dict' =>
'DictionaryMeasuringUnits'
558 'p.surface_units' => array(
559 'rule' =>
'fetchscalefromcodeunits',
560 'classfile' =>
'/core/class/cunits.class.php',
563 'units' =>
'surface',
564 'dict' =>
'DictionaryMeasuringUnits'
566 'p.volume_units' => array(
567 'rule' =>
'fetchscalefromcodeunits',
568 'classfile' =>
'/core/class/cunits.class.php',
572 'dict' =>
'DictionaryMeasuringUnits'
574 'p.fk_country' => array(
575 'rule' =>
'fetchidfromcodeid',
576 'classfile' =>
'/core/class/ccountry.class.php',
577 'class' =>
'Ccountry',
579 'dict' =>
'DictionaryCountry'
581 'p.finished'=> array(
582 'rule' =>
'fetchidfromcodeorlabel',
583 'classfile' =>
'/core/class/cproductnature.class.php',
584 'class' =>
'CProductNature',
586 'dict' =>
'DictionaryProductNature'
588 'p.accountancy_code_sell'=>array(
'rule'=>
'accountingaccount'),
589 'p.accountancy_code_sell_intra'=>array(
'rule'=>
'accountingaccount'),
590 'p.accountancy_code_sell_export'=>array(
'rule'=>
'accountingaccount'),
591 'p.accountancy_code_buy'=>array(
'rule'=>
'accountingaccount'),
592 'p.accountancy_code_buy_intra'=>array(
'rule'=>
'accountingaccount'),
593 'p.accountancy_code_buy_export'=>array(
'rule'=>
'accountingaccount'),
596 $this->import_regex_array[$r] = array(
598 'p.price_base_type' =>
'\AHT\z|\ATTC\z',
599 'p.tosell' =>
'^[0|1]$',
600 'p.tobuy' =>
'^[0|1]$',
601 'p.fk_product_type' =>
'^[0|1]$',
602 'p.datec' =>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
603 'p.recuperableonly' =>
'^[0|1]$',
606 if (isModEnabled(
'stock')) {
607 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
608 'p.fk_default_warehouse'=>
'DefaultWarehouse',
609 'p.tobatch'=>
'ManageLotSerial',
610 'p.seuil_stock_alerte' =>
'StockLimit',
611 'p.pmp' =>
'PMPValue',
612 'p.desiredstock' =>
'DesiredStock'
615 $this->import_regex_array[$r] = array_merge($this->import_regex_array[$r], array(
616 'p.tobatch' =>
'^[0|1|2]$'
619 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
620 'p.fk_default_warehouse' => array(
621 'rule' =>
'fetchidfromref',
622 'classfile' =>
'/product/stock/class/entrepot.class.php',
623 'class' =>
'Entrepot',
625 'element'=>
'Warehouse'
630 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
631 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.cost_price'=>
'CostPrice'));
633 if (is_object($mysoc) && $usenpr) {
634 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.recuperableonly'=>
'NPR'));
636 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
637 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax1_tx'=>
'LT1',
'p.localtax1_type'=>
'LT1Type'));
639 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
640 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax2_tx'=>
'LT2',
'p.localtax2_type'=>
'LT2Type'));
642 if (isModEnabled(
'barcode')) {
643 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
646 $this->import_fields_array[$r][
'p.fk_unit'] =
'Unit';
650 $import_extrafield_sample = array();
651 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0, ".$conf->entity.
")";
652 $resql = $this->db->query($sql);
654 while ($obj = $this->db->fetch_object($resql)) {
655 $fieldname =
'extra.'.$obj->name;
656 $fieldlabel = ucfirst($obj->label);
657 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
658 $import_extrafield_sample[$fieldname] = $fieldlabel;
662 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'product');
665 $import_sample = array(
666 'p.ref' =>
"ref:PREF123456",
668 'p.label' =>
"Product name in default language",
669 'p.description' =>
"Product description in default language",
670 'p.note_public' =>
"a public note (free text)",
671 'p.note' =>
"a private note (free text)",
672 'p.customcode' =>
'customs code',
673 'p.fk_country' =>
'FR',
675 'p.price_min' =>
"100",
676 'p.price_ttc' =>
"110",
677 'p.price_min_ttc' =>
"110",
678 'p.price_base_type' =>
"HT (show/use price excl. tax) / TTC (show/use price incl. tax)",
680 'p.tosell' =>
"0 (not for sale to customer, eg. raw material) / 1 (for sale)",
681 'p.tobuy' =>
"0 (not for purchase from supplier, eg. virtual product) / 1 (for purchase)",
682 'p.fk_product_type' =>
"0 (product) / 1 (service)",
683 'p.duration' =>
"eg. 365d/12m/1y",
684 'p.url' =>
'link to product (no https)',
685 'p.accountancy_code_sell' =>
"",
686 'p.accountancy_code_sell_intra' =>
"",
687 'p.accountancy_code_sell_export' =>
"",
688 'p.accountancy_code_buy' =>
"",
689 'p.accountancy_code_buy_intra' =>
"",
690 'p.accountancy_code_buy_export' =>
"",
692 'p.weight_units' =>
'kg',
694 'p.length_units' =>
'm',
696 'p.width_units' =>
'm',
698 'p.height_units' =>
'm',
700 'p.surface_units' =>
'm2',
702 'p.volume_units' =>
'm3',
703 'p.finished' =>
'0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.
'c_product_nature"'
706 if (isModEnabled(
'stock')) {
707 $import_sample = array_merge($import_sample, array(
708 'p.tobatch'=>
"0 (don't use) / 1 (use batch) / 2 (use serial number)",
709 'p.seuil_stock_alerte' =>
'',
711 'p.desiredstock' =>
''
714 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
715 $import_sample = array_merge($import_sample, array(
'p.cost_price'=>
'90'));
717 if (is_object($mysoc) && $usenpr) {
718 $import_sample = array_merge($import_sample, array(
'p.recuperableonly'=>
'0'));
720 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
721 $import_sample = array_merge($import_sample, array(
'p.localtax1_tx'=>
'',
'p.localtax1_type'=>
''));
723 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
724 $import_sample = array_merge($import_sample, array(
'p.localtax2_tx'=>
'',
'p.localtax2_type'=>
''));
726 if (isModEnabled(
'barcode')) {
727 $import_sample = array_merge($import_sample, array(
'p.barcode'=>
''));
730 $import_sample = array_merge(
733 'p.fk_unit' =>
'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "'.MAIN_DB_PREFIX.
'c_units"'
737 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
738 'p.fk_unit' => array(
739 'rule' =>
'fetchidfromcodeorlabel',
740 'classfile' =>
'/core/class/cunits.class.php',
743 'dict' =>
'DictionaryUnits'
747 $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
748 $this->import_updatekeys_array[$r] = array(
'p.ref'=>
'Ref');
749 if (isModEnabled(
'barcode')) {
750 $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array(
'p.barcode'=>
'BarCode'));
756 $this->import_code[$r] = $this->rights_class.
'_stock_by_warehouse';
757 $this->import_label[$r] =
"ProductStockWarehouse";
758 $this->import_icon[$r] = $this->picto;
759 $this->import_entities_array[$r] = array();
760 $this->import_tables_array[$r] = array(
'pwp'=>MAIN_DB_PREFIX.
'product_warehouse_properties');
761 $this->import_fields_array[$r] = array(
'pwp.fk_product'=>
"Product*",
762 'pwp.fk_entrepot'=>
"Warehouse*",
'pwp.seuil_stock_alerte'=>
"StockLimit",
763 'pwp.desiredstock'=>
"DesiredStock");
764 $this->import_regex_array[$r] = array(
765 'pwp.fk_product' =>
'rowid@'.MAIN_DB_PREFIX.
'product',
766 'pwp.fk_entrepot' =>
'rowid@'.MAIN_DB_PREFIX.
'entrepot',
768 $this->import_convertvalue_array[$r] = array(
769 'pwp.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
770 ,
'pwp.fk_entrepot'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/stock/class/entrepot.class.php',
'class'=>
'Entrepot',
'method'=>
'fetch',
'element'=>
'Entrepot')
772 $this->import_examplevalues_array[$r] = array(
'pwp.fk_product'=>
"ref:PRODUCT_REF or id:123456",
773 'pwp.fk_entrepot'=>
"ref:WAREHOUSE_REF or id:123456",
774 'pwp.seuil_stock_alerte'=>
"100",
775 'pwp.desiredstock'=>
"110"
777 $this->import_updatekeys_array[$r] = array(
'pwp.fk_product'=>
'Product',
'pwp.fk_entrepot'=>
'Warehouse');
780 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
783 $this->import_code[$r] = $this->rights_class.
'_supplierprices';
784 $this->import_label[$r] =
"SuppliersPricesOfProductsOrServices";
785 $this->import_icon[$r] = $this->picto;
786 $this->import_entities_array[$r] = array();
787 $this->import_tables_array[$r] = array(
'sp'=>MAIN_DB_PREFIX.
'product_fournisseur_price',
'extra'=>MAIN_DB_PREFIX.
'product_fournisseur_price_extrafields');
788 $this->import_tables_creator_array[$r] = array(
'sp'=>
'fk_user');
789 $this->import_fields_array[$r] = array(
790 'sp.fk_product'=>
"ProductOrService*",
791 'sp.fk_soc' =>
"Supplier*",
792 'sp.ref_fourn' =>
'SupplierRef*',
793 'sp.quantity' =>
"QtyMin*",
794 'sp.tva_tx' =>
'VATRate',
795 'sp.default_vat_code' =>
'VATCode',
796 'sp.delivery_time_days' =>
'NbDaysToDelivery',
797 'sp.supplier_reputation' =>
'SupplierReputation',
798 'sp.status' =>
'Status'
800 if (is_object($mysoc) && $usenpr) {
801 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.recuperableonly'=>
'VATNPR'));
803 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
804 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax1_tx'=>
'LT1',
'sp.localtax1_type'=>
'LT1Type'));
806 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
807 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax2_tx'=>
'LT2',
'sp.localtax2_type'=>
'LT2Type'));
809 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
810 'sp.price'=>
"PriceQtyMinHT*",
811 'sp.unitprice'=>
'UnitPriceHT*',
812 'sp.remise_percent'=>
'DiscountQtyMin'
815 if (isModEnabled(
"multicurrency")) {
816 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
817 'sp.fk_multicurrency'=>
'CurrencyCodeId',
818 'sp.multicurrency_code'=>
'CurrencyCode',
819 'sp.multicurrency_tx'=>
'CurrencyRate',
820 'sp.multicurrency_unitprice'=>
'CurrencyUnitPrice',
821 'sp.multicurrency_price'=>
'CurrencyPrice',
826 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.packaging' =>
'PackagingForThisProduct'));
830 $import_extrafield_sample = array();
831 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.
")";
832 $resql = $this->db->query($sql);
834 while ($obj = $this->db->fetch_object($resql)) {
835 $fieldname =
'extra.'.$obj->name;
836 $fieldlabel = ucfirst($obj->label);
837 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
838 $import_extrafield_sample[$fieldname] = $fieldlabel;
842 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'product_fournisseur_price');
844 $this->import_convertvalue_array[$r] = array(
845 'sp.fk_soc'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty'),
846 'sp.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
849 $this->import_examplevalues_array[$r] = array(
850 'sp.fk_product' =>
"ref:PRODUCT_REF or id:123456",
851 'sp.fk_soc' =>
"My Supplier",
852 'sp.ref_fourn' =>
"XYZ-F123456",
853 'sp.quantity' =>
"5",
856 'sp.unitprice'=>
'50',
857 'sp.remise_percent'=>
'0',
858 'sp.default_vat_code' =>
'',
859 'sp.delivery_time_days' =>
'5',
860 'sp.supplier_reputation' =>
'FAVORITE / NOTTHGOOD / DONOTORDER',
863 if (is_object($mysoc) && $usenpr) {
864 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.recuperableonly'=>
''));
866 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
867 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax1_tx'=>
'LT1',
'sp.localtax1_type'=>
'LT1Type'));
869 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
870 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax2_tx'=>
'LT2',
'sp.localtax2_type'=>
'LT2Type'));
872 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
873 'sp.price' =>
"50.00",
874 'sp.unitprice' =>
'10',
876 'sp.remise_percent' =>
'20'
878 if (isModEnabled(
"multicurrency")) {
879 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
880 'sp.fk_multicurrency'=>
'eg: 2, rowid for code of multicurrency currency',
881 'sp.multicurrency_code'=>
'GBP',
882 'sp.multicurrency_tx'=>
'1.12345',
883 'sp.multicurrency_unitprice'=>
'',
885 'sp.multicurrency_price'=>
''
889 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
890 'sp.packaging'=>
'10',
894 $this->import_updatekeys_array[$r] = array(
'sp.fk_product'=>
'ProductOrService',
'sp.ref_fourn'=>
'SupplierRef',
'sp.fk_soc'=>
'Supplier',
'sp.quantity'=>
"QtyMin");
900 $this->import_code[$r] = $this->rights_class.
'_multiprice';
901 $this->import_label[$r] =
"ProductsOrServiceMultiPrice";
902 $this->import_icon[$r] = $this->picto;
903 $this->import_entities_array[$r] = array();
904 $this->import_tables_array[$r] = array(
'pr'=>MAIN_DB_PREFIX.
'product_price');
905 $this->import_tables_creator_array[$r] = array(
'pr'=>
'fk_user_author');
906 $this->import_fields_array[$r] = array(
'pr.fk_product'=>
"ProductOrService*",
907 'pr.price_base_type'=>
"PriceBase",
'pr.price_level'=>
"PriceLevel",
908 'pr.price'=>
"PriceLevelUnitPriceHT",
'pr.price_ttc'=>
"PriceLevelUnitPriceTTC",
909 'pr.price_min'=>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc'=>
"MinPriceLevelUnitPriceTTC",
910 'pr.date_price'=>
'DateCreation*');
912 $this->import_fields_array[$r][
'pr.tva_tx'] =
'VATRate';
914 if (is_object($mysoc) && $usenpr) {
915 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'pr.recuperableonly'=>
'NPR'));
917 $this->import_regex_array[$r] = array(
'pr.datec'=>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
'pr.recuperableonly'=>
'^[0|1]$');
918 $this->import_convertvalue_array[$r] = array(
919 'pr.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
921 $this->import_examplevalues_array[$r] = array(
'pr.fk_product'=>
"ref:PRODUCT_REF or id:123456",
922 'pr.price_base_type'=>
"HT (for excl tax) or TTC (for inc tax)",
'pr.price_level'=>
"1",
923 'pr.price'=>
"100",
'pr.price_ttc'=>
"110",
924 'pr.price_min'=>
"100",
'pr.price_min_ttc'=>
"110",
926 'pr.recuperableonly'=>
'0',
927 'pr.date_price'=>
'2020-12-31');
933 $this->import_code[$r] = $this->rights_class.
'_languages';
934 $this->import_label[$r] =
"ProductsOrServicesTranslations";
935 $this->import_icon[$r] = $this->picto;
936 $this->import_entities_array[$r] = array();
937 $this->import_tables_array[$r] = array(
'l'=>MAIN_DB_PREFIX.
'product_lang');
939 $this->import_fields_array[$r] = array(
'l.fk_product'=>
'ProductOrService*',
'l.lang'=>
'Language*',
'l.label'=>
'TranslatedLabel',
'l.description'=>
'TranslatedDescription');
941 $this->import_convertvalue_array[$r] = array(
942 'l.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
944 $this->import_examplevalues_array[$r] = array(
'l.fk_product'=>
'ref:PRODUCT_REF or id:123456',
'l.lang'=>
'en_US',
'l.label'=>
'Label in en_US',
'l.description'=>
'Desc in en_US');
945 $this->import_updatekeys_array[$r] = array(
'l.fk_product'=>
'ProductOrService',
'l.lang'=>
'Language');