54 $this->family =
"products";
55 $this->module_position =
'26';
57 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
61 $this->version =
'dolibarr';
63 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
64 $this->picto =
'product';
67 $this->dirs = array(
"/product/temp");
70 $this->hidden =
false;
71 $this->depends = array();
72 $this->requiredby = array(
"modStock",
"modBarcode",
"modProductBatch",
"modVariants",
"modBom");
73 $this->conflictwith = array();
74 $this->phpmin = array(7, 0);
77 $this->config_page_url = array(
"product.php@product");
78 $this->langfiles = array(
"products",
"companies",
"stocks",
"bills");
81 $this->
const = array();
84 $this->
const[$r][0] =
"PRODUCT_CODEPRODUCT_ADDON";
85 $this->
const[$r][1] =
"chaine";
86 $this->
const[$r][2] =
"mod_codeproduct_leopard";
87 $this->
const[$r][3] =
'Module to control product codes';
88 $this->
const[$r][4] = 0;
91 $this->
const[$r][0] =
"PRODUCT_PRICE_UNIQ";
92 $this->
const[$r][1] =
"chaine";
93 $this->
const[$r][2] =
"1";
94 $this->
const[$r][3] =
'pricing rule by default';
95 $this->
const[$r][4] = 0;
106 $this->boxes = array(
107 0 => array(
'file' =>
'box_produits.php',
'enabledbydefaulton' =>
'Home'),
108 1 => array(
'file' =>
'box_produits_alerte_stock.php',
'enabledbydefaulton' =>
'Home'),
109 2 => array(
'file' =>
'box_graph_product_distribution.php',
'enabledbydefaulton' =>
'Home')
113 $this->rights = array();
114 $this->rights_class =
'produit';
117 $this->rights[$r][0] = 31;
118 $this->rights[$r][1] =
'Read products';
119 $this->rights[$r][2] =
'r';
120 $this->rights[$r][3] = 0;
121 $this->rights[$r][4] =
'lire';
124 $this->rights[$r][0] = 32;
125 $this->rights[$r][1] =
'Create/modify products';
126 $this->rights[$r][2] =
'w';
127 $this->rights[$r][3] = 0;
128 $this->rights[$r][4] =
'creer';
131 $this->rights[$r][0] = 33;
132 $this->rights[$r][1] =
'Read prices products';
133 $this->rights[$r][2] =
'w';
134 $this->rights[$r][3] = 0;
135 $this->rights[$r][4] =
'product_advance';
136 $this->rights[$r][5] =
'read_prices';
139 $this->rights[$r][0] = 34;
140 $this->rights[$r][1] =
'Delete products';
141 $this->rights[$r][2] =
'd';
142 $this->rights[$r][3] = 0;
143 $this->rights[$r][4] =
'supprimer';
146 $this->rights[$r][0] = 38;
147 $this->rights[$r][1] =
'Export products';
148 $this->rights[$r][2] =
'r';
149 $this->rights[$r][3] = 0;
150 $this->rights[$r][4] =
'export';
153 $this->rights[$r][0] = 39;
154 $this->rights[$r][1] =
'Ignore minimum price';
155 $this->rights[$r][2] =
'r';
156 $this->rights[$r][3] = 0;
157 $this->rights[$r][4] =
'ignore_price_min_advance';
180 if (is_object($mysoc)) {
181 $usenpr = $mysoc->useNPR();
188 $alias_product_perentity = !
getDolGlobalString(
'MAIN_PRODUCT_PERENTITY_SHARED') ?
"p" :
"ppe";
191 $this->export_code[$r] = $this->rights_class.
'_'.$r;
192 $this->export_label[$r] =
"Products";
193 $this->export_permission[$r] = array(array(
"produit",
"export"));
194 $this->export_fields_array[$r] = array(
195 'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
196 'p.fk_product_type' =>
'Type',
'p.tosell' =>
"OnSell",
'p.tobuy' =>
"OnBuy",
197 'p.description' =>
"Description",
'p.url' =>
"PublicUrl",
198 'p.customcode' =>
'CustomCode',
'p.fk_country' =>
'IDCountry',
199 $alias_product_perentity .
'.accountancy_code_sell' =>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
200 $alias_product_perentity .
'.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
201 $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
202 'p.note' =>
"NotePrivate",
'p.note_public' =>
'NotePublic',
203 '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",
204 'p.surface' =>
"Surface",
'p.surface_units' =>
"SurfaceUnits",
'p.volume' =>
"Volume",
'p.volume_units' =>
"VolumeUnits",
205 'p.duration' =>
"Duration",
206 'p.finished' =>
'Nature',
207 'p.price_base_type' =>
"PriceBase",
'p.price' =>
"UnitPriceHT",
'p.price_ttc' =>
"UnitPriceTTC",
208 'p.price_min' =>
"MinPriceHT",
'p.price_min_ttc' =>
"MinPriceTTC",
209 'p.tva_tx' =>
'VATRate',
210 'p.datec' =>
'DateCreation',
'p.tms' =>
'DateModification'
212 if (is_object($mysoc) && $usenpr) {
213 $this->export_fields_array[$r][
'p.recuperableonly'] =
'NPR';
215 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
216 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.cost_price' =>
'CostPrice'));
218 if (isModEnabled(
'stock')) {
219 $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'));
221 if (isModEnabled(
'barcode')) {
222 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode' =>
'BarCode'));
224 $keyforselect =
'product';
225 $keyforelement =
'product';
226 $keyforaliasextra =
'extra';
227 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
228 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
229 $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'));
232 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'group_concat(cat.label)' =>
'Categories'));
235 $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'));
238 $this->export_fields_array[$r][
'p.fk_unit'] =
'Unit';
240 $this->export_TypeFields_array[$r] = array(
241 'p.ref' =>
"Text",
'p.label' =>
"Text",
242 'p.fk_product_type' =>
'Numeric',
'p.tosell' =>
"Boolean",
'p.tobuy' =>
"Boolean",
243 'p.description' =>
"Text",
'p.url' =>
"Text",
244 $alias_product_perentity .
'.accountancy_code_sell' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export' =>
"Text",
245 $alias_product_perentity .
'.accountancy_code_buy' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"Text",
246 'p.note' =>
"Text",
'p.note_public' =>
"Text",
247 'p.weight' =>
"Numeric",
'p.length' =>
"Numeric",
'p.width' =>
"Numeric",
'p.height' =>
"Numeric",
'p.surface' =>
"Numeric",
'p.volume' =>
"Numeric",
248 'p.customcode' =>
'Text',
249 'p.duration' =>
"Text",
250 'p.finished' =>
'Numeric',
251 'p.price_base_type' =>
"Text",
'p.price' =>
"Numeric",
'p.price_ttc' =>
"Numeric",
252 'p.price_min' =>
"Numeric",
'p.price_min_ttc' =>
"Numeric",
253 'p.tva_tx' =>
'Numeric',
254 'p.datec' =>
'Date',
'p.tms' =>
'Date'
256 if (isModEnabled(
'stock')) {
257 $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'));
259 if (isModEnabled(
'barcode')) {
260 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode' =>
'Text'));
262 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
263 $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'));
266 $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'));
269 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
"group_concat(cat.label)" =>
'Text'));
271 $this->export_entities_array[$r] = array();
273 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
"group_concat(cat.label)" =>
'category'));
275 if (isModEnabled(
'stock')) {
276 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock' =>
'product',
'p.pmp' =>
'product'));
278 if (isModEnabled(
'barcode')) {
279 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode' =>
'product'));
281 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
282 $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'));
285 $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'));
288 $this->export_dependencies_array[$r] = array(
'category' =>
'p.rowid');
290 if (isModEnabled(
'stock')) {
291 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock' =>
'product',
'p.pmp' =>
'product'));
293 if (isModEnabled(
'barcode')) {
294 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode' =>
'product'));
296 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
297 $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'));
300 $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'));
303 $this->export_dependencies_array[$r] = array(
'category' =>
'p.rowid');
305 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
306 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
308 $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);
311 $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';
314 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lang as l ON l.fk_product = p.rowid';
316 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object';
317 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
318 $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';
320 if (isModEnabled(
'stock')) {
321 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'entrepot as e ON e.rowid = p.fk_default_warehouse';
323 $this->export_sql_end[$r] .=
' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity(
'product').
')';
325 $this->export_sql_order[$r] =
' GROUP BY p.rowid';
331 $this->export_code[$r] = $this->rights_class.
'_'.$r;
332 $this->export_label[$r] =
"ProductsMultiPrice";
333 $this->export_permission[$r] = array(array(
"produit",
"export"));
334 $this->export_fields_array[$r] = array(
'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
335 'pr.price_base_type' =>
"PriceBase",
'pr.price_level' =>
"PriceLevel",
336 'pr.price' =>
"PriceLevelUnitPriceHT",
'pr.price_ttc' =>
"PriceLevelUnitPriceTTC",
337 'pr.price_min' =>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc' =>
"MinPriceLevelUnitPriceTTC",
338 'pr.tva_tx' =>
'PriceLevelVATRate',
339 'pr.date_price' =>
'DateCreation');
340 if (is_object($mysoc) && $usenpr) {
341 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
349 $this->export_entities_array[$r] = array(
'p.rowid' =>
"product",
'p.ref' =>
"product",
'p.label' =>
"Label",
350 'pr.price_base_type' =>
"product",
'pr.price_level' =>
"product",
'pr.price' =>
"product",
351 'pr.price_ttc' =>
"product",
352 'pr.price_min' =>
"product",
'pr.price_min_ttc' =>
"product",
353 'pr.tva_tx' =>
'product',
354 'pr.recuperableonly' =>
'product',
355 'pr.date_price' =>
"product");
356 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
357 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
358 $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;
359 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
360 $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').
'))';
361 $this->export_sql_end[$r] .=
' ORDER BY p.ref, pr.price_level';
367 $this->export_code[$r] = $this->rights_class.
'_'.$r;
368 $this->export_label[$r] =
"ProductsPricePerCustomer";
369 $this->export_permission[$r] = array(array(
"produit",
"export"));
370 $this->export_fields_array[$r] = array(
'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
371 's.nom' =>
'ThirdParty',
372 's.code_client' =>
'CodeClient',
373 'pr.price_base_type' =>
"PriceBase",
374 'pr.price' =>
"PriceUnitPriceHT",
'pr.price_ttc' =>
"PriceUnitPriceTTC",
375 'pr.price_min' =>
"MinPriceUnitPriceHT",
'pr.price_min_ttc' =>
"MinPriceUnitPriceTTC",
376 'pr.tva_tx' =>
'PriceVATRate',
377 'pr.default_vat_code' =>
'PriceVATCode',
378 'pr.datec' =>
'DateCreation');
379 if (is_object($mysoc) && $usenpr) {
380 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
382 $this->export_entities_array[$r] = array(
'p.rowid' =>
"product",
'p.ref' =>
"product",
'p.label' =>
"Label",
383 's.nom' =>
'company',
384 's.code_client' =>
'company',
385 'pr.price_base_type' =>
"product",
'pr.price' =>
"product",
386 'pr.price_ttc' =>
"product",
387 'pr.price_min' =>
"product",
'pr.price_min_ttc' =>
"product",
388 'pr.tva_tx' =>
'product',
389 'pr.default_vat_code' =>
'product',
390 'pr.recuperableonly' =>
'product',
391 'pr.datec' =>
"product");
392 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
393 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
394 $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;
395 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON pr.fk_soc = s.rowid';
396 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
402 $this->export_code[$r] = $this->rights_class.
'_'.$r;
403 $this->export_label[$r] =
"AssociatedProducts";
404 $this->export_permission[$r] = array(array(
"produit",
"export"));
405 $this->export_fields_array[$r] = array(
406 'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
'p.description' =>
"Description",
'p.url' =>
"PublicUrl",
407 $alias_product_perentity .
'.accountancy_code_sell' =>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
408 $alias_product_perentity .
'.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
409 $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
410 'p.note' =>
"NotePrivate",
'p.note_public' =>
'NotePublic',
411 'p.weight' =>
"Weight",
'p.length' =>
"Length",
'p.surface' =>
"Surface",
'p.volume' =>
"Volume",
'p.customcode' =>
'CustomCode',
412 'p.price_base_type' =>
"PriceBase",
'p.price' =>
"UnitPriceHT",
'p.price_ttc' =>
"UnitPriceTTC",
'p.tva_tx' =>
'VATRate',
'p.tosell' =>
"OnSell",
413 'p.tobuy' =>
"OnBuy",
'p.datec' =>
'DateCreation',
'p.tms' =>
'DateModification'
415 if (isModEnabled(
'stock')) {
416 $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'));
418 if (isModEnabled(
'barcode')) {
419 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode' =>
'BarCode'));
421 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'pa.qty' =>
'Qty',
'pa.incdec' =>
'ComposedProductIncDecStock'));
422 $this->export_TypeFields_array[$r] = array(
423 'p.ref' =>
"Text",
'p.label' =>
"Text",
'p.description' =>
"Text",
'p.url' =>
"Text",
424 $alias_product_perentity .
'.accountancy_code_sell' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export' =>
"Text",
425 $alias_product_perentity .
'.accountancy_code_buy' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"Text",
426 'p.note' =>
"Text",
'p.note_public' =>
"Text",
427 'p.weight' =>
"Numeric",
'p.length' =>
"Numeric",
'p.surface' =>
"Numeric",
'p.volume' =>
"Numeric",
'p.customcode' =>
'Text',
428 'p.price_base_type' =>
"Text",
'p.price' =>
"Numeric",
'p.price_ttc' =>
"Numeric",
'p.tva_tx' =>
'Numeric',
'p.tosell' =>
"Boolean",
'p.tobuy' =>
"Boolean",
429 'p.datec' =>
'Date',
'p.tms' =>
'Date'
431 if (isModEnabled(
'stock')) {
432 $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'));
434 if (isModEnabled(
'barcode')) {
435 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode' =>
'Text'));
437 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'pa.qty' =>
'Numeric'));
438 $this->export_entities_array[$r] = array(
439 'p.rowid' =>
"virtualproduct",
'p.ref' =>
"virtualproduct",
'p.label' =>
"virtualproduct",
'p.description' =>
"virtualproduct",
'p.url' =>
"virtualproduct",
440 $alias_product_perentity .
'.accountancy_code_sell' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_intra' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_export' =>
'virtualproduct',
441 $alias_product_perentity .
'.accountancy_code_buy' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_intra' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_export' =>
'virtualproduct',
442 'p.note' =>
"virtualproduct",
'p.length' =>
"virtualproduct",
443 'p.surface' =>
"virtualproduct",
'p.volume' =>
"virtualproduct",
'p.weight' =>
"virtualproduct",
'p.customcode' =>
'virtualproduct',
444 'p.price_base_type' =>
"virtualproduct",
'p.price' =>
"virtualproduct",
'p.price_ttc' =>
"virtualproduct",
'p.tva_tx' =>
"virtualproduct",
445 'p.tosell' =>
"virtualproduct",
'p.tobuy' =>
"virtualproduct",
'p.datec' =>
"virtualproduct",
'p.tms' =>
"virtualproduct"
447 if (isModEnabled(
'stock')) {
448 $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'));
450 if (isModEnabled(
'barcode')) {
451 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode' =>
'virtualproduct'));
453 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'pa.qty' =>
"subproduct",
'pa.incdec' =>
'subproduct'));
454 $keyforselect =
'product';
455 $keyforelement =
'product';
456 $keyforaliasextra =
'extra';
457 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
458 $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"));
459 $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"));
460 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
461 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
463 $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);
465 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object,';
466 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'product_association as pa, '.MAIN_DB_PREFIX.
'product as p2';
467 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
468 $this->export_sql_end[$r] .=
' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
478 $this->import_code[$r] = $this->rights_class.
'_'.$r;
479 $this->import_label[$r] =
"Products";
480 $this->import_icon[$r] = $this->picto;
481 $this->import_entities_array[$r] = array();
482 $this->import_tables_array[$r] = array(
'p' => MAIN_DB_PREFIX.
'product',
'extra' => MAIN_DB_PREFIX.
'product_extrafields');
483 $this->import_tables_creator_array[$r] = array(
'p' =>
'fk_user_author');
484 $this->import_fields_array[$r] = array(
486 'p.label' =>
"Label*",
487 'p.fk_product_type' =>
"Type*",
488 'p.tosell' =>
"OnSell*",
489 'p.tobuy' =>
"OnBuy*",
490 'p.description' =>
"Description",
491 'p.url' =>
"PublicUrl",
492 'p.customcode' =>
'CustomCode',
493 'p.fk_country' =>
'CountryCode',
494 'p.accountancy_code_sell' =>
"ProductAccountancySellCode",
495 'p.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
496 'p.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode",
497 'p.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
498 'p.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode",
499 'p.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
500 'p.note_public' =>
"NotePublic",
501 'p.note' =>
"NotePrivate",
502 'p.weight' =>
"Weight",
503 'p.weight_units' =>
"WeightUnits",
504 'p.length' =>
"Length",
505 'p.length_units' =>
"LengthUnits",
506 'p.width' =>
"Width",
507 'p.width_units' =>
"WidthUnits",
508 'p.height' =>
"Height",
509 'p.height_units' =>
"HeightUnits",
510 'p.surface' =>
"Surface",
511 'p.surface_units' =>
"SurfaceUnits",
512 'p.volume' =>
"Volume",
513 'p.volume_units' =>
"VolumeUnits",
514 'p.duration' =>
"Duration",
515 'p.finished' =>
'Nature',
516 'p.price' =>
"SellingPriceHT",
517 'p.price_min' =>
"MinPrice",
518 'p.price_ttc' =>
"SellingPriceTTC",
519 'p.price_min_ttc' =>
"SellingMinPriceTTC",
520 'p.price_base_type' =>
"PriceBaseType",
521 'p.tva_tx' =>
'VATRate',
522 'p.datec' =>
'DateCreation',
523 'p.cost_price' =>
"CostPrice"
526 $this->import_convertvalue_array[$r] = array(
527 'p.weight_units' => array(
528 'rule' =>
'fetchscalefromcodeunits',
529 'classfile' =>
'/core/class/cunits.class.php',
533 'dict' =>
'DictionaryMeasuringUnits'
535 'p.length_units' => array(
536 'rule' =>
'fetchscalefromcodeunits',
537 'classfile' =>
'/core/class/cunits.class.php',
541 'dict' =>
'DictionaryMeasuringUnits'
543 'p.width_units' => array(
544 'rule' =>
'fetchscalefromcodeunits',
545 'classfile' =>
'/core/class/cunits.class.php',
549 'dict' =>
'DictionaryMeasuringUnits'
551 'p.height_units' => array(
552 'rule' =>
'fetchscalefromcodeunits',
553 'classfile' =>
'/core/class/cunits.class.php',
557 'dict' =>
'DictionaryMeasuringUnits'
559 'p.surface_units' => array(
560 'rule' =>
'fetchscalefromcodeunits',
561 'classfile' =>
'/core/class/cunits.class.php',
564 'units' =>
'surface',
565 'dict' =>
'DictionaryMeasuringUnits'
567 'p.volume_units' => array(
568 'rule' =>
'fetchscalefromcodeunits',
569 'classfile' =>
'/core/class/cunits.class.php',
573 'dict' =>
'DictionaryMeasuringUnits'
575 'p.fk_country' => array(
576 'rule' =>
'fetchidfromcodeid',
577 'classfile' =>
'/core/class/ccountry.class.php',
578 'class' =>
'Ccountry',
580 'dict' =>
'DictionaryCountry'
582 'p.finished' => array(
583 'rule' =>
'fetchidfromcodeorlabel',
584 'classfile' =>
'/core/class/cproductnature.class.php',
585 'class' =>
'CProductNature',
587 'dict' =>
'DictionaryProductNature'
589 'p.accountancy_code_sell' => array(
'rule' =>
'accountingaccount'),
590 'p.accountancy_code_sell_intra' => array(
'rule' =>
'accountingaccount'),
591 'p.accountancy_code_sell_export' => array(
'rule' =>
'accountingaccount'),
592 'p.accountancy_code_buy' => array(
'rule' =>
'accountingaccount'),
593 'p.accountancy_code_buy_intra' => array(
'rule' =>
'accountingaccount'),
594 'p.accountancy_code_buy_export' => array(
'rule' =>
'accountingaccount'),
597 $this->import_regex_array[$r] = array(
599 'p.price_base_type' =>
'\AHT\z|\ATTC\z',
600 'p.tosell' =>
'^[0|1]$',
601 'p.tobuy' =>
'^[0|1]$',
602 'p.fk_product_type' =>
'^[0|1]$',
603 'p.datec' =>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
604 'p.recuperableonly' =>
'^[0|1]$',
607 if (isModEnabled(
'stock')) {
608 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
609 'p.fk_default_warehouse' =>
'DefaultWarehouse',
610 'p.tobatch' =>
'ManageLotSerial',
611 'p.seuil_stock_alerte' =>
'StockLimit',
612 'p.pmp' =>
'PMPValue',
613 'p.desiredstock' =>
'DesiredStock'
616 $this->import_regex_array[$r] = array_merge($this->import_regex_array[$r], array(
617 'p.tobatch' =>
'^[0|1|2]$'
620 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
621 'p.fk_default_warehouse' => array(
622 'rule' =>
'fetchidfromref',
623 'classfile' =>
'/product/stock/class/entrepot.class.php',
624 'class' =>
'Entrepot',
626 'element' =>
'Warehouse'
631 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
632 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.cost_price' =>
'CostPrice'));
634 if (is_object($mysoc) && $usenpr) {
635 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.recuperableonly' =>
'NPR'));
637 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
638 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax1_tx' =>
'LT1',
'p.localtax1_type' =>
'LT1Type'));
640 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
641 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax2_tx' =>
'LT2',
'p.localtax2_type' =>
'LT2Type'));
643 if (isModEnabled(
'barcode')) {
644 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.barcode' =>
'BarCode'));
647 $this->import_fields_array[$r][
'p.fk_unit'] =
'Unit';
651 $import_extrafield_sample = array();
652 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0, ".
$conf->entity.
")";
653 $resql = $this->db->query($sql);
655 while ($obj = $this->db->fetch_object($resql)) {
656 $fieldname =
'extra.'.$obj->name;
657 $fieldlabel = ucfirst($obj->label);
658 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
659 $import_extrafield_sample[$fieldname] = $fieldlabel;
663 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object' =>
'lastrowid-'.MAIN_DB_PREFIX.
'product');
666 $import_sample = array(
667 'p.ref' =>
"ref:PREF123456",
669 'p.label' =>
"Product name in default language",
670 'p.description' =>
"Product description in default language",
671 'p.note_public' =>
"a public note (free text)",
672 'p.note' =>
"a private note (free text)",
673 'p.customcode' =>
'customs code',
674 'p.fk_country' =>
'FR',
676 'p.price_min' =>
"100",
677 'p.price_ttc' =>
"110",
678 'p.price_min_ttc' =>
"110",
679 'p.price_base_type' =>
"HT (show/use price excl. tax) / TTC (show/use price incl. tax)",
681 'p.tosell' =>
"0 (not for sale to customer, eg. raw material) / 1 (for sale)",
682 'p.tobuy' =>
"0 (not for purchase from supplier, eg. virtual product) / 1 (for purchase)",
683 'p.fk_product_type' =>
"0 (product) / 1 (service)",
684 'p.duration' =>
"eg. 365d/12m/1y",
685 'p.url' =>
'link to product (no https)',
686 'p.accountancy_code_sell' =>
"",
687 'p.accountancy_code_sell_intra' =>
"",
688 'p.accountancy_code_sell_export' =>
"",
689 'p.accountancy_code_buy' =>
"",
690 'p.accountancy_code_buy_intra' =>
"",
691 'p.accountancy_code_buy_export' =>
"",
693 'p.weight_units' =>
'kg',
695 'p.length_units' =>
'm',
697 'p.width_units' =>
'm',
699 'p.height_units' =>
'm',
701 'p.surface_units' =>
'm2',
703 'p.volume_units' =>
'm3',
704 'p.finished' =>
'0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.
'c_product_nature"'
707 if (isModEnabled(
'stock')) {
708 $import_sample = array_merge($import_sample, array(
709 'p.tobatch' =>
"0 (don't use) / 1 (use batch) / 2 (use serial number)",
710 'p.seuil_stock_alerte' =>
'',
712 'p.desiredstock' =>
''
715 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice") || isModEnabled(
'margin')) {
716 $import_sample = array_merge($import_sample, array(
'p.cost_price' =>
'90'));
718 if (is_object($mysoc) && $usenpr) {
719 $import_sample = array_merge($import_sample, array(
'p.recuperableonly' =>
'0'));
721 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
722 $import_sample = array_merge($import_sample, array(
'p.localtax1_tx' =>
'',
'p.localtax1_type' =>
''));
724 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
725 $import_sample = array_merge($import_sample, array(
'p.localtax2_tx' =>
'',
'p.localtax2_type' =>
''));
727 if (isModEnabled(
'barcode')) {
728 $import_sample = array_merge($import_sample, array(
'p.barcode' =>
''));
731 $import_sample = array_merge(
734 '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"'
738 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
739 'p.fk_unit' => array(
740 'rule' =>
'fetchidfromcodeorlabel',
741 'classfile' =>
'/core/class/cunits.class.php',
744 'dict' =>
'DictionaryUnits'
748 $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
749 $this->import_updatekeys_array[$r] = array(
'p.ref' =>
'Ref');
750 if (isModEnabled(
'barcode')) {
751 $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array(
'p.barcode' =>
'BarCode'));
757 $this->import_code[$r] = $this->rights_class.
'_stock_by_warehouse';
758 $this->import_label[$r] =
"ProductStockWarehouse";
759 $this->import_icon[$r] = $this->picto;
760 $this->import_entities_array[$r] = array();
761 $this->import_tables_array[$r] = array(
'pwp' => MAIN_DB_PREFIX.
'product_warehouse_properties');
762 $this->import_fields_array[$r] = array(
'pwp.fk_product' =>
"Product*",
763 'pwp.fk_entrepot' =>
"Warehouse*",
'pwp.seuil_stock_alerte' =>
"StockLimit",
764 'pwp.desiredstock' =>
"DesiredStock");
765 $this->import_regex_array[$r] = array(
766 'pwp.fk_product' =>
'rowid@'.MAIN_DB_PREFIX.
'product',
767 'pwp.fk_entrepot' =>
'rowid@'.MAIN_DB_PREFIX.
'entrepot',
769 $this->import_convertvalue_array[$r] = array(
770 'pwp.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
771 ,
'pwp.fk_entrepot' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/stock/class/entrepot.class.php',
'class' =>
'Entrepot',
'method' =>
'fetch',
'element' =>
'Entrepot')
773 $this->import_examplevalues_array[$r] = array(
'pwp.fk_product' =>
"ref:PRODUCT_REF or id:123456",
774 'pwp.fk_entrepot' =>
"ref:WAREHOUSE_REF or id:123456",
775 'pwp.seuil_stock_alerte' =>
"100",
776 'pwp.desiredstock' =>
"110"
778 $this->import_updatekeys_array[$r] = array(
'pwp.fk_product' =>
'Product',
'pwp.fk_entrepot' =>
'Warehouse');
781 if (isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")) {
784 $this->import_code[$r] = $this->rights_class.
'_supplierprices';
785 $this->import_label[$r] =
"SuppliersPricesOfProductsOrServices";
786 $this->import_icon[$r] = $this->picto;
787 $this->import_entities_array[$r] = array();
788 $this->import_tables_array[$r] = array(
'sp' => MAIN_DB_PREFIX.
'product_fournisseur_price',
'extra' => MAIN_DB_PREFIX.
'product_fournisseur_price_extrafields');
789 $this->import_tables_creator_array[$r] = array(
'sp' =>
'fk_user');
790 $this->import_fields_array[$r] = array(
791 'sp.fk_product' =>
"ProductOrService*",
792 'sp.fk_soc' =>
"Supplier*",
793 'sp.ref_fourn' =>
'SupplierRef*',
794 'sp.quantity' =>
"QtyMin*",
795 'sp.tva_tx' =>
'VATRate',
796 'sp.default_vat_code' =>
'VATCode',
797 'sp.delivery_time_days' =>
'NbDaysToDelivery',
798 'sp.supplier_reputation' =>
'SupplierReputation',
799 'sp.status' =>
'Status'
801 if (is_object($mysoc) && $usenpr) {
802 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.recuperableonly' =>
'VATNPR'));
804 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
805 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax1_tx' =>
'LT1',
'sp.localtax1_type' =>
'LT1Type'));
807 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
808 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax2_tx' =>
'LT2',
'sp.localtax2_type' =>
'LT2Type'));
810 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
811 'sp.price' =>
"PriceQtyMinHT*",
812 'sp.unitprice' =>
'UnitPriceHT*',
813 'sp.remise_percent' =>
'DiscountQtyMin'
816 if (isModEnabled(
"multicurrency")) {
817 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
818 'sp.fk_multicurrency' =>
'CurrencyCodeId',
819 'sp.multicurrency_code' =>
'CurrencyCode',
820 'sp.multicurrency_tx' =>
'CurrencyRate',
821 'sp.multicurrency_unitprice' =>
'CurrencyUnitPrice',
822 'sp.multicurrency_price' =>
'CurrencyPrice',
827 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.packaging' =>
'PackagingForThisProduct'));
831 $import_extrafield_sample = array();
832 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product_fournisseur_price' AND entity IN (0, ".
$conf->entity.
")";
833 $resql = $this->db->query($sql);
835 while ($obj = $this->db->fetch_object($resql)) {
836 $fieldname =
'extra.'.$obj->name;
837 $fieldlabel = ucfirst($obj->label);
838 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
839 $import_extrafield_sample[$fieldname] = $fieldlabel;
843 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object' =>
'lastrowid-'.MAIN_DB_PREFIX.
'product_fournisseur_price');
845 $this->import_convertvalue_array[$r] = array(
846 'sp.fk_soc' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/societe/class/societe.class.php',
'class' =>
'Societe',
'method' =>
'fetch',
'element' =>
'ThirdParty'),
847 'sp.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
850 $this->import_examplevalues_array[$r] = array(
851 'sp.fk_product' =>
"ref:PRODUCT_REF or id:123456",
852 'sp.fk_soc' =>
"My Supplier",
853 'sp.ref_fourn' =>
"XYZ-F123456",
854 'sp.quantity' =>
"5",
857 'sp.unitprice' =>
'50',
858 'sp.remise_percent' =>
'0',
859 'sp.default_vat_code' =>
'',
860 'sp.delivery_time_days' =>
'5',
861 'sp.supplier_reputation' =>
'FAVORITE / NOTTHGOOD / DONOTORDER',
864 if (is_object($mysoc) && $usenpr) {
865 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.recuperableonly' =>
''));
867 if (is_object($mysoc) && $mysoc->useLocalTax(1)) {
868 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax1_tx' =>
'LT1',
'sp.localtax1_type' =>
'LT1Type'));
870 if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
871 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax2_tx' =>
'LT2',
'sp.localtax2_type' =>
'LT2Type'));
873 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
874 'sp.price' =>
"50.00",
875 'sp.unitprice' =>
'10',
877 'sp.remise_percent' =>
'20'
879 if (isModEnabled(
"multicurrency")) {
880 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
881 'sp.fk_multicurrency' =>
'eg: 2, rowid for code of multicurrency currency',
882 'sp.multicurrency_code' =>
'GBP',
883 'sp.multicurrency_tx' =>
'1.12345',
884 'sp.multicurrency_unitprice' =>
'',
886 'sp.multicurrency_price' =>
''
890 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
891 'sp.packaging' =>
'10',
895 $this->import_updatekeys_array[$r] = array(
'sp.fk_product' =>
'ProductOrService',
'sp.ref_fourn' =>
'SupplierRef',
'sp.fk_soc' =>
'Supplier',
'sp.quantity' =>
"QtyMin");
901 $this->import_code[$r] = $this->rights_class.
'_multiprice';
902 $this->import_label[$r] =
"ProductsOrServiceMultiPrice";
903 $this->import_icon[$r] = $this->picto;
904 $this->import_entities_array[$r] = array();
905 $this->import_tables_array[$r] = array(
'pr' => MAIN_DB_PREFIX.
'product_price');
906 $this->import_tables_creator_array[$r] = array(
'pr' =>
'fk_user_author');
907 $this->import_fields_array[$r] = array(
'pr.fk_product' =>
"ProductOrService*",
908 'pr.price_base_type' =>
"PriceBase",
'pr.price_level' =>
"PriceLevel",
909 'pr.price' =>
"PriceLevelUnitPriceHT",
'pr.price_ttc' =>
"PriceLevelUnitPriceTTC",
910 'pr.price_min' =>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc' =>
"MinPriceLevelUnitPriceTTC",
911 'pr.date_price' =>
'DateCreation*');
913 $this->import_fields_array[$r][
'pr.tva_tx'] =
'VATRate';
915 if (is_object($mysoc) && $usenpr) {
916 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'pr.recuperableonly' =>
'NPR'));
918 $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]$');
919 $this->import_convertvalue_array[$r] = array(
920 'pr.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
922 $this->import_examplevalues_array[$r] = array(
'pr.fk_product' =>
"ref:PRODUCT_REF or id:123456",
923 'pr.price_base_type' =>
"HT (for excl tax) or TTC (for inc tax)",
'pr.price_level' =>
"1",
924 'pr.price' =>
"100",
'pr.price_ttc' =>
"110",
925 'pr.price_min' =>
"100",
'pr.price_min_ttc' =>
"110",
927 'pr.recuperableonly' =>
'0',
928 'pr.date_price' =>
'2020-12-31');
934 $this->import_code[$r] = $this->rights_class.
'_languages';
935 $this->import_label[$r] =
"ProductsOrServicesTranslations";
936 $this->import_icon[$r] = $this->picto;
937 $this->import_entities_array[$r] = array();
938 $this->import_tables_array[$r] = array(
'l' => MAIN_DB_PREFIX.
'product_lang');
940 $this->import_fields_array[$r] = array(
'l.fk_product' =>
'ProductOrService*',
'l.lang' =>
'Language*',
'l.label' =>
'TranslatedLabel',
'l.description' =>
'TranslatedDescription');
942 $this->import_convertvalue_array[$r] = array(
943 'l.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
945 $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');
946 $this->import_updatekeys_array[$r] = array(
'l.fk_product' =>
'ProductOrService',
'l.lang' =>
'Language');
952 $this->import_code[$r] = $this->rights_class .
'_' . $r;
953 $this->import_label[$r] =
"AssociatedProducts";
954 $this->import_icon[$r] = $this->picto;
955 $this->import_entities_array[$r] = array();
956 $this->import_tables_array[$r] = array(
'pa' => MAIN_DB_PREFIX .
'product_association');
957 $this->import_fields_array[$r] = array(
'pa.fk_product_pere' =>
'ParentProducts',
'pa.fk_product_fils' =>
'ComposedProduct',
'pa.qty' =>
'Qty',
'pa.incdec' =>
'ComposedProductIncDecStock',
'pa.rang' =>
'rang');
959 $this->import_convertvalue_array[$r] = array(
960 'pa.fk_product_pere' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product'),
961 'pa.fk_product_fils' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
963 $this->import_examplevalues_array[$r] = array(
964 'pa.fk_product_pere' =>
"ref:PREF123456",
965 'pa.fk_product_fils' =>
"ref:PREF123456",
969 $this->import_regex_array[$r] = array(
'pa.fk_product_pere' =>
'rowid@'.MAIN_DB_PREFIX.
'product',
'pa.fk_product_fils' =>
'rowid@'.MAIN_DB_PREFIX.
'product');
970 $this->import_updatekeys_array[$r] = array(
'pa.fk_product_pere' =>
'ref parent',
'pa.fk_product_fils' =>
"ref enfant");