projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kunde: Datenbanktabelle "klass" nach "pricegroup_id" migriert
[kivitendo-erp.git]
/
SL
/
SEPA.pm
diff --git
a/SL/SEPA.pm
b/SL/SEPA.pm
index
f2599a8
..
2809063
100644
(file)
--- a/
SL/SEPA.pm
+++ b/
SL/SEPA.pm
@@
-49,7
+49,7
@@
sub retrieve_open_invoices {
FROM ${arap}
LEFT JOIN ${vc} vc ON (${arap}.${vc}_id = vc.id)
FROM ${arap}
LEFT JOIN ${vc} vc ON (${arap}.${vc}_id = vc.id)
- LEFT JOIN (SELECT sei.${arap}_id, SUM(sei.amount) AS amount
+ LEFT JOIN (SELECT sei.${arap}_id, SUM(sei.amount)
+ SUM(COALESCE(sei.skonto_amount,0))
AS amount
FROM sepa_export_items sei
LEFT JOIN sepa_export se ON (sei.sepa_export_id = se.id)
WHERE NOT se.closed
FROM sepa_export_items sei
LEFT JOIN sepa_export se ON (sei.sepa_export_id = se.id)
WHERE NOT se.closed
@@
-322,13
+322,24
@@
sub list_exports {
if ($filter->{invnumber}) {
push @where_sub, "arap.invnumber ILIKE ?";
if ($filter->{invnumber}) {
push @where_sub, "arap.invnumber ILIKE ?";
- push @values_sub,
'%' . $filter->{invnumber} . '%'
;
+ push @values_sub,
like($filter->{invnumber})
;
$joins_sub{$arap} = 1;
}
$joins_sub{$arap} = 1;
}
+ if ($filter->{message_id}) {
+ push @values, like($filter->{message_id});
+ push @where, <<SQL;
+ se.id IN (
+ SELECT sepa_export_id
+ FROM sepa_export_message_ids
+ WHERE message_id ILIKE ?
+ )
+SQL
+ }
+
if ($filter->{vc}) {
push @where_sub, "vc.name ILIKE ?";
if ($filter->{vc}) {
push @where_sub, "vc.name ILIKE ?";
- push @values_sub,
'%' . $filter->{vc} . '%'
;
+ push @values_sub,
like($filter->{vc})
;
$joins_sub{$arap} = 1;
$joins_sub{vc} = 1;
}
$joins_sub{$arap} = 1;
$joins_sub{vc} = 1;
}
@@
-370,6
+381,9
@@
sub list_exports {
(SELECT SUM(sei.amount)
FROM sepa_export_items sei
WHERE (sei.sepa_export_id = se.id)) AS sum_amounts,
(SELECT SUM(sei.amount)
FROM sepa_export_items sei
WHERE (sei.sepa_export_id = se.id)) AS sum_amounts,
+ (SELECT string_agg(semi.message_id, ', ')
+ FROM sepa_export_message_ids semi
+ WHERE semi.sepa_export_id = se.id) AS message_ids,
e.name AS employee
FROM sepa_export se
LEFT JOIN (
e.name AS employee
FROM sepa_export se
LEFT JOIN (