1 package FS::access_user_log;
2 use base qw( FS::Record );
6 #use FS::Record qw( qsearch qsearchs );
11 FS::access_user_log - Object methods for access_user_log records
15 use FS::access_user_log;
17 $record = new FS::access_user_log \%hash;
18 $record = new FS::access_user_log { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::access_user_log object represents a backoffice web server log entry.
31 FS::access_user_log inherits from FS::Record. The following fields are
62 Creates a new log entry. To add the log entry to the database, see L<"insert">.
64 Note that this stores the hash reference, not a distinct copy of the hash it
65 points to. You can ask the object for a copy with the I<hash> method.
69 sub table { 'access_user_log'; }
71 =item insert_new_path PATH
73 Adds a log entry for PATH for the current user and timestamp.
78 my( $class, $path, $render_seconds ) = @_;
80 return '' unless defined $FS::CurrentUser::CurrentUser;
82 my $self = $class->new( {
83 'usernum' => $FS::CurrentUser::CurrentUser->usernum,
86 'render_seconds' => $render_seconds,
89 #so we can still log pages after a transaction-aborting SQL error (and then
90 # show the # error page)
91 local($FS::UID::dbh) = dbh->clone;
92 #if current transaction is aborted (if we had a way to check for it)
94 my $error = $self->insert;
101 Adds this record to the database. If there is an error, returns the error,
102 otherwise returns false.
106 Delete this record from the database.
108 =item replace OLD_RECORD
110 Replaces the OLD_RECORD with this one in the database. If there is an error,
111 returns the error, otherwise returns false.
115 Checks all fields to make sure this is a valid log entry. If there is
116 an error, returns the error, otherwise returns false. Called by the insert
125 $self->ut_numbern('lognum')
126 || $self->ut_foreign_key('usernum', 'access_user', 'usernum')
127 || $self->ut_text('path')
128 || $self->ut_number('_date')
129 || $self->ut_numbern('render_seconds')
131 return $error if $error;