Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3bb28790

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID 3bb28790124fffa77da1a8b512a4aa34e8862dd9
  • Vorgänger c1ffd6a2
  • Nachfolger 1d122829

DispositionManager: Fehlermeldung bei doppelter Bestellung von Artikeln

Unterschiede anzeigen:

SL/Controller/Order.pm
2235 2235
    $self->order->add_phone_notes($phone_note) if $is_new;
2236 2236
  }
2237 2237

  
2238
  # check for purchase basket items
2239
  my %basket_item_id_to_orderitem =
2240
    map { $_->{basket_item_id} => $_ }
2241
    grep { $_->{basket_item_id} ne '' }
2242
    $self->order->orderitems;
2243
  my @basket_item_ids = keys %basket_item_id_to_orderitem;
2244
  if (scalar @basket_item_ids) {
2245
    my $basket_items = SL::DB::Manager::PurchaseBasketItem->get_all(
2246
      where => [ id => \@basket_item_ids ]);
2247
    if (scalar @$basket_items != scalar @basket_item_ids) {
2248
      my %basket_item_exists = map { $_->id => 1 } @$basket_items;
2249
      my @missing_for_positions =
2250
        map { $_->position }
2251
        map { $basket_item_id_to_orderitem{$_} }
2252
        grep { !$basket_item_exists{$_} }
2253
        @basket_item_ids;
2254
      return [t8('Purchase basket item not existing any more for position(s): #1.',
2255
                 join(',', @missing_for_positions))];
2256
    }
2257
  }
2258

  
2238 2259
  my $is_new = !$self->order->id;
2239 2260
  $db->with_transaction(sub {
2240 2261
    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