Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Help with sql query please
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Help with sql query please
#48190
Help with sql query please 10 Years, 4 Months ago Karma: 0
Hi again

I have a couple of instances of Ari Data tables and need to customise each one to display only permitted information based on the user group the logged in user is assigned to. So this is my current query which shows records made by the current logged in user based on their registered email.

SELECT (CASE WHEN state = '1' THEN 'Accepted' WHEN state = '-2' THEN 'Waiting' WHEN state = '-1' THEN 'Archived' WHEN state = '0' THEN 'Rejected' ELSE 'Unknown' END) AS Status, s.names, s.phone, FROM_UNIXTIME(datetime1,'%d/%m/%y %T'), s.begin, s.PickupAddr1, s.end, s.PickupAddr4, s.message, s.selpassengers, s.selluggage, IF(s.returntrip=0, 'No', 'Yes'), IF(FROM_UNIXTIME(datetime2,'%Y') = '1970', NULL, FROM_UNIXTIME(datetime2, '%d/%m/%y %T')), tc.title AS Vehicle, s.cprice, pm.title As Payment, s.payment, s.selinfantseats, s.selchildseats, s.selboosterseats, s.selcarry, s.email, s.id, s.prepay, s.vehicletype FROM #__taxibooking_orders s
INNER JOIN #__taxibooking_cars tc ON tc.id = s.vehicletype
INNER JOIN #__taxibooking_paymentmethods pm ON pm.id = s.payment
WHERE s.email = {$UserEmail}

What I need is to modify this so that the records displayed are those created by anyone in the 'supervisor' user group. Are you able to assist please?

Thanks
The administrator has disabled public write access.
 
#48197
Re:Help with sql query please 10 Years, 4 Months ago Karma: 748
Hello,

Where user ID is stored in your tables?

Regards,
ARI Soft
The administrator has disabled public write access.
 
#48204
Re:Help with sql query please 10 Years, 4 Months ago Karma: 0
Hi, thanks for the reply

User IDs are stored in jos_users and the groups are stored in jos_usergroups

I don't want to specify the actual usergroup 'supervisor', just if the logged in user is in a specific group then they see the records created by anyone in that group.

Thanks
The administrator has disabled public write access.
 
#48205
Re:Help with sql query please 10 Years, 4 Months ago Karma: 748
Where user ID is stored in your tables (we don't ask about Joomla! tables, you work with "taxibooking" tables and we asked about these tables)?

Regards,
ARI Soft
The administrator has disabled public write access.
 
#48206
Re:Help with sql query please 10 Years, 4 Months ago Karma: 0
Oh I see, sorry!

There is no user ID stored in the taxibooking tables that I can see, I believe the reference is the 'email' field of the taxibooking_orders table

Thanks
Last Edit: 2014/03/02 08:51 By mnunan.
The administrator has disabled public write access.
 
#48207
Re:Help with sql query please 10 Years, 4 Months ago Karma: 748
What Joomla! version do you use?

Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 12