mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-05 15:45:25 +01:00
update
This commit is contained in:
@@ -93,28 +93,28 @@ class modService extends DolibarrModules
|
||||
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'lire';
|
||||
$r++;
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 532; // id de la permission
|
||||
$this->rights[$r][1] = 'Create/modify services'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'w'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'creer';
|
||||
$r++;
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 534; // id de la permission
|
||||
$this->rights[$r][1] = 'Delete les services'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'supprimer';
|
||||
$r++;
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 538; // Must be same permission than in product module
|
||||
$this->rights[$r][1] = 'Export services';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'export';
|
||||
$r++;
|
||||
$r++;
|
||||
|
||||
// Menus
|
||||
//-------
|
||||
@@ -137,7 +137,7 @@ class modService extends DolibarrModules
|
||||
$usenpr = 0;
|
||||
if (is_object($mysoc)) $usenpr = $mysoc->useNPR();
|
||||
|
||||
// Exports
|
||||
// Exports
|
||||
//--------
|
||||
$r = 0;
|
||||
|
||||
@@ -208,8 +208,8 @@ class modService extends DolibarrModules
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
|
||||
if (!empty($conf->fournisseur->enabled)) $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';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] = ' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
$this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
|
||||
if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] = ' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
|
||||
|
||||
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
|
||||
{
|
||||
@@ -238,8 +238,8 @@ class modService extends DolibarrModules
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.date_price'=>"product");
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.date_price'=>"product");
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$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; // export prices only for the current entity
|
||||
@@ -248,90 +248,90 @@ class modService extends DolibarrModules
|
||||
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $usenpr) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product", 'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$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; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
// Exports product multiprice
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
|
||||
's.nom'=>'ThirdParty',
|
||||
'pr.price_base_type'=>"PriceBase",
|
||||
'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
|
||||
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
|
||||
'pr.tva_tx'=>'PriceVATRate',
|
||||
'pr.default_vat_code'=>'PriceVATCode',
|
||||
'pr.datec'=>'DateCreation');
|
||||
if (is_object($mysoc) && $usenpr) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
|
||||
's.nom'=>'company',
|
||||
'pr.price_base_type'=>"product", 'pr.price'=>"product",
|
||||
'pr.price_ttc'=>"product",
|
||||
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
|
||||
'pr.tva_tx'=>'product',
|
||||
'pr.default_vat_code'=>'product',
|
||||
'pr.recuperableonly'=>'product',
|
||||
'pr.datec'=>"product");
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$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; // export prices only for the current entity
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUIT_SOUSPRODUITS))
|
||||
{
|
||||
// Exports virtual products
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
// Exports virtual products
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r] = array(array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
|
||||
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
|
||||
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) $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'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
|
||||
'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
|
||||
'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
|
||||
'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) $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'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
|
||||
'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
|
||||
'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
|
||||
'p.note'=>"Text", 'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) $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'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r] = array(
|
||||
'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"Text", 'p.note_public'=>"Text",
|
||||
'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
|
||||
'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
|
||||
'p.datec'=>'Date', 'p.tms'=>'Date'
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) $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'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
|
||||
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
|
||||
$this->export_entities_array[$r] = array(
|
||||
'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
|
||||
'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
|
||||
'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
|
||||
'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
|
||||
'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) $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'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
|
||||
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$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"));
|
||||
$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"));
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
|
||||
'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
|
||||
'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) $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'));
|
||||
if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
|
||||
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
|
||||
$keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$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"));
|
||||
$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"));
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
|
||||
$this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
|
||||
$this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,141 +348,141 @@ class modService extends DolibarrModules
|
||||
$this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
|
||||
$this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id
|
||||
$this->import_fields_array[$r] = array(
|
||||
'p.ref' => "Ref*",
|
||||
'p.label' => "Label*",
|
||||
'p.fk_product_type' => "Type*",
|
||||
'p.tosell' => "OnSell*",
|
||||
'p.tobuy' => "OnBuy*",
|
||||
'p.description' => "Description",
|
||||
'p.url' => "PublicUrl",
|
||||
'p.customcode' => 'CustomCode',
|
||||
'p.fk_country' => 'CountryCode',
|
||||
'p.accountancy_code_sell' => "ProductAccountancySellCode",
|
||||
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
|
||||
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode",
|
||||
'p.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode",
|
||||
'p.note_public' => "NotePublic",
|
||||
'p.note' => "NotePrivate",
|
||||
'p.weight' => "Weight",
|
||||
'p.weight_units' => "WeightUnits",
|
||||
'p.length' => "Length",
|
||||
'p.length_units' => "LengthUnit",
|
||||
'p.width' => "Width",
|
||||
'p.width_units' => "WidthUnits",
|
||||
'p.height' => "Height",
|
||||
'p.height_units' => "HeightUnit",
|
||||
'p.surface' => "Surface",
|
||||
'p.surface_units' => "SurfaceUnit",
|
||||
'p.volume' => "Volume",
|
||||
'p.volume_units' => "VolumeUnits",
|
||||
'p.duration' => "Duration", //duration of service
|
||||
'p.finished' => 'Nature',
|
||||
'p.price' => "SellingPriceHT", //without
|
||||
'p.price_min' => "MinPrice",
|
||||
'p.price_ttc' => "SellingPriceTTC", //with tax
|
||||
'p.price_min_ttc' => "SellingMinPriceTTC",
|
||||
'p.price_base_type' => "PriceBaseType", //price base: with-tax (TTC) or without (HT) tax. Displays accordingly in Product card
|
||||
'p.tva_tx' => 'VATRate',
|
||||
'p.datec' => 'DateCreation',
|
||||
'p.cost_price' => "CostPrice",
|
||||
$this->import_fields_array[$r] = array(
|
||||
'p.ref' => "Ref*",
|
||||
'p.label' => "Label*",
|
||||
'p.fk_product_type' => "Type*",
|
||||
'p.tosell' => "OnSell*",
|
||||
'p.tobuy' => "OnBuy*",
|
||||
'p.description' => "Description",
|
||||
'p.url' => "PublicUrl",
|
||||
'p.customcode' => 'CustomCode',
|
||||
'p.fk_country' => 'CountryCode',
|
||||
'p.accountancy_code_sell' => "ProductAccountancySellCode",
|
||||
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
|
||||
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
|
||||
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
|
||||
'p.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode",
|
||||
'p.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode",
|
||||
'p.note_public' => "NotePublic",
|
||||
'p.note' => "NotePrivate",
|
||||
'p.weight' => "Weight",
|
||||
'p.weight_units' => "WeightUnits",
|
||||
'p.length' => "Length",
|
||||
'p.length_units' => "LengthUnit",
|
||||
'p.width' => "Width",
|
||||
'p.width_units' => "WidthUnits",
|
||||
'p.height' => "Height",
|
||||
'p.height_units' => "HeightUnit",
|
||||
'p.surface' => "Surface",
|
||||
'p.surface_units' => "SurfaceUnit",
|
||||
'p.volume' => "Volume",
|
||||
'p.volume_units' => "VolumeUnits",
|
||||
'p.duration' => "Duration", //duration of service
|
||||
'p.finished' => 'Nature',
|
||||
'p.price' => "SellingPriceHT", //without
|
||||
'p.price_min' => "MinPrice",
|
||||
'p.price_ttc' => "SellingPriceTTC", //with tax
|
||||
'p.price_min_ttc' => "SellingMinPriceTTC",
|
||||
'p.price_base_type' => "PriceBaseType", //price base: with-tax (TTC) or without (HT) tax. Displays accordingly in Product card
|
||||
'p.tva_tx' => 'VATRate',
|
||||
'p.datec' => 'DateCreation',
|
||||
'p.cost_price' => "CostPrice",
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {//if Stock module enabled
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
'p.seuil_stock_alerte' => 'StockLimit', //lower limit for warning
|
||||
'p.pmp' => 'PMPValue', //weighted average price
|
||||
'p.desiredstock' => 'DesiredStock'//desired stock for replenishment feature
|
||||
));
|
||||
}
|
||||
if (!empty($conf->stock->enabled)) {//if Stock module enabled
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
'p.seuil_stock_alerte' => 'StockLimit', //lower limit for warning
|
||||
'p.pmp' => 'PMPValue', //weighted average price
|
||||
'p.desiredstock' => 'DesiredStock'//desired stock for replenishment feature
|
||||
));
|
||||
}
|
||||
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'p.weight_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'weight',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.length_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.width_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.height_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.surface_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'surface',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.volume_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'volume',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.fk_country' => array(
|
||||
'rule' => 'fetchidfromcodeid',
|
||||
'classfile' => '/core/class/ccountry.class.php',
|
||||
'class' => 'Ccountry',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryCountry'
|
||||
)
|
||||
);
|
||||
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $usenpr) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
|
||||
if (!empty($conf->barcode->enabled)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'p.weight_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'weight',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.length_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.width_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.height_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.surface_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'surface',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.volume_units' => array(
|
||||
'rule' => 'fetchscalefromcodeunits', // Switch this to fetchidfromcodeunits when we will store id instead of scale in product table
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'volume',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.fk_country' => array(
|
||||
'rule' => 'fetchidfromcodeid',
|
||||
'classfile' => '/core/class/ccountry.class.php',
|
||||
'class' => 'Ccountry',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryCountry'
|
||||
)
|
||||
);
|
||||
if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $usenpr) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
|
||||
if (!empty($conf->barcode->enabled)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
// Add extra fields
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
|
||||
$this->import_regex_array[$r] = array(
|
||||
'p.ref'=>'[^ ]',
|
||||
'p.ref'=>'[^ ]',
|
||||
'p.price_base_type' => '\AHT\z|\ATTC\z',
|
||||
'p.tosell'=>'^[0|1]$',
|
||||
'p.tobuy'=>'^[0|1]$',
|
||||
'p.fk_product_type'=>'^[0|1]$',
|
||||
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'p.tobuy'=>'^[0|1]$',
|
||||
'p.fk_product_type'=>'^[0|1]$',
|
||||
'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
'p.finished' => '^[0|1]$'
|
||||
);
|
||||
@@ -565,7 +565,7 @@ class modService extends DolibarrModules
|
||||
{
|
||||
if (!empty($conf->fournisseur->enabled))
|
||||
{
|
||||
// Import suppliers prices (note: this code is duplicated in module Service)
|
||||
// Import suppliers prices (note: this code is duplicated in module Service)
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class.'_supplierprices';
|
||||
$this->import_label[$r] = "SuppliersPricesOfProductsOrServices"; // Translation key
|
||||
@@ -574,14 +574,14 @@ class modService extends DolibarrModules
|
||||
$this->import_tables_array[$r] = array('sp'=>MAIN_DB_PREFIX.'product_fournisseur_price');
|
||||
$this->import_tables_creator_array[$r] = array('sp'=>'fk_user');
|
||||
$this->import_fields_array[$r] = array(//field order as per structure of table llx_product_fournisseur_price, without optional fields
|
||||
'sp.fk_product'=>"ProductOrService*",
|
||||
'sp.fk_soc' => "Supplier*",
|
||||
'sp.ref_fourn' => 'SupplierRef*',
|
||||
'sp.quantity' => "QtyMin*",
|
||||
'sp.tva_tx' => 'VATRate',
|
||||
'sp.default_vat_code' => 'VATCode',
|
||||
'sp.delivery_time_days' => 'DeliveryDelay',
|
||||
'sp.supplier_reputation' => 'SupplierReputation'
|
||||
'sp.fk_product'=>"ProductOrService*",
|
||||
'sp.fk_soc' => "Supplier*",
|
||||
'sp.ref_fourn' => 'SupplierRef*',
|
||||
'sp.quantity' => "QtyMin*",
|
||||
'sp.tva_tx' => 'VATRate',
|
||||
'sp.default_vat_code' => 'VATCode',
|
||||
'sp.delivery_time_days' => 'DeliveryDelay',
|
||||
'sp.supplier_reputation' => 'SupplierReputation'
|
||||
);
|
||||
if (is_object($mysoc) && $usenpr) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.recuperableonly'=>'VATNPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('sp.localtax1_tx'=>'LT1', 'sp.localtax1_type'=>'LT1Type'));
|
||||
@@ -594,13 +594,13 @@ class modService extends DolibarrModules
|
||||
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line
|
||||
'sp.multicurrency_code'=>'CurrencyCode',
|
||||
'sp.multicurrency_tx'=>'CurrencyRate',
|
||||
'sp.multicurrency_unitprice'=>'CurrencyUnitPrice',
|
||||
'sp.multicurrency_price'=>'CurrencyPrice',
|
||||
));
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line
|
||||
'sp.multicurrency_code'=>'CurrencyCode',
|
||||
'sp.multicurrency_tx'=>'CurrencyRate',
|
||||
'sp.multicurrency_unitprice'=>'CurrencyUnitPrice',
|
||||
'sp.multicurrency_price'=>'CurrencyPrice',
|
||||
));
|
||||
}
|
||||
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
@@ -646,7 +646,7 @@ class modService extends DolibarrModules
|
||||
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES))
|
||||
{
|
||||
// Import products multiprices
|
||||
// Import products multiprices
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class.'_multiprice';
|
||||
$this->import_label[$r] = "ProductsOrServiceMultiPrice"; // Translation key
|
||||
@@ -663,20 +663,20 @@ class modService extends DolibarrModules
|
||||
if (is_object($mysoc) && $usenpr) $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('pr.recuperableonly'=>'NPR'));
|
||||
$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]$');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
|
||||
'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
|
||||
);
|
||||
$this->import_examplevalues_array[$r] = array('pr.fk_product'=>"SERVICE_REF or id:123456",
|
||||
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1",
|
||||
'pr.price'=>"100", 'pr.price_ttc'=>"110",
|
||||
'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110",
|
||||
'pr.tva_tx'=>'20',
|
||||
'pr.recuperableonly'=>'0',
|
||||
'pr.recuperableonly'=>'0',
|
||||
'pr.date_price'=>'2013-04-10');
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
// Import translations of product names and descriptions
|
||||
// Import translations of product names and descriptions
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class.'_languages';
|
||||
$this->import_label[$r] = "ProductsOrServicesTranslations";
|
||||
@@ -701,7 +701,7 @@ class modService extends DolibarrModules
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
|
||||
Reference in New Issue
Block a user