phpScheduleIt
May 25, 2013, 12:21:23 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: [SOLVED] Changing a reservations resource.  (Read 628 times)
Azyrus
Newbie
*

Karma: 0
Posts: 28


« on: April 23, 2012, 10:54:29 PM »

Solution here: http://php.brickhost.com/forums/index.php?topic=11258.0

Hi Everyone,

As the title says I'm trying to change an existing reservations resource. So far I have a pretty crude code that is a drop down list that shows the resources to choose from and displays the resource selected.

Problem: When selecting the new resource and upon saving it says complete no issues. Reviewing the schedule the reservation is allocated to the same resource.

Code:
/**
* Print out the reservation summary or a box to add/edit one
* @param string $machid machid to edit
* @param string $type type of reservation
*/
function print_machid($machid, $type) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr class="tableBorder">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="cellColor" style="width:50%;">Invoice Number:</td>
<td class="cellColor" style="text-align:right;">
<?
if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY)
echo '<select name="machid" class="textbox" value="' . $machid . '"/>';
if ($machid == sc14f8f8c6c8c699)
echo "<option selected=selected>Pending Andrew</option>";
else
echo "<option>Pending Andrew</option>";

if ($machid == sc14f8f8c6084ad0)
echo "<option selected=selected>Andrew</option>";
else
echo "<option>Andrew</option>";
echo '</select>';

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

I have a feeling that something is maybe overwriting or taking priority over this change.

If anyone has any idea what I'm doing wrong please help Smiley
« Last Edit: April 27, 2012, 09:16:18 PM by Azyrus » Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5419


WWW
« Reply #1 on: April 24, 2012, 09:39:03 AM »

Try this:

Code:
/**
* Print out the reservation summary or a box to add/edit one
* @param string $machid machid to edit
* @param string $type type of reservation
*/
function print_machid($machid, $type) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr class="tableBorder">
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="cellColor" style="width:50%;">Invoice Number:</td>
<td class="cellColor" style="text-align:right;">
<?
if ($type == RES_TYPE_ADD || $type == RES_TYPE_MODIFY)
echo '<select name="machid" class="textbox" />';
if ($machid == 'sc14f8f8c6c8c699')
echo "<option selected=selected value='$machid'>Pending Andrew</option>";
else
echo "<option value='$machid'>Pending Andrew</option>";

if ($machid == 'sc14f8f8c6084ad0')
echo "<option selected=selected value='$machid'>Andrew</option>";
else
echo "<option value='$machid'>Andrew</option>";
echo '</select>';

?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
}
Logged
Azyrus
Newbie
*

Karma: 0
Posts: 28


« Reply #2 on: April 25, 2012, 06:48:41 PM »

Hey Nick, thanks for your input I really appreciate it.

Unfortunately I didn't manage to get that code working either.
I'm trying all different combinations and nothing seems to write the machid to the database.

Have you got any other ideas? Ill be working on this most of today, ill post an update if I find a solution. Otherwise I'm really keen for any ideas you may have Smiley

Thanks again.

*Edit* Still no success Sad Though the code is working somewhat, I changed:

Code:
$res->machid = $machid;
To
Code:
$res->machid = $summary;

With this in effect the machid is successfully updated to the summary column in the table.

When
Code:
$res->machid = $machid;
is in effect NOTHING happens... no update...

*2nd Edit* Hey Nick no success today Sad seems like when you update a reservation the machid is updated also which I think may be overwriting the machid change field in the reservation page... Really looking forward to your input this is all we need to launch it Cheesy Though there are hundreds of things we are planning to do and help contribute.
« Last Edit: April 26, 2012, 12:42:14 AM by Azyrus » Logged
Azyrus
Newbie
*

Karma: 0
Posts: 28


« Reply #3 on: April 27, 2012, 01:10:21 AM »

RESERVATION.CLASS.PHP 1117-1124

Code:
/**
* Returns the resource id of this reservation
* @param none
* @return string resource id
*/
function get_machid() {
return $this->resource->get_property('machid');
}

CHANGE TO (can change existing reservations resourcen, no calendar function, new reservations have no machid):

Code:
/**
* Returns the resource id of this reservation
* @param none
* @return string resource id
*/
function get_machid() {
return $this->machid;
}

To create new reservations you have to change the code back, I'm going to try adding each code to add new res or edit res somehow.

Any ideas are much appreciated, I'm just posting progress to see if it sparks an idea from anyone.
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!