Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
196bb426
Commit
196bb426
authored
Jan 15, 2012
by
Regis Houssin
Browse files
Options
Downloads
Patches
Plain Diff
Fix: use MAIN_JS_ON_PAYMENT just for the auto-completion payment
parent
244af052
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/compta/paiement.php
+145
-130
145 additions, 130 deletions
htdocs/compta/paiement.php
with
145 additions
and
130 deletions
htdocs/compta/paiement.php
+
145
−
130
View file @
196bb426
...
@@ -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-201
0
Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-201
2
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
"
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment