Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0ed6ca32

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 0ed6ca32fa59bb98da5fbff6b34da23d3e968e03
  • Vorgänger ea74d55f
  • Nachfolger 127f5b5c

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
21 21
use SL::DB::Reclamation::TypeData qw(:types);
22 22

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

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

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

  
50 52
# hooks
51 53

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

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

  
73 86
# methods
74 87

  
75 88
sub items { goto &orderitems; }

Auch abrufbar als: Unified diff