Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d2af074a

Von Jan Büren vor mehr als 9 Jahren hinzugefügt

  • ID d2af074aaff9dc869be9fa766a796f1642e8ba54
  • Vorgänger d735aab3
  • Nachfolger 6c9d43ef

Erste Überarbeitung "Prüfen beim Speichern, ob Dokument geändert wurde."

Unterschiede anzeigen:

SL/Form.pm
2604 2604
}
2605 2605

  
2606 2606
sub mtime_ischanged {
2607
  my ($self, $relation,$option) = @_;
2608
  #$main::lxdebug->message(LXDebug->DEBUG2(),"mtime_ischanged from rel=".$relation." id=".$id);
2609
  if ( ! $self->{id} ) { return ; }
2607
  my ($self, $relation, $option) = @_;
2610 2608

  
2611
  my $query = "SELECT mtime, itime FROM ".$relation." WHERE id = ?";
2609
  return unless $self->{id};  # maybe better croak, but i have no api doc to refer to ...
2610

  
2611
  my $query = "SELECT mtime, itime FROM " . $relation . " WHERE id = ?";
2612 2612
  my $ref = selectfirst_hashref_query($self, $self->get_standard_dbh, $query, $self->{id});
2613 2613
  $ref->{mtime} = $ref->{itime} if !$ref->{mtime};
2614
  #$main::lxdebug->message(LXDebug->DEBUG2(),"my  mtime=".$self->{lastmtime}." new mtime=".$ref->{mtime});
2614

  
2615 2615
  if ($self->{lastmtime} && $self->{lastmtime} ne $ref->{mtime} ) {
2616 2616
      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");
2617

  
2617 2618
      $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")
2618
				  if  defined $option && $option eq 'mail';
2619
        if ($option eq 'mail');
2620
      # ^^ I prefer:
2621
      # my $etxt = ($option eq 'mail') ? locale1 : locale2;
2619 2622
      $self->error($main::locale->text($etxt));
2620 2623
    ::end_of_request();
2621 2624
  }
......
2772 2775
      qq|SELECT
2773 2776
           a.cp_id, a.invnumber, a.transdate, a.${table}_id, a.datepaid,
2774 2777
           a.duedate, a.ordnumber, a.taxincluded, (SELECT cu.name FROM currencies cu WHERE cu.id=a.currency_id) AS currency, a.notes,
2775
           a.mtime,a.itime,
2778
           a.mtime, a.itime,
2776 2779
           a.intnotes, a.department_id, a.amount AS oldinvtotal,
2777 2780
           a.paid AS oldtotalpaid, a.employee_id, a.gldate, a.type,
2778 2781
           a.globalproject_id, ${extra_columns}
......
2789 2792
    foreach my $key (keys %$ref) {
2790 2793
      $self->{$key} = $ref->{$key};
2791 2794
    }
2792
    $self->{mtime} = $self->{itime} if ! $self->{mtime};
2795
    $self->{mtime} ||= $self->{itime};
2793 2796
    $self->{lastmtime} = $self->{mtime};
2794 2797
    my $transdate = "current_date";
2795 2798
    if ($self->{transdate}) {

Auch abrufbar als: Unified diff