Add logs
This commit is contained in:
parent
184705fb14
commit
22bfa7a9e2
@ -527,10 +527,13 @@ jQuery(document).ready(function() {
|
|||||||
jQuery('#trlinefordates').show();
|
jQuery('#trlinefordates').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
/* When changing predefined product, we reload list of supplier prices */
|
/* When changing predefined product, we reload list of supplier prices required for margin combo */
|
||||||
$("#idprod, #idprodfournprice").change(function()
|
$("#idprod, #idprodfournprice").change(function()
|
||||||
{
|
{
|
||||||
setforpredef();
|
console.log("#idprod, #idprodfournprice change triggered");
|
||||||
|
|
||||||
|
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
|
||||||
|
|
||||||
jQuery('#trlinefordates').show();
|
jQuery('#trlinefordates').show();
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -564,7 +567,7 @@ jQuery(document).ready(function() {
|
|||||||
if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
|
if ($conf->global->MARGIN_TYPE == 'pmp') print 'pmp';
|
||||||
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
|
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
|
||||||
} ?>';
|
} ?>';
|
||||||
console.log("defaultbuyprice="+defaultbuyprice);
|
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
$(data).each(function() {
|
$(data).each(function() {
|
||||||
@ -573,23 +576,25 @@ jQuery(document).ready(function() {
|
|||||||
i++;
|
i++;
|
||||||
this.price = parseFloat(this.price); // to fix when this.price >0
|
this.price = parseFloat(this.price); // to fix when this.price >0
|
||||||
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
|
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
|
||||||
console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
|
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
|
||||||
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
|
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
|
||||||
}
|
}
|
||||||
if (this.id == 'pmpprice')
|
if (this.id == 'pmpprice')
|
||||||
{
|
{
|
||||||
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
|
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
|
||||||
console.log("id="+this.id+"-price="+this.price);
|
//console.log("id="+this.id+"-price="+this.price);
|
||||||
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
|
||||||
{
|
{
|
||||||
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
if (this.price > 0) {
|
||||||
console.log("pmppricevalue="+pmppricevalue); }
|
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
|
||||||
|
//console.log("pmppricevalue="+pmppricevalue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.id == 'costprice')
|
if (this.id == 'costprice')
|
||||||
{
|
{
|
||||||
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
|
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
|
||||||
console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
|
//console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
|
||||||
if ('costprice' == defaultbuyprice)
|
if ('costprice' == defaultbuyprice)
|
||||||
{
|
{
|
||||||
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
|
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
|
||||||
@ -635,7 +640,9 @@ jQuery(document).ready(function() {
|
|||||||
},
|
},
|
||||||
'json');
|
'json');
|
||||||
|
|
||||||
<?php } ?>
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
/* To set focus */
|
/* To set focus */
|
||||||
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
|
if (jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val() > 0)
|
||||||
@ -659,6 +666,7 @@ jQuery(document).ready(function() {
|
|||||||
|
|
||||||
/* Function to set fields from choice */
|
/* Function to set fields from choice */
|
||||||
function setforfree() {
|
function setforfree() {
|
||||||
|
console.log("Call setforfree. We show most fields");
|
||||||
jQuery("#search_idprod").val('');
|
jQuery("#search_idprod").val('');
|
||||||
jQuery("#idprod").val('');
|
jQuery("#idprod").val('');
|
||||||
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
|
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
|
||||||
@ -680,6 +688,7 @@ function setforfree() {
|
|||||||
jQuery("#units, #title_units").show();
|
jQuery("#units, #title_units").show();
|
||||||
}
|
}
|
||||||
function setforpredef() {
|
function setforpredef() {
|
||||||
|
console.log("Call setforpredef. We hide some fields");
|
||||||
jQuery("#select_type").val(-1);
|
jQuery("#select_type").val(-1);
|
||||||
jQuery("#prod_entry_mode_free").prop('checked',false);
|
jQuery("#prod_entry_mode_free").prop('checked',false);
|
||||||
jQuery("#prod_entry_mode_predef").prop('checked',true);
|
jQuery("#prod_entry_mode_predef").prop('checked',true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user