Picon

Room Admin to approve Bookings

Hi,

 

I am trying to add the ability for Room Admin to approve the bookings,

 

I have added a column in the mrbs_rooms table named room_admin. In here Ive added a username of a user who needs to be able to approve the bookings.

 

I have modified the auth_book_admin function as below.

 

$query= "select mrbs_room.id as RoomID, mrbs_area.id as AreaID, mrbs_room.room_admin as RoomAdmin, mrbs_area.approval_enabled as Approval from mrbs_room join mrbs_area on mrbs_room.area_id = mrbs_area.id WHERE mrbs_room.id=$room";

 

 

  $runQuery = mysql_query($query);

  while($Result = mysql_fetch_array($runQuery, MYSQL_ASSOC))

  {

  $roomAdmin = "{$Result['RoomAdmin']}";

  $approval = "{$Result['Approval']}";

  }

 $pos = strpos($roomAdmin, $user);

 

                if ($approval == 1)

                {

                                if ($pos === false) {

         return FALSE;

                                } else {

        return TRUE;

                                }

 

                }

                else

                {

                                return (authGetUserLevel($user) >= 2);               

                }

 

 

This works as such that the Room Admin can add appointments without approval and can delete appointments.

The issue is the Room Admin cannot approve appointments and it doesn’t show any pending bookings for the Room Admin.

 

Im new to PHP so i could be way off the mark with the above.

 

Kind Regards

 

Jason

 

 


********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere
For more information and to find out how you can switch, visit www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Want to unsubscribe: mailto:mrbs-general-request <at> lists.sourceforge.net?subject=unsubscribe
Campbell Morrison | 4 Jan 18:17 2012
Picon

Re: Room Admin to approve Bookings

I’m afraid there are a few other things you’ll need to change to get this to work:

 

1.       You’ll need to change the SQL queries in header.inc and pending.php so that they also come up with the bookings for which that user is a room admin.   At the moment it only works for genuine admins

2.       I think you’ll probably also need to change the code in view_entry.php and pending.php that decides which buttons to present so that it works for room_admins

3.       You’ll need to change functions_mail.inc to send an email to the room admin.

 

And maybe a few other things as well!   You might also find you’re better off having a new table for room admins that has two columns, room id and user id.   That way you’ll be able to have more than one admin for a room.

 

Campbell

 

PS  Your test $pos = strpos($roomAdmin, $user); will give a false positive if the roomAdmin user name is a subset/superset (can’t remember which way round it will be) of the logged in user name.  A simple == test would be better (having first converted both names to lowercase).

 

 

 

From: Hall Jason (HULL TEACHING PCT) [mailto:jason.hall1 <at> nhs.net]
Sent: 04 January 2012 16:41
To: mrbs-general <at> lists.sourceforge.net
Subject: [MRBS-general] Room Admin to approve Bookings

 

Hi,

 

I am trying to add the ability for Room Admin to approve the bookings,

 

I have added a column in the mrbs_rooms table named room_admin. In here Ive added a username of a user who needs to be able to approve the bookings.

 

I have modified the auth_book_admin function as below.

 

$query= "select mrbs_room.id as RoomID, mrbs_area.id as AreaID, mrbs_room.room_admin as RoomAdmin, mrbs_area.approval_enabled as Approval from mrbs_room join mrbs_area on mrbs_room.area_id = mrbs_area.id WHERE mrbs_room.id=$room";

 

 

  $runQuery = mysql_query($query);

  while($Result = mysql_fetch_array($runQuery, MYSQL_ASSOC))

  {

  $roomAdmin = "{$Result['RoomAdmin']}";

  $approval = "{$Result['Approval']}";

  }

 $pos = strpos($roomAdmin, $user);

 

                if ($approval == 1)

                {

                                if ($pos === false) {

         return FALSE;

                                } else {

        return TRUE;

                                }

 

                }

                else

                {

                                return (authGetUserLevel($user) >= 2);               

                }

 

 

This works as such that the Room Admin can add appointments without approval and can delete appointments.

