From c84d4c53e5f785b413d366b46ce44bde638aa94b Mon Sep 17 00:00:00 2001 From: atm-GregM <85485123+atm-GregM@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:19:36 +0200 Subject: [PATCH] New develop import export product customer price (#35349) * NEW import/export product customer price * back travis and more * back travis 2 --- htdocs/core/modules/modProduct.class.php | 49 ++++++++++++++++++++++++ htdocs/langs/fr_FR/products.lang | 5 +++ 2 files changed, 54 insertions(+) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index baa6e2350eb..77f7e4909ed 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -981,6 +981,55 @@ class modProduct extends DolibarrModules 'pr.date_price' => '2020-12-31'); } + + if (getDolGlobalInt('PRODUIT_CUSTOMER_PRICES')) { + $r++; + $this->import_code[$r] = $this->rights_class.'_productcustomerprice'; + $this->import_label[$r] = "ProductsPricePerCustomer"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('sp' => $this->db->prefix().'product_customer_price', 'extra' => $this->db->prefix().'product_customer_price_extrafields'); + $this->import_tables_creator_array[$r] = array('sp' => 'fk_user'); // Fields to store import user id + $this->import_fields_array[$r] = array( + 'sp.fk_product' => "Products*", + 'sp.fk_soc' => "Customer*", + 'sp.ref_customer' => "RefCustomer", + 'sp.date_begin' => "AppliedPricesFrom*", + 'sp.date_end' => "AppliedPricesTo", + 'sp.tva_tx' => "VATRate*", + 'sp.default_vat_code' => 'PriceVATCode', + 'sp.discount_percent' => 'Discount', + 'sp.price_base_type' => "PriceBase*", + 'sp.price' => "SellingUnitPriceHT*", + 'sp.price_min' => "SellingUnitMinPriceHT", + 'sp.price_ttc' => "SellingUnitPriceTTC", + 'sp.price_min_ttc' => "SellingUnitMinPriceTTC", + 'sp.datec' => "DateCreation"); + + $this->import_convertvalue_array[$r] = array( + 'sp.fk_soc' => array('rule' => 'fetchidfromref', 'classfile' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), + 'sp.fk_product' => array('rule' => 'fetchidfromref', 'classfile' => '/product/class/product.class.php', 'class' => 'Product', 'method' => 'fetch', 'element' => 'Product') + ); + + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); + $this->import_examplevalues_array[$r] = array( + 'sp.fk_product' => "ref:PRODUCT_REF or id:123456", + 'sp.fk_soc' => "My Supplier", + 'sp.ref_customer' => "XYZ-F123456", + 'sp.date_begin' => "2025-06-30", + 'sp.date_end' => "2027-06-30", + 'sp.tva_tx' => '20', + 'sp.default_vat_code' => '5', + 'sp.discount_percent' => '30', + 'sp.price_base_type'=> 'HT (for excl tax) or TTC (for inc tax)', + 'sp.price' => "100", + 'sp.price_min' => "80", + 'sp.price_ttc' => "120", + 'sp.price_min_ttc' => "96", + 'sp.datec' => "2025-09-30" + ); + } + if (getDolGlobalInt('MAIN_MULTILANGS')) { // Import translations of product names and descriptions $r++; diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 728959a982b..a3aae093043 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -73,8 +73,13 @@ AppliedPricesTo=Appliqué jusqu'au ErrorAppliedPricesIntersectAnotherPeriod=La date de début ou de fin croise une autre période existante. SellingPrice=Prix de vente SellingPriceHT=Prix de vente HT +SellingMinPriceHT=Prix de vente minimum (HT) +SellingUnitPriceHT=Prix de vente unitaire (HT) +SellingUnitMinPriceHT=Prix de vente unitaire minimum (HT) SellingPriceTTC=Prix de vente TTC SellingMinPriceTTC=Prix de vente min. (TTC) +SellingUnitMinPriceTTC=Prix de vente unitaire minimum (TTC) +SellingUnitPriceTTC=Prix de vente unitaire (TTC) CostPriceDescription=Ce champ de prix (hors taxes) peut être utilisé pour saisir le montant moyen que ce produit coûte à votre société. Il peut s'agir de n'importe quel prix que vous calculez vous-même, par exemple à partir du prix d'achat moyen plus le coût moyen de production et de distribution. CostPriceUsage=Cette valeur peut être utilisée dans le calcul des marges. ManufacturingPrice=Prix de fabrication