Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ecdd2707

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID ecdd270743845d43ad2dacf7e463189fa4347a83
  • Vorgänger 1c6ac21e
  • Nachfolger f3c44e37

SL::Controller::Reclamation->delete auf SL/Model/Record gemapt

Unterschiede anzeigen:

SL/Controller/Reclamation.pm
250 250
sub action_delete {
251 251
  my ($self) = @_;
252 252

  
253
  my $errors = $self->delete();
254

  
255
  if (scalar @{ $errors }) {
256
    $self->js->flash('error', $_) foreach @{ $errors };
257
    return $self->js->render();
258
  }
259 253

  
254
  my %history = (snumbers => 'record_number_' . $self->reclamation->record_number);
255
  my %params = (history => \%history);
256
  SL::Model::Record->delete($self->reclamation, %params);
260 257
  flash_later('info', t8('The reclamation has been deleted'));
261 258

  
262 259
  my @redirect_params = (
......
1725 1722
  }
1726 1723
}
1727 1724

  
1728
# delete the reclamation
1729
#
1730
# And remove related files in the spool directory
1731
sub delete {
1732
  my ($self) = @_;
1733

  
1734
  my $errors = [];
1735
  my $db     = $self->reclamation->db;
1736

  
1737
  $db->with_transaction(
1738
    sub {
1739
      my @spoolfiles = grep { $_ } map { $_->spoolfile } @{ SL::DB::Manager::Status->get_all(where => [ trans_id => $self->reclamation->id ]) };
1740
      $self->reclamation->delete;
1741
      my $spool = $::lx_office_conf{paths}->{spool};
1742
      unlink map { "$spool/$_" } @spoolfiles if $spool;
1743

  
1744
      $self->save_history('DELETED');
1745

  
1746
      1;
1747
  }) || push(@{$errors}, $db->error);
1748

  
1749
  return $errors;
1750
}
1751

  
1752 1725
# save the reclamation
1753 1726
#
1754 1727
# And delete items that are deleted in the form.

Auch abrufbar als: Unified diff