20 |
20 |
use SL::DB::Part;
|
21 |
21 |
use SL::DB::PartsGroup;
|
22 |
22 |
use SL::DB::PriceRuleItem;
|
|
23 |
use SL::DB::PurchaseBasketItem;
|
23 |
24 |
use SL::DB::Shop;
|
24 |
25 |
use SL::Helper::Flash;
|
25 |
26 |
use SL::JSON;
|
... | ... | |
257 |
258 |
$self->render_form;
|
258 |
259 |
}
|
259 |
260 |
|
|
261 |
sub action_add_to_basket {
|
|
262 |
my ( $self ) = @_;
|
|
263 |
|
|
264 |
if ( !$self->_is_in_purchase_basket && scalar @{$self->part->makemodels}) {
|
|
265 |
my $basket_part = SL::DB::PurchaseBasketItem->new(
|
|
266 |
parts_id => $self->part->id,
|
|
267 |
qty => $self->part->ordersize || 1, # was ist wenn order_size < (rop-onhand) ist? sollte dann nicht (rop-onhand) genommen werden?
|
|
268 |
)->save;
|
|
269 |
|
|
270 |
$self->js->flash('info', t8('Part added to purchasebasket'))->render;
|
|
271 |
} else {
|
|
272 |
$self->js->flash('error', t8('Part already in purchasebasket or has no vendor'))->render;
|
|
273 |
}
|
|
274 |
return 1;
|
|
275 |
}
|
|
276 |
|
260 |
277 |
sub render_form {
|
261 |
278 |
my ($self, %params) = @_;
|
262 |
279 |
|
... | ... | |
942 |
959 |
|
943 |
960 |
my $position = 0;
|
944 |
961 |
my $makemodels = delete($::form->{makemodels}) || [];
|
945 |
|
$main::lxdebug->dump(0, 'WH:MMFORM ', $makemodels);
|
946 |
962 |
foreach my $makemodel ( @{$makemodels} ) {
|
947 |
963 |
next unless $makemodel->{make};
|
948 |
964 |
$position++;
|
... | ... | |
1102 |
1118 |
my $position = 0;
|
1103 |
1119 |
my @makemodel_array = ();
|
1104 |
1120 |
my $makemodels = delete($::form->{makemodels}) || [];
|
1105 |
|
$main::lxdebug->dump(0, 'WH:MM ', $makemodels);
|
1106 |
1121 |
|
1107 |
1122 |
foreach my $makemodel ( @{$makemodels} ) {
|
1108 |
1123 |
next unless $makemodel->{make};
|
... | ... | |
1461 |
1476 |
return \@item_objects;
|
1462 |
1477 |
}
|
1463 |
1478 |
|
|
1479 |
sub _is_in_purchase_basket {
|
|
1480 |
my ( $self ) = @_;
|
|
1481 |
|
|
1482 |
return SL::DB::Manager::PurchaseBasketItem->get_all_count( query => [ parts_id => $self->part->id ] );
|
|
1483 |
}
|
|
1484 |
|
1464 |
1485 |
sub _setup_form_action_bar {
|
1465 |
1486 |
my ($self) = @_;
|
1466 |
1487 |
|
... | ... | |
1533 |
1554 |
: undef,
|
1534 |
1555 |
],
|
1535 |
1556 |
|
|
1557 |
action => [
|
|
1558 |
t8('Add to basket'),
|
|
1559 |
call => [ 'kivi.Part.add_to_basket' ],
|
|
1560 |
disabled => $self->_is_in_purchase_basket ? t8('Part already in purchasebasket')
|
|
1561 |
: !scalar @{$self->part->makemodels} ? t8('No vendors to add to purchasebasket')
|
|
1562 |
: undef,
|
|
1563 |
],
|
|
1564 |
|
1536 |
1565 |
'separator',
|
1537 |
1566 |
|
1538 |
1567 |
action => [
|
Dispositionsmanager: Artikel aus der artikelmaske dem Einkaufswarenkorb
hinzufügen