Skip to content

Commit

Permalink
CORE product: Ajout des dates de debut et de fin de validité d'un pri…
Browse files Browse the repository at this point in the history
…x de vente client et de la remise PR Dolibarr#33223 et PR Dolibarr#33225
  • Loading branch information
kkhelifa-opendsi committed Feb 28, 2025
1 parent d85652e commit ca92c45
Show file tree
Hide file tree
Showing 13 changed files with 124 additions and 68 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ public function createFromClone(User $user, $socid = 0, $forceentity = null, $up
if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
}
$remise_percent = $custprice_line->remise_percent;
$remise_percent = $custprice_line->discount_percent;
break;
}
}
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/class/html.form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2698,8 +2698,8 @@ public function select_produits_list($selected = '', $htmlname = 'productid', $f
//Price by customer
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
$sql .= ', pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,';
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.default_vat_code as custdefault_vat_code, pcp.ref_customer as custref, pcp.remise_percent as custremise_percent';
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custdefault_vat_code, custref, custremise_percent";
$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.default_vat_code as custdefault_vat_code, pcp.ref_customer as custref, pcp.discount_percent as custdiscount_percent';
$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custdefault_vat_code, custref, custdiscount_percent";
}
// Units
if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
Expand Down Expand Up @@ -3251,7 +3251,7 @@ protected function constructProductListOption(&$objp, &$opt, &$optJson, $price_l
$outpricebasetype = $objp->custprice_base_type;
$outtva_tx = $objp->custtva_tx;
$outdefault_vat_code = $objp->custdefault_vat_code;
$outdiscount = $objp->custremise_percent;
$outdiscount = $objp->custdiscount_percent;
}
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/modProduct.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public function __construct($db)
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
'pr.tva_tx'=>'PriceVATRate',
'pr.default_vat_code'=>'PriceVATCode',
'pr.remise_percent' => 'Discount',
'pr.discount_percent' => 'Discount',
'pr.datec'=>'DateCreation');
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
Expand All @@ -389,7 +389,7 @@ public function __construct($db)
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.default_vat_code'=>'product',
'pr.remise_percent' => 'product',
'pr.discount_percent' => 'product',
'pr.recuperableonly'=>'product',
'pr.datec'=>"product");
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/modules/modService.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ public function __construct($db)
'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
'pr.tva_tx'=>'PriceVATRate',
'pr.default_vat_code'=>'PriceVATCode',
'pr.remise_percent' => 'Discount',
'pr.discount_percent' => 'Discount',
'pr.datec'=>'DateCreation');
if (is_object($mysoc) && $usenpr) {
$this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
Expand All @@ -348,7 +348,7 @@ public function __construct($db)
'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.default_vat_code'=>'product',
'pr.remise_percent' => 'product',
'pr.discount_percent' => 'product',
'pr.recuperableonly'=>'product',
'pr.datec'=>"product");
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
Expand Down
2 changes: 2 additions & 0 deletions htdocs/install/mysql/migration/17.0.0-18.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -670,3 +670,5 @@ ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_
ALTER TABLE llx_product_customer_price ADD CONSTRAINT fk_product_customer_price_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
UPDATE llx_product_customer_price SET date_begin = datec WHERE date_begin IS NULL;
UPDATE llx_product_customer_price_log SET date_begin = datec WHERE date_begin IS NULL;
ALTER TABLE llx_product_customer_price CHANGE COLUMN remise_percent discount_percent real DEFAULT 0;
ALTER TABLE llx_product_customer_price_log CHANGE COLUMN remise_percent discount_percent real DEFAULT 0;
4 changes: 2 additions & 2 deletions htdocs/install/mysql/tables/llx_product_customer_price.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ create table llx_product_customer_price
fk_product integer NOT NULL,
fk_soc integer NOT NULL,
ref_customer varchar(128),
date_begin date NOT NULL,
date_begin date,
date_end date,
price double(24,8) DEFAULT 0,
price_ttc double(24,8) DEFAULT 0,
Expand All @@ -43,7 +43,7 @@ create table llx_product_customer_price
localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2_tx double(7,4) DEFAULT 0, -- Other local VAT 2
localtax2_type varchar(10) NOT NULL DEFAULT '0',
remise_percent real DEFAULT 0,
discount_percent real DEFAULT 0,
fk_user integer,
import_key varchar(14) -- Import key
)ENGINE=innodb;
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ create table llx_product_customer_price_log
fk_product integer NOT NULL,
fk_soc integer DEFAULT 0 NOT NULL,
ref_customer varchar(30),
date_begin date NOT NULL,
date_begin date,
date_end date,
price double(24,8) DEFAULT 0,
price_ttc double(24,8) DEFAULT 0,
Expand All @@ -42,7 +42,7 @@ create table llx_product_customer_price_log
localtax1_type varchar(10) NOT NULL DEFAULT '0',
localtax2_tx double(7,4) DEFAULT 0, -- Other local VAT 2
localtax2_type varchar(10) NOT NULL DEFAULT '0',
remise_percent real DEFAULT 0,
discount_percent real DEFAULT 0,
fk_user integer,
import_key varchar(14) -- Import key
)ENGINE=innodb;
1 change: 1 addition & 0 deletions htdocs/langs/en_US/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ UpdateDefaultPrice=Update default price
UpdateLevelPrices=Update prices for each level
AppliedPricesFrom=Applied from
AppliedPricesTo=Applied to
ErrorAppliedPricesIntersectAnotherPeriod=The begin or end date intersect to another existing period.
SellingPrice=Selling price
SellingPriceHT=Selling price (excl. tax)
SellingPriceTTC=Selling price (inc. tax)
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/fr_FR/products.lang
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ UpdateDefaultPrice=Modifier prix par défaut
UpdateLevelPrices=Modifier prix pour chaque niveau
AppliedPricesFrom=Pratiqués à partir du
AppliedPricesTo=Pratiqués jusqu'au
ErrorAppliedPricesIntersectAnotherPeriod=La date de début ou de fin rentre en conflit avec une période de dates existante.
SellingPrice=Prix de vente
SellingPriceHT=Prix de vente HT
SellingPriceTTC=Prix de vente TTC
Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/ajax/products.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
$outtva_tx_formated = price($custprice_line->tva_tx);
$outtva_tx = price2num($custprice_line->tva_tx);
$outdefault_vat_code = $custprice_line->default_vat_code;
$outdiscount = $custprice_line->remise_percent;
$outdiscount = $custprice_line->discount_percent;
break;
}
}
Expand Down
Loading

0 comments on commit ca92c45

Please sign in to comment.