Booked Scheduler Community Support
September 01, 2014, 03:26:40 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Booked 2.5 has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Problem adding fields to a reservation  (Read 7812 times)
joedekangeroe
Newbie
*

Karma: 0
Posts: 4


« on: July 06, 2006, 08:48:41 AM »

Hi

I tried to add two extra fields to a reservation. I have downloaded the developer guide and followed instructions.

Now I can make a new reservation but phpscheduleit does not save the given information correctly. He is mixing up some fields.

Modifications to a reservations can be made without any issues.

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

Karma: 15
Posts: 6256


WWW
« Reply #1 on: July 06, 2006, 10:12:33 AM »

My first guess is that you may be passing the values to the database in the wrong order.
Logged
joedekangeroe
Newbie
*

Karma: 0
Posts: 4


« Reply #2 on: July 10, 2006, 05:54:00 AM »

I altered the database by adding two extra fields (startplace and destination)

Code:

CREATE TABLE `reservations` (
  `resid` varchar(16) NOT NULL default '',
  `machid` varchar(16) NOT NULL default '',
  `scheduleid` varchar(16) NOT NULL default '',
  `start_date` int(11) NOT NULL default '0',
  `end_date` int(11) NOT NULL default '0',
  `starttime` int(11) NOT NULL,
  `endtime` int(11) NOT NULL,
  `created` int(11) NOT NULL default '0',
  `modified` int(11) default NULL,
  `parentid` varchar(16) default NULL,
  `startplace` text,
  `destination` text,
  `summary` text,
  `is_blackout` smallint(1) NOT NULL default '0',
  `is_pending` smallint(1) NOT NULL default '0',
  `allow_participation` smallint(6) NOT NULL default '0',
  `allow_anon_participation` smallint(6) NOT NULL default '0',
  PRIMARY KEY  (`resid`),
  KEY `res_resid` (`resid`),
  KEY `res_machid` (`machid`),
  KEY `res_startTime` (`starttime`),
  KEY `res_endTime` (`endtime`),
  KEY `res_created` (`created`),
  KEY `res_modified` (`modified`),
  KEY `res_isblackout` (`is_blackout`),
  KEY `res_scheduleid` (`scheduleid`),
  KEY `reservations_ispending` (`is_pending`),
  KEY `reservations_startdate` (`start_date`),
  KEY `reservations_enddate` (`end_date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;



And in ResDB.class.php I have:

Code:
function add_res($res, $is_parent, $users_to_invite, $resources_to_add, $accept_code) {
$id = $this->get_new_id();

// Insert the main reservation data
$values = array (
$id,
$res->get_machid(),
$res->get_scheduleid(),
$res->get_start_date(),
$res->get_end_date(),
$res->get_start(),
$res->get_end(),
mktime(),
null,
($is_parent ? $id : $res->get_parentid()),
intval($res->is_blackout),
$res->get_pending(),
$res->get_startplace(),
$res->get_destination(),
$res->get_summary(),
$res->get_allow_participation(),
$res->get_allow_anon_participation()
);

$query = 'INSERT INTO ' . $this->get_table(TBL_RESERVATIONS) . ' VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
$q = $this->db->prepare($query);
$result = $this->db->execute($q, $values);
$this->check_for_error($result);

// Insert the user participation data
$values = null;
$values[] = array($id, $res->get_memberid(), 1, 0, 1, 1, null);

foreach ($users_to_invite as $memberid => $email) {
$values[] = array($id, $memberid, 0, 1, 0, 0, $accept_code);
}

$query = 'INSERT INTO ' . $this->get_table(TBL_RESERVATION_USERS) . ' VALUES(?,?,?,?,?,?,?)';
$q = $this->db->prepare($query);
$result = $this->db->executeMultiple($q, $values);
$this->check_for_error($result);

// Insert the additional resources data
if (count($resources_to_add) > 0) {
$values = null;
for ($i = 0; $i < count($resources_to_add); $i++) {
$values[] = array($id, $resources_to_add[$i], 0);
}

$query = 'INSERT INTO ' . $this->get_table(TBL_RESERVATION_RESOURCES) . ' VALUES(?,?,?)';
$q = $this->db->prepare($query);
$result = $this->db->executeMultiple($q, $values);
$this->check_for_error($result);
}

unset($values, $query);
return $id;
}
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 6256


WWW
« Reply #3 on: July 10, 2006, 10:05:18 AM »

Should be:

Code:
$values = array (
               $id,
               $res->get_machid(),
               $res->get_scheduleid(),
               $res->get_start_date(),
               $res->get_end_date(),
               $res->get_start(),
               $res->get_end(),
               mktime(),
               null,
               ($is_parent ? $id : $res->get_parentid()),            
               $res->get_startplace(),
               $res->get_destination(),
               $res->get_summary(),
 intval($res->is_blackout),
               $res->get_pending(),
               $res->get_allow_participation(),
               $res->get_allow_anon_participation()
            );
Logged
joedekangeroe
Newbie
*

Karma: 0
Posts: 4


« Reply #4 on: July 10, 2006, 10:33:21 AM »

It works! Thanks a lot.
Logged
zaky
Newbie
*

Karma: 0
Posts: 17


« Reply #5 on: June 11, 2010, 03:33:02 PM »

I have the same problem, the value of the new field  selected from a dropdown list of a combobox is not saved in the database ( looking at the reservation table the value zero is stored instead).
What should I need to change?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 6256


WWW
« Reply #6 on: June 14, 2010, 02:06:34 PM »

Sounds like the value was not added to the update SQL statement, or it was not pulled off of the form.  I'd add echo statements along the code path that you changed and see where the value is being lost.
Logged
Marisa261
Newbie
*

Karma: 0
Posts: 2


« Reply #7 on: September 18, 2011, 07:06:18 PM »

I have the same problem and can't fix it!!!
I'm very angry Angry
hopefully fixed soon
Logged
Marisa261
Newbie
*

Karma: 0
Posts: 2


« Reply #8 on: September 20, 2011, 06:01:37 AM »

i solve it
Logged
Marishvcard
Newbie
*

Karma: 0
Posts: 1

Shpping manager


WWW
« Reply #9 on: December 15, 2011, 04:08:00 AM »

I have the problem is very hardly
please help me Embarrassed Shocked
Logged

[
BernardII
Newbie
*

Karma: 0
Posts: 6


« Reply #10 on: January 17, 2012, 11:22:43 PM »

I am also facing the same problem...i tried the given recommendation. But i think i am on the wrong track Huh

Please Help
Logged
Gornur9
Newbie
*

Karma: 0
Posts: 1


WWW
« Reply #11 on: February 08, 2012, 03:01:45 AM »

Thanks to the answer of Nick.
I solve the problem!!  Wink Wink 
« Last Edit: February 08, 2012, 03:03:17 AM by Gornur9 » Logged
tineg@94
Newbie
*

Karma: 0
Posts: 26


« Reply #12 on: May 07, 2012, 05:58:09 AM »

Hi,


Could someone update the Develloper Guide PDF file according to the phpSchedulIt 2.x version?
I know that a new field "Attribute" is going to be added nearly however it would be nice to have a generic method to add a field anywhere.


Thanks in advance
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 6256


WWW
« Reply #13 on: May 08, 2012, 01:34:58 PM »

I'll put it on my list. The trouble is there isn't a very generic way of doing this. It's all based on context and what you're trying to achieve.
Logged
Pages: [1]
  Print  
 
Jump to:  

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