Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9c8d0637

Von Sven Schöling vor mehr als 9 Jahren hinzugefügt

  • ID 9c8d0637fda107ec6d4a35ae52802ee2d1cb9eb3
  • Vorgänger e24e6570
  • Nachfolger 01678c87

Mahnungen löschen

Unterschiede anzeigen:

bin/mozilla/dn.pl
36 36
use SL::IS;
37 37
use SL::PE;
38 38
use SL::DN;
39
use SL::DB::Dunning;
40
use SL::Helper::Flash;
41
use SL::Locale::String qw(t8);
39 42
use SL::ReportGenerator;
40 43

  
41 44
require "bin/mozilla/common.pl";
......
473 476
  $main::lxdebug->leave_sub();
474 477
}
475 478

  
479
sub delete {
480
  $main::auth->assert('dunning_edit');
481

  
482
  my @dunning_ids = map { $::form->{"dunning_id_$_"} } grep { $::form->{"selected_$_"} } (1..$::form->{rowcount});
483

  
484
  if (!scalar @dunning_ids) {
485
    $::form->error($::locale->text('No dunnings have been selected for printing.'));
486
  }
487

  
488
  my $dunnings = SL::DB::Manager::Dunning->get_all(query => [ dunning_id => \@dunning_ids ]);
489

  
490
  SL::DB::Dunning->new->db->with_transaction(sub {
491
    for my $dunning (@$dunnings) {
492
      SL::DB::Manager::Invoice->find_by(id => $dunning->trans_id)->update_attributes(dunning_config_id => undef);
493
      $dunning->delete;
494
    }
495
  });
496

  
497
  flash('info', t8('#1 dunnings have been deleted', scalar @$dunnings));
498

  
499
  search();
500
}
501

  
476 502
sub print_multiple {
477 503
  $main::lxdebug->enter_sub();
478 504

  
......
526 552
  call_sub($main::form->{nextsub});
527 553
}
528 554

  
555
sub dispatcher {
556
  foreach my $action (qw(delete print_multiple)) {
557
    if ($::form->{"action_${action}"}) {
558
      call_sub($action);
559
      return;
560
    }
561
  }
562

  
563
  $::form->error($::locale->text('No action defined.'));
564
}
529 565
# end of main

Auch abrufbar als: Unified diff