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");
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 = empty($conf->global->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'));
230 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
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'));
267 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
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();
271 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
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'));
286 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
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'));
301 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
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';
306 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
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);
309 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
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').
')';
323 if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) {
324 $this->export_sql_order[$r] =
' GROUP BY p.rowid';
327 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
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.entity IN ('.
getEntity(
'product').
'))';
360 $this->export_sql_end[$r] .=
' ORDER BY p.ref, pr.price_level';
363 if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
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 'pr.price_base_type'=>
"PriceBase",
372 'pr.price'=>
"PriceUnitPriceHT",
'pr.price_ttc'=>
"PriceUnitPriceTTC",
373 'pr.price_min'=>
"MinPriceUnitPriceHT",
'pr.price_min_ttc'=>
"MinPriceUnitPriceTTC",
374 'pr.tva_tx'=>
'PriceVATRate',
375 'pr.default_vat_code'=>
'PriceVATCode',
376 'pr.datec'=>
'DateCreation');
377 if (is_object($mysoc) && $usenpr) {
378 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
380 $this->export_entities_array[$r] = array(
'p.rowid'=>
"product",
'p.ref'=>
"product",
'p.label'=>
"Label",
382 'pr.price_base_type'=>
"product",
'pr.price'=>
"product",
383 'pr.price_ttc'=>
"product",
384 'pr.price_min'=>
"product",
'pr.price_min_ttc'=>
"product",
385 'pr.tva_tx'=>
'product',
386 'pr.default_vat_code'=>
'product',
387 'pr.recuperableonly'=>
'product',
388 'pr.datec'=>
"product");
389 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
390 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
391 $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;
392 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON pr.fk_soc = s.rowid';
393 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
396 if (!empty($conf->global->PRODUIT_SOUSPRODUITS)) {
399 $this->export_code[$r] = $this->rights_class.
'_'.$r;
400 $this->export_label[$r] =
"AssociatedProducts";
401 $this->export_permission[$r] = array(array(
"produit",
"export"));
402 $this->export_fields_array[$r] = array(
403 'p.rowid'=>
"Id",
'p.ref'=>
"Ref",
'p.label'=>
"Label",
'p.description'=>
"Description",
'p.url'=>
"PublicUrl",
404 $alias_product_perentity .
'.accountancy_code_sell'=>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra'=>
"ProductAccountancySellIntraCode",
405 $alias_product_perentity .
'.accountancy_code_sell_export'=>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy'=>
"ProductAccountancyBuyCode",
406 $alias_product_perentity .
'.accountancy_code_buy_intra'=>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export'=>
"ProductAccountancyBuyExportCode",
407 'p.note'=>
"NotePrivate",
'p.note_public'=>
'NotePublic',
408 'p.weight'=>
"Weight",
'p.length'=>
"Length",
'p.surface'=>
"Surface",
'p.volume'=>
"Volume",
'p.customcode'=>
'CustomCode',
409 'p.price_base_type'=>
"PriceBase",
'p.price'=>
"UnitPriceHT",
'p.price_ttc'=>
"UnitPriceTTC",
'p.tva_tx'=>
'VATRate',
'p.tosell'=>
"OnSell",
410 'p.tobuy'=>
"OnBuy",
'p.datec'=>
'DateCreation',
'p.tms'=>
'DateModification'
412 if (isModEnabled(
'stock')) {
413 $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'));
415 if (isModEnabled(
'barcode')) {
416 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
418 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'pa.qty'=>
'Qty',
'pa.incdec'=>
'ComposedProductIncDecStock'));
419 $this->export_TypeFields_array[$r] = array(
420 'p.ref'=>
"Text",
'p.label'=>
"Text",
'p.description'=>
"Text",
'p.url'=>
"Text",
421 $alias_product_perentity .
'.accountancy_code_sell'=>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra'=>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export'=>
"Text",
422 $alias_product_perentity .
'.accountancy_code_buy'=>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra'=>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export'=>
"Text",
423 'p.note'=>
"Text",
'p.note_public'=>
"Text",
424 'p.weight'=>
"Numeric",
'p.length'=>
"Numeric",
'p.surface'=>
"Numeric",
'p.volume'=>
"Numeric",
'p.customcode'=>
'Text',
425 'p.price_base_type'=>
"Text",
'p.price'=>
"Numeric",
'p.price_ttc'=>
"Numeric",
'p.tva_tx'=>
'Numeric',
'p.tosell'=>
"Boolean",
'p.tobuy'=>
"Boolean",
426 'p.datec'=>
'Date',
'p.tms'=>
'Date'
428 if (isModEnabled(
'stock')) {
429 $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'));
431 if (isModEnabled(
'barcode')) {
432 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode'=>
'Text'));
434 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'pa.qty'=>
'Numeric'));
435 $this->export_entities_array[$r] = array(
436 'p.rowid'=>
"virtualproduct",
'p.ref'=>
"virtualproduct",
'p.label'=>
"virtualproduct",
'p.description'=>
"virtualproduct",
'p.url'=>
"virtualproduct",
437 $alias_product_perentity .
'.accountancy_code_sell'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_intra'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_export'=>
'virtualproduct',
438 $alias_product_perentity .
'.accountancy_code_buy'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_intra'=>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_export'=>
'virtualproduct',
439 'p.note'=>
"virtualproduct",
'p.length'=>
"virtualproduct",
440 'p.surface'=>
"virtualproduct",
'p.volume'=>
"virtualproduct",
'p.weight'=>
"virtualproduct",
'p.customcode'=>
'virtualproduct',
441 'p.price_base_type'=>
"virtualproduct",
'p.price'=>
"virtualproduct",
'p.price_ttc'=>
"virtualproduct",
'p.tva_tx'=>
"virtualproduct",
442 'p.tosell'=>
"virtualproduct",
'p.tobuy'=>
"virtualproduct",
'p.datec'=>
"virtualproduct",
'p.tms'=>
"virtualproduct"
444 if (isModEnabled(
'stock')) {
445 $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'));
447 if (isModEnabled(
'barcode')) {
448 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode'=>
'virtualproduct'));
450 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'pa.qty'=>
"subproduct",
'pa.incdec'=>
'subproduct'));
451 $keyforselect =
'product';
452 $keyforelement =
'product';
453 $keyforaliasextra =
'extra';
454 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
455 $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"));
456 $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"));
457 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
458 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
459 if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
460 $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);
462 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object,';
463 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'product_association as pa, '.MAIN_DB_PREFIX.
'product as p2';
464 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
465 $this->export_sql_end[$r] .=
' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
475 $this->import_code[$r] = $this->rights_class.
'_'.$r;
476 $this->import_label[$r] =
"Products";
477 $this->import_icon[$r] = $this->picto;
478 $this->import_entities_array[$r] = array();
479 $this->import_tables_array[$r] = array(
'p'=>MAIN_DB_PREFIX.
'product',
'extra'=>MAIN_DB_PREFIX.
'product_extrafields');
480 $this->import_tables_creator_array[$r] = array(
'p'=>
'fk_user_author');
481 $this->import_fields_array[$r] = array(
483 'p.label' =>
"Label*",
484 'p.fk_product_type' =>
"Type*",
485 'p.tosell' =>
"OnSell*",
486 'p.tobuy' =>
"OnBuy*",
487 'p.description' =>
"Description",
488 'p.url' =>
"PublicUrl",
489 'p.customcode' =>
'CustomCode',
490 'p.fk_country' =>
'CountryCode',
491 'p.accountancy_code_sell' =>
"ProductAccountancySellCode",
492 'p.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
493 'p.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode",
494 'p.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
495 'p.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode",
496 'p.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
497 'p.note_public' =>
"NotePublic",
498 'p.note' =>
"NotePrivate",
499 'p.weight' =>
"Weight",
500 'p.weight_units' =>
"WeightUnits",
501 'p.length' =>
"Length",
502 'p.length_units' =>
"LengthUnits",
503 'p.width' =>
"Width",
504 'p.width_units' =>
"WidthUnits",
505 'p.height' =>
"Height",
506 'p.height_units' =>
"HeightUnits",
507 'p.surface' =>
"Surface",
508 'p.surface_units' =>
"SurfaceUnits",
509 'p.volume' =>
"Volume",
510 'p.volume_units' =>
"VolumeUnits",
511 'p.duration' =>
"Duration",
512 'p.finished' =>
'Nature',
513 'p.price' =>
"SellingPriceHT",
514 'p.price_min' =>
"MinPrice",
515 'p.price_ttc' =>
"SellingPriceTTC",
516 'p.price_min_ttc' =>
"SellingMinPriceTTC",
517 'p.price_base_type' =>
"PriceBaseType",
518 'p.tva_tx' =>
'VATRate',
519 'p.datec' =>
'DateCreation',
520 'p.cost_price' =>
"CostPrice"
523 $this->import_convertvalue_array[$r] = array(
524 'p.weight_units' => array(
525 'rule' =>
'fetchscalefromcodeunits',
526 'classfile' =>
'/core/class/cunits.class.php',
530 'dict' =>
'DictionaryMeasuringUnits'
532 'p.length_units' => array(
533 'rule' =>
'fetchscalefromcodeunits',
534 'classfile' =>
'/core/class/cunits.class.php',
538 'dict' =>
'DictionaryMeasuringUnits'
540 'p.width_units' => array(
541 'rule' =>
'fetchscalefromcodeunits',
542 'classfile' =>
'/core/class/cunits.class.php',
546 'dict' =>
'DictionaryMeasuringUnits'
548 'p.height_units' => array(
549 'rule' =>
'fetchscalefromcodeunits',
550 'classfile' =>
'/core/class/cunits.class.php',
554 'dict' =>
'DictionaryMeasuringUnits'
556 'p.surface_units' => array(
557 'rule' =>
'fetchscalefromcodeunits',
558 'classfile' =>
'/core/class/cunits.class.php',
561 'units' =>
'surface',
562 'dict' =>
'DictionaryMeasuringUnits'
564 'p.volume_units' => array(
565 'rule' =>
'fetchscalefromcodeunits',
566 'classfile' =>
'/core/class/cunits.class.php',
570 'dict' =>
'DictionaryMeasuringUnits'
572 'p.fk_country' => array(
573 'rule' =>
'fetchidfromcodeid',
574 'classfile' =>
'/core/class/ccountry.class.php',
575 'class' =>
'Ccountry',
577 'dict' =>
'DictionaryCountry'
579 'p.finished'=> array(
580 'rule' =>
'fetchidfromcodeorlabel',
581 'classfile' =>
'/core/class/cproductnature.class.php',
582 'class' =>
'CProductNature',
584 'dict' =>
'DictionaryProductNature'
586 'p.accountancy_code_sell'=>array(
'rule'=>
'accountingaccount'),
587 'p.accountancy_code_sell_intra'=>array(
'rule'=>
'accountingaccount'),
588 'p.accountancy_code_sell_export'=>array(
'rule'=>
'accountingaccount'),
589 'p.accountancy_code_buy'=>array(
'rule'=>
'accountingaccount'),
590 'p.accountancy_code_buy_intra'=>array(
'rule'=>
'accountingaccount'),
591 'p.accountancy_code_buy_export'=>array(
'rule'=>
'accountingaccount'),
594 $this->import_regex_array[$r] = array(
596 'p.price_base_type' =>
'\AHT\z|\ATTC\z',
597 'p.tosell' =>
'^[0|1]$',
598 'p.tobuy' =>
'^[0|1]$',
599 'p.fk_product_type' =>
'^[0|1]$',
600 'p.datec' =>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
601 'p.recuperableonly' =>
'^[0|1]$',
604 if (isModEnabled(
'stock')) {
605 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
606 'p.fk_default_warehouse'=>
'DefaultWarehouse',
607 'p.tobatch'=>
'ManageLotSerial',
608 'p.seuil_stock_alerte' =>
'StockLimit',
609 'p.pmp' =>
'PMPValue',
610 'p.desiredstock' =>
'DesiredStock'
613 $this->import_regex_array[$r] = array_merge($this->import_regex_array[$r], array(
614 'p.tobatch' =>
'^[0|1|2]$'
617 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
618 'p.fk_default_warehouse' => array(
619 'rule' =>
'fetchidfromref',
620 'classfile' =>
'/product/stock/class/entrepot.class.php',
621 'class' =>
'Entrepot',
623 'element'=>
'Warehouse'
628 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
629 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.cost_price'=>
'CostPrice'));
631 if (is_object($mysoc) && $usenpr) {
632 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.recuperableonly'=>
'NPR'));
634 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
635 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax1_tx'=>
'LT1',
'p.localtax1_type'=>
'LT1Type'));
637 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
638 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax2_tx'=>
'LT2',
'p.localtax2_type'=>
'LT2Type'));
640 if (isModEnabled(
'barcode')) {
641 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.barcode'=>
'BarCode'));
644 $this->import_fields_array[$r][
'p.fk_unit'] =
'Unit';
648 $import_extrafield_sample = array();
649 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0, ".$conf->entity.
")";
650 $resql = $this->db->query($sql);
652 while ($obj = $this->db->fetch_object($resql)) {
653 $fieldname =
'extra.'.$obj->name;
654 $fieldlabel = ucfirst($obj->label);
655 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
656 $import_extrafield_sample[$fieldname] = $fieldlabel;
660 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'product');
663 $import_sample = array(
664 'p.ref' =>
"ref:PREF123456",
666 'p.label' =>
"Product name in default language",
667 'p.description' =>
"Product description in default language",
668 'p.note_public' =>
"a public note (free text)",
669 'p.note' =>
"a private note (free text)",
670 'p.customcode' =>
'customs code',
671 'p.fk_country' =>
'FR',
673 'p.price_min' =>
"100",
674 'p.price_ttc' =>
"110",
675 'p.price_min_ttc' =>
"110",
676 'p.price_base_type' =>
"HT (show/use price excl. tax) / TTC (show/use price incl. tax)",
678 'p.tosell' =>
"0 (not for sale to customer, eg. raw material) / 1 (for sale)",
679 'p.tobuy' =>
"0 (not for purchase from supplier, eg. virtual product) / 1 (for purchase)",
680 'p.fk_product_type' =>
"0 (product) / 1 (service)",
681 'p.duration' =>
"eg. 365d/12m/1y",
682 'p.url' =>
'link to product (no https)',
683 'p.accountancy_code_sell' =>
"",
684 'p.accountancy_code_sell_intra' =>
"",
685 'p.accountancy_code_sell_export' =>
"",
686 'p.accountancy_code_buy' =>
"",
687 'p.accountancy_code_buy_intra' =>
"",
688 'p.accountancy_code_buy_export' =>
"",
690 'p.weight_units' =>
'kg',
692 'p.length_units' =>
'm',
694 'p.width_units' =>
'm',
696 'p.height_units' =>
'm',
698 'p.surface_units' =>
'm2',
700 'p.volume_units' =>
'm3',
701 'p.finished' =>
'0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.
'c_product_nature"'
704 if (isModEnabled(
'stock')) {
705 $import_sample = array_merge($import_sample, array(
706 'p.tobatch'=>
"0 (don't use) / 1 (use batch) / 2 (use serial number)",
707 'p.seuil_stock_alerte' =>
'',
709 'p.desiredstock' =>
''
712 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
713 $import_sample = array_merge($import_sample, array(
'p.cost_price'=>
'90'));
715 if (is_object($mysoc) && $usenpr) {
716 $import_sample = array_merge($import_sample, array(
'p.recuperableonly'=>
'0'));
718 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
719 $import_sample = array_merge($import_sample, array(
'p.localtax1_tx'=>
'',
'p.localtax1_type'=>
''));
721 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
722 $import_sample = array_merge($import_sample, array(
'p.localtax2_tx'=>
'',
'p.localtax2_type'=>
''));
724 if (isModEnabled(
'barcode')) {
725 $import_sample = array_merge($import_sample, array(
'p.barcode'=>
''));
728 $import_sample = array_merge(
731 '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"'
735 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
736 'p.fk_unit' => array(
737 'rule' =>
'fetchidfromcodeorlabel',
738 'classfile' =>
'/core/class/cunits.class.php',
741 'dict' =>
'DictionaryUnits'
745 $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
746 $this->import_updatekeys_array[$r] = array(
'p.ref'=>
'Ref');
747 if (isModEnabled(
'barcode')) {
748 $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array(
'p.barcode'=>
'BarCode'));
751 if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
754 $this->import_code[$r] = $this->rights_class.
'_stock_by_warehouse';
755 $this->import_label[$r] =
"ProductStockWarehouse";
756 $this->import_icon[$r] = $this->picto;
757 $this->import_entities_array[$r] = array();
758 $this->import_tables_array[$r] = array(
'pwp'=>MAIN_DB_PREFIX.
'product_warehouse_properties');
759 $this->import_fields_array[$r] = array(
'pwp.fk_product'=>
"Product*",
760 'pwp.fk_entrepot'=>
"Warehouse*",
'pwp.seuil_stock_alerte'=>
"StockLimit",
761 'pwp.desiredstock'=>
"DesiredStock");
762 $this->import_regex_array[$r] = array(
763 'pwp.fk_product' =>
'rowid@'.MAIN_DB_PREFIX.
'product',
764 'pwp.fk_entrepot' =>
'rowid@'.MAIN_DB_PREFIX.
'entrepot',
766 $this->import_convertvalue_array[$r] = array(
767 'pwp.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
768 ,
'pwp.fk_entrepot'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/stock/class/entrepot.class.php',
'class'=>
'Entrepot',
'method'=>
'fetch',
'element'=>
'Entrepot')
770 $this->import_examplevalues_array[$r] = array(
'pwp.fk_product'=>
"ref:PRODUCT_REF or id:123456",
771 'pwp.fk_entrepot'=>
"ref:WAREHOUSE_REF or id:123456",
772 'pwp.seuil_stock_alerte'=>
"100",
773 'pwp.desiredstock'=>
"110"
775 $this->import_updatekeys_array[$r] = array(
'pwp.fk_product'=>
'Product',
'pwp.fk_entrepot'=>
'Warehouse');
778 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
781 $this->import_code[$r] = $this->rights_class.
'_supplierprices';
782 $this->import_label[$r] =
"SuppliersPricesOfProductsOrServices";
783 $this->import_icon[$r] = $this->picto;
784 $this->import_entities_array[$r] = array();
785 $this->import_tables_array[$r] = array(
'sp'=>MAIN_DB_PREFIX.
'product_fournisseur_price',
'extra'=>MAIN_DB_PREFIX.
'product_fournisseur_price_extrafields');
786 $this->import_tables_creator_array[$r] = array(
'sp'=>
'fk_user');
787 $this->import_fields_array[$r] = array(
788 'sp.fk_product'=>
"ProductOrService*",
789 'sp.fk_soc' =>
"Supplier*",
790 'sp.ref_fourn' =>
'SupplierRef*',
791 'sp.quantity' =>
"QtyMin*",
792 'sp.tva_tx' =>
'VATRate',
793 'sp.default_vat_code' =>
'VATCode',
794 'sp.delivery_time_days' =>
'NbDaysToDelivery',
795 'sp.supplier_reputation' =>
'SupplierReputation',
796 'sp.status' =>
'Status'
798 if (is_object($mysoc) && $usenpr) {
799 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.recuperableonly'=>
'VATNPR'));
801 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
802 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax1_tx'=>
'LT1',
'sp.localtax1_type'=>
'LT1Type'));
804 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
805 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax2_tx'=>
'LT2',
'sp.localtax2_type'=>
'LT2Type'));
807 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
808 'sp.price'=>
"PriceQtyMinHT*",
809 'sp.unitprice'=>
'UnitPriceHT*',
810 'sp.remise_percent'=>
'DiscountQtyMin'
813 if (isModEnabled(
"multicurrency")) {
814 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
815 'sp.fk_multicurrency'=>
'CurrencyCodeId',
816 'sp.multicurrency_code'=>
'CurrencyCode',
817 'sp.multicurrency_tx'=>
'CurrencyRate',
818 'sp.multicurrency_unitprice'=>
'CurrencyUnitPrice',
819 'sp.multicurrency_price'=>
'CurrencyPrice',
823 if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
824 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.packaging' =>
'PackagingForThisProduct'));
828 $import_extrafield_sample = array();
829 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product_fournisseur_price' AND entity IN (0, ".$conf->entity.
")";
830 $resql = $this->db->query($sql);
832 while ($obj = $this->db->fetch_object($resql)) {
833 $fieldname =
'extra.'.$obj->name;
834 $fieldlabel = ucfirst($obj->label);
835 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
836 $import_extrafield_sample[$fieldname] = $fieldlabel;
840 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object'=>
'lastrowid-'.MAIN_DB_PREFIX.
'product_fournisseur_price');
842 $this->import_convertvalue_array[$r] = array(
843 'sp.fk_soc'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/societe/class/societe.class.php',
'class'=>
'Societe',
'method'=>
'fetch',
'element'=>
'ThirdParty'),
844 'sp.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
847 $this->import_examplevalues_array[$r] = array(
848 'sp.fk_product' =>
"ref:PRODUCT_REF or id:123456",
849 'sp.fk_soc' =>
"My Supplier",
850 'sp.ref_fourn' =>
"XYZ-F123456",
851 'sp.quantity' =>
"5",
854 'sp.unitprice'=>
'50',
855 'sp.remise_percent'=>
'0',
856 'sp.default_vat_code' =>
'',
857 'sp.delivery_time_days' =>
'5',
858 'sp.supplier_reputation' =>
'FAVORITE / NOTTHGOOD / DONOTORDER',
861 if (is_object($mysoc) && $usenpr) {
862 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.recuperableonly'=>
''));
864 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
865 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax1_tx'=>
'LT1',
'sp.localtax1_type'=>
'LT1Type'));
867 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
868 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax2_tx'=>
'LT2',
'sp.localtax2_type'=>
'LT2Type'));
870 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
871 'sp.price' =>
"50.00",
872 'sp.unitprice' =>
'10',
874 'sp.remise_percent' =>
'20'
876 if (isModEnabled(
"multicurrency")) {
877 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
878 'sp.fk_multicurrency'=>
'eg: 2, rowid for code of multicurrency currency',
879 'sp.multicurrency_code'=>
'GBP',
880 'sp.multicurrency_tx'=>
'1.12345',
881 'sp.multicurrency_unitprice'=>
'',
883 'sp.multicurrency_price'=>
''
886 if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
887 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
888 'sp.packaging'=>
'10',
892 $this->import_updatekeys_array[$r] = array(
'sp.fk_product'=>
'ProductOrService',
'sp.ref_fourn'=>
'SupplierRef',
'sp.fk_soc'=>
'Supplier',
'sp.quantity'=>
"QtyMin");
895 if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
898 $this->import_code[$r] = $this->rights_class.
'_multiprice';
899 $this->import_label[$r] =
"ProductsOrServiceMultiPrice";
900 $this->import_icon[$r] = $this->picto;
901 $this->import_entities_array[$r] = array();
902 $this->import_tables_array[$r] = array(
'pr'=>MAIN_DB_PREFIX.
'product_price');
903 $this->import_tables_creator_array[$r] = array(
'pr'=>
'fk_user_author');
904 $this->import_fields_array[$r] = array(
'pr.fk_product'=>
"ProductOrService*",
905 'pr.price_base_type'=>
"PriceBase",
'pr.price_level'=>
"PriceLevel",
906 'pr.price'=>
"PriceLevelUnitPriceHT",
'pr.price_ttc'=>
"PriceLevelUnitPriceTTC",
907 'pr.price_min'=>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc'=>
"MinPriceLevelUnitPriceTTC",
908 'pr.date_price'=>
'DateCreation*');
909 if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {
910 $this->import_fields_array[$r][
'pr.tva_tx'] =
'VATRate';
912 if (is_object($mysoc) && $usenpr) {
913 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'pr.recuperableonly'=>
'NPR'));
915 $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]$');
916 $this->import_convertvalue_array[$r] = array(
917 'pr.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
919 $this->import_examplevalues_array[$r] = array(
'pr.fk_product'=>
"ref:PRODUCT_REF or id:123456",
920 'pr.price_base_type'=>
"HT (for excl tax) or TTC (for inc tax)",
'pr.price_level'=>
"1",
921 'pr.price'=>
"100",
'pr.price_ttc'=>
"110",
922 'pr.price_min'=>
"100",
'pr.price_min_ttc'=>
"110",
924 'pr.recuperableonly'=>
'0',
925 'pr.date_price'=>
'2020-12-31');
931 $this->import_code[$r] = $this->rights_class.
'_languages';
932 $this->import_label[$r] =
"ProductsOrServicesTranslations";
933 $this->import_icon[$r] = $this->picto;
934 $this->import_entities_array[$r] = array();
935 $this->import_tables_array[$r] = array(
'l'=>MAIN_DB_PREFIX.
'product_lang');
937 $this->import_fields_array[$r] = array(
'l.fk_product'=>
'ProductOrService*',
'l.lang'=>
'Language*',
'l.label'=>
'TranslatedLabel',
'l.description'=>
'TranslatedDescription');
939 $this->import_convertvalue_array[$r] = array(
940 'l.fk_product'=>array(
'rule'=>
'fetchidfromref',
'classfile'=>
'/product/class/product.class.php',
'class'=>
'Product',
'method'=>
'fetch',
'element'=>
'Product')
942 $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');
943 $this->import_updatekeys_array[$r] = array(
'l.fk_product'=>
'ProductOrService',
'l.lang'=>
'Language');