#405 in MSSQL, audit does not function properly

data
closed-fixed
nobody
None
5
2007-02-19
2007-02-18
Chavous P. Camp
No

In 0.9.5RC3, audit does not function under MSSQL...

First issue: project and ticket audit tables are created with the projectid and ticketid fields set to autonumber. MSSQL explicitly prohibits autonumbered fields to be assigned in a SQL INSERT unless INSERT_IDENTITY is turned on, which it IS NOT normally.

Resolved by modifying the db schema, and updating the various schema files to match.

NEXT ISSUE (and this one was a bear to track down): The following backtrace (or something very similar) is generated when viewing ANY audit...

mktime() expects parameter 2 to be long, string given D:\websites\track.scfoc.com\inc\class.DCL_DateTime.inc.php (109) : mktime
D:\websites\track.scfoc.com\inc\class.DCL_DB_Core.inc.php (369) : DCLTimestamp->SetFromDB
D:\websites\track.scfoc.com\inc\class.DCL_DB_Core.inc.php (775) : DCL_DB_Core->FormatTimeStampForDisplay
D:\websites\track.scfoc.com\inc\class.DCL_DB_Core.inc.php (519) : DCL_DB_Core->FieldValueFromSQL
D:\websites\track.scfoc.com\inc\class.boAudit.inc.php (37) : DCL_DB_Core->AuditLoad
D:\websites\track.scfoc.com\inc\class.htmlAudit.inc.php (69) : boAudit->LoadDiff
D:\websites\track.scfoc.com\inc\functions.inc.php (214) : htmlAudit->show
D:\websites\track.scfoc.com\main.php (34) : Invoke

Basically occurs b/c the datetimes aren't coming out of the database properly because ConvertDateTime function is NOT being called on the field name.

Resolved by modifying DCL_DB_Core.AuditLoad() to use the same code that DCL_DB_Core.load() uses to generate the column list for the sql query. Also modified dbWorkOrderAccount.AuditWorkOrderList() to call $this.ConvertDateTime() on the 'audit_on' column.

Patch attached.

Discussion

  • Patch to fix the issues with audits in MSSQL

     
    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=6207
    Originator: NO

    Committed revision 46