- # 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});
+ if (($form->{create_zugferd_invoices} // '') ne '') {
+ $where .= qq| AND (ct.create_zugferd_invoices = ?)|;
+ push @values, $form->{create_zugferd_invoices};
+ }
+
+ if ($form->{all_phonenumbers}) {
+ $where .= qq| AND (ct.phone ILIKE ? OR
+ ct.fax ILIKE ? OR
+ ct.id IN
+ (SELECT cp_cv_id FROM contacts
+ WHERE cp_phone1 ILIKE ? OR
+ cp_phone2 ILIKE ? OR
+ cp_fax ILIKE ? OR
+ cp_mobile1 ILIKE ? OR
+ cp_mobile2 ILIKE ? OR
+ cp_satphone ILIKE ? OR
+ cp_satfax ILIKE ? OR
+ cp_privatphone ILIKE ?
+ )
+ )|;
+ push @values, (like(trim($form->{all_phonenumbers})))x10;