Browse Source

MMIProduct : fix supplier price reduction display

Mathieu Moulin 1 year ago
parent
commit
3e960b738e
1 changed files with 8 additions and 8 deletions
  1. 8 8
      htdocs/product/fournisseurs.php

+ 8 - 8
htdocs/product/fournisseurs.php

@@ -745,28 +745,28 @@ END;
 
 				// MMI Hack
 				if (!empty($conf->global->MMIPRODUCT_SUPPLIER_PRICE_REDUCTED_DISPLAY)) {
-					$price = GETPOST('price') ? price(GETPOST('price')) : (isset($object->fourn_price) ? price($object->fourn_price) : 0);
-					$remise_percent = GETPOSTISSET('remise_percent') ? vatrate(price2num(GETPOST('remise_percent'), '', 2)) : (isset($object->fourn_remise_percent) ?vatrate($object->fourn_remise_percent) : 0);
+					$price = GETPOST('price') ? GETPOST('price') : (isset($object->fourn_price) ? $object->fourn_price : 0);
+					$remise_percent = GETPOSTISSET('remise_percent') ? GETPOST('remise_percent') : (isset($object->fourn_remise_percent) ?$object->fourn_remise_percent : 0);
 					// Supplier priced with rediction
 					print '<tr><td>'.$langs->trans("DiscountPriceQtyMin").'</td>';
 					print '<td><input class="flat" name="discount_price" size="4" value="'.($price*(1-$remise_percent/100)).'" /></td>';
 					print '</tr>';
 					print '<script type="text/javascript">';
-					print '$("input[name=discount_price]").change(function(){
-						var discount_price = $(this).val().replace(",", ".");
-						var remise_percent = $("input[name=remise_percent]").val().replace(",", ".");
-						$("input[name=price]").val(discount_price/(1-remise_percent/100));
-					});';
 					print '$("input[name=price]").change(function(){
 						var price = $(this).val().replace(",", ".");
 						var remise_percent = $("input[name=remise_percent]").val().replace(",", ".");
 						$("input[name=discount_price]").val(price*(1-remise_percent/100));
-					});';
+					}).change();;';
 					print '$("input[name=remise_percent]").change(function(){
 						var remise_percent = $(this).val().replace(",", ".");
 						var price = $("input[name=price]").val().replace(",", ".");
 						$("input[name=discount_price]").val(price*(1-remise_percent/100));
 					});';
+					print '$("input[name=discount_price]").change(function(){
+						var discount_price = $(this).val().replace(",", ".");
+						var remise_percent = $("input[name=remise_percent]").val().replace(",", ".");
+						$("input[name=price]").val(discount_price/(1-remise_percent/100));
+					})';
 					print '</script>';
 				}