Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bb8c0275

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID bb8c0275069e406bdaadd2d2e94ae1a97d484335
  • Vorgänger 2aec7b6d
  • Nachfolger 01548f39

FIX: DeliveryOrder: Setze Aufträge auf geliefert

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1107 1107

  
1108 1108
  $self->js
1109 1109
    ->flash("info", t8("Stock transfered"))
1110
    ->run('kivi.ActionBar.setDisabled', '#save_action',
1111
          t8('This record has already been delivered.'))
1110 1112
    ->run('kivi.ActionBar.setDisabled', '#transfer_out_action',
1111 1113
          t8('The parts for this order have already been transferred'))
1112 1114
    ->run('kivi.ActionBar.setDisabled', '#transfer_in_action',
SL/DB/DeliveryOrder.pm
20 20
use SL::DB::Reclamation::TypeData qw(:types);
21 21

  
22 22
use SL::Helper::Number qw(_format_total _round_total);
23
use SL::Helper::ShippedQty;
23 24

  
24 25
use List::Util qw(first);
25 26
use List::MoreUtils qw(any pairwise);
......
45 46

  
46 47
__PACKAGE__->before_save('_before_save_set_donumber');
47 48
__PACKAGE__->after_save('_after_save_link_records');
49
__PACKAGE__->after_save('_mark_orders_if_delivered');
48 50

  
49 51
# hooks
50 52

  
......
69 71
  );
70 72
}
71 73

  
74
sub _mark_orders_if_delivered {
75
  my ($self) = @_;
76
  my $orders = $self->linked_records(from => 'Order');
77
  SL::Helper::ShippedQty->new->calculate($orders)->write_to_objects;
78
  foreach my $order (@$orders) {
79
    next if $order->is_sales != $self->is_sales;
80
    $order->update_attributes(delivered => $order->{delivered});
81
  }
82
  return 1;
83
}
84

  
72 85
# methods
73 86

  
74 87
sub items { goto &orderitems; }

Auch abrufbar als: Unified diff