summaryrefslogtreecommitdiff
path: root/doc/todo/httpauth_example
ModeNameSize
-rw-r--r--discussion.mdwn322logplain
  • # This file contains source code included with or based on SQL-Ledger which
  • # is Copyright Dieter Simader and DWS Systems Inc. 2000-2005 and licensed
  • # under the GNU General Public License version 2 or, at your option, any later
  • # version. For a full list including contact information of contributors,
  • # maintainers, and copyright holders, see the CONTRIBUTORS file.
  • #
  • # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
  • # Copyright (C) 2001
  • #
  • # Author: DWS Systems Inc.
  • # Web: http://www.sql-ledger.org
  • #
  • # Contributors:
  • #
  • #======================================================================
  • #
  • # This file has undergone whitespace cleanup
  • #
  • #======================================================================
  • #
  • # Price Matrix module
  • #
  • #
  • #======================================================================
  • package PriceMatrix;
  • sub price_matrix_query {
  • my ($dbh, $form) = @_;
  • my $query;
  • my $sth;
  • my @queryargs;
  • if ($form->{customer_id}) {
  • my $defaultcurrency = $form->{dbh}->quote(
  • $form->{defaultcurrency});
  • my $customer_id = $form->{dbh}->quote($form->{customer_id});
  • $query = qq|
  • SELECT p.id AS parts_id, 0 AS customer_id,
  • 0 AS pricegroup_id, 0 AS pricebreak,
  • p.sellprice, NULL AS validfrom, NULL AS validto,
  • (SELECT substr(curr,1,3) FROM defaults) AS curr,
  • '' AS pricegroup
  • FROM parts p
  • WHERE p.id = ?
  • UNION
  • SELECT p.*, g.pricegroup
  • FROM partscustomer p
  • LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
  • WHERE p.parts_id = ?
  • AND p.customer_id = $customer_id
  • UNION
  • SELECT p.*, g.pricegroup
  • FROM partscustomer p
  • LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
  • JOIN customer c ON (c.pricegroup_id = g.id)
  • WHERE p.parts_id = ?
  • AND c.id = $customer_id
  • UNION
  • SELECT p.*, '' AS pricegroup
  • FROM partscustomer p
  • WHERE p.customer_id = 0
  • AND p.pricegroup_id = 0
  • AND p.parts_id = ?
  • ORDER BY customer_id DESC, pricegroup_id DESC,
  • pricebreak
  • |;
  • $sth = $dbh->prepare($query) || $form->dberror($query);
  • } elsif ($form->{vendor_id}) {
  • my $vendor_id = $form->{dbh}->quote($form->{vendor_id});
  • # price matrix and vendor's partnumber
  • $query = qq|
  • SELECT partnumber
  • FROM partsvendor