Fix: 3 fixes on option MAIN_JS_ON_PAYMENT (css, bad path, removed
forced var)
This commit is contained in:
parent
8c27a3202b
commit
5b02ff3a86
@ -18,7 +18,6 @@
|
||||
/**
|
||||
* \file htdocs/compta/ajaxpayment.php
|
||||
* \brief File to return Ajax response on payment breakdown process
|
||||
* \version ajaxpayment.php,v 1.0
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
@ -45,10 +44,7 @@ $currentInvId = $_POST['imgClicked']; // from DOM elements : imgId (equals invo
|
||||
|
||||
// Getting the posted keys=>values, sanitize the ones who are from text inputs
|
||||
// from text inputs : total amount
|
||||
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment)
|
||||
: ''
|
||||
)
|
||||
: ''; // keep void if not a valid entry
|
||||
$amountPayment = $amountPayment!='' ? ( is_numeric(price2num($amountPayment)) ? price2num($amountPayment) : '' ) : ''; // keep void if not a valid entry
|
||||
// Checkamounts
|
||||
foreach ($amounts as $key => $value)
|
||||
{
|
||||
@ -60,7 +56,7 @@ foreach ($amounts as $key => $value)
|
||||
$result = $amountPayment != '' ? $amountPayment - array_sum($amounts) : $amountPayment + array_sum($amounts); // Remaining amountPayment
|
||||
$toJsonArray = array();
|
||||
$totalRemaining = price2num(array_sum($remains));
|
||||
$toJsonArray['label'] = $amountPayment == '' ? $langs->transnoentities('AmountToBeCharged') : $langs->transnoentities('RemainingAmountPayment');
|
||||
$toJsonArray['label'] = $amountPayment == '' ? '' : $langs->transnoentities('RemainingAmountPayment');
|
||||
if($currentInvId) // Here to breakdown
|
||||
{
|
||||
// Get the current amount (from form) and the corresponding remainToPay (from invoice)
|
||||
|
||||
@ -280,12 +280,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
|
||||
$(\'#fieldchqemetteur\').val(\'\');
|
||||
}
|
||||
}';
|
||||
// For paiement auto-completion
|
||||
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
|
||||
{
|
||||
print "\n".'
|
||||
function elemToJson(selector)
|
||||
}
|
||||
|
||||
function _elemToJson(selector)
|
||||
{
|
||||
var subJson = {};
|
||||
$.map(selector.serializeArray(), function(n,i)
|
||||
@ -300,14 +297,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
var form = $("#payment_form");
|
||||
|
||||
json["amountPayment"] = $("#amountpayment").attr("value");
|
||||
json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
|
||||
json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
|
||||
json["amounts"] = _elemToJson(form.find("input[name*=\"amount_\"]"));
|
||||
json["remains"] = _elemToJson(form.find("input[name*=\"remain_\"]"));
|
||||
|
||||
if (imgId != null) {
|
||||
json["imgClicked"] = imgId;
|
||||
}
|
||||
|
||||
$.post("ajaxpayment.php", json, function(data)
|
||||
$.post("'.DOL_URL_ROOT.'/compta/ajaxpayment.php", json, function(data)
|
||||
{
|
||||
json = $.parseJSON(data);
|
||||
|
||||
@ -317,9 +314,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
if (key == "result") {
|
||||
if (json["makeRed"]) {
|
||||
$("#"+key).css("color", "red");
|
||||
$("#"+key).addClass("error");
|
||||
} else {
|
||||
$("#"+key).removeAttr("style");
|
||||
$("#"+key).removeClass("error");
|
||||
}
|
||||
json[key]=json["label"]+" "+json[key];
|
||||
$("#"+key).text(json[key]);
|
||||
@ -331,27 +328,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
}
|
||||
});
|
||||
}
|
||||
function callToBreakdown(imgSelector) {
|
||||
var form = $("#payment_form"), imgId;
|
||||
|
||||
imgId = imgSelector.attr("id");
|
||||
callForResult(imgId);
|
||||
}
|
||||
|
||||
$("#payment_form").find("img").click(function() {
|
||||
callToBreakdown(jQuery(this));
|
||||
});
|
||||
|
||||
$("#payment_form").find("input[name*=\"amount_\"]").change(function() {
|
||||
callForResult();
|
||||
});
|
||||
$("#payment_form").find("input[name*=\"amount_\"]").keyup(function() {
|
||||
callForResult();
|
||||
});
|
||||
';
|
||||
|
||||
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
|
||||
{
|
||||
print ' $("#payment_form").find("img").click(function() {
|
||||
callForResult(jQuery(this).attr("id"));
|
||||
});
|
||||
|
||||
$("#amountpayment").change(function() {
|
||||
callForResult();
|
||||
});';
|
||||
}
|
||||
print '});
|
||||
</script>'."\n";
|
||||
|
||||
print ' });'."\n";
|
||||
print ' </script>'."\n";
|
||||
}
|
||||
|
||||
print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
@ -573,7 +570,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if ($totalrecudeposits) print '+'.price($totalrecudeposits);
|
||||
print '</b></td>';
|
||||
print '<td align="right"><b>'.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT')).'</b></td>';
|
||||
print '<td align="right" id="result" style="font-weight:bold;"></td>';
|
||||
print '<td align="right" id="result" style="font-weight: bold;"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -212,6 +212,6 @@ if (! defined('NOREQUIRETRAN'))
|
||||
if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR');
|
||||
|
||||
// We force feature to help debug
|
||||
$conf->global->MAIN_JS_ON_PAYMENT=0; // We set to zero to unifrmize way of working between customer and supplier payments
|
||||
//$conf->global->MAIN_JS_ON_PAYMENT=0;
|
||||
|
||||
?>
|
||||
|
||||
@ -1441,7 +1441,7 @@ font-family: <?php print $fontlist ?>;
|
||||
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
td.highlights { background: #f9c5c6; }
|
||||
|
||||
|
||||
@ -1595,7 +1595,7 @@ font-family: <?php print $fontlist ?>;
|
||||
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
td.highlights { background: #f9c5c6; }
|
||||
|
||||
|
||||
@ -1511,7 +1511,7 @@ font-family: <?php print $fontlist ?>;
|
||||
*/
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
div.ok {
|
||||
color: #114466;
|
||||
|
||||
@ -1762,9 +1762,7 @@ tr.fiche {
|
||||
*/
|
||||
.ok { color: #114466; }
|
||||
.warning { color: #887711; }
|
||||
.error { color: #550000; font-weight: bold; }
|
||||
|
||||
td.highlights { background: #f9c5c6; }
|
||||
.error { color: #550000 !important; font-weight: bold; }
|
||||
|
||||
div.ok {
|
||||
color: #114466;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user