Form: round_amount precision support
[kivitendo-erp.git] / SL / SEPA.pm
index f2599a8..9457917 100644 (file)
@@ -326,6 +326,17 @@ sub list_exports {
     $joins_sub{$arap} = 1;
   }
 
+  if ($filter->{message_id}) {
+    push @values, '%' . $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 ?";
     push @values_sub, '%' . $filter->{vc} . '%';
@@ -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 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 (