Revision 7e80cfae
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
2120 | 2120 |
); |
2121 | 2121 |
} |
2122 | 2122 |
|
2123 |
# check for purchase basket items |
|
2124 |
my %basket_item_id_to_orderitem = |
|
2125 |
map { $_->{basket_item_id} => $_ } |
|
2126 |
grep { $_->{basket_item_id} ne '' } |
|
2127 |
$self->order->orderitems; |
|
2128 |
my @basket_item_ids = keys %basket_item_id_to_orderitem; |
|
2129 |
if (scalar @basket_item_ids) { |
|
2130 |
my $basket_items = SL::DB::Manager::PurchaseBasketItem->get_all( |
|
2131 |
where => [ id => \@basket_item_ids ]); |
|
2132 |
if (scalar @$basket_items != scalar @basket_item_ids) { |
|
2133 |
my %basket_item_exists = map { $_->id => 1 } @$basket_items; |
|
2134 |
my @missing_for_positions = |
|
2135 |
map { $_->position } |
|
2136 |
map { $basket_item_id_to_orderitem{$_} } |
|
2137 |
grep { !$basket_item_exists{$_} } |
|
2138 |
@basket_item_ids; |
|
2139 |
return [t8('Purchase basket item not existing any more for position(s): #1.', |
|
2140 |
join(',', @missing_for_positions))]; |
|
2141 |
} |
|
2142 |
} |
|
2143 |
|
|
2123 | 2144 |
my $is_new = !$self->order->id; |
2124 | 2145 |
|
2125 | 2146 |
my $objects_to_close = scalar @converted_from_oe_ids |
SL/DB/Order.pm | ||
---|---|---|
177 | 177 |
my ($self) = @_; |
178 | 178 |
|
179 | 179 |
my @basket_item_ids = grep { $_ ne ''} map { $_->{basket_item_id} } $self->orderitems; |
180 |
return 1 unless scalar @basket_item_ids; |
|
181 |
|
|
182 |
# check if all items are still in the basket |
|
183 |
my $basket_item_count = SL::DB::Manager::PurchaseBasketItem->get_all_count( |
|
184 |
where => [ id => \@basket_item_ids ] |
|
185 |
); |
|
186 |
if ($basket_item_count != scalar @basket_item_ids) { |
|
187 |
die "Error while saving order: some items are not in the purchase basket anymore."; |
|
188 |
} |
|
180 | 189 |
|
181 | 190 |
if (scalar @basket_item_ids) { |
182 | 191 |
SL::DB::Manager::PurchaseBasketItem->delete_all( |
Auch abrufbar als: Unified diff
DispositionManager: Fehlermeldung bei doppelter Bestellung von Artikeln