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
61 Creates a new log entry. To add the log entry to the database, see L<"insert">.
63 Note that this stores the hash reference, not a distinct copy of the hash it
64 points to. You can ask the object for a copy with the I<hash> method.
68 sub table { 'access_user_log'; }
70 =item insert_new_path PATH
72 Adds a log entry for PATH for the current user and timestamp.
77 my( $class, $path ) = @_;
79 return '' unless defined $FS::CurrentUser::CurrentUser;
81 my $self = $class->new( {
82 'usernum' => $FS::CurrentUser::CurrentUser->usernum,
87 #so we can still log pages after a transaction-aborting SQL error (and then
88 # show the # error page)
89 local($FS::UID::dbh) = dbh->clone;
90 #if current transaction is aborted (if we had a way to check for it)
92 my $error = $self->insert;
99 Adds this record to the database. If there is an error, returns the error,
100 otherwise returns false.
104 Delete this record from the database.
106 =item replace OLD_RECORD
108 Replaces the OLD_RECORD with this one in the database. If there is an error,
109 returns the error, otherwise returns false.
113 Checks all fields to make sure this is a valid log entry. If there is
114 an error, returns the error, otherwise returns false. Called by the insert
123 $self->ut_numbern('lognum')
124 || $self->ut_foreign_key('usernum', 'access_user', 'usernum')
125 || $self->ut_text('path')
126 || $self->ut_number('_date')
128 return $error if $error;