Revision 0497b9cd
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
615 | 615 |
my @values; |
616 | 616 |
|
617 | 617 |
my %allowed_sort_columns = ( |
618 |
"id" => "id",
|
|
619 |
"customernumber" => "customernumber",
|
|
620 |
"vendornumber" => "vendornumber",
|
|
621 |
"name" => "ct.name", |
|
622 |
"contact" => "contact",
|
|
623 |
"phone" => "phone",
|
|
624 |
"fax" => "fax",
|
|
625 |
"email" => "email",
|
|
626 |
"street" => "street",
|
|
627 |
"taxnumber" => "taxnumber",
|
|
628 |
"business" => "business",
|
|
629 |
"invnumber" => "invnumber",
|
|
630 |
"ordnumber" => "ordnumber",
|
|
631 |
"quonumber" => "quonumber",
|
|
632 |
"zipcode" => "zipcode",
|
|
633 |
"city" => "city",
|
|
634 |
"country" => "country",
|
|
635 |
"salesman" => "e.name" |
|
618 |
"id" => "ct.id",
|
|
619 |
"customernumber" => "ct.customernumber",
|
|
620 |
"vendornumber" => "ct.vendornumber",
|
|
621 |
"name" => "ct.name",
|
|
622 |
"contact" => "ct.contact",
|
|
623 |
"phone" => "ct.phone",
|
|
624 |
"fax" => "ct.fax",
|
|
625 |
"email" => "ct.email",
|
|
626 |
"street" => "ct.street",
|
|
627 |
"taxnumber" => "ct.taxnumber",
|
|
628 |
"business" => "ct.business",
|
|
629 |
"invnumber" => "ct.invnumber",
|
|
630 |
"ordnumber" => "ct.ordnumber",
|
|
631 |
"quonumber" => "ct.quonumber",
|
|
632 |
"zipcode" => "ct.zipcode",
|
|
633 |
"city" => "ct.city",
|
|
634 |
"country" => "ct.country",
|
|
635 |
"salesman" => "e.name"
|
|
636 | 636 |
); |
637 | 637 |
|
638 | 638 |
$form->{sort} ||= "name"; |
... | ... | |
674 | 674 |
$where .= " AND ((lower(ct.city) LIKE lower(?)) |
675 | 675 |
OR |
676 | 676 |
(ct.id IN ( |
677 |
SELECT trans_id |
|
678 |
FROM shipto |
|
679 |
WHERE (module = 'CT') |
|
680 |
AND (lower(shiptocity) LIKE lower(?)) |
|
677 |
SELECT sc.trans_id
|
|
678 |
FROM shipto sc
|
|
679 |
WHERE (sc.module = 'CT')
|
|
680 |
AND (lower(sc.shiptocity) LIKE lower(?))
|
|
681 | 681 |
)) |
682 | 682 |
)"; |
683 | 683 |
push @values, ('%' . $form->{addr_city} . '%') x 2; |
... | ... | |
687 | 687 |
$where .= " AND ((lower(ct.country) LIKE lower(?)) |
688 | 688 |
OR |
689 | 689 |
(ct.id IN ( |
690 |
SELECT trans_id |
|
691 |
FROM shipto |
|
692 |
WHERE (module = 'CT') |
|
693 |
AND (lower(shiptocountry) LIKE lower(?)) |
|
690 |
SELECT so.trans_id
|
|
691 |
FROM shipto so
|
|
692 |
WHERE (so.module = 'CT')
|
|
693 |
AND (lower(so.shiptocountry) LIKE lower(?))
|
|
694 | 694 |
)) |
695 | 695 |
)"; |
696 | 696 |
push @values, ('%' . $form->{addr_country} . '%') x 2; |
... | ... | |
716 | 716 |
} |
717 | 717 |
|
718 | 718 |
if ($form->{obsolete} eq "Y") { |
719 |
$where .= qq| AND obsolete|; |
|
719 |
$where .= qq| AND ct.obsolete|;
|
|
720 | 720 |
} elsif ($form->{obsolete} eq "N") { |
721 |
$where .= qq| AND NOT obsolete|; |
|
721 |
$where .= qq| AND NOT ct.obsolete|;
|
|
722 | 722 |
} |
723 | 723 |
|
724 | 724 |
if ($form->{business_id}) { |
725 |
$where .= qq| AND (business_id = ?)|; |
|
725 |
$where .= qq| AND (ct.business_id = ?)|;
|
|
726 | 726 |
push(@values, conv_i($form->{business_id})); |
727 | 727 |
} |
728 | 728 |
|
729 | 729 |
# Nur Kunden finden, bei denen ich selber der Verkäufer bin |
730 | 730 |
# Gilt nicht für Lieferanten |
731 | 731 |
if ($cv eq 'customer' && !$main::auth->assert('customer_vendor_all_edit', 1)) { |
732 |
$where .= qq| AND ct.salesman_id = (select id from employee where login= ?)|;
|
|
732 |
$where .= qq| AND ct.salesman_id = (select em.id from employee em where em.login = ?)|;
|
|
733 | 733 |
push(@values, $form->{login}); |
734 | 734 |
} |
735 | 735 |
|
... | ... | |
743 | 743 |
} |
744 | 744 |
|
745 | 745 |
if ($form->{addr_street}) { |
746 |
$where .= qq| AND (street ILIKE ?)|; |
|
746 |
$where .= qq| AND (ct.street ILIKE ?)|;
|
|
747 | 747 |
push @values, '%' . $form->{addr_street} . '%'; |
748 | 748 |
} |
749 | 749 |
|
750 | 750 |
if ($form->{addr_zipcode}) { |
751 |
$where .= qq| AND (zipcode ILIKE ?)|; |
|
751 |
$where .= qq| AND (ct.zipcode ILIKE ?)|;
|
|
752 | 752 |
push @values, $form->{addr_zipcode} . '%'; |
753 | 753 |
} |
754 | 754 |
|
Auch abrufbar als: Unified diff
Kunden-/Lieferantensuche: Spaltennamen eindeutig bei Recht customer_vendor_all_edit nicht gesetzt