Closing pay period error

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Locked
ignus
Posts: 4
Joined: Tue Jan 02, 2007 10:05 am

Closing pay period error

Post by ignus »

Hi,

We just completed our first pay period on TimeTrex and I'm not able to close it(nor lock it).
All time sheets have been verified.
When debugging is off, all I get is the "timetrex is down for maintenance" message.

TimeTrex version: 1.3.1
PHP: 5.1.6
OS: Windows Server 2003
Web: IIS

PHP is logging to a file and here are the only 2 errors today:
[02-Jan-2007 17:19:19] PHP Warning: mail() [<a href='function.mail'>function.mail</a>]: "sendmail_from" not set in php.ini or custom "From:" header missing in c:\Inetpub\TimeTrex\classes\modules\core\Debug.class.php on line 160
[02-Jan-2007 09:19:54] PHP Fatal error: Call to a member function getId() on a non-object in c:\Inetpub\TimeTrex\interface\index.php on line 47

Here's the debug on the webpage when I attempted to close the pay period:
(mysqlt): SET SESSION sql_mode='ansi'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select session_id,user_id,ip_address,created_date,updated_date from authentication WHERE session_id = 'a766bb23bc9e9f502c17851a02c91df5' AND ip_address = '10.90.40.11' AND updated_date >= 1167743024
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): update authentication set updated_date = 1167757424 where session_id = 'a766bb23bc9e9f502c17851a02c91df5'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): SET SESSION time_zone='America/North_Dakota/Center'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select * from station where company_id = '1' AND station_id = '065b42e2c69123b6363b303b76b4abb7' AND deleted = 0
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select * from cron WHERE deleted = 0 ORDER BY last_run_date DESC LIMIT 1
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): SELECT count(*) FROM message as a LEFT JOIN users as d ON a.object_type_id = 5 AND a.object_id = d.id LEFT JOIN request as b ON a.object_type_id = 50 AND a.object_id = b.id AND b.deleted=0 LEFT JOIN user_date as c ON b.user_date_id = c.id AND c.deleted = 0 WHERE a.object_type_id in (5,50) AND a.status_id = 10 AND ( ( c.user_id = '1' OR d.id = '1' OR a.parent_id in ( select parent_id FROM message WHERE created_by = '1' AND parent_id != 0 ) OR a.parent_id in ( select id FROM message WHERE created_by = '1' AND parent_id = 0 ) ) AND a.created_by != '1' ) AND a.deleted = 0
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select d.severity_id as severity_id, count(*) as count from exception as a LEFT JOIN user_date as b ON a.user_date_id = b.id LEFT JOIN users as c ON b.user_id = c.id LEFT JOIN exception_policy as d ON a.exception_policy_id = d.id LEFT JOIN pay_period as e ON b.pay_period_id = e.id where b.user_id = '1' AND b.date_stamp < '2007-01-02 00:00:00' AND e.status_id = 10 AND NOT EXISTS ( select z.id from request as z where z.user_date_id = a.user_date_id AND z.status_id = 30 ) AND ( a.deleted = 0 AND b.deleted = 0 AND e.deleted=0) GROUP BY d.severity_id ORDER BY d.severity_id desc
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select * from permission where company_id = '1' AND user_id in (-1, '1' ) AND deleted = 0 ORDER BY company_id ASC, user_id ASC
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select name FROM bread_crumb WHERE user_id = '1' AND name = 'End of Pay Period' LIMIT 1
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): UPDATE bread_crumb SET url = '/payperiod/ClosePayPeriod.php?select_all=on&pay_period_ids%5B%5D=1&action=Close', created_date = 1167757425 WHERE user_id = '1' AND name = 'End of Pay Period'
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): SET AUTOCOMMIT=0
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): BEGIN
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select * from pay_period where id = '1' AND deleted=0
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(mysqlt): select * from pay_period_schedule where id = '1' AND deleted=0
--------------------------------------------------------------------------------
FailTrans was called

ADOConnection.FailTrans() % line 58, file: Exception.class.php
GeneralError.__construct(Invalid Data, not saving.) % line 761, file: Factory.class.php
Factory.Save() % line 87, file: ClosePayPeriod.php

======================================================================
EXCEPTION!
======================================================================
Error message: Invalid Data, not saving.
Error code: 0
Script Name: c:\Inetpub\TimeTrex\classes\modules\core\Factory.class.php
Line Number: 761
======================================================================
EXCEPTION!
======================================================================

