diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index db55be8754c..fad1af3c082 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -527,7 +527,8 @@ jQuery(document).ready(function() { } if (this.id == 'pmpprice') { - var defaultbuyprice = global->MARGIN_PMP_AS_DEFAULT_BUY_PRICE)?int($conf->global->MARGIN_PMP_AS_DEFAULT_BUY_PRICE):1); ?>; + // If margin is calculated on PMP, we set it by defaut (but only if value is not 0) + var defaultbuyprice = global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')?1:0); ?>; if (this.price > 0 && 1 == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; } options += ''; } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 715bfe7b35b..9a0f55010ab 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -141,16 +141,28 @@ print '