22 |
22 |
use SL::DB::Part;
|
23 |
23 |
use SL::DB::PartsGroup;
|
24 |
24 |
use SL::DB::PriceRuleItem;
|
|
25 |
use SL::DB::PurchaseBasketItem;
|
25 |
26 |
use SL::DB::Shop;
|
26 |
27 |
use SL::Helper::Flash;
|
27 |
28 |
use SL::JSON;
|
... | ... | |
260 |
261 |
$self->render_form;
|
261 |
262 |
}
|
262 |
263 |
|
|
264 |
sub action_add_to_basket {
|
|
265 |
my ( $self ) = @_;
|
|
266 |
|
|
267 |
if ( !$self->_is_in_purchase_basket && scalar @{$self->part->makemodels}) {
|
|
268 |
my $basket_part = SL::DB::PurchaseBasketItem->new(
|
|
269 |
parts_id => $self->part->id,
|
|
270 |
qty => $self->part->ordersize || 1, # was ist wenn order_size < (rop-onhand) ist? sollte dann nicht (rop-onhand) genommen werden?
|
|
271 |
)->save;
|
|
272 |
|
|
273 |
$self->js->flash('info', t8('Part added to purchasebasket'))->render;
|
|
274 |
} else {
|
|
275 |
$self->js->flash('error', t8('Part already in purchasebasket or has no vendor'))->render;
|
|
276 |
}
|
|
277 |
return 1;
|
|
278 |
}
|
|
279 |
|
263 |
280 |
sub render_form {
|
264 |
281 |
my ($self, %params) = @_;
|
265 |
282 |
|
... | ... | |
986 |
1003 |
|
987 |
1004 |
my $position = 0;
|
988 |
1005 |
my $makemodels = delete($::form->{makemodels}) || [];
|
989 |
|
$main::lxdebug->dump(0, 'WH:MMFORM ', $makemodels);
|
990 |
1006 |
foreach my $makemodel ( @{$makemodels} ) {
|
991 |
1007 |
next unless $makemodel->{make};
|
992 |
1008 |
$position++;
|
... | ... | |
1179 |
1195 |
my $position = 0;
|
1180 |
1196 |
my @makemodel_array = ();
|
1181 |
1197 |
my $makemodels = delete($::form->{makemodels}) || [];
|
1182 |
|
$main::lxdebug->dump(0, 'WH:MM ', $makemodels);
|
1183 |
1198 |
|
1184 |
1199 |
foreach my $makemodel ( @{$makemodels} ) {
|
1185 |
1200 |
next unless $makemodel->{make};
|
... | ... | |
1568 |
1583 |
return \@item_objects;
|
1569 |
1584 |
}
|
1570 |
1585 |
|
|
1586 |
sub _is_in_purchase_basket {
|
|
1587 |
my ( $self ) = @_;
|
|
1588 |
|
|
1589 |
return SL::DB::Manager::PurchaseBasketItem->get_all_count( query => [ parts_id => $self->part->id ] );
|
|
1590 |
}
|
|
1591 |
|
1571 |
1592 |
sub _setup_form_action_bar {
|
1572 |
1593 |
my ($self) = @_;
|
1573 |
1594 |
|
... | ... | |
1640 |
1661 |
: undef,
|
1641 |
1662 |
],
|
1642 |
1663 |
|
|
1664 |
action => [
|
|
1665 |
t8('Add to basket'),
|
|
1666 |
call => [ 'kivi.Part.add_to_basket' ],
|
|
1667 |
disabled => $self->_is_in_purchase_basket ? t8('Part already in purchasebasket')
|
|
1668 |
: !scalar @{$self->part->makemodels} ? t8('No vendors to add to purchasebasket')
|
|
1669 |
: undef,
|
|
1670 |
],
|
|
1671 |
|
1643 |
1672 |
'separator',
|
1644 |
1673 |
|
1645 |
1674 |
action => [
|
Dispositionsmanager: Artikel aus der artikelmaske dem Einkaufswarenkorb
hinzufügen