0 Members and 1 Guest are viewing this topic.

*

KHDev

  • *****
  • 85
  • Releasing stuff and learning on the way!
    • KH Web Development
  • osDate Version: osDateEvo v1.2
Delete Event Bug (User-end)
« on: August 02, 2016, 04:18:22 PM »
Hey,

Not sure if this has already been addressed or if its affecting anyone else but figured i'd post it since i have encountered it and fixed it on my install.

Problem
Error Code displayed when event deleted

Code: [Select]
Input array has 0 params, does not match query: 'select id, userid, event, description, date_add(datetime_from, interval -6.00 hour) as datetime_from, date_add(datetime_to, interval -6.00 hour) as datetime_to, calendarid, timezone, private_to, enabled, recurring, recuroption from xxxx_calendarevents where id=?
Reason
Upon deleting an event the event page  is reloaded with no event_id so the get event data query is not passed an event id causing the error

Solution
Place the get event data query in a "if" statement so it would look something like:

Code: [Select]
// Check If Event ID is present
if(isset($_REQUEST["event_id"])) {
// Get event data
$event = $osDB->getRow("select id, userid, event, description, ".
   "       date_add(datetime_from, interval ! hour) as datetime_from, ".
   "       date_add(datetime_to, interval ! hour) as datetime_to, ".
   "       calendarid, timezone, private_to, ".
   "       enabled, ".
   "       recurring, ".
   "       recuroption ".
   "from ! ".
   "where id=? ",array($user["timezone"], $user["timezone"], EVENTS_TABLE,$_REQUEST["event_id"]));

if(!$event)
$t->assign("error",1);
else
{
$event["watched"]=$osDB->getOne("select count(*) from ! where userid=? and eventid=? ",array(WATCHES_TABLE, $_SESSION["UserId"], $event["id"]));
$event["username"]=$osDB->getOne("select username from ! where id=?",array(USER_TABLE, $event["userid"]));
$event['datetime_from'] = strtotime($event['datetime_from']);
$event['datetime_to'] = strtotime($event['datetime_to']);
$event['calendar_name'] = $osDB->getOne('select calendar from ! where id = ?',array(CALENDARS_TABLE, $event['calendarid']) );
if ($event['username'] == '') {
/* Admin User */
$event['username'] = $osDB->getOne("select username from ! where id=?",array(ADMIN_TABLE, $event["userid"]));
$event['usertype'] = 'admin';
}
}
} else {
$t->assign("error",1);
}
// END OF Event ID Presence Check



:)

*

Pharg

  • *****
  • 2,830
    • OsDateFourm
  • osDate Version: osDateEvo v1.2
Re: Delete Event Bug (User-end)
« Reply #1 on: August 02, 2016, 09:54:09 PM »
Hi KHDev,

Thanks for that, didn't know about this bug. :)

Will put it into the osDateEvo script when I work out what file to put this in, I take it is the event.php file?
« Last Edit: August 03, 2016, 06:53:45 AM by Pharg »
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.2 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

KHDev

  • *****
  • 85
  • Releasing stuff and learning on the way!
    • KH Web Development
  • osDate Version: osDateEvo v1.2
Re: Delete Event Bug (User-end)
« Reply #2 on: August 03, 2016, 10:38:00 AM »
no problem.

ha ha yeah event.php

thought I had put what file :P should find it near the bottom of the file.

*

Pharg

  • *****
  • 2,830
    • OsDateFourm
  • osDate Version: osDateEvo v1.2
Re: Delete Event Bug (User-end)
« Reply #3 on: August 03, 2016, 12:11:34 PM »
Hi KHDev,

I had already tested it and works perfectly, thanks again :)
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.2 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35