Hi all,
Ok I'm tired of trying to find the error!
I have written a special section of my logic hook to take a new user we have and add here to the invite list by directly manipulating the the meetings_users table. The office generally invites everyone so it will show on the calendar since they are scheduling out quite a ways.
I keep getting php errors in the code. In paritcular this one:
Parse error: syntax error, unexpected T_STRING, expecting '(' in /var/www/html/dev2/custom/include/Clients/Assignclientnumber.php on line 412
Using CentOS, php 5.0, mysql 5, Sugar 5.2K.
Can you please help find the error. Also, please check my insert statement, is this the correct way to get the mysql to generate its on id for the meetings_user table entry? Will the $countr query correctly? This logic fires off the Account before_save. I've used a special account name to make sure it only runs when I want it to! I couldn't get the date to work correctly so I hard coded it.
Thanks for the help, Looking forward to a solution!
Paris
Code:class Assignclientnumber { function Assignclientnumber (&$bean, $event, $arguments) { // check if value not set for both ... lots of other stuff here .... // // Special coding for Mass add to meetings for new employee // if ($bean->name = '123add'){ // // Get list of meetings to process add correct date! $query = "SELECT id FROM meetings WHERE date_start >= '2010-03-14' AND deleted = '0'"; $result = $bean->db->query($query, true,"Error mtg ID: "); while($row = $bean->db->fetchByAssoc($result)) { echo "Meetings DB row: ".$row['id']." * "; echo "Meetings DB row no id: ".$row." * "; $line = readline("Continue? "); // [16] $query = "SELECT COUNT(meeting_id) FROM meetings_users WHERE meeting_id = ".$row['id']; $countr = $bean->db->query($query, true,"Error with count: "); echo " countr: ".$countr." xx "; $line = readline("Continue? "); if ($countr > 1) { // If only single person is in the table ignore $query = "select * from meetings_users where meeting_id=".$row['id']." and user_id = 'f1a0b548-2ece-11df-b351-001e0b7ff34a'"; $result2 = $bean->db->query($query, true,"Error Meeting users: "); $row2 = $bean->db->fetchByAssoc($result2); // if($row2 != null) { //echo "row2 meet-user ".$row2." xx "; $query = "INSERT INTO meetings_users (`id`,`meeting_id`,`user_id`,`required`,`accept_status`,`date_modified`,`deleted`) VALUES (null,{$row['id']},'f1a0b548-2ece-11df-b351-001e0b7ff34a','1','none','2010-03-14 00:00:00',0)"; $insrt = $bean->db->query($query, true,"Error inserting: "); } //If not null } // if count>1 } //while row } if client name = special (This is Line 412!!) } //end function } //end class


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks