+sub mtime_ischanged {
+ my ($self, $relation,$option) = @_;
+ #$main::lxdebug->message(LXDebug->DEBUG2(),"mtime_ischanged from rel=".$relation." id=".$id);
+ if ( ! $self->{id} ) { return ; }
+
+ 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};
+ #$main::lxdebug->message(LXDebug->DEBUG2(),"my mtime=".$self->{lastmtime}." new mtime=".$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 defined $option && $option eq 'mail';
+ $self->error($main::locale->text($etxt));
+ ::end_of_request();
+ }
+}
+