[Rt-commit] r15586 - in rt/branches/3.999-DANGEROUS: lib/RT
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Wed Aug 27 23:45:39 EDT 2008
Author: sunnavy
Date: Wed Aug 27 23:45:37 2008
New Revision: 15586
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
Log:
r16232 at sunnavys-mb: sunnavy | 2008-08-28 11:41:23 +0800
added default value for last_update_by, created and last_updated
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Record.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Record.pm Wed Aug 27 23:45:37 2008
@@ -272,10 +272,23 @@
$attribs{'creator'} ||= $self->current_user->id
if $self->can('creator') && $self->current_user;
+ $attribs{'last_update_by'} ||= $self->current_user->id
+ if $self->can('last_update_by') && $self->current_user;
+# XXX TODO by sunnavy:
+# I found we didn't have created and last_updated here weirdly.
+# maybe one may wish to use the defer schema to give them default
+# values? well, because we have some 'created' columns in different tables,
+# maybe putting it here is the best practice.
my $now = RT::Date->new( current_user => $self->current_user );
$now->set( format => 'unix', value => time );
+ $attribs{'created'} ||= $now->iso
+ if $self->can( 'created' ) && $self->current_user;
+ $attribs{'last_updated'} ||= $now->iso
+ if $self->can( 'last_updated' ) && $self->current_user;
+
+
my ($id) = $self->SUPER::create(%attribs);
if ( UNIVERSAL::isa( $id, 'Class::ReturnValue' ) ) {
if ( $id->errno ) {
More information about the Rt-commit
mailing list