Revision ce904bd6
Von Kivitendo Admin vor mehr als 7 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
26 | 26 |
assortment assortment_items assembly assembly_items |
27 | 27 |
all_pricegroups all_translations all_partsgroups all_units |
28 | 28 |
all_buchungsgruppen all_payment_terms all_warehouses |
29 |
parts_classification_filter |
|
29 | 30 |
all_languages all_units all_price_factors) ], |
30 | 31 |
'scalar' => [ qw(warehouse bin) ], |
31 | 32 |
); |
... | ... | |
75 | 76 |
|
76 | 77 |
check_has_valid_part_type($::form->{part}{part_type}); |
77 | 78 |
|
79 |
die 'parts_classification_type must be "sales" or "purchases"' |
|
80 |
unless $::form->{parts_classification_type} =~ m/^(sales|purchases)$/; |
|
81 |
|
|
78 | 82 |
$self->parse_form; |
79 | 83 |
$self->add; |
80 | 84 |
} |
... | ... | |
968 | 972 |
); |
969 | 973 |
} |
970 | 974 |
|
975 |
sub init_parts_classification_filter { |
|
976 |
return [] unless $::form->{parts_classification_type}; |
|
977 |
|
|
978 |
return [ used_for_sale => 't' ] if $::form->{parts_classification_type} eq 'sales'; |
|
979 |
return [ used_for_purchase => 't' ] if $::form->{parts_classification_type} eq 'purchases'; |
|
980 |
|
|
981 |
die "no query rules for parts_classification_type " . $::form->{parts_classification_type}; |
|
982 |
} |
|
983 |
|
|
971 | 984 |
# simple checks to run on $::form before saving |
972 | 985 |
|
973 | 986 |
sub form_check_part_description_exists { |
SL/Presenter/Part.pm | ||
---|---|---|
104 | 104 |
# |
105 | 105 |
sub select_classification { |
106 | 106 |
my ($self, $name, %attributes) = @_; |
107 |
|
|
107 | 108 |
$attributes{value_key} = 'id'; |
108 | 109 |
$attributes{title_key} = 'description'; |
109 |
my $collection = SL::DB::Manager::PartClassification->get_all_sorted(); |
|
110 |
|
|
111 |
my $classification_type_filter = delete $attributes{type} // []; |
|
112 |
|
|
113 |
my $collection = SL::DB::Manager::PartClassification->get_all_sorted( where => $classification_type_filter ); |
|
110 | 114 |
$_->description($::locale->text($_->description)) for @{ $collection }; |
111 | 115 |
return $self->select_tag( $name, $collection, %attributes ); |
112 | 116 |
} |
bin/mozilla/io.pl | ||
---|---|---|
704 | 704 |
my $callback = build_std_url("action=return_from_new_item", "previousform=$previousform"); |
705 | 705 |
my $i = $::form->{rowcount}; |
706 | 706 |
|
707 |
my $parts_classification_type = $::form->{vc} eq 'customer' ? 'sales' : 'purchases'; |
|
708 |
|
|
707 | 709 |
my @HIDDENS; |
708 | 710 |
push @HIDDENS, { 'name' => 'callback', 'value' => $callback }; |
709 | 711 |
push @HIDDENS, map +{ 'name' => $_, 'value' => $::form->{$_} }, qw(rowcount vc); |
... | ... | |
711 | 713 |
push @HIDDENS, { 'name' => "part.$price", 'value' => $::form->{"sellprice_$i"} }; |
712 | 714 |
push @HIDDENS, { 'name' => "part.notes", 'value' => $::form->{"longdescription_$i"} }; |
713 | 715 |
|
716 |
push @HIDDENS, { 'name' => "parts_classification_type", 'value' => $parts_classification_type }; |
|
717 |
|
|
714 | 718 |
$::form->header; |
715 | 719 |
print $::form->parse_html_template("generic/new_item", { HIDDENS => [ sort { $a->{name} cmp $b->{name} } @HIDDENS ] } ); |
716 | 720 |
} |
templates/webpages/part/_basic_data.html | ||
---|---|---|
23 | 23 |
</tr> |
24 | 24 |
<tr> |
25 | 25 |
<th align="right">[% 'Part Classification' | $T8 %]</th> |
26 |
<td>[% P.select_classification('part.classification_id', default => SELF.part.classification_id) %]</td> |
|
26 |
<td>[% P.select_classification('part.classification_id', default => SELF.part.classification_id, type => SELF.parts_classification_filter ) %]</td>
|
|
27 | 27 |
</tr> |
28 | 28 |
<tr> |
29 | 29 |
<th align="right">[% 'Part Description' | $T8 %]</th> |
Auch abrufbar als: Unified diff
Artikel aus Belegen anlegen - Artikelklassifizierung berücksichtigen
Bei Verkaufsbelegen sollen im Dropdown nur Verkaufsklassifizierungen angezeigt werden,
bei Einkaufsbelegen nur Einkaufsklassifizierungen.