From: Jan Büren Date: Fri, 9 Oct 2015 15:23:12 +0000 (+0200) Subject: Erste Überarbeitung "Prüfen beim Speichern, ob Dokument geändert wurde." X-Git-Tag: release-3.4.1~648 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d2af074aaff9dc869be9fa766a796f1642e8ba54;p=kivitendo-erp.git Erste Überarbeitung "Prüfen beim Speichern, ob Dokument geändert wurde." --- diff --git a/SL/DO.pm b/SL/DO.pm index 4cc0f5909..a293239d9 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -685,7 +685,7 @@ sub retrieve { dord.closed, dord.reqdate, dord.department_id, dord.cusordnumber, d.description AS department, dord.language_id, dord.shipto_id, - dord.itime,dord.mtime, + dord.itime, dord.mtime, dord.globalproject_id, dord.delivered, dord.transaction_description, dord.taxzone_id, dord.taxincluded, dord.payment_id, (SELECT cu.name FROM currencies cu WHERE cu.id=dord.currency_id) AS currency, dord.delivery_term_id, dord.itime::DATE AS insertdate @@ -720,7 +720,7 @@ sub retrieve { } } $sth->finish(); - $form->{mtime} = $form->{itime} if !$form->{mtime}; + $form->{mtime} ||= $form->{itime}; $form->{lastmtime} = $form->{mtime}; $form->{donumber_array} =~ s/\s*$//g; $form->{ordnumber_array} =~ s/ //; diff --git a/SL/Form.pm b/SL/Form.pm index 81b5370b7..645544eec 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2604,18 +2604,21 @@ sub all_vc { } sub mtime_ischanged { - my ($self, $relation,$option) = @_; - #$main::lxdebug->message(LXDebug->DEBUG2(),"mtime_ischanged from rel=".$relation." id=".$id); - if ( ! $self->{id} ) { return ; } + my ($self, $relation, $option) = @_; - my $query = "SELECT mtime, itime FROM ".$relation." WHERE id = ?"; + 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}; - #$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'; + if ($option eq 'mail'); + # ^^ I prefer: + # my $etxt = ($option eq 'mail') ? locale1 : locale2; $self->error($main::locale->text($etxt)); ::end_of_request(); } @@ -2772,7 +2775,7 @@ sub create_links { qq|SELECT a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid, a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes, - a.mtime,a.itime, + a.mtime, a.itime, a.intnotes, a.department_id, a.amount AS oldinvtotal, a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type, a.globalproject_id, ${extra_columns} @@ -2789,7 +2792,7 @@ sub create_links { foreach my $key (keys %$ref) { $self->{$key} = $ref->{$key}; } - $self->{mtime} = $self->{itime} if ! $self->{mtime}; + $self->{mtime} ||= $self->{itime}; $self->{lastmtime} = $self->{mtime}; my $transdate = "current_date"; if ($self->{transdate}) { diff --git a/SL/OE.pm b/SL/OE.pm index 355ccc793..36cbcd1b7 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -947,7 +947,7 @@ sub retrieve { map { $form->{$_} = '' if ($ref->{$_} ne $form->{$_}) } keys %$ref; } } - $form->{mtime} = $form->{itime} if ! $form->{mtime}; + $form->{mtime} ||= $form->{itime}; $form->{lastmtime} = $form->{mtime}; # if not given, fill transdate with current_date diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index ad119c477..ea2cffadf 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1794,9 +1794,8 @@ sub sales_order { my $locale = $main::locale; check_oe_access(); - - $form->mtime_ischanged('oe'); $main::auth->assert('sales_order_edit'); + $form->mtime_ischanged('oe'); if ($form->{type} eq "purchase_order") { delete($form->{ordnumber}); @@ -1944,7 +1943,6 @@ sub e_mail { $main::lxdebug->enter_sub(); my $form = $main::form; - my $locale = $main::locale; check_oe_access();