Merge branch '3.1' of ssh://git@github.com/Dolibarr/dolibarr.git into 3.1
This commit is contained in:
commit
13b50e3dd7
@ -252,92 +252,106 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
|
if (! empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid=$conf->global->PAYPAL_BANK_ACCOUNT;
|
||||||
$paymentnum=$facture->ref_int;
|
$paymentnum=$facture->ref_int;
|
||||||
}
|
}
|
||||||
if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_JS_ON_PAYMENT))
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print "\n".'<script type="text/javascript" language="javascript">';
|
print "\n".'<script type="text/javascript" language="javascript">';
|
||||||
print 'jQuery(document).ready(function () {';
|
print '$(document).ready(function () {
|
||||||
print 'jQuery("#selectpaiementcode").change(function() {
|
setPaiementCode();
|
||||||
code=jQuery("#selectpaiementcode option:selected").val();
|
|
||||||
if (code == \'CHQ\')
|
$("#selectpaiementcode").change(function() {
|
||||||
{
|
setPaiementCode();
|
||||||
jQuery(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
|
|
||||||
if (jQuery(\'#fieldchqemetteur\').val() == \'\')
|
|
||||||
{
|
|
||||||
jQuery(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jQuery(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function elemToJson(selector)
|
|
||||||
{
|
|
||||||
var subJson = {};
|
|
||||||
jQuery.map(selector.serializeArray(), function(n,i)
|
|
||||||
{
|
|
||||||
subJson[n["name"]] = n["value"];
|
|
||||||
});
|
});
|
||||||
return subJson;
|
|
||||||
}
|
function setPaiementCode()
|
||||||
function callForResult(imgId)
|
|
||||||
{
|
|
||||||
var json = {};
|
|
||||||
var form = jQuery("#payment_form");
|
|
||||||
|
|
||||||
json["amountPayment"] = jQuery("#amountpayment").attr("value");
|
|
||||||
json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
|
|
||||||
json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
|
|
||||||
|
|
||||||
if(imgId != null)json["imgClicked"] = imgId;
|
|
||||||
|
|
||||||
jQuery.post("ajaxpayment.php", json, function(data)
|
|
||||||
{
|
{
|
||||||
json = jQuery.parseJSON(data);
|
var code = $("#selectpaiementcode option:selected").val();
|
||||||
|
|
||||||
form.data(json);
|
if (code == \'CHQ\')
|
||||||
|
|
||||||
for(var key in json)
|
|
||||||
{
|
{
|
||||||
if(key == "result") {
|
$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
|
||||||
if(json["makeRed"]) {
|
if ($(\'#fieldchqemetteur\').val() == \'\')
|
||||||
jQuery("#"+key).css("color", "red");
|
{
|
||||||
} else {
|
$(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val());
|
||||||
jQuery("#"+key).removeAttr("style");
|
|
||||||
}
|
|
||||||
json[key]=json["label"]+" "+json[key];
|
|
||||||
jQuery("#"+key).text(json[key]);
|
|
||||||
} else {
|
|
||||||
form.find("input[name*=\""+key+"\"]").each(function() {
|
|
||||||
jQuery(this).attr("value", json[key]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
else
|
||||||
|
{
|
||||||
}
|
$(\'.fieldrequireddyn\').removeClass(\'fieldrequired\');
|
||||||
function callToBreakdown(imgSelector) {
|
$(\'#fieldchqemetteur\').val(\'\');
|
||||||
var form = jQuery("#payment_form"), imgId;
|
}
|
||||||
|
}';
|
||||||
imgId = imgSelector.attr("id");
|
// For paiement auto-completion
|
||||||
callForResult(imgId);
|
if (! empty($conf->global->MAIN_JS_ON_PAYMENT))
|
||||||
}
|
{
|
||||||
|
print "\n".'
|
||||||
jQuery("#payment_form").find("img").click(function() {
|
function elemToJson(selector)
|
||||||
callToBreakdown(jQuery(this));
|
{
|
||||||
});
|
var subJson = {};
|
||||||
|
$.map(selector.serializeArray(), function(n,i)
|
||||||
jQuery("#payment_form").find("input[name*=\"amount_\"]").change(function() {
|
{
|
||||||
callForResult();
|
subJson[n["name"]] = n["value"];
|
||||||
});
|
});
|
||||||
|
return subJson;
|
||||||
jQuery("#amountpayment").change(function() {
|
}
|
||||||
callForResult();
|
function callForResult(imgId)
|
||||||
});
|
{
|
||||||
});
|
var json = {};
|
||||||
</script>'."\n";
|
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_\"]"));
|
||||||
|
|
||||||
|
if (imgId != null) {
|
||||||
|
json["imgClicked"] = imgId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post("ajaxpayment.php", json, function(data)
|
||||||
|
{
|
||||||
|
json = $.parseJSON(data);
|
||||||
|
|
||||||
|
form.data(json);
|
||||||
|
|
||||||
|
for (var key in json)
|
||||||
|
{
|
||||||
|
if (key == "result") {
|
||||||
|
if (json["makeRed"]) {
|
||||||
|
$("#"+key).css("color", "red");
|
||||||
|
} else {
|
||||||
|
$("#"+key).removeAttr("style");
|
||||||
|
}
|
||||||
|
json[key]=json["label"]+" "+json[key];
|
||||||
|
$("#"+key).text(json[key]);
|
||||||
|
} else {
|
||||||
|
form.find("input[name*=\""+key+"\"]").each(function() {
|
||||||
|
$(this).attr("value", json[key]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#amountpayment").change(function() {
|
||||||
|
callForResult();
|
||||||
|
});';
|
||||||
|
}
|
||||||
|
print '});
|
||||||
|
</script>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form id="payment_form" name="add_paiement" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
|||||||
@ -246,7 +246,7 @@ class Translate {
|
|||||||
$tab=explode('=',$line,2);
|
$tab=explode('=',$line,2);
|
||||||
$key=trim($tab[0]);
|
$key=trim($tab[0]);
|
||||||
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
|
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
|
||||||
if (empty($this->tab_translate[$key]) && isset($tab[1])) // If data was already found, we must not enter here, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite)
|
if ((! empty($conf->global->MAIN_USE_CUSTOM_TRANSLATION) || empty($this->tab_translate[$key])) && isset($tab[1])) // If data was already found, we must not enter here, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite)
|
||||||
{
|
{
|
||||||
$value=trim(preg_replace('/\\n/',"\n",$tab[1]));
|
$value=trim(preg_replace('/\\n/',"\n",$tab[1]));
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ class Translate {
|
|||||||
$size=dol_setcache($usecachekey,$tabtranslatedomain);
|
$size=dol_setcache($usecachekey,$tabtranslatedomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_FORCELANGDIR)) break; // Break loop on each root dir. If a module has forced dir, we do not stop loop.
|
if (empty($conf->global->MAIN_FORCELANGDIR) && empty($conf->global->MAIN_USE_CUSTOM_TRANSLATION)) break; // Break loop on each root dir. If a module has forced dir, we do not stop loop.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user