The issue is the Room Admin cannot approve appointments and it doesn’t show any pending bookings for the Room Admin.

 

Im new to PHP so i could be way off the mark with the above.

 

Kind Regards

 

Jason

 

 


********************************************************************************************************************

This message may contain confidential information. If you are not the intended recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.

Thank you for your co-operation.

NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
NHSmail provides an email address for your career in the NHS and can be accessed anywhere
For more information and to find out how you can switch, visit www.connectingforhealth.nhs.uk/nhsmail

********************************************************************************************************************

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Want to unsubscribe: mailto:mrbs-general-request <at> lists.sourceforge.net?subject=unsubscribe
Thomas Bleher | 4 Jan 19:33 2012
Picon
Picon

Re: Room Admin to approve Bookings

* "Hall Jason (HULL TEACHING PCT)" <jason.hall1 <at> nhs.net> [2012-01-04 18:00]:
> Hi,
> 
> I am trying to add the ability for Room Admin to approve the bookings,

I had a similar need a while ago: I needed area admins, i.e. users that
have control over just one area. I solved it by adding a new config
variable so area admins can be defined directly in the config.inc.php
file. So

$area_admins[14][] = 'tbleher';

makes user 'tbleher' admin of area 14.

The first attached patch makes sure that the room id is always that of
the selected entry. This is important if the room id is checked in
auth_book_admin(). This patch should probably be in trunk.

The second patch adds the mentioned config variable and amends the SQL
queries so only relevant pending bookings are shown to each area admin.

The patch doesn't add room admins, but it should be quite easy to extend
to this use-case.

I agree with Campbell that adding a new table with a room_id -> username
mapping for room admins is probably the best long-term solution. That
way, room admins could be managed using the web interface.

Best regards
Thomas

> I have added a column in the mrbs_rooms table named room_admin. In here Ive added a username of a user who
needs to be able to approve the bookings.
> 
> I have modified the auth_book_admin function as below.
> 
> $query= "select mrbs_room.id as RoomID, mrbs_area.id as AreaID, mrbs_room.room_admin as RoomAdmin,
mrbs_area.approval_enabled as Approval from mrbs_room join mrbs_area on mrbs_room.area_id =
mrbs_area.id WHERE mrbs_room.id=$room";
> 
> 
>   $runQuery = mysql_query($query);
>   while($Result = mysql_fetch_array($runQuery, MYSQL_ASSOC))
>   {
>   $roomAdmin = "{$Result['RoomAdmin']}";
>   $approval = "{$Result['Approval']}";
>   }
>  $pos = strpos($roomAdmin, $user);
> 
>                 if ($approval == 1)
>                 {
>                                 if ($pos === false) {
>          return FALSE;
>                                 } else {
>         return TRUE;
>                                 }
> 
>                 }
>                 else
>                 {
>                                 return (authGetUserLevel($user) >= 2);
>                 }
> 
> 
> This works as such that the Room Admin can add appointments without approval and can delete appointments.
> The issue is the Room Admin cannot approve appointments and it doesn’t show any pending bookings for the
Room Admin.
> 
> Im new to PHP so i could be way off the mark with the above.
> 
> Kind Regards
> 
> Jason
> 
> 
> 
> ********************************************************************************************************************
> 
> This message may contain confidential information. If you are not the intended recipient please inform the
> sender that you have received the message in error before deleting it.
> Please do not disclose, copy or distribute information in this e-mail or take any action in reliance on its contents:
> to do so is strictly prohibited and may be unlawful.
> 
> Thank you for your co-operation.
> 
> NHSmail is the secure email and directory service available for all NHS staff in England and Scotland
> NHSmail is approved for exchanging patient data and other sensitive information with NHSmail and GSi recipients
> NHSmail provides an email address for your career in the NHS and can be accessed anywhere
> For more information and to find out how you can switch, visit www.connectingforhealth.nhs.uk/nhsmail
> 
> ********************************************************************************************************************

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Want to unsubscribe: mailto:mrbs-general-request <at> lists.sourceforge.net?subject=unsubscribe

Gmane