Skip to content
Snippets Groups Projects
Commit f1c2c789 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop

parents c7b88d39 196bb426
Branches
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -243,35 +243,48 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie ...@@ -243,35 +243,48 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
// Invoice with Paypal transaction // Invoice with Paypal transaction
// TODO add hook possibility (regis)
if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int)) if ($conf->paypalplus->enabled && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && ! empty($facture->ref_int))
{ {
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();
$("#selectpaiementcode").change(function() {
setPaiementCode();
});
function setPaiementCode()
{
var code = $("#selectpaiementcode option:selected").val();
if (code == \'CHQ\') if (code == \'CHQ\')
{ {
jQuery(\'.fieldrequireddyn\').addClass(\'fieldrequired\'); $(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
if (jQuery(\'#fieldchqemetteur\').val() == \'\') if ($(\'#fieldchqemetteur\').val() == \'\')
{ {
jQuery(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val()); $(\'#fieldchqemetteur\').val(jQuery(\'#thirdpartylabel\').val());
} }
} }
else else
{ {
jQuery(\'.fieldrequireddyn\').removeClass(\'fieldrequired\'); $(\'.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 = {}; var subJson = {};
jQuery.map(selector.serializeArray(), function(n,i) $.map(selector.serializeArray(), function(n,i)
{ {
subJson[n["name"]] = n["value"]; subJson[n["name"]] = n["value"];
}); });
...@@ -280,17 +293,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie ...@@ -280,17 +293,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
function callForResult(imgId) function callForResult(imgId)
{ {
var json = {}; var json = {};
var form = jQuery("#payment_form"); var form = $("#payment_form");
json["amountPayment"] = jQuery("#amountpayment").attr("value"); json["amountPayment"] = $("#amountpayment").attr("value");
json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]")); json["amounts"] = elemToJson(form.find("input[name*=\"amount_\"]"));
json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]")); json["remains"] = elemToJson(form.find("input[name*=\"remain_\"]"));
if(imgId != null)json["imgClicked"] = imgId; if (imgId != null) {
json["imgClicked"] = imgId;
}
jQuery.post("ajaxpayment.php", json, function(data) $.post("ajaxpayment.php", json, function(data)
{ {
json = jQuery.parseJSON(data); json = $.parseJSON(data);
form.data(json); form.data(json);
...@@ -298,40 +313,40 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie ...@@ -298,40 +313,40 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{ {
if (key == "result") { if (key == "result") {
if (json["makeRed"]) { if (json["makeRed"]) {
jQuery("#"+key).css("color", "red"); $("#"+key).css("color", "red");
} else { } else {
jQuery("#"+key).removeAttr("style"); $("#"+key).removeAttr("style");
} }
json[key]=json["label"]+" "+json[key]; json[key]=json["label"]+" "+json[key];
jQuery("#"+key).text(json[key]); $("#"+key).text(json[key]);
} else { } else {
form.find("input[name*=\""+key+"\"]").each(function() { form.find("input[name*=\""+key+"\"]").each(function() {
jQuery(this).attr("value", json[key]); $(this).attr("value", json[key]);
}); });
} }
} }
}); });
} }
function callToBreakdown(imgSelector) { function callToBreakdown(imgSelector) {
var form = jQuery("#payment_form"), imgId; var form = $("#payment_form"), imgId;
imgId = imgSelector.attr("id"); imgId = imgSelector.attr("id");
callForResult(imgId); callForResult(imgId);
} }
jQuery("#payment_form").find("img").click(function() { $("#payment_form").find("img").click(function() {
callToBreakdown(jQuery(this)); callToBreakdown(jQuery(this));
}); });
jQuery("#payment_form").find("input[name*=\"amount_\"]").change(function() { $("#payment_form").find("input[name*=\"amount_\"]").change(function() {
callForResult(); callForResult();
}); });
jQuery("#amountpayment").change(function() { $("#amountpayment").change(function() {
callForResult(); callForResult();
}); });';
}); }
print '});
</script>'."\n"; </script>'."\n";
} }
......
...@@ -250,7 +250,7 @@ class Translate ...@@ -250,7 +250,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]));
...@@ -286,7 +286,7 @@ class Translate ...@@ -286,7 +286,7 @@ class Translate
} }
} }
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.
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment