@@ -, +, @@ themselves with database generated value automatically --- Koha/Object.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/Koha/Object.pm +++ a/Koha/Object.pm @@ -121,7 +121,9 @@ sub store { my ($self) = @_; try { - return $self->_result()->update_or_insert() ? $self : undef; + my $object = $self->_result()->update_or_insert() ? $self : undef; + $object->discard_changes if $object->_has_derived_columns && defined wantarray; + return $object; } catch { # Catch problems and raise relevant exceptions @@ -401,6 +403,17 @@ sub AUTOLOAD { return $r; } +=head3 _has_derived_columns + +This method is a flag that tells us if an object has derived columns generated by the database. +If the object does, this method should return true. If not, it can be left out. + +=cut + +sub _has_derived_columns { + return 0; +} + =head3 _type This method must be defined in the child class. The value is the name of the DBIC resultset. --