Debug Buffer
============================================================================
Memory Usage: N/A
----------------------------------------------------------------------------
DEBUG [135]: [Function](): URI: /payperiod/ClosePayPeriod.php?select_all=on&pay_period_ids%5B%5D=1&action=Close
DEBUG [137]: [Function](): Production: 0
DEBUG [92]: DateTime::setTimeZone(): Setting TimeZone: PST8PDT
DEBUG [423]: Authentication::Check(): Session Name: SessionID
DEBUG [429]: Authentication::Check(): Session ID: a766bb23bc9e9f502c17851a02c91df5
DEBUG [278]: Validator::stripNonAlphaNumeric(): Alpha Numeric String:a766bb23bc9e9f502c17851a02c91df5
DEBUG [78]: Authentication::getIdle(): Idle Seconds Allowed: 14400
DEBUG [278]: Validator::stripNonAlphaNumeric(): Alpha Numeric String:a766bb23bc9e9f502c17851a02c91df5
DEBUG [62]: [Function](): User Authenticated: admin
DEBUG [1622]: UserFactory::isInformationComplete(): User Information is Complete:
DEBUG [92]: DateTime::setTimeZone(): Setting TimeZone: America/North_Dakota/Center
DEBUG [108]: DateTime::setDateFormat(): Setting Default Date Format: Y-m-d
DEBUG [122]: DateTime::setTimeFormat(): Setting Default Time Format: G:i
DEBUG [136]: DateTime::setTimeUnitFormat(): Setting Default Time Unit Format: 10
DEBUG [1622]: UserFactory::isInformationComplete(): User Information is Complete:
DEBUG [954]: UserPreferenceFactory::isPreferencesComplete(): User Preferences IS Complete:
DEBUG [105]: [Function](): Station ID Cookie found! 065b42e2c69123b6363b303b76b4abb7
DEBUG [192]: [Function](): UnRead Messages: 0
DEBUG [48]: BreadCrumb::setCrumb(): Dropping Bread Crumb: End of Pay Period URL: /payperiod/ClosePayPeriod.php?select_all=on&pay_period_ids%5B%5D=1&action=Close
DEBUG [64] Array: [Function](): Selected Pay Periods
array(1) {
[0]=>
string(1) "1"
}


DEBUG [71]: [Function](): Lock Selected Pay Periods
DEBUG [707]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 0 Trans Off: 0
DEBUG [94]: Validator::inArrayKey(): Key: 20
DEBUG [707]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 1
DEBUG [753]: Factory::Save(): Calling preSave()
DEBUG [707]: Factory::StartTransaction(): StartTransaction(): Transaction Count: 1 Trans Off: 2
DEBUG [724]: Factory::isValid(): Calling Validate()
DEBUG [488]: PayPeriodFactory::Validate(): Start Date: 1165125577 End Date: 1166335176
DEBUG [536]: PayPeriodFactory::Validate(): Pay Period Type is NOT Monthly + Advance:
DEBUG [382]: Validator::Error(): Validation Error: Label: advance_end_date Msg: Advance end date is set
DEBUG [382]: Validator::Error(): Validation Error: Label: advance_transaction_date Msg: Advance transaction date is set
DEBUG [361] Array: Validator::isValid(): Errors
array(2) {
["advance_end_date"]=>
array(1) {
[0]=>
string(23) "Advance end date is set"
}
["advance_transaction_date"]=>
array(1) {
[0]=>
string(31) "Advance transaction date is set"
}
}
mikeb
Posts: 709
Joined: Thu Jul 27, 2006 11:58 am

Post by mikeb »

Thanks for the detailed report, try this:

Edit file:
classes/modules/payperiod/PayPeriodFactory.class.php

On line 537, change:

Code: Select all

if ( $this->getAdvanceEndDate() != FALSE ) {
To:

Code: Select all

if ( $this->getAdvanceEndDate() != '' ) {
And on line 543, change:

Code: Select all

 if ( $this->getAdvanceTransactionDate() != FALSE ) {
To:

Code: Select all

 if ( $this->getAdvanceTransactionDate() != '' ) {
Essentially changing FALSE to '' on those two lines.

Let us know if that helps, if it does we'll get a fix out for this in the next release.
TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!
ignus
Posts: 4
Joined: Tue Jan 02, 2007 10:05 am

Post by ignus »

Hi Mike,

I made those changes and it had the same problem.

I also upgraded to the latest (1.4.2) and it has the same problem. I will re-run the debug messages and post those(probably tonight).

Thanks!
mikeb
Posts: 709
Joined: Thu Jul 27, 2006 11:58 am

Post by mikeb »

We did some more testing and this turns out to be a MySQL gotcha, run these SQL queries at your MySQL console AFTER you have backed up your data.

Code: Select all

alter table pay_period change start_date start_date timestamp NULL default NULL;
alter table pay_period change end_date end_date timestamp NULL default NULL;
alter table pay_period change transaction_date transaction_date timestamp NULL default NULL;
alter table pay_period change advance_end_date advance_end_date timestamp NULL default NULL;
alter table pay_period change advance_transaction_date advance_transaction_date timestamp NULL default NULL;

update pay_period set advance_end_date = NULL;
update pay_period set advance_transaction_date = NULL;
This will be fixed in TimeTrex v1.5.0-beta2. Thanks for the report.
TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!
Locked