- Posts: 91
- Karma: 1
- Thank you received: 0
- Community Forum
- Appointment Booking Pro - Retired, no longer for sale or supported.
- ABPro 4.0.x
- User Credits not being deducted sometimes
User Credits not being deducted sometimes
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
We use User Credits.
We give everyone a credit balance to draw from based on how much vacation time they get each year.
When someone books a resource, we subtract time from their user credit account (8 hours for a full day or 4 hours for a half day)
For some reason that I can't figure out, sometimes, someone books a resource (for example Full Day that costs 8 hours) the transaction is not being written to the user credit table j3_sv_apptpro3_user_credit_activity and the j3_sv_apptpro3_user_credit table is not being updated. if I cancel the request and re-enter it, it works.
The resource is being booked and the update is being pushed to the google calendar, but the user credit table isn't always being updated.
We have been using this for 4 years at this point and the problem started to occur in December 2018.
Any ideas what I can do to troubleshoot this?
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
Check the ABPro Error Log screen to see if problems may be occurring.
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
I checked the error log and there are zero errors there.
Any ideas about how I can dig into this to see what might be occurring?
For example, I just saw someone enter quite a few bookings and all of them except 1 handled the user credits correctly.
They are using Google Chrome 65.0.3325.162 so I asked them to update to a newer version of Chrome to see if it could be a browser based issue.
Which code is being called that updates the user_credit tables?
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
In fact, it doesn't even show the transaction to decrease the credits at all.
That's pretty strange.
Are the bookings being made via the normal front end booking screen?
I assume you have logins required, as the user credits only work for registered and logged in users.
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
yes, Logins are required
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
Are bookings done via the desktop? You are not using the jQuery web app?
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
If you have not changed the program, it seems more likely a user issue than a program issue.
Maybe someone is using the system in a way you had not anticipated.
Do they have access to the Front Desk and thereby the staff booking screen?
Is it common to one or two users? If so, maybe ask them exactly how they are booking.
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
In the PHP error log, I see:
[24-Jan-2019 11:34:53 America/Chicago] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /data1/webserver/htdocs/components/com_rsappt_pro3/functions2.php on line 667
I'm not sure if this is an ignorable PHP error or not or if upgrading PHP might be the culprit.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
If everyone is using the same screen, and are logged in, then the exact same code is run for everyone so I cannot see how it would work sometimes and not others.
If you look at the booking detail, it will show the $ deducted from the user's credit.
Also, see questions in my previous posts.
Confirm you are running with auto-accept = yes.
In the Payment Processors scree, General Settings tab, ensure you have Non-Pay Booking Button = Display and Block
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
Please find below:
1. Each user has their own login --> Yes. No one can share logins, we use LDAP for users.
2. Are bookings done via the desktop --> Yes, we are only using the desktop, no mobile phones or jQuery web apps.
3. Do they have access to the Front Desk and thereby the staff booking screen? --> No, only the GAD
4. Is it common to one or two users? --> No, it can happen to anyone.
5. The booking detail shows $0.00 when it fails.
6. Auto Accept is set to Yes (we have been running this for 4 years and it's worked until December 2018).
7. Non-Pay Booking Button is set to No and has been for the last 4 years.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
If the booking cost = $0 then ABPro will have nothing to deduct from the credit.
If Non-Pay Booking Button = No, then you must be using PayPal or other payment processor in order to show booking costs.Non-Pay Booking Button is set to No and has been for the last 4 years
Which payment processor are you using?
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
When it works, the booking details shows $8.00 and it deducts from the User Credits
When it fails, the booking details shows $0.00 and it doesn't enter a transaction in the User Credits.
I have PayPal set to Yes, but it never calls PayPal because we "give" people credits. When they run out of credits, they can't make any more requests.
Effectively, 1 credit = 1 hour of vacation time. A full day "resource" costs 8 credits (or $8.00). A half day "resource" costs 4 credits (or $4.00). At the beginning of the year, I calculate how many days of vacation time each person receives and then I go to User Credits and increase their Credit Balance to however many days of vacation they get. When someone books a resource, for example 1 day of vacation time, it subtracts 8 credits from their credit "account". Once they get to 0 credits, they are sent to PayPal to buy more, but this isn't real - it sends them to the Test PayPal server and they can't actually "purchase" more vacation time.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
When it fails, the booking details shows $0.00 and it doesn't enter a transaction in the User Credits.
Yes, that is how it is designed to work.
The question is why does it show $0.00.
Ensure you have not turned on Joomla cache, as that can send old data out to the browser.
Ensure your resource Rate is just a number (no $).
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
System Cache: OFF - Caching disabled
2. Resource Rage:
Rate: 1.00 Rate Unit: per Hour
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
Unfortunately, unless you can reproduce it, I can see no way to troubleshoot that scenario further.
Maybe look for anything common to all failed bookings(??).
Another option may be to brute force stop the booking if the credit used = $0.
I will investigate what would be required to do that.
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
Thanks for your help.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
as quickly as the problem started occurring, it's also disappeared
Aren't computers fun
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
Alternately, point me to the file that has the code in it about the user credits and I'll review that and ask questions if I have any.
Please Log in to join the conversation.
- Rob
- Offline
- Administrator
- Posts: 4785
- Karma: 103
- Thank you received: 673
You could go in to the User Credits screen and manually adjust the user's credits.Can you give me some SQL that will insert/update the appropriate table(s) around user credits so I can just do updates when the problem happens instead of having people cancel and rebook?
I thing we determined the issue is not in the user credits code, it is the booking amount due being $0 so ABPro does not do any credit adjustment.Alternately, point me to the file that has the code in it about the user credits and I'll review that and ask questions if I have any.
Ensure you have Early Booking Discounts = No in the Config Basic Setting tab.
If that were on, it could be discounting the booking charge based on when they book.
The amount to discount and days in advance are is set in the resource or service setup screen, the default is $1 discount if booked 7 days in advance. As you using a $1 booking charge, that would discount to free booking.
You could hard code a check in the validation that if the credit is $0, the process aborts.
To instruct on how to do that I would need to know which booking screen you use.
Please Log in to join the conversation.
- Patrick Gay
- Topic Author
- Offline
- Expert Boarder
- Posts: 91
- Karma: 1
- Thank you received: 0
2. We use the GAD Booking Screen.
3. Can you tell me what sql I need to use to insert the missing rows in the user_credits and user_credit_activity tables for the bookings that are already missing user credits?
Please Log in to join the conversation.
- Community Forum
- Appointment Booking Pro - Retired, no longer for sale or supported.
- ABPro 4.0.x
- User Credits not being deducted sometimes