Kundenbericht: Suche nach Hauptansprechperson repariert, …
[kivitendo-erp.git] / SL / CT.pm
index d8635b7..092da52 100644 (file)
--- a/SL/CT.pm
+++ b/SL/CT.pm
@@ -244,13 +244,6 @@ sub search {
     push @values, $form->{create_zugferd_invoices};
   }
 
-  # Nur Kunden finden, bei denen ich selber der Verkäufer bin
-  # Gilt nicht für Lieferanten
-  if ($cv eq 'customer' &&   !$main::auth->assert('customer_vendor_all_edit', 1)) {
-    $where .= qq| AND ct.salesman_id = (select em.id from employee em where em.login = ?)|;
-    push(@values, $::myconfig{login});
-  }
-
   my ($cvar_where, @cvar_values) = CVar->build_filter_query('module'         => 'CT',
                                                             'trans_id_field' => 'ct.id',
                                                             'filter'         => $form);
@@ -296,6 +289,7 @@ sub search {
         qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
         qq|  pt.description as payment | .
         $pg_select .
+        $main_cp_select .
         qq|, a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | .
         qq|  '$module' AS module, 'invoice' AS formtype, | .
         qq|  (a.amount = a.paid) AS closed | .
@@ -315,6 +309,7 @@ sub search {
         qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
         qq|  pt.description as payment | .
         $pg_select .
+        $main_cp_select .
         qq|, ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
         qq|  'oe' AS module, 'order' AS formtype, o.closed | .
         qq|FROM $cv ct | .
@@ -333,6 +328,7 @@ sub search {
         qq|SELECT ct.*, ct.itime::DATE AS insertdate, b.description AS business, e.name as salesman, | .
         qq|  pt.description as payment | .
         $pg_select .
+        $main_cp_select .
         qq|, ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | .
         qq|  'oe' AS module, 'quotation' AS formtype, o.closed | .
         qq|FROM $cv ct | .