Fix: MARGIN_TYPE == 2 is "using PMP price" so i remove a duplicate

option to get same behaviour.
This commit is contained in:
Laurent Destailleur 2015-06-24 21:33:19 +02:00
parent a7aaa89e49
commit 1485ead215
2 changed files with 17 additions and 4 deletions

View File

@ -527,7 +527,8 @@ jQuery(document).ready(function() {
}
if (this.id == 'pmpprice')
{
var defaultbuyprice = <?php echo (isset($conf->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 = <?php echo ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')?1:0); ?>;
if (this.price > 0 && 1 == defaultbuyprice) { defaultkey = this.id; defaultprice = this.price; }
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
}

View File

@ -141,16 +141,28 @@ print '<td align="right">'.$langs->trans('MargeBrute');
print ' <input type="radio" name="MARGIN_TYPE" value="1" ';
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1')
print 'checked ';
print '/><br/>'.$langs->trans('MargeNette');
print '/><br>';
/*print $langs->trans('MargeNette');
print ' <input type="radio" name="MARGIN_TYPE" value="2" ';
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '2')
print 'checked ';
print '/>';
print '/>';*/
// TODO Check that PMP is available when stock module is not enabled. If not, make this choice greyed when stock module disabled.
//if (! empty($conf->stock->enabled))
//{
print $langs->trans('MargeNette');
print ' <input type="radio" name="MARGIN_TYPE" value="pmp" ';
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp')
print 'checked ';
print '/>';
//}
print '</td>';
print '<td>';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" class="button">';
print '</td>';
print '<td>'.$langs->trans('MARGIN_TYPE_DETAILS').'</td>';
print '<td>'.$langs->trans('MARGIN_TYPE_DETAILS');
print ' ('.$langs->trans("PMP").')';
print '</td>';
print '</tr>';
print '</form>';