phpScheduleIt
June 19, 2013, 02:24:37 PM *
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: Bug: Booking does not show up! But is is in the Manage schedule listing  (Read 1076 times)
actanuk
Newbie
*

Karma: 0
Posts: 2


« on: April 07, 2009, 09:15:38 AM »

All the bookings are in the database but does not show up in the booking calendar ! Is there a way to refresh these bookings back to the booking screen ?
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5506


WWW
« Reply #1 on: April 07, 2009, 02:02:23 PM »

Did the time on your server change recently?  Either a manual or automatic DST change may have caused this.  If so, the fix is pretty simple.
Logged
kjester
Newbie
*

Karma: 0
Posts: 2


« Reply #2 on: July 31, 2009, 10:31:17 AM »

Nick,

I'm having the same issue and yes, the time was changed recently (actually, it was time-zone that changed).

You mention that this is a simple fix, but don't go into the specifics....

thanks,

-Ian
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5506


WWW
« Reply #3 on: August 03, 2009, 01:57:27 PM »

You can use this script to fix the data.  Name it whatever you want and place it in the root of your phpScheduleIt installation.  Full instructions are in the comments.

Code:
<?php
/**
* Daylight savings time (DST) patch for USA DST adjustment
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @version 03-11-07
* @package phpScheduleIt
*/

/**
* TO USE:
* 1) Back up your data
* 2) Place this file in the root of your phpScheduleIt installation
* 3) Browse to this file from your web browser
* 4) Delete this file
*/

/**
* Please refer to readme.html and LICENSE for any additional information
*
* Copyright (C) 2003 - 2006 phpScheduleIt
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the
* Free Software Foundation, Inc.
* 59 Temple Place
* Suite 330
* Boston, MA
* 02111-1307
* USA
*/

require_once('lib/db/ScheduleDB.class.php');

$dbEngine = new DBEngine();
$db $dbEngine->db;

$rs $db->query('SELECT resid, start_date, end_date FROM reservations');

$AdjustmentResults = new AdjustmentResults();

while (
$row $rs->fetchRow())
{
$result AdjustReservationDates($db$row['resid'], $row['start_date'], $row['end_date']);
$AdjustmentResults->Add($result);
}

if (
$AdjustmentResults->AnyAdjustments)
{
echo '<br/><br/>All date adjustments have been made.  Please use the provided rollback queries if any problems are found with the adjustments made.<br/>';
echo '<pre>' $AdjustmentResults->GetRollbackQueries() . '</pre>';
}
else
{
echo '<br/>No date adjustments were necessary.';
}

function 
AdjustReservationDates($db$resid$startDate$endDate)
{
$adjustedStartDate GetAdjustedDate($startDate);
$adjustedEndDate GetAdjustedDate($endDate);

if ($adjustedStartDate != $startDate || $adjustedEndDate != $endDate)
{
echo sprintf('<br/>resid: %s will be adjusted.<br/>Start date is %s (%s).<br/>End date is %s (%s)'$residdate('m-d-Y H:i:s'$startDate), $startDatedate('m-d-Y H:i:s'$endDate), $endDate);
echo sprintf('<br/>Start date should be %s (%s).<br/>End date should be %s (%s)<br/>'$residdate('m-d-Y H:i:s'$adjustedStartDate), $adjustedStartDatedate('m-d-Y H:i:s'$adjustedEndDate), $adjustedEndDate);

$query $db->prepare('UPDATE reservations SET start_date = ?, end_date = ? WHERE resid = ?');
$result $db->execute($query, array($adjustedStartDate$adjustedEndDate$resid));

$rollbackQuery "UPDATE reservations SET start_date = $startDate, end_date = $endDate WHERE resid = '$resid'\n";

if (DB::isError($result))
{
echo '<br/>ERROR: ' $result->getMessage() . ' ' $result->getDebugInfo() . '<br/>';
}

return new AdjustmentResult(true$rollbackQuery);
}

return new AdjustmentResult(false'');
}

function 
GetAdjustedDate($timestamp)
{
$adjustedStartDate $timestamp;

$parts getdate($timestamp);

$hours $parts['hours'];

if ($hours != 0)
{
if ($hours 16)
{
// Reservation was likely supposed to be for the next day
$adjustedDay $parts['mday'] + 1;
$adjustedStartDate mktime(000$parts['mon'], $adjustedDay$parts['year']);
}
else if ($hours 8)
{
$adjustedStartDate mktime(000$parts['mon'], $parts['mday'], $parts['year']);
}
}

return $adjustedStartDate;
}

class 
AdjustmentResult
{
var $DateAdjusted false;
var $RollbackQuery '';

function AdjusmtmentResult($dateAdjusted$rollbackQuery)
{
$this->DateAdjusted $dateAdjusted;
$this->RollbackQuery $rollbackQuery;
}
}

class 
AdjustmentResults
{
var $AnyAdjustments false;
var $Results = array();

function Add($adjustmentResult)
{
if ($adjustmentResult->DateAdjusted)
{
$this->AnyAdjustments true;
}

$Results[] = $adjustmentResult;
}

function GetRollbackQueries()
{
$queries '';
foreach ($this->Results as $result)
{
$queries .= $result->RollbackQuery;
}

return $queries;
}
}
?>
Logged
kjester
Newbie
*

Karma: 0
Posts: 2


« Reply #4 on: August 05, 2009, 05:21:18 PM »

I'm getting a Parse error in line 43 when attempting to run it.... any thoughts?

thanks,
Logged
Nick
Administrator
Hero Member
*****

Karma: 15
Posts: 5506


WWW
« Reply #5 on: August 10, 2009, 01:38:07 PM »

It may have something to do with the copy paste.  Email me directly for the file: nkorbel at gmail dot com
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!