Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 095484d1

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 095484d16f4c2bd1cba77024a8bc1b591a5cc355
  • Vorgänger 31dde52b
  • Nachfolger 8873a00d

DispositionManager: Fehlermeldung bei doppelter Bestellung von Artikeln

Unterschiede anzeigen:

SL/Controller/Order.pm
2252 2252
    $self->order->add_phone_notes($phone_note) if $is_new;
2253 2253
  }
2254 2254

  
2255
  # check for purchase basket items
2256
  my %basket_item_id_to_orderitem =
2257
    map { $_->{basket_item_id} => $_ }
2258
    grep { $_->{basket_item_id} ne '' }
2259
    $self->order->orderitems;
2260
  my @basket_item_ids = keys %basket_item_id_to_orderitem;
2261
  if (scalar @basket_item_ids) {
2262
    my $basket_items = SL::DB::Manager::PurchaseBasketItem->get_all(
2263
      where => [ id => \@basket_item_ids ]);
2264
    if (scalar @$basket_items != scalar @basket_item_ids) {
2265
      my %basket_item_exists = map { $_->id => 1 } @$basket_items;
2266
      my @missing_for_positions =
2267
        map { $_->position }
2268
        map { $basket_item_id_to_orderitem{$_} }
2269
        grep { !$basket_item_exists{$_} }
2270
        @basket_item_ids;
2271
      return [t8('Purchase basket item not existing any more for position(s): #1.',
2272
                 join(',', @missing_for_positions))];
2273
    }
2274
  }
2275

  
2255 2276
  my $is_new = !$self->order->id;
2256 2277
  $db->with_transaction(sub {
2257 2278
    my $validity_token;
SL/DB/Order.pm
140 140
  my ($self) = @_;
141 141

  
142 142
  my @basket_item_ids = grep { $_ ne ''} map { $_->{basket_item_id} } $self->orderitems;
143
  return 1 unless scalar @basket_item_ids;
144

  
145
  # check if all items are still in the basket
146
  my $basket_item_count = SL::DB::Manager::PurchaseBasketItem->get_all_count(
147
    where => [ id => \@basket_item_ids ]
148
  );
149
  if ($basket_item_count != scalar @basket_item_ids) {
150
    die "Error while saving order: some items are not in the purchase basket anymore.";
151
  }
143 152

  
144 153
  if (scalar @basket_item_ids) {
145 154
    SL::DB::Manager::PurchaseBasketItem->delete_all(

Auch abrufbar als: Unified diff