+sub mtime_ischanged {
+ my ($self, $relation, $option) = @_;
+
+ return unless $self->{id}; # maybe better croak, but i have no api doc to refer to ...
+
+ my $query = "SELECT mtime, itime FROM " . $relation . " WHERE id = ?";
+ my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id});
+ $ref->{mtime} = $ref->{itime} if !$ref->{mtime};
+
+ if ($self->{lastmtime} && $self->{lastmtime} ne $ref->{mtime} ) {
+ my $etxt = $main::locale->text("The document has been changed from other user. Please reopen it in another window and copy the changes to the new window");
+
+ $etxt = $main::locale->text("The document has been changed from other user. No mail was sent. Please reopen it in another window and copy the changes to the new window")
+ if ($option eq 'mail');
+ # ^^ I prefer:
+ # my $etxt = ($option eq 'mail') ? locale1 : locale2;
+ $self->error($main::locale->text($etxt));
+ ::end_of_request();
+ }
+}
+