Revision 1c77d03f
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/OE.pm | ||
---|---|---|
68 | 68 |
|
69 | 69 |
my $query; |
70 | 70 |
my $ordnumber = 'ordnumber'; |
71 |
my $quotation = '0'; |
|
72 |
my $intake = '0'; |
|
71 |
my $record_type = $form->{type}; |
|
73 | 72 |
|
74 | 73 |
my @values; |
75 | 74 |
my $where; |
... | ... | |
79 | 78 |
my $rate = ($form->{vc} eq 'customer') ? 'buy' : 'sell'; |
80 | 79 |
|
81 | 80 |
if ($form->{type} =~ /_quotation$/) { |
82 |
$quotation = '1'; |
|
83 | 81 |
$ordnumber = 'quonumber'; |
84 | 82 |
|
85 | 83 |
} elsif ($form->{type} eq 'purchase_quotation_intake') { |
86 |
$intake = '1'; |
|
87 |
$quotation = '1'; |
|
88 | 84 |
$ordnumber = 'quonumber'; |
89 |
|
|
90 |
} elsif ($form->{type} =~ /_order_intake$/) { |
|
91 |
$intake = '1'; |
|
92 |
|
|
93 | 85 |
} elsif ($form->{type} eq 'sales_order') { |
94 | 86 |
$periodic_invoices_columns = qq| , COALESCE(pcfg.active, 'f') AS periodic_invoices |; |
95 | 87 |
$periodic_invoices_joins = qq| LEFT JOIN periodic_invoices_configs pcfg ON (o.id = pcfg.oe_id) |; |
... | ... | |
172 | 164 |
)| . |
173 | 165 |
qq|$periodic_invoices_joins | . |
174 | 166 |
$phone_notes_join . |
175 |
qq|WHERE (o.quotation = ?) | . |
|
176 |
qq| AND (o.intake = ?) |; |
|
177 |
push(@values, $quotation); |
|
178 |
push(@values, $intake); |
|
167 |
qq|WHERE (o.record_type = ?) |; |
|
168 |
push(@values, $record_type); |
|
179 | 169 |
|
180 | 170 |
if ($form->{department_id}) { |
181 | 171 |
$query .= qq| AND o.department_id = ?|; |
... | ... | |
565 | 555 |
LEFT JOIN customer c ON (oe.customer_id = c.id) |
566 | 556 |
LEFT JOIN vendor v ON (oe.vendor_id = v.id) |
567 | 557 |
LEFT JOIN employee e ON (oe.employee_id = e.id) |
568 |
WHERE (COALESCE(quotation, FALSE) = TRUE)
|
|
558 |
WHERE ((oe.record_type = 'sales_quotation') OR (oe.record_type = 'request_quotation'))
|
|
569 | 559 |
AND (COALESCE(closed, FALSE) = FALSE) |
570 | 560 |
AND ((oe.employee_id = ?) OR (oe.salesman_id = ?)) |
571 | 561 |
AND NOT (oe.reqdate ISNULL) |
... | ... | |
1088 | 1078 |
|
1089 | 1079 |
SL::DB->client->with_transaction(sub { |
1090 | 1080 |
|
1091 |
my $query = qq|SELECT quotation FROM oe WHERE id = ?|;
|
|
1081 |
my $query = qq|SELECT record_type FROM oe WHERE id = ?|;
|
|
1092 | 1082 |
my $sth = prepare_query($form, $dbh, $query); |
1093 | 1083 |
|
1094 | 1084 |
do_statement($form, $sth, $query, conv_i($params{to_id})); |
1095 | 1085 |
|
1096 |
my ($quotation) = $sth->fetchrow_array();
|
|
1086 |
my ($record_type) = $sth->fetchrow_array();
|
|
1097 | 1087 |
|
1098 |
if ($quotation) {
|
|
1088 |
if ($record_type =~ /_quotation$/) {
|
|
1099 | 1089 |
return 1; |
1100 | 1090 |
} |
1101 | 1091 |
|
... | ... | |
1104 | 1094 |
foreach my $from_id (@{ $params{from_id} }) { |
1105 | 1095 |
$from_id = conv_i($from_id); |
1106 | 1096 |
do_statement($form, $sth, $query, $from_id); |
1107 |
($quotation) = $sth->fetchrow_array();
|
|
1108 |
push @close_ids, $from_id if ($quotation);
|
|
1097 |
($record_type) = $sth->fetchrow_array();
|
|
1098 |
push @close_ids, $from_id if ($record_type =~ /_quotation$/);
|
|
1109 | 1099 |
} |
1110 | 1100 |
|
1111 | 1101 |
$sth->finish(); |
Auch abrufbar als: Unified diff
Angebotsflag/Intakeflag aus Datenbankzugriffen entfernt