[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1263] trunk
- Subject: SF.net SVN: ledger-smb: [1263] trunk
- From: ..hidden..
- Date: Sun, 10 Jun 2007 21:54:33 -0700
Revision: 1263
http://svn.sourceforge.net/ledger-smb/?rev=1263&view=rev
Author: einhverfr
Date: 2007-06-10 21:54:33 -0700 (Sun, 10 Jun 2007)
Log Message:
-----------
Fixing error searching by address
Modified Paths:
--------------
trunk/LedgerSMB/AA.pm
trunk/LedgerSMB/AM.pm
trunk/LedgerSMB/BP.pm
trunk/LedgerSMB/CP.pm
trunk/LedgerSMB/CT.pm
trunk/LedgerSMB/GL.pm
trunk/LedgerSMB/IC.pm
trunk/LedgerSMB/IS.pm
trunk/LedgerSMB/OE.pm
trunk/LedgerSMB/PriceMatrix.pm
trunk/LedgerSMB/RC.pm
trunk/doc/faq.html
Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/AA.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -766,7 +766,7 @@
my $where = "1 = 1";
if ( $form->{"$form->{vc}_id"} ) {
- $where .= qq| AND a.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
+ $where .= qq| AND a.entity_id = $form->{entity_id}|;
}
else {
if ( $form->{ $form->{vc} } ) {
Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/AM.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -969,7 +969,7 @@
AS expired
FROM recurring s
JOIN ar a ON (a.id = s.id)
- JOIN customer n ON (n.id = a.customer_id)
+ JOIN customer n USING (entity_id)
LEFT JOIN recurringemail se ON (se.id = s.id)
LEFT JOIN recurringprint sp ON (sp.id = s.id)
LEFT JOIN exchangerate ex
@@ -1024,7 +1024,7 @@
AS expired
FROM recurring s
JOIN oe a ON (a.id = s.id)
- JOIN customer n ON (n.id = a.customer_id)
+ JOIN customer USING (entity_id)
LEFT JOIN recurringemail se ON (se.id = s.id)
LEFT JOIN recurringprint sp ON (sp.id = s.id)
LEFT JOIN exchangerate ex ON
Modified: trunk/LedgerSMB/BP.pm
===================================================================
--- trunk/LedgerSMB/BP.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/BP.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -67,7 +67,7 @@
SELECT count(*)
FROM (SELECT DISTINCT vc.id
FROM $form->{vc} vc, $item a, status s
- WHERE a.$form->{vc}_id = vc.id
+ WHERE a.entity_id = vc.entity_id
AND s.trans_id = a.id
AND s.formname = ?
AND s.spoolfile IS NOT NULL) AS total|;
@@ -91,7 +91,7 @@
SELECT DISTINCT vc.id, vc.name
FROM $item a
JOIN $form->{vc} vc
- ON (a.$form->{vc}_id = vc.id)
+ USING (entity_id)
JOIN status s ON (s.trans_id = a.id)
WHERE s.formname = ?
AND s.spoolfile IS NOT NULL|;
@@ -207,11 +207,11 @@
WHERE s.trans_id = a.id
AND s.spoolfile IS NOT NULL
AND s.formname = ?
- AND a.$form->{vc}_id = vc.id|;
+ AND a.entity_id = vc.entity_id|;
push( @queryargs, $form->{type} );
if ( $form->{"$form->{vc}_id"} ) {
- $query .= qq| AND a.$form->{vc}_id = $form->{"$form->{vc}_id"}|;
+ $query .= qq| AND a.entity_id = $form->{"entity_id"}|;
}
else {
Modified: trunk/LedgerSMB/CP.pm
===================================================================
--- trunk/LedgerSMB/CP.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/CP.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -129,7 +129,7 @@
my $arap = ( $form->{vc} eq 'customer' ) ? 'ar' : 'ap';
my $query = qq|SELECT count(*)
FROM $form->{vc} ct, $arap a
- WHERE a.$form->{vc}_id = ct.id
+ WHERE a.entity_id = ct.entity_id
AND a.amount != a.paid|;
my ($count) = $dbh->selectrow_array($query);
@@ -138,7 +138,7 @@
my $ref;
my $i = 0;
- my $where = qq|WHERE a.$form->{vc}_id = ct.id
+ my $where = qq|WHERE a.entity_id = ct.entity_id
AND a.amount != a.paid|;
if ( $form->{ $form->{vc} } ) {
@@ -208,8 +208,8 @@
# connect to database
my $dbh = $form->{dbh};
- $vc_id = $dbh->quote( $form->{"$form->{vc}_id"} );
- my $where = qq|WHERE a.$form->{vc}_id = $vc_id
+ $vc_id = $dbh->quote( $form->{"entity_id"} );
+ my $where = qq|WHERE a.entity__id = $vc_id
AND a.amount != a.paid|;
$curr = $dbh->quote( $form->{currency} );
@@ -251,9 +251,9 @@
}
my $query = qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid,
- a.curr, c.name, a.$form->{vc}_id, c.language_code
+ a.curr, c.name, a.entity_id, c.language_code
FROM $form->{arap} a
- JOIN $form->{vc} c ON (c.id = a.$form->{vc}_id)
+ JOIN $form->{vc} c ON (c.entity_id = a.entity_id)
$where
ORDER BY $sortorder|;
Modified: trunk/LedgerSMB/CT.pm
===================================================================
--- trunk/LedgerSMB/CT.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/CT.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -608,7 +608,7 @@
if ( $form->{address} ne "" ) {
$var = $dbh->quote( $form->like( lc $form->{address} ) );
$where .=
-" AND (lower(ct.address1) LIKE $var OR lower(ct.address2) LIKE '$var')";
+" AND (lower(ct.address1) ILIKE $var)";
}
if ( $form->{startdatefrom} ) {
@@ -634,17 +634,12 @@
FROM oe o, $form->{db} vc
WHERE vc.id = o.$form->{db}_id)|;
- if ( $form->{db} eq 'customer' ) {
- $where .= qq| AND ct.id NOT IN (SELECT a.customer_id
+ if ( $form->{db} =~ /(^customer$|^vendor$)/ ) {
+ $where .= qq| AND ct.id NOT IN (SELECT a.entity_id
FROM ar a, customer vc
- WHERE vc.id = a.customer_id)|;
+ WHERE vc.entity_id = a.entity_id)|;
}
- if ( $form->{db} eq 'vendor' ) {
- $where .= qq| AND ct.id NOT IN (SELECT a.vendor_id
- FROM ap a, vendor vc
- WHERE vc.id = a.vendor_id)|;
- }
$form->{l_invnumber} = $form->{l_ordnumber} = $form->{l_quonumber} = "";
}
@@ -888,7 +883,7 @@
if ( $form->{address} ne "" ) {
$var = $dbh->quote( $form->like( lc $form->{address} ) );
- $where .= " AND lower(ct.address1) LIKE $var";
+ $where .= " AND lower(ct.address1) ILIKE $var";
}
for (qw(name contact email phone notes city state zipcode country)) {
Modified: trunk/LedgerSMB/GL.pm
===================================================================
--- trunk/LedgerSMB/GL.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/GL.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -416,7 +416,7 @@
FROM ar a
JOIN acc_trans ac ON (a.id = ac.trans_id)
JOIN chart c ON (ac.chart_id = c.id)
- JOIN customer ct ON (a.customer_id = ct.id)
+ JOIN customer ct USING (entity_id)
LEFT JOIN department d ON (d.id = a.department_id)
WHERE $arwhere
Modified: trunk/LedgerSMB/IC.pm
===================================================================
--- trunk/LedgerSMB/IC.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/IC.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -1239,11 +1239,11 @@
ON (p.id = i.parts_id)
JOIN ar a ON (a.id = i.trans_id)
JOIN customer ct
- ON (a.customer_id = ct.id)
+ USING (entity_id)
LEFT JOIN partsgroup pg
ON (p.partsgroup_id = pg.id)
LEFT JOIN employees e
- ON (a.employee_id = e.id)
+ ON (a.person_id = e.entity_id)
$makemodeljoin
WHERE $invwhere|;
$union = "
@@ -1305,14 +1305,14 @@
JOIN parts p ON (i.parts_id = p.id)
JOIN oe a ON (i.trans_id = a.id)
JOIN customer ct
- ON (a.customer_id = ct.id)
+ USING (entity_id)
LEFT JOIN partsgroup pg
ON (p.partsgroup_id = pg.id)
LEFT JOIN employees e
ON (a.employee_id = e.id)
$makemodeljoin
WHERE $ordwhere
- AND a.customer_id > 0|;
+ AND a.entity_id IS NOT NULL|;
$union = "
UNION ALL";
}
@@ -1411,14 +1411,14 @@
JOIN parts p ON (i.parts_id = p.id)
JOIN oe a ON (i.trans_id = a.id)
JOIN customer ct
- ON (a.customer_id = ct.id)
+ USING (entity_id)
LEFT JOIN partsgroup pg
ON (p.partsgroup_id = pg.id)
LEFT JOIN employees e
ON (a.employee_id = e.id)
$makemodeljoin
WHERE $quowhere
- AND a.customer_id > 0|;
+ AND a.entity_id IS NOT NULL|;
$union = "
UNION ALL";
}
Modified: trunk/LedgerSMB/IS.pm
===================================================================
--- trunk/LedgerSMB/IS.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/IS.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -1742,10 +1742,10 @@
a.intnotes,
a.duedate, a.taxincluded, a.curr AS currency,
a.employee_id, e.name AS employee, a.till,
- a.customer_id,
+ a.entity_id,
a.language_code, a.ponumber
FROM ar a
- LEFT JOIN employees e ON (e.id = a.employee_id)
+ LEFT JOIN employees e ON (e.entity_id = a.employee_id)
WHERE a.id = ?|;
$sth = $dbh->prepare($query);
Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/OE.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -248,7 +248,7 @@
my ( $self, $myconfig, $form ) = @_;
$form->db_prepare_vars(
- "quonumber", "transdate", "vendor_id", "customer_id",
+ "quonumber", "transdate", "vendor_id", "entity_id",
"reqdate", "taxincluded", "shippingpoint", "shipvia",
"currency", "department_id", "employee_id", "language_code",
"ponumber", "terms"
@@ -346,10 +346,10 @@
# $form->{id} is safe because it is only pulled *from* the db.
$query = qq|
INSERT INTO oe
- (id, ordnumber, quonumber, transdate, vendor_id,
- customer_id, reqdate, shippingpoint, shipvia,
+ (id, ordnumber, quonumber, transdate,
+ entity_id, reqdate, shippingpoint, shipvia,
notes, intnotes, curr, closed, department_id,
- employee_id, language_code, ponumber, terms,
+ person_id, language_code, ponumber, terms,
quotation)
VALUES
($form->{id}, ?, ?, ?, ?,
@@ -358,12 +358,11 @@
?, ?, ?, ?, ?)|;
@queryargs = (
$form->{ordnumber}, $form->{quonumber},
- $form->{transdate}, $form->{vendor_id},
- $form->{customer_id}, $form->{reqdate},
+ $form->{transdate}, $form->{entity_id}, $form->{reqdate},
$form->{shippingpoint}, $form->{shipvia},
$form->{notes}, $form->{intnotes},
$form->{currency}, $form->{closed},
- $form->{department_id}, $form->{employee_id},
+ $form->{department_id}, $form->{person_id},
$form->{language_code}, $form->{ponumber},
$form->{terms}, $quotation
);
@@ -508,7 +507,7 @@
}
# set values which could be empty
- for (qw(vendor_id customer_id taxincluded closed quotation)) {
+ for (qw(entity_id taxincluded closed quotation)) {
$form->{$_} *= 1;
}
@@ -553,8 +552,7 @@
ordnumber = ?,
quonumber = ?,
transdate = ?,
- vendor_id = ?,
- customer_id = ?,
+ entity_id = ?,
amount = ?,
netamount = ?,
reqdate = ?,
@@ -579,8 +577,7 @@
@queryargs = (
$form->{ordnumber}, $form->{quonumber},
- $form->{transdate}, $form->{vendor_id},
- $form->{customer_id}, $amount,
+ $form->{transdate}, $form->{entity_id}, $amount,
$netamount, $form->{reqdate},
$form->{taxincluded}, $form->{shippingpoint},
$form->{shipvia}, $form->{notes},
@@ -2416,8 +2413,7 @@
UPDATE oe SET
ordnumber = ?,
transdate = current_date,
- vendor_id = ?,
- customer_id = 0,
+ entity_id = ?
amount = ?,
netamount = ?,
taxincluded = ?,
@@ -2516,8 +2512,7 @@
# the orders
@orderitems = ();
- $form->{customer_id} = $form->{vendor_id} = 0;
- $form->{"$form->{vc}_id"} = $vc_id;
+ $form->{entity_id} = $vc_id;
$amount = 0;
$netamount = 0;
@@ -2570,8 +2565,8 @@
UPDATE oe SET
ordnumber = | . $dbh->quote($ordnumber) . qq|,
transdate = current_date,
- vendor_id = $form->{vendor_id},
- customer_id = $form->{customer_id},
+ entity_id = | .
+ $dbh->quote($form->{entity_id}).qq|,
amount = $amount,
netamount = $netamount,
reqdate = | . $form->dbquote( $ref->{reqdate}, SQL_DATE ) . qq|,
Modified: trunk/LedgerSMB/PriceMatrix.pm
===================================================================
--- trunk/LedgerSMB/PriceMatrix.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/PriceMatrix.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -41,12 +41,12 @@
my $sth;
my @queryargs;
+ my $entity_id = $form->{dbh}->quote( $form->{entity_id} );
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,
+ SELECT p.id AS parts_id, 0 AS entity_id,
0 AS pricegroup_id, 0 AS pricebreak,
p.sellprice, NULL AS validfrom, NULL AS validto,
(SELECT substr(value,1,3) FROM defaults WHERE
@@ -57,50 +57,49 @@
UNION
- SELECT p.parts_id, p.customer_id, p.pricegroup_id,
+ SELECT p.parts_id, p.entity_id, p.pricegroup_id,
p.pricebreak, p.sellprice, p.validfrom,
p.validto, p.curr, 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
+ AND p.entity_id = $entity_id
UNION
- SELECT p.parts_id, p.customer_id, p.pricegroup_id,
+ SELECT p.parts_id, p.entity_id, p.pricegroup_id,
p.pricebreak, p.sellprice, p.validfrom,
p.validto, p.curr, 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
+ AND c.id = $entity_id
UNION
- SELECT p.parts_id, p.customer_id, p.pricegroup_id,
+ SELECT p.parts_id, p.entity_id, p.pricegroup_id,
p.pricebreak, p.sellprice, p.validfrom,
p.validto, p.curr, g.pricegroup
FROM partscustomer p
LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id)
- WHERE p.customer_id = 0
+ WHERE p.entity_id = 0
AND p.pricegroup_id = 0
AND p.parts_id = ?
- ORDER BY customer_id DESC, pricegroup_id DESC,
+ ORDER BY entity_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
WHERE parts_id = ?
- AND vendor_id = $vendor_id|;
+ AND entity_id = $entity_id|;
$sth = $dbh->prepare($query) || $form->dberror($query);
}
Modified: trunk/LedgerSMB/RC.pm
===================================================================
--- trunk/LedgerSMB/RC.pm 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/LedgerSMB/RC.pm 2007-06-11 04:54:33 UTC (rev 1263)
@@ -300,7 +300,7 @@
FROM acc_trans ac
JOIN chart ch ON (ac.chart_id = ch.id)
JOIN ar a ON (a.id = ac.trans_id)
- JOIN customer n ON (n.id = a.customer_id)
+ JOIN customer n USING (entity_id)
WHERE ch.accno = | . $dbh->quote( $form->{accno} ) . qq|
$fx_transaction $cleared|;
$query .= " AND ac.transdate >= " . $dbh->quote( $form->{fromdate} )
@@ -335,7 +335,7 @@
$query = qq|
SELECT c.name
FROM customer c
- JOIN ar a ON (c.id = a.customer_id)
+ JOIN ar a using (entity_id)
JOIN acc_trans ac ON (a.id = ac.trans_id)
JOIN chart ch ON (ac.chart_id = ch.id)
WHERE ac.transdate = ?
@@ -368,7 +368,7 @@
$query = qq|
SELECT c.name
FROM customer c
- JOIN ar a ON (c.id = a.customer_id)
+ JOIN ar a USING (entity_id)
JOIN acc_trans ac ON (a.id = ac.trans_id)
JOIN chart ch ON (ac.chart_id = ch.id)
WHERE ac.transdate = ?
Modified: trunk/doc/faq.html
===================================================================
--- trunk/doc/faq.html 2007-06-11 04:40:57 UTC (rev 1262)
+++ trunk/doc/faq.html 2007-06-11 04:54:33 UTC (rev 1263)
@@ -295,15 +295,6 @@
superior environment to produce professional-looking forms in
postscript and PDF format.
-<p><li><h4>W3M</h4>
-pass terminal=mozilla when you start w3m
-<pre>
- $ w3m -F http://localhost/ledger-smb/login.pl?terminal=mozilla</pre>
-
-To use without frames
-<pre>
- $ w3m http://localhost/ledger-smb/login.pl?terminal=lynx</pre>
-
<p><li><h4>PDF option disappeared</h4>
Edit ledger-smb.conf and set:
latex = 1
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.