Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 54f61b14

Von Werner Hahn vor etwa 1 Jahr hinzugefügt

  • ID 54f61b1440acbc40efe787e9825277787d3d3ed5
  • Vorgänger 3d0d2a52
  • Nachfolger 38acfb33

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 = (
......
1731 1728
  }
1732 1729
}
1733 1730

  
1734
# delete the reclamation
1735
#
1736
# And remove related files in the spool directory
1737
sub delete {
1738
  my ($self) = @_;
1739

  
1740
  my $errors = [];
1741
  my $db     = $self->reclamation->db;
1742

  
1743
  $db->with_transaction(
1744
    sub {
1745
      my @spoolfiles = grep { $_ } map { $_->spoolfile } @{ SL::DB::Manager::Status->get_all(where => [ trans_id => $self->reclamation->id ]) };
1746
      $self->reclamation->delete;
1747
      my $spool = $::lx_office_conf{paths}->{spool};
1748
      unlink map { "$spool/$_" } @spoolfiles if $spool;
1749

  
1750
      $self->save_history('DELETED');
1751

  
1752
      1;
1753
  }) || push(@{$errors}, $db->error);
1754

  
1755
  return $errors;
1756
}
1757

  
1758 1731
# save the reclamation
1759 1732
#
1760 1733
# And delete items that are deleted in the form.

Auch abrufbar als: Unified diff