phpScheduleIt
May 23, 2013, 03:38:36 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: phpScheduleIt 2.4.2 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Reservation Customization -- Resolved  (Read 1448 times)
TSAElement
Newbie
*

Karma: 0
Posts: 20


« on: July 09, 2009, 02:47:06 PM »

I would like to use phpscheduleit to schedule equipment for delivery to rooms, and as such would like to be able to have a reservation crossed out once the equipment has been delivered. Thus far I have produced a check box titled "Delivered?" that only shows up when a reservation is being modified, but how to produce the rest is beyond me (I'm a php novice). Any help would be much appreciated.  Smiley
« Last Edit: August 10, 2009, 06:33:17 PM by TSAElement » Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: July 13, 2009, 01:59:27 PM »

You'd want to show the reservation as crossed out on the bookings page or in some other section of the application?
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #2 on: July 13, 2009, 04:27:58 PM »

Thanks for the response  Smiley

I'd like to see it right on the bookings list (my version shows it as schedule.php). That way any equipment that has been delivered is crossed out and any reservations that have not been completed (equipment has not been delivered) will still show normally.

Thanks in advance!
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #3 on: July 20, 2009, 12:56:31 PM »

Any updates?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #4 on: July 20, 2009, 02:06:03 PM »

You will have to change the query to pull your new field in lib/scheduledb.class.php get_all_res().  Then you'll need to change the display in schedule.template.php to look for the Delivered flag and change the output to strikethrough.
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #5 on: July 20, 2009, 04:09:19 PM »

thanks, I'll give it a shot.  Smiley
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #6 on: July 21, 2009, 10:41:35 AM »

You will have to change the query to pull your new field in lib/scheduledb.class.php get_all_res().  Then you'll need to change the display in schedule.template.php to look for the Delivered flag and change the output to strikethrough.

So I started snooping around and ran into a few snags. First I just want to double check. Is the proper file to edit scheduledb.class.php in /lib/db or schedule.class.php in /lib ??
I did see the get_all_res funtion in the /lib/db/schedulebd.class file, but again I just wanted to double check if I am in fact in the right location.
Also, on top of what I previously mentioned (adding the delivered checkbox) would a new field inside the reservations table be the proper step to take? I have produced a field titled "is_delivered", carrying the same structure as "is_pending" (smallint(6), not null, default value=0).

Please advise.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #7 on: July 27, 2009, 01:29:42 PM »

Yeap, you want the file in lib/db/.

Adding a new field through the code is pretty simple.  Take a look at the developers guide (available from the project download page in SourceForge).
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #8 on: July 27, 2009, 04:24:56 PM »

I found the guide your referring to but didn't get a chance to look at it today. Will give it a shot tomorrow. Thanks for all the help!  Grin
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #9 on: August 09, 2009, 06:39:57 PM »

Nick,

 I used your guide and successfully added two fields: deliveredby (CHAR(10)) and returnedby (CHAR(10)). I have also successfully integrated their placement into the reserve.template file when a reservation is modified, as shown here

Code:
if ($res->type == RES_TYPE_MODIFY) {

print_deliveredby($res->get_deliveredby(), $res->type); // Prints out delivered by box
print_returnedby($res->get_returnedby(), $res->type);   // Prints out the returned by box
}

Code:
function print_deliveredby($deliveredby, $type) {
?>
<div id="deliv">
   <table width="100%" border="0" cellspacing="0" cellpadding="1">
    <tr class="tableBorder">
     <td>
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
       <tr>
     <td colspan="2" class="cellColor"><h5 align="center"><?php echo translate('Delivery status')?></h5></td>
   </tr>
   <tr>
<td class="formNames" style="text-align: left;"><?php echo translate('Delivered by')?></td>
        <td class="cellColor" style="text-align: center;">
<?php
if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY || $type == RES_TYPE_APPROVE) {
echo '<input type="text" name="deliveredby" class="textbox" size="10" value="' $deliveredby '"/>';
}
else {
echo (!empty($deliveredby) ? CmnFns::html_activate_links($deliveredby) : translate('N/A'));
}
?>

        </td>
       </tr>
<?php
}

/**
* Print out the reservation returnedby box to add/edit one
*/
function print_returnedby($returnedby$type) {
?>

   
      <tr>
   <td class="formNames" style="text-align: left;"><?php echo translate('Returned by')?></td>
       <td class="cellColor" style="text-align: center;">
    <?php
  if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY) {
echo '<input type="text" name="returnedby" class="textbox"  size="10" value="' $returnedby '"/>';
  }
  else {
echo (!empty($returnedby) ? CmnFns::html_activate_links($returnedby) : translate('N/A'));
}
    ?>

   </td>
  </tr>
</table>
</td>
   </table>
   </div>
<?php
}

In my previous post I requested assistance regarding strikethrough text, however I have found that including the deliveredby and returnedby text within the reservation cell should be sufficient. What I am curious to know now is there a way to change the cell bgcolor when deliveredby and returnedby text is found. In other words before equipment has been delivered the cell shows with the predesignated blue bg color. When equipment has been delivered (and now has deliveredby data) the reservation's cell bg color would be changed to a red. And lastly when the equipment has been returned (and now has returnedby data) the reservation's cell bg color would be changed to a green.

I know this is alot to ask for, and I am quite sure that you are a busy busy man, but any assistance would be much appreciated.
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #10 on: August 10, 2009, 02:06:44 PM »

Sounds like all you need to do is something like:

$bgColor = empty($deliveredby) ? '' : 'background-color: red';

And set the td style:

<td class="cellColor" style="text-align: center; <php echo $bgColor ?>">

It's a hack, but it should work.
Logged
TSAElement
Newbie
*

Karma: 0
Posts: 20


« Reply #11 on: August 10, 2009, 06:44:03 PM »

Nick,

 I was able resolve my issue, though it was a bit different then your recommendation, so I thought I'd share.

Edit to the Config.php file:

Code:
$conf['ui']['delivered'][] = array ('color' => 'CC0000', 'hover' => 'FF0000', 'text' => 'FFFFFF');
$conf['ui']['returned'][] = array ('color' => '39B54A', 'hover' => '40CF53', 'text' => 'FFFFFF');

Edit to the Schedule.class.php file:

Code:
if ($rs['deliveredby'] ) {
        $color_select = 'delivered';
        }

if ($rs['returnedby'] ) {
$color_select = 'returned';
}

Thanks for all your help  Grin

- Patrick
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!