Revision df52f0a4
Von Bernd Bleßmann vor mehr als 4 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
906 | 906 |
|
907 | 907 |
$sth->finish(); |
908 | 908 |
|
909 |
$query = qq|SELECT |
|
910 |
cp.parts_id, |
|
911 |
cp.customer_partnumber AS customer_model, |
|
912 |
c.name AS customer_make |
|
913 |
FROM part_customer_prices cp |
|
914 |
LEFT JOIN customer c ON (cp.customer_id = c.id) |
|
915 |
WHERE cp.parts_id IN ($placeholders)|; |
|
916 |
|
|
917 |
my %customermodel = (); |
|
918 |
|
|
919 |
$sth = prepare_execute_query($form, $dbh, $query, @part_ids); |
|
920 |
|
|
921 |
while (my $ref = $sth->fetchrow_hashref()) { |
|
922 |
$customermodel{$ref->{parts_id}} ||= []; |
|
923 |
push @{ $customermodel{$ref->{parts_id}} }, $ref; |
|
924 |
} |
|
925 |
|
|
926 |
$sth->finish(); |
|
927 |
|
|
909 | 928 |
my @columns = qw(ean image microfiche drawing); |
910 | 929 |
|
911 | 930 |
$query = qq|SELECT id, | . join(', ', @columns) . qq| |
... | ... | |
915 | 934 |
my %data = selectall_as_map($form, $dbh, $query, 'id', \@columns, @part_ids); |
916 | 935 |
|
917 | 936 |
my %template_arrays; |
918 |
map { $template_arrays{$_} = [] } (qw(make model), @columns); |
|
937 |
map { $template_arrays{$_} = [] } (qw(make model customer_make customer_model), @columns);
|
|
919 | 938 |
|
920 | 939 |
foreach my $i (1 .. $rowcount) { |
921 | 940 |
my $id = $form->{"${prefix}${i}"}; |
... | ... | |
929 | 948 |
push @{ $template_arrays{make} }, []; |
930 | 949 |
push @{ $template_arrays{model} }, []; |
931 | 950 |
|
932 |
next if (!$makemodel{$id}); |
|
951 |
if ($makemodel{$id}) { |
|
952 |
foreach my $ref (@{ $makemodel{$id} }) { |
|
953 |
map { push @{ $template_arrays{$_}->[-1] }, $ref->{$_} } qw(make model); |
|
954 |
} |
|
955 |
} |
|
956 |
|
|
957 |
push @{ $template_arrays{customer_make} }, []; |
|
958 |
push @{ $template_arrays{customer_model} }, []; |
|
933 | 959 |
|
934 |
foreach my $ref (@{ $makemodel{$id} }) { |
|
935 |
map { push @{ $template_arrays{$_}->[-1] }, $ref->{$_} } qw(make model); |
|
960 |
if ($customermodel{$id}) { |
|
961 |
foreach my $ref (@{ $customermodel{$id} }) { |
|
962 |
push @{ $template_arrays{$_}->[-1] }, $ref->{$_} for qw(customer_make customer_model); |
|
963 |
} |
|
936 | 964 |
} |
965 |
|
|
937 | 966 |
} |
938 | 967 |
|
939 | 968 |
my $parts = SL::DB::Manager::Part->get_all(query => [ id => \@part_ids ]); |
Auch abrufbar als: Unified diff
Kundenartikelnummern in Vorlagen verwenden können
Einsortierung in das template array wie Lieferantenartikelnummern als
customer_make und customer_model.
Standard-Druckvorlagen Angebot/Auftrag/Lieferschein/Rechnung für Verkauf
exemplarisch angepasst.