X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Faccess_user_log.pm;h=563f3cef08fbe09d2df1445cb26854bba50b6154;hb=18af4f3316291938fa8f0a74e083209f62eac4fa;hp=9e7f7a00effff86923fda87c455681bdfa5ebe56;hpb=9aee669886202be7035e6c6049fc71bc99dd3013;p=freeside.git diff --git a/FS/FS/access_user_log.pm b/FS/FS/access_user_log.pm index 9e7f7a00e..563f3cef0 100644 --- a/FS/FS/access_user_log.pm +++ b/FS/FS/access_user_log.pm @@ -2,6 +2,7 @@ package FS::access_user_log; use base qw( FS::Record ); use strict; +use FS::UID qw( dbh ); #use FS::Record qw( qsearch qsearchs ); use FS::CurrentUser; @@ -48,6 +49,7 @@ path _date +=item render_seconds =back @@ -73,16 +75,22 @@ Adds a log entry for PATH for the current user and timestamp. =cut sub insert_new_path { - my( $class, $path ) = @_; + my( $class, $path, $render_seconds ) = @_; return '' unless defined $FS::CurrentUser::CurrentUser; my $self = $class->new( { - 'usernum' => $FS::CurrentUser::CurrentUser->usernum, - 'path' => $path, - '_date' => time, + 'usernum' => $FS::CurrentUser::CurrentUser->usernum, + 'path' => $path, + '_date' => time, + 'render_seconds' => $render_seconds, } ); + #so we can still log pages after a transaction-aborting SQL error (and then + # show the # error page) + local($FS::UID::dbh) = dbh->clone; + #if current transaction is aborted (if we had a way to check for it) + my $error = $self->insert; die $error if $error; @@ -118,6 +126,7 @@ sub check { || $self->ut_foreign_key('usernum', 'access_user', 'usernum') || $self->ut_text('path') || $self->ut_number('_date') + || $self->ut_numbern('render_seconds') ; return $error if $error;