rob marks | 10 Jan 22:10 2008
Picon

2 hour time limit and booking conflicts

I would like to limit all users (except admin) to 2 hours per day and 1 booking per day. Also when I put in a recurring meeting and there is a conflict, I want it to book all the non-conflict dates and let me handle the conflict. Are there easyish answers?

Share life as it happens with the new Windows Live. Start sharing!
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general
Andrew White | 10 Jan 23:05 2008
Picon
Picon

Re: 2 hour time limit and booking conflicts

1) Limit bookings to 2 hours except administrators:

add this code to edit_entry_handler.php after the Units definition section:

# if not administrator, reject bookings longer than 2 hours
if ((!getAuthorised(2)) && (($units * $duration) > 7200))
{
     print_header($day, $month, $year, $area);
     ?>
       <H1><?php echo get_vocab('invalid_booking'); ?></H1>
       <?php echo get_vocab('invalid_duration'); ?>
   </BODY>
</HTML>
<?
     exit;
}

and add something like this to the "# Used in edit_entry_handler.php" section of lang.en:

$vocab["invalid_duration"]   = "Maximum booking duration allowed is 2 hours. Go back and 
try again.";

2) Limit users to 1 booking per day except admininstrators:

add this code to mrbs_sql.inc after the line:     global $periods;

# Prevent more than 1 booking per user per day
if (!getAuthorised(2))
{
    $create_by = getUserName();
    $booking = date("Ymd", $starttime);
    $todayCount = 0;

    $res = mysql_query("SELECT start_time FROM mrbs_entry WHERE (create_by = 
'$create_by' AND id <> $ignore)");
    if(! $res)
           return sql_error();

    while ($row = mysql_fetch_assoc($res))
    {
           $RowDate = date("Ymd", $row['start_time']);
           if($RowDate == $booking) $todayCount++;         
    }

    if ($todayCount > 0)
    {
    	  $err = "<B>You are not allowed to have more than one booking in one day.</B>";
          return $err ;
    }
    else
    {
    sql_free($res);
    }

}

Hope that helps,
Andrew

On 10 Jan 2008 at 16:10, rob marks wrote:

To:	<mrbs-general <at> lists.sourceforge.net>
From:	rob marks <rmarksduke <at> hotmail.com>
Date sent:	Thu, 10 Jan 2008 16:10:28 -0500
Subject:	[MRBS-general] 2 hour time limit and booking conflicts
Send reply to:	"General purpose list (support/developers/users)" <mrbs-general <at> lists.sourceforge.net>
	<mrbs-general.lists.sourceforge.net>
	<mailto:mrbs-general-request <at> lists.sourceforge.net?subject=unsubscribe>
	<mailto:mrbs-general-request <at> lists.sourceforge.net?subject=subscribe>

> 
> 
> I would like to limit all users (except admin) to 2 hours per day and
> 1 booking per day. Also when I put in a recurring meeting and there is
> a conflict, I want it to book all the non-conflict dates and let me
> handle the conflict. Are there easyish answers?
> _________________________________________________________________
> Share life as it happens with the new Windows Live.
> http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_0
> 12008

________________________________________________________
Andrew White
Information Technology Librarian        whitea1 <at> lincoln.ac.nz
Lincoln University Library          http://www.lincoln.ac.nz/libr/
P.O. Box 64, Lincoln University, Lincoln 7647, New Zealand.
tel: +64-3-3252811                   fax: +64-3-3252944

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
Kaltsas, Konstantin G | 28 Jan 01:39 2008

Re: 2 hour time limit and booking conflicts

Andrew,

Do you think this code is adaptable to restrict to a maximum of 3 hours
per day or week instead of 1 booking per day?

Also thanks for the 2 hour code, I may try to implement that, although I
changed the input field from a box to radio buttons so users only get
choices of .5 to 3 hours in half hour increments.

Thanks!

-Tino

-----Original Message-----
From: mrbs-general-bounces <at> lists.sourceforge.net
[mailto:mrbs-general-bounces <at> lists.sourceforge.net] On Behalf Of Andrew
White
Sent: Thursday, January 10, 2008 4:06 PM
To: mrbs-general <at> lists.sourceforge.net
Subject: Re: [MRBS-general] 2 hour time limit and booking conflicts

1) Limit bookings to 2 hours except administrators:

add this code to edit_entry_handler.php after the Units definition
section:

# if not administrator, reject bookings longer than 2 hours
if ((!getAuthorised(2)) && (($units * $duration) > 7200))
{
     print_header($day, $month, $year, $area);
     ?>
       <H1><?php echo get_vocab('invalid_booking'); ?></H1>
       <?php echo get_vocab('invalid_duration'); ?>
   </BODY>
</HTML>
<?
     exit;
}

and add something like this to the "# Used in edit_entry_handler.php"
section of lang.en:

$vocab["invalid_duration"]   = "Maximum booking duration allowed is 2
hours. Go back and 
try again.";

2) Limit users to 1 booking per day except admininstrators:

add this code to mrbs_sql.inc after the line:     global $periods;

# Prevent more than 1 booking per user per day
if (!getAuthorised(2))
{
    $create_by = getUserName();
    $booking = date("Ymd", $starttime);
    $todayCount = 0;

    $res = mysql_query("SELECT start_time FROM mrbs_entry WHERE
(create_by = 
'$create_by' AND id <> $ignore)");
    if(! $res)
           return sql_error();

    while ($row = mysql_fetch_assoc($res))
    {
           $RowDate = date("Ymd", $row['start_time']);
           if($RowDate == $booking) $todayCount++;         
    }

    if ($todayCount > 0)
    {
    	  $err = "<B>You are not allowed to have more than one booking
in one day.</B>";
          return $err ;
    }
    else
    {
    sql_free($res);
    }

}

Hope that helps,
Andrew

On 10 Jan 2008 at 16:10, rob marks wrote:

To:	<mrbs-general <at> lists.sourceforge.net>
From:	rob marks <rmarksduke <at> hotmail.com>
Date sent:	Thu, 10 Jan 2008 16:10:28 -0500
Subject:	[MRBS-general] 2 hour time limit and booking conflicts
Send reply to:	"General purpose list (support/developers/users)"
<mrbs-general <at> lists.sourceforge.net>
	<mrbs-general.lists.sourceforge.net>
	
<mailto:mrbs-general-request <at> lists.sourceforge.net?subject=unsubscribe>
	
<mailto:mrbs-general-request <at> lists.sourceforge.net?subject=subscribe>

> 
> 
> I would like to limit all users (except admin) to 2 hours per day and
> 1 booking per day. Also when I put in a recurring meeting and there is
> a conflict, I want it to book all the non-conflict dates and let me
> handle the conflict. Are there easyish answers?
> _________________________________________________________________
> Share life as it happens with the new Windows Live.
> http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_0
> 12008

________________________________________________________
Andrew White
Information Technology Librarian        whitea1 <at> lincoln.ac.nz
Lincoln University Library          http://www.lincoln.ac.nz/libr/
P.O. Box 64, Lincoln University, Lincoln 7647, New Zealand.
tel: +64-3-3252811                   fax: +64-3-3252944

------------------------------------------------------------------------
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketp
lace
_______________________________________________
mrbs-general mailing list
mrbs-general <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mrbs-general

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane