Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1978142d

Von Werner Hahn vor etwa 1 Jahr hinzugefügt

  • ID 1978142d278b23c0e4a4b48d5523f6550bea8cd4
  • Vorgänger f66eb3df
  • Nachfolger a5012911

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

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
192 192
sub action_delete {
193 193
  my ($self) = @_;
194 194

  
195
  my $errors = $self->delete();
196

  
197
  if (scalar @{ $errors }) {
198
    $self->js->flash('error', $_) foreach @{ $errors };
199
    return $self->js->render();
200
  }
201

  
195
  my $number_type = $self->type_data;
196
  my %history = (snumbers => $self->type . '_' . $self->order->number);
197
  my %params = (history => \%history);
198
  SL::Model::Record->delete($self->order,%params);
202 199
  flash_later('info', $self->type_data->text("delete"));
203 200

  
204 201
  my @redirect_params = (
......
1635 1632
  }
1636 1633
}
1637 1634

  
1638
# delete the order
1639
#
1640
# And remove related files in the spool directory
1641
sub delete {
1642
  my ($self) = @_;
1643

  
1644
  my $errors = [];
1645
  my $db     = $self->order->db;
1646

  
1647
  $db->with_transaction(
1648
    sub {
1649
      my @spoolfiles = grep { $_ } map { $_->spoolfile } @{ SL::DB::Manager::Status->get_all(where => [ trans_id => $self->order->id ]) };
1650
      $self->order->delete;
1651
      my $spool = $::lx_office_conf{paths}->{spool};
1652
      unlink map { "$spool/$_" } @spoolfiles if $spool;
1653

  
1654
      $self->save_history('DELETED');
1655

  
1656
      1;
1657
  }) || push(@{$errors}, $db->error);
1658

  
1659
  return $errors;
1660
}
1661

  
1662 1635
# save the order
1663 1636
#
1664 1637
# And delete items that are deleted in the form.

Auch abrufbar als: Unified diff