Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stripe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Extensions
Stripe
Commits
3fee1676
Commit
3fee1676
authored
9 years ago
by
Joshua Walker
Browse files
Options
Downloads
Plain Diff
Merge pull request
#118
from progressivetech/github117
FIx constraint violation if we try to insert 0 for campaign id.
parents
0cfd5112
6f311003
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Stripe/Page/Webhook.php
+13
-5
13 additions, 5 deletions
CRM/Stripe/Page/Webhook.php
with
13 additions
and
5 deletions
CRM/Stripe/Page/Webhook.php
+
13
−
5
View file @
3fee1676
...
...
@@ -90,9 +90,7 @@ class CRM_Stripe_Page_Webhook extends CRM_Core_Page {
$net_amount
=
$total_amount
-
$fee_amount
;
$transaction_id
=
$charge
->
id
;
$new_invoice_id
=
$stripe_event_data
->
data
->
object
->
id
;
if
(
empty
(
$recur_contrib_query
->
campaign_id
))
{
$recur_contrib_query
->
campaign_id
=
0
;
}
$query_params
=
array
(
1
=>
array
(
$invoice_id
,
'String'
),
...
...
@@ -128,8 +126,18 @@ class CRM_Stripe_Page_Webhook extends CRM_Core_Page {
10
=>
array
(
$recur_contrib_query
->
currency
,
'String'
),
11
=>
array
(
$recur_contrib_query
->
id
,
'Integer'
),
12
=>
array
(
$recur_contrib_query
->
is_test
,
'Integer'
),
13
=>
array
(
$recur_contrib_query
->
campaign_id
,
'Integer'
),
);
// We have to add campaign_id manually because it could be an integer
// or it could be NULL and CiviCRM can't validate something that could
// be either.;
if
(
!
empty
(
$recur_contrib_query
->
campaign_id
))
{
// If it's a number, ensure it's an intval to avoid injection attack.
$campaign_id
=
intval
(
$recur_contrib_query
->
campaign_id
);
}
else
{
$campaign_id
=
'NULL'
;
}
CRM_Core_DAO
::
executeQuery
(
"INSERT INTO civicrm_contribution (
contact_id,
{
$financial_field
}
, payment_instrument_id, receive_date,
total_amount, fee_amount, net_amount, trxn_id, invoice_id, currency,
...
...
@@ -137,7 +145,7 @@ class CRM_Stripe_Page_Webhook extends CRM_Core_Page {
) VALUES (
%1, %2, %3, %4,
%5, %6, %7, %8, %9, %10,
%11, %12, '1',
%13
)"
,
%11, %12, '1',
$campaign_id
)"
,
$query_params
);
if
(
!
empty
(
$end_time
)
&&
$time_compare
>
$end_time
)
{
...
...
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