Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8118132d

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 8118132d56d668679c6f63090be155afe33c0a05
  • Vorgänger 26ec73d6
  • Nachfolger ec9ed803

Model::Record: Workflow mit ausgewählten Positionen ermöglichen

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
81 81

  
82 82
__PACKAGE__->run_before('get_unalterable_data',
83 83
  only => [ qw(
84
    save save_as_new save_and_delivery_order save_and_invoice
84
    save save_as_new save_and_new_record save_and_invoice
85 85
    save_and_ap_transaction print send_email
86 86
    ) ]);
87 87

  
......
118 118
  die "No 'from_type' was given." unless ($from_type);
119 119
  die "No 'from_id' was given."   unless ($from_id);
120 120

  
121
  my %flags = ();
122
  if (defined($::form->{from_item_ids})) {
123
    my %use_item = map { $_ => 1 } @{$::form->{from_item_ids}};
124
    $flags{item_filter} = sub {
125
      my ($item) = @_;
126
      return %use_item{$item->id};
127
    }
128
  }
129

  
121 130
  my $record = SL::Model::Record->get_record($from_type, $from_id);
122
  my $delivery_order = SL::Model::Record->new_from_workflow($record, $self->type);
131
  my $delivery_order = SL::Model::Record->new_from_workflow($record, $self->type, %flags);
123 132
  $self->order($delivery_order);
124 133

  
125 134
  $self->action_add;
......
515 524
  my $to_type = $::form->{to_type};
516 525
  my $to_controller = get_object_name_from_type($to_type);
517 526

  
527
  my %additional_params = ();
528
  if ($::form->{only_selected_items}) {
529
    my $from_item_ids = $::form->{selected_items} || [];
530
    $additional_params{from_item_ids} = $from_item_ids;
531
  }
532

  
518 533
  $self->save();
519 534
  flash_later('info', $self->type_data->text('saved'));
520 535

  
......
524 539
    type       => $to_type,
525 540
    from_id    => $self->order->id,
526 541
    from_type  => $self->order->type,
542
    %additional_params,
527 543
  );
528 544
}
529 545

  

Auch abrufbar als: Unified diff