51 $this->family =
"products";
52 $this->module_position =
'29';
54 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
58 $this->version =
'dolibarr';
60 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
61 $this->picto =
'service';
64 $this->dirs = array(
"/product/temp");
67 $this->hidden =
false;
68 $this->depends = array();
69 $this->requiredby = array();
70 $this->conflictwith = array();
71 $this->phpmin = array(7, 0);
74 $this->config_page_url = array(
"product.php@product");
75 $this->langfiles = array(
"products",
"companies",
"stocks",
"bills");
78 $this->
const = array();
82 0 => array(
'file' =>
'box_services_contracts.php',
'enabledbydefaulton' =>
'Home'),
83 1 => array(
'file' =>
'box_graph_product_distribution.php',
'enabledbydefaulton' =>
'Home')
87 $this->rights = array();
88 $this->rights_class =
'service';
91 $this->rights[$r][0] = 531;
92 $this->rights[$r][1] =
'Read services';
93 $this->rights[$r][2] =
'r';
94 $this->rights[$r][3] = 0;
95 $this->rights[$r][4] =
'lire';
98 $this->rights[$r][0] = 532;
99 $this->rights[$r][1] =
'Create/modify services';
100 $this->rights[$r][2] =
'w';
101 $this->rights[$r][3] = 0;
102 $this->rights[$r][4] =
'creer';
105 $this->rights[$r][0] = 533;
106 $this->rights[$r][1] =
'Read prices services';
107 $this->rights[$r][2] =
'w';
108 $this->rights[$r][3] = 0;
109 $this->rights[$r][4] =
'service_advance';
110 $this->rights[$r][5] =
'read_prices';
113 $this->rights[$r][0] = 535;
114 $this->rights[$r][1] =
'Read supplier prices';
115 $this->rights[$r][2] =
'w';
116 $this->rights[$r][3] = 0;
117 $this->rights[$r][4] =
'service_advance';
118 $this->rights[$r][5] =
'read_supplier_prices';
121 $this->rights[$r][0] = 534;
122 $this->rights[$r][1] =
'Delete les services';
123 $this->rights[$r][2] =
'd';
124 $this->rights[$r][3] = 0;
125 $this->rights[$r][4] =
'supprimer';
128 $this->rights[$r][0] = 538;
129 $this->rights[$r][1] =
'Export services';
130 $this->rights[$r][2] =
'r';
131 $this->rights[$r][3] = 0;
132 $this->rights[$r][4] =
'export';
155 $usenpr =
$mysoc->useNPR();
162 $alias_product_perentity = !
getDolGlobalString(
'MAIN_PRODUCT_PERENTITY_SHARED') ?
"p" :
"ppe";
165 $this->export_code[$r] = $this->rights_class.
'_'.$r;
166 $this->export_label[$r] =
"Services";
167 $this->export_permission[$r] = array(array(
"service",
"export"));
168 $this->export_fields_array[$r] = array(
169 'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
170 'p.fk_product_type' =>
'Type',
'p.tosell' =>
"OnSell",
'p.tobuy' =>
"OnBuy",
171 'p.description' =>
"Description",
'p.url' =>
"PublicUrl",
172 'p.customcode' =>
'CustomsCode',
'p.fk_country' =>
'IDCountry',
173 $alias_product_perentity .
'.accountancy_code_sell' =>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
174 $alias_product_perentity .
'.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
175 $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
176 'p.note' =>
"NotePrivate",
'p.note_public' =>
'NotePublic',
177 'p.weight' =>
"Weight",
'p.length' =>
"Length",
'p.width' =>
"Width",
'p.height' =>
"Height",
'p.surface' =>
"Surface",
'p.volume' =>
"Volume",
178 'p.duration' =>
"Duration",
179 'p.finished' =>
'Nature',
180 'p.price_base_type' =>
"PriceBase",
'p.price' =>
"UnitPriceHT",
'p.price_ttc' =>
"UnitPriceTTC",
181 'p.tva_tx' =>
'VATRate',
182 'p.datec' =>
'DateCreation',
'p.tms' =>
'DateModification'
184 if (is_object(
$mysoc) && $usenpr) {
185 $this->export_fields_array[$r][
'p.recuperableonly'] =
'NPR';
188 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.cost_price' =>
'CostPrice'));
191 $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'));
194 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode' =>
'BarCode'));
196 $keyforselect =
'product';
197 $keyforelement =
'product';
198 $keyforaliasextra =
'extra';
199 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
201 $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'));
204 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'group_concat(cat.label)' =>
'Categories'));
207 $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'));
210 $this->export_fields_array[$r][
'p.fk_unit'] =
'Unit';
212 $this->export_TypeFields_array[$r] = array(
213 'p.ref' =>
"Text",
'p.label' =>
"Text",
214 'p.fk_product_type' =>
'Numeric',
'p.tosell' =>
"Boolean",
'p.tobuy' =>
"Boolean",
215 'p.description' =>
"Text",
'p.url' =>
"Text",
216 $alias_product_perentity .
'.accountancy_code_sell' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export' =>
"Text",
217 $alias_product_perentity .
'.accountancy_code_buy' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"Text",
218 'p.note' =>
"Text",
'p.note_public' =>
"Text",
219 'p.weight' =>
"Numeric",
'p.length' =>
"Numeric",
'p.width' =>
"Numeric",
'p.height' =>
"Numeric",
'p.surface' =>
"Numeric",
'p.volume' =>
"Numeric",
220 'p.customcode' =>
'Text',
221 'p.duration' =>
"Text",
222 'p.finished' =>
'Numeric',
223 'p.price_base_type' =>
"Text",
'p.price' =>
"Numeric",
'p.price_ttc' =>
"Numeric",
'p.tva_tx' =>
'Numeric',
224 'p.datec' =>
'Date',
'p.tms' =>
'Date'
227 $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'));
230 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode' =>
'Text'));
233 $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'));
236 $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'));
239 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
"group_concat(cat.label)" =>
'Text'));
241 $this->export_entities_array[$r] = array();
243 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
"group_concat(cat.label)" =>
'category'));
246 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock' =>
'product',
'p.pmp' =>
'product'));
249 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode' =>
'product'));
252 $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'));
255 $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'));
258 $this->export_dependencies_array[$r] = array(
'category' =>
'p.rowid');
261 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.stock' =>
'product',
'p.pmp' =>
'product'));
264 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode' =>
'product'));
267 $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'));
270 $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'));
273 $this->export_dependencies_array[$r] = array(
'category' =>
'p.rowid');
275 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
276 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
278 $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);
281 $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';
284 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_lang as l ON l.fk_product = p.rowid';
286 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object';
288 $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';
290 $this->export_sql_end[$r] .=
' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity(
'product').
')';
292 $this->export_sql_order[$r] =
' GROUP BY p.rowid';
299 $this->export_code[$r] = $this->rights_class.
'_'.$r;
300 $this->export_label[$r] =
"ProductsMultiPrice";
301 $this->export_permission[$r] = array(array(
"service",
"export"));
302 $this->export_fields_array[$r] = array(
'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
303 'pr.price_base_type' =>
"PriceBase",
'pr.price_level' =>
"PriceLevel",
304 'pr.price' =>
"PriceLevelUnitPriceHT",
'pr.price_ttc' =>
"PriceLevelUnitPriceTTC",
305 'pr.price_min' =>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc' =>
"MinPriceLevelUnitPriceTTC",
306 'pr.tva_tx' =>
'PriceLevelVATRate',
307 'pr.date_price' =>
'DateCreation');
308 if (is_object(
$mysoc) && $usenpr) {
309 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
317 $this->export_entities_array[$r] = array(
'p.rowid' =>
"product",
'p.ref' =>
"product",
'p.label' =>
"Label",
318 'pr.price_base_type' =>
"product",
'pr.price_level' =>
"product",
'pr.price' =>
"product",
319 'pr.price_ttc' =>
"product",
320 'pr.price_min' =>
"product",
'pr.price_min_ttc' =>
"product",
321 'pr.tva_tx' =>
'product',
322 'pr.recuperableonly' =>
'product',
323 'pr.date_price' =>
"product");
324 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
325 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
326 $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;
327 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
328 $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').
'))';
329 $this->export_sql_end[$r] .=
' ORDER BY p.ref, pr.price_level';
335 $this->export_code[$r] = $this->rights_class.
'_'.$r;
336 $this->export_label[$r] =
"ProductsPricePerCustomer";
337 $this->export_permission[$r] = array(array(
"service",
"export"));
338 $this->export_fields_array[$r] = array(
'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
339 's.nom' =>
'ThirdParty',
340 'pr.date_begin' =>
"AppliedPricesFrom",
341 'pr.date_end' =>
"AppliedPricesTo",
342 'pr.price_base_type' =>
"PriceBase",
343 'pr.price' =>
"PriceUnitPriceHT",
'pr.price_ttc' =>
"PriceUnitPriceTTC",
344 'pr.price_min' =>
"MinPriceUnitPriceHT",
'pr.price_min_ttc' =>
"MinPriceUnitPriceTTC",
345 'pr.tva_tx' =>
'PriceVATRate',
346 'pr.default_vat_code' =>
'PriceVATCode',
347 'pr.discount_percent' =>
'Discount',
348 'pr.datec' =>
'DateCreation');
349 if (is_object(
$mysoc) && $usenpr) {
350 $this->export_fields_array[$r][
'pr.recuperableonly'] =
'NPR';
352 $this->export_entities_array[$r] = array(
'p.rowid' =>
"product",
'p.ref' =>
"product",
353 's.nom' =>
'company',
354 'pr.date_begin' =>
"product",
355 'pr.date_end' =>
"product",
356 'pr.price_base_type' =>
"product",
'pr.price' =>
"product",
357 'pr.price_ttc' =>
"product",
358 'pr.price_min' =>
"product",
'pr.price_min_ttc' =>
"product",
359 'pr.tva_tx' =>
'product',
360 'pr.default_vat_code' =>
'product',
361 'pr.discount_percent' =>
'product',
362 'pr.recuperableonly' =>
'product',
363 'pr.datec' =>
"product");
364 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
365 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
366 $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;
367 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'societe as s ON pr.fk_soc = s.rowid';
368 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
374 $this->export_code[$r] = $this->rights_class.
'_'.$r;
375 $this->export_label[$r] =
"AssociatedProducts";
376 $this->export_permission[$r] = array(array(
"service",
"export"));
377 $this->export_fields_array[$r] = array(
378 'p.rowid' =>
"Id",
'p.ref' =>
"Ref",
'p.label' =>
"Label",
'p.description' =>
"Description",
'p.url' =>
"PublicUrl",
379 $alias_product_perentity .
'.accountancy_code_sell' =>
"ProductAccountancySellCode", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
380 $alias_product_perentity .
'.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode", $alias_product_perentity .
'.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
381 $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
382 'p.note' =>
"NotePrivate",
'p.note_public' =>
'NotePublic',
383 'p.weight' =>
"Weight",
'p.length' =>
"Length",
'p.surface' =>
"Surface",
'p.volume' =>
"Volume",
'p.customcode' =>
'CustomsCode',
384 'p.price_base_type' =>
"PriceBase",
'p.price' =>
"UnitPriceHT",
'p.price_ttc' =>
"UnitPriceTTC",
'p.tva_tx' =>
'VATRate',
'p.tosell' =>
"OnSell",
385 'p.tobuy' =>
"OnBuy",
'p.datec' =>
'DateCreation',
'p.tms' =>
'DateModification'
388 $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'));
391 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'p.barcode' =>
'BarCode'));
393 $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array(
'pa.qty' =>
'Qty',
'pa.incdec' =>
'ComposedProductIncDecStock'));
394 $this->export_TypeFields_array[$r] = array(
395 'p.ref' =>
"Text",
'p.label' =>
"Text",
'p.description' =>
"Text",
'p.url' =>
"Text",
396 $alias_product_perentity .
'.accountancy_code_sell' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_sell_export' =>
"Text",
397 $alias_product_perentity .
'.accountancy_code_buy' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_intra' =>
"Text", $alias_product_perentity .
'.accountancy_code_buy_export' =>
"Text",
398 'p.note' =>
"Text",
'p.note_public' =>
"Text",
399 'p.weight' =>
"Numeric",
'p.length' =>
"Numeric",
'p.surface' =>
"Numeric",
'p.volume' =>
"Numeric",
'p.customcode' =>
'Text',
400 'p.price_base_type' =>
"Text",
'p.price' =>
"Numeric",
'p.price_ttc' =>
"Numeric",
'p.tva_tx' =>
'Numeric',
'p.tosell' =>
"Boolean",
'p.tobuy' =>
"Boolean",
401 'p.datec' =>
'Date',
'p.tms' =>
'Date'
404 $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'));
407 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'p.barcode' =>
'Text'));
409 $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array(
'pa.qty' =>
'Numeric'));
410 $this->export_entities_array[$r] = array(
411 'p.rowid' =>
"virtualproduct",
'p.ref' =>
"virtualproduct",
'p.label' =>
"virtualproduct",
'p.description' =>
"virtualproduct",
'p.url' =>
"virtualproduct",
412 $alias_product_perentity .
'.accountancy_code_sell' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_intra' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_sell_export' =>
'virtualproduct',
413 $alias_product_perentity .
'.accountancy_code_buy' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_intra' =>
'virtualproduct', $alias_product_perentity .
'.accountancy_code_buy_export' =>
'virtualproduct',
414 'p.note' =>
"virtualproduct",
'p.length' =>
"virtualproduct",
415 'p.surface' =>
"virtualproduct",
'p.volume' =>
"virtualproduct",
'p.weight' =>
"virtualproduct",
'p.customcode' =>
'virtualproduct',
416 'p.price_base_type' =>
"virtualproduct",
'p.price' =>
"virtualproduct",
'p.price_ttc' =>
"virtualproduct",
'p.tva_tx' =>
"virtualproduct",
417 'p.tosell' =>
"virtualproduct",
'p.tobuy' =>
"virtualproduct",
'p.datec' =>
"virtualproduct",
'p.tms' =>
"virtualproduct"
420 $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'));
423 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'p.barcode' =>
'virtualproduct'));
425 $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array(
'pa.qty' =>
"subproduct",
'pa.incdec' =>
'subproduct'));
426 $keyforselect =
'product';
427 $keyforelement =
'product';
428 $keyforaliasextra =
'extra';
429 include DOL_DOCUMENT_ROOT.
'/core/extrafieldsinexport.inc.php';
430 $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"));
431 $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"));
432 $this->export_sql_start[$r] =
'SELECT DISTINCT ';
433 $this->export_sql_end[$r] =
' FROM '.MAIN_DB_PREFIX.
'product as p';
435 $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);
437 $this->export_sql_end[$r] .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product_extrafields as extra ON p.rowid = extra.fk_object,';
438 $this->export_sql_end[$r] .=
' '.MAIN_DB_PREFIX.
'product_association as pa, '.MAIN_DB_PREFIX.
'product as p2';
439 $this->export_sql_end[$r] .=
' WHERE p.entity IN ('.getEntity(
'product').
')';
440 $this->export_sql_end[$r] .=
' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
451 $this->import_code[$r] = $this->rights_class.
'_'.$r;
452 $this->import_label[$r] =
"Products";
453 $this->import_icon[$r] = $this->picto;
454 $this->import_entities_array[$r] = array();
455 $this->import_tables_array[$r] = array(
'p' => MAIN_DB_PREFIX.
'product',
'extra' => MAIN_DB_PREFIX.
'product_extrafields');
456 $this->import_tables_creator_array[$r] = array(
'p' =>
'fk_user_author');
457 $this->import_fields_array[$r] = array(
459 'p.label' =>
"Label*",
460 'p.fk_product_type' =>
"Type*",
461 'p.tosell' =>
"OnSell*",
462 'p.tobuy' =>
"OnBuy*",
463 'p.description' =>
"Description",
464 'p.url' =>
"PublicUrl",
465 'p.customcode' =>
'CustomsCode',
466 'p.fk_country' =>
'CountryCode',
467 'p.accountancy_code_sell' =>
"ProductAccountancySellCode",
468 'p.accountancy_code_sell_intra' =>
"ProductAccountancySellIntraCode",
469 'p.accountancy_code_sell_export' =>
"ProductAccountancySellExportCode",
470 'p.accountancy_code_buy' =>
"ProductAccountancyBuyCode",
471 'p.accountancy_code_buy_intra' =>
"ProductAccountancyBuyIntraCode",
472 'p.accountancy_code_buy_export' =>
"ProductAccountancyBuyExportCode",
473 'p.note_public' =>
"NotePublic",
474 'p.note' =>
"NotePrivate",
475 'p.weight' =>
"Weight",
476 'p.weight_units' =>
"WeightUnits",
477 'p.length' =>
"Length",
478 'p.length_units' =>
"LengthUnits",
479 'p.width' =>
"Width",
480 'p.width_units' =>
"WidthUnits",
481 'p.height' =>
"Height",
482 'p.height_units' =>
"HeightUnits",
483 'p.surface' =>
"Surface",
484 'p.surface_units' =>
"SurfaceUnits",
485 'p.volume' =>
"Volume",
486 'p.volume_units' =>
"VolumeUnits",
487 'p.duration' =>
"Duration",
488 'p.finished' =>
'Nature',
489 'p.price' =>
"SellingPriceHT",
490 'p.price_min' =>
"MinPrice",
491 'p.price_ttc' =>
"SellingPriceTTC",
492 'p.price_min_ttc' =>
"SellingMinPriceTTC",
493 'p.price_base_type' =>
"PriceBaseType",
494 'p.tva_tx' =>
'VATRate',
495 'p.datec' =>
'DateCreation',
496 'p.cost_price' =>
"CostPrice"
499 $this->import_convertvalue_array[$r] = array(
500 'p.weight_units' => array(
501 'rule' =>
'fetchscalefromcodeunits',
502 'classfile' =>
'/core/class/cunits.class.php',
506 'dict' =>
'DictionaryMeasuringUnits'
508 'p.length_units' => array(
509 'rule' =>
'fetchscalefromcodeunits',
510 'classfile' =>
'/core/class/cunits.class.php',
514 'dict' =>
'DictionaryMeasuringUnits'
516 'p.width_units' => array(
517 'rule' =>
'fetchscalefromcodeunits',
518 'classfile' =>
'/core/class/cunits.class.php',
522 'dict' =>
'DictionaryMeasuringUnits'
524 'p.height_units' => array(
525 'rule' =>
'fetchscalefromcodeunits',
526 'classfile' =>
'/core/class/cunits.class.php',
530 'dict' =>
'DictionaryMeasuringUnits'
532 'p.surface_units' => array(
533 'rule' =>
'fetchscalefromcodeunits',
534 'classfile' =>
'/core/class/cunits.class.php',
537 'units' =>
'surface',
538 'dict' =>
'DictionaryMeasuringUnits'
540 'p.volume_units' => array(
541 'rule' =>
'fetchscalefromcodeunits',
542 'classfile' =>
'/core/class/cunits.class.php',
546 'dict' =>
'DictionaryMeasuringUnits'
548 'p.fk_country' => array(
549 'rule' =>
'fetchidfromcodeid',
550 'classfile' =>
'/core/class/ccountry.class.php',
551 'class' =>
'Ccountry',
553 'dict' =>
'DictionaryCountry'
555 'p.accountancy_code_sell' => array(
'rule' =>
'accountingaccount'),
556 'p.accountancy_code_sell_intra' => array(
'rule' =>
'accountingaccount'),
557 'p.accountancy_code_sell_export' => array(
'rule' =>
'accountingaccount'),
558 'p.accountancy_code_buy' => array(
'rule' =>
'accountingaccount'),
559 'p.accountancy_code_buy_intra' => array(
'rule' =>
'accountingaccount'),
560 'p.accountancy_code_buy_export' => array(
'rule' =>
'accountingaccount'),
563 $this->import_regex_array[$r] = array(
565 'p.price_base_type' =>
'\AHT\z|\ATTC\z',
566 'p.tosell' =>
'^[0|1]$',
567 'p.tobuy' =>
'^[0|1]$',
568 'p.fk_product_type' =>
'^[0|1]$',
569 'p.datec' =>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
570 'p.recuperableonly' =>
'^[0|1]$',
574 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
575 'p.fk_default_warehouse' =>
'DefaultWarehouse',
576 'p.tobatch' =>
'ManageLotSerial',
577 'p.seuil_stock_alerte' =>
'StockLimit',
578 'p.pmp' =>
'PMPValue',
579 'p.desiredstock' =>
'DesiredStock'
582 $this->import_regex_array[$r] = array_merge($this->import_regex_array[$r], array(
583 'p.tobatch' =>
'^[0|1|2]$'
586 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
587 'p.fk_default_warehouse' => array(
588 'rule' =>
'fetchidfromref',
589 'classfile' =>
'/product/stock/class/entrepot.class.php',
590 'class' =>
'Entrepot',
592 'element' =>
'Warehouse'
598 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.cost_price' =>
'CostPrice'));
600 if (is_object(
$mysoc) && $usenpr) {
601 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.recuperableonly' =>
'NPR'));
604 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax1_tx' =>
'LT1',
'p.localtax1_type' =>
'LT1Type'));
607 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.localtax2_tx' =>
'LT2',
'p.localtax2_type' =>
'LT2Type'));
610 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'p.barcode' =>
'BarCode'));
613 $this->import_fields_array[$r][
'p.fk_unit'] =
'Unit';
616 $import_extrafield_sample = array();
617 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product' AND entity IN (0,".
$conf->entity.
")";
618 $resql = $this->db->query($sql);
620 while ($obj = $this->db->fetch_object($resql)) {
621 $fieldname =
'extra.'.$obj->name;
622 $fieldlabel = ucfirst($obj->label);
623 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
624 $import_extrafield_sample[$fieldname] = $fieldlabel;
628 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object' =>
'lastrowid-'.MAIN_DB_PREFIX.
'product');
631 $import_sample = array(
632 'p.ref' =>
"ref:PREF123456",
634 'p.label' =>
"Product name in default language",
635 'p.description' =>
"Product description in default language",
636 'p.note_public' =>
"a public note (free text)",
637 'p.note' =>
"a private note (free text)",
638 'p.customcode' =>
'customs code',
639 'p.fk_country' =>
'FR',
641 'p.price_min' =>
"100",
642 'p.price_ttc' =>
"110",
643 'p.price_min_ttc' =>
"110",
644 'p.price_base_type' =>
"HT (show/use price excl. tax) / TTC (show/use price incl. tax)",
646 'p.tosell' =>
"0 (not for sale to customer, eg. raw material) / 1 (for sale)",
647 'p.tobuy' =>
"0 (not for purchase from supplier, eg. virtual product) / 1 (for purchase)",
648 'p.fk_product_type' =>
"0 (product) / 1 (service)",
649 'p.duration' =>
"eg. 365d/12m/1y",
650 'p.url' =>
'link to product (no https)',
651 'p.accountancy_code_sell' =>
"",
652 'p.accountancy_code_sell_intra' =>
"",
653 'p.accountancy_code_sell_export' =>
"",
654 'p.accountancy_code_buy' =>
"",
655 'p.accountancy_code_buy_intra' =>
"",
656 'p.accountancy_code_buy_export' =>
"",
658 'p.weight_units' =>
'kg',
660 'p.length_units' =>
'm',
662 'p.width_units' =>
'm',
664 'p.height_units' =>
'm',
666 'p.surface_units' =>
'm2',
668 'p.volume_units' =>
'm3',
669 'p.finished' =>
'0 (raw material) / 1 (finished goods), matches field "code" in dictionary table "'.MAIN_DB_PREFIX.
'c_product_nature"'
673 $import_sample = array_merge($import_sample, array(
674 'p.seuil_stock_alerte' =>
'',
676 'p.desiredstock' =>
''
680 $import_sample = array_merge($import_sample, array(
'p.cost_price' =>
'90'));
682 if (is_object(
$mysoc) && $usenpr) {
683 $import_sample = array_merge($import_sample, array(
'p.recuperableonly' =>
'0'));
686 $import_sample = array_merge($import_sample, array(
'p.localtax1_tx' =>
'',
'p.localtax1_type' =>
''));
689 $import_sample = array_merge($import_sample, array(
'p.localtax2_tx' =>
'',
'p.localtax2_type' =>
''));
692 $import_sample = array_merge($import_sample, array(
'p.barcode' =>
''));
695 $import_sample = array_merge(
698 '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"'
702 if (!is_array($this->import_convertvalue_array[$r])) {
703 $this->import_convertvalue_array[$r] = array();
705 $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
706 'p.fk_unit' => array(
707 'rule' =>
'fetchidfromcodeorlabel',
708 'classfile' =>
'/core/class/cunits.class.php',
711 'dict' =>
'DictionaryUnits'
715 $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
716 $this->import_updatekeys_array[$r] = array(
'p.ref' =>
'Ref');
718 $this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array(
'p.barcode' =>
'BarCode'));
725 $this->import_code[$r] = $this->rights_class.
'_supplierprices';
726 $this->import_label[$r] =
"SuppliersPricesOfProductsOrServices";
727 $this->import_icon[$r] = $this->picto;
728 $this->import_entities_array[$r] = array();
729 $this->import_tables_array[$r] = array(
'sp' => MAIN_DB_PREFIX.
'product_fournisseur_price',
'extra' => MAIN_DB_PREFIX.
'product_fournisseur_price_extrafields');
730 $this->import_tables_creator_array[$r] = array(
'sp' =>
'fk_user');
731 $this->import_fields_array[$r] = array(
732 'sp.fk_product' =>
"ProductOrService*",
733 'sp.fk_soc' =>
"Supplier*",
734 'sp.ref_fourn' =>
'SupplierRef*',
735 'sp.quantity' =>
"QtyMin*",
736 'sp.tva_tx' =>
'VATRate',
737 'sp.default_vat_code' =>
'VATCode',
738 'sp.delivery_time_days' =>
'NbDaysToDelivery',
739 'sp.supplier_reputation' =>
'SupplierReputation',
740 'sp.status' =>
'Status',
741 'sp.datec' =>
'DateCreation'
743 if (is_object(
$mysoc) && $usenpr) {
744 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.recuperableonly' =>
'VATNPR'));
747 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax1_tx' =>
'LT1',
'sp.localtax1_type' =>
'LT1Type'));
750 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'sp.localtax2_tx' =>
'LT2',
'sp.localtax2_type' =>
'LT2Type'));
752 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
753 'sp.price' =>
"PriceQtyMinHT*",
754 'sp.unitprice' =>
'UnitPriceHT*',
755 'sp.remise_percent' =>
'DiscountQtyMin'
759 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
760 'sp.fk_multicurrency' =>
'CurrencyCodeId',
761 'sp.multicurrency_code' =>
'CurrencyCode',
762 'sp.multicurrency_tx' =>
'CurrencyRate',
763 'sp.multicurrency_unitprice' =>
'CurrencyUnitPrice',
764 'sp.multicurrency_price' =>
'CurrencyPrice',
769 $import_extrafield_sample = array();
770 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product_fournisseur_price' AND entity IN (0, ".
$conf->entity.
")";
771 $resql = $this->db->query($sql);
773 while ($obj = $this->db->fetch_object($resql)) {
774 $fieldname =
'extra.'.$obj->name;
775 $fieldlabel = ucfirst($obj->label);
776 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
777 $import_extrafield_sample[$fieldname] = $fieldlabel;
783 $this->import_fieldshidden_array[$r] = array(
785 'extra.fk_object' =>
'lastrowid-'.MAIN_DB_PREFIX.
'product_fournisseur_price'
788 $this->import_convertvalue_array[$r] = array(
789 'sp.fk_soc' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/societe/class/societe.class.php',
'class' =>
'Societe',
'method' =>
'fetch',
'element' =>
'ThirdParty'),
790 'sp.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
793 $this->import_regex_array[$r] = array(
794 'sp.datec' =>
'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$'
797 $this->import_examplevalues_array[$r] = array(
798 'sp.fk_product' =>
"ref:PRODUCT_REF or id:123456",
799 'sp.fk_soc' =>
"My Supplier",
800 'sp.ref_fourn' =>
"XYZ-F123456",
801 'sp.quantity' =>
"5",
804 'sp.unitprice' =>
'50',
805 'sp.remise_percent' =>
'0',
806 'sp.default_vat_code' =>
'',
807 'sp.delivery_time_days' =>
'5',
808 'sp.supplier_reputation' =>
'FAVORITE / NOTTHGOOD / DONOTORDER',
812 if (is_object(
$mysoc) && $usenpr) {
813 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.recuperableonly' =>
''));
816 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax1_tx' =>
'LT1',
'sp.localtax1_type' =>
'LT1Type'));
819 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
'sp.localtax2_tx' =>
'LT2',
'sp.localtax2_type' =>
'LT2Type'));
821 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
822 'sp.price' =>
"50.00",
823 'sp.unitprice' =>
'10',
825 'sp.remise_percent' =>
'20'
828 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
829 'sp.fk_multicurrency' =>
'eg: 2 = the rowid for code of multicurrency currency',
830 'sp.multicurrency_code' =>
'GBP',
831 'sp.multicurrency_tx' =>
'1.12345',
832 'sp.multicurrency_unitprice' =>
'',
834 'sp.multicurrency_price' =>
''
838 $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array(
839 'sp.packaging' =>
'10',
843 $this->import_updatekeys_array[$r] = array(
'sp.fk_product' =>
'ProductOrService',
'sp.ref_fourn' =>
'SupplierRef',
'sp.fk_soc' =>
'Supplier',
'sp.quantity' =>
"QtyMin");
849 $this->import_code[$r] = $this->rights_class.
'_multiprice';
850 $this->import_label[$r] =
"ProductsOrServiceMultiPrice";
851 $this->import_icon[$r] = $this->picto;
852 $this->import_entities_array[$r] = array();
853 $this->import_tables_array[$r] = array(
'pr' => MAIN_DB_PREFIX.
'product_price',
'extra' => MAIN_DB_PREFIX.
'product_price_extrafields');
854 $this->import_tables_creator_array[$r] = array(
'pr' =>
'fk_user_author');
855 $this->import_fields_array[$r] = array(
'pr.fk_product' =>
"ProductOrService*",
856 'pr.price_base_type' =>
"PriceBase",
'pr.price_level' =>
"PriceLevel",
857 'pr.price' =>
"PriceLevelUnitPriceHT",
'pr.price_ttc' =>
"PriceLevelUnitPriceTTC",
858 'pr.price_min' =>
"MinPriceLevelUnitPriceHT",
'pr.price_min_ttc' =>
"MinPriceLevelUnitPriceTTC",
859 'pr.date_price' =>
'DateCreation*');
861 $this->import_fields_array[$r][
'pr.tva_tx'] =
'VATRate';
863 if (is_object(
$mysoc) && $usenpr) {
864 $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
'pr.recuperableonly' =>
'NPR'));
868 $import_extrafield_sample = array();
869 $sql =
"SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX.
"extrafields WHERE type <> 'separate' AND elementtype = 'product_price' AND entity IN (0, ".
$conf->entity.
")";
870 $resql = $this->db->query($sql);
872 while ($obj = $this->db->fetch_object($resql)) {
873 $fieldname =
'extra.'.$obj->name;
874 $fieldlabel = ucfirst($obj->label);
875 $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ?
'*' :
'');
876 $import_extrafield_sample[$fieldname] = $fieldlabel;
880 $this->import_fieldshidden_array[$r] = array(
'extra.fk_object' =>
'lastrowid-'.MAIN_DB_PREFIX.
'product_price');
881 $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]$');
882 $this->import_convertvalue_array[$r] = array(
883 'pr.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
885 $this->import_examplevalues_array[$r] = array(
'pr.fk_product' =>
"ref:SERVICE_REF or id:123456",
886 'pr.price_base_type' =>
"HT (for excl tax) or TTC (for inc tax)",
'pr.price_level' =>
"1",
887 'pr.price' =>
"100",
'pr.price_ttc' =>
"110",
888 'pr.price_min' =>
"100",
'pr.price_min_ttc' =>
"110",
890 'pr.recuperableonly' =>
'0',
891 'pr.date_price' =>
'2020-12-31');
897 $this->import_code[$r] = $this->rights_class.
'_languages';
898 $this->import_label[$r] =
"ProductsOrServicesTranslations";
899 $this->import_icon[$r] = $this->picto;
900 $this->import_entities_array[$r] = array();
901 $this->import_tables_array[$r] = array(
'l' => MAIN_DB_PREFIX.
'product_lang');
903 $this->import_fields_array[$r] = array(
'l.fk_product' =>
'ProductOrService*',
'l.lang' =>
'Language*',
'l.label' =>
'TranslatedLabel',
'l.description' =>
'TranslatedDescription');
905 $this->import_convertvalue_array[$r] = array(
906 'l.fk_product' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
908 $this->import_examplevalues_array[$r] = array(
'l.fk_product' =>
'ref:SERVICE_REF or id:123456',
'l.lang' =>
'en_US',
'l.label' =>
'Label in en_US',
'l.description' =>
'Desc in en_US');
909 $this->import_updatekeys_array[$r] = array(
'l.fk_product' =>
'ProductOrService',
'l.lang' =>
'Language');
916 $this->import_code[$r] = $this->rights_class .
'_' . $r;
917 $this->import_label[$r] =
"AssociatedProducts";
918 $this->import_icon[$r] = $this->picto;
919 $this->import_entities_array[$r] = array();
920 $this->import_tables_array[$r] = array(
'pa' => MAIN_DB_PREFIX .
'product_association');
921 $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');
923 $this->import_convertvalue_array[$r] = array(
924 'pa.fk_product_pere' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product'),
925 'pa.fk_product_fils' => array(
'rule' =>
'fetchidfromref',
'classfile' =>
'/product/class/product.class.php',
'class' =>
'Product',
'method' =>
'fetch',
'element' =>
'Product')
927 $this->import_examplevalues_array[$r] = array(
928 'pa.fk_product_pere' =>
"ref:PREF123456",
929 'pa.fk_product_fils' =>
"ref:PREF123456",
933 $this->import_regex_array[$r] = array(
'pa.fk_product_pere' =>
'rowid@'.MAIN_DB_PREFIX.
'product',
'pa.fk_product_fils' =>
'rowid@'.MAIN_DB_PREFIX.
'product');
934 $this->import_updatekeys_array[$r] = array(
'pa.fk_product_pere' =>
'ref parent',
'pa.fk_product_fils' =>
"ref enfant");