[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1131] trunk
- Subject: SF.net SVN: ledger-smb: [1131] trunk
- From: ..hidden..
- Date: Sun, 06 May 2007 10:56:04 -0700
Revision: 1131
http://svn.sourceforge.net/ledger-smb/?rev=1131&view=rev
Author: einhverfr
Date: 2007-05-06 10:56:02 -0700 (Sun, 06 May 2007)
Log Message:
-----------
Fixing bug 1708011
Modified Paths:
--------------
trunk/LedgerSMB/OE.pm
trunk/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql
trunk/utils/fixme/fixme.pgsql
Modified: trunk/LedgerSMB/OE.pm
===================================================================
--- trunk/LedgerSMB/OE.pm 2007-05-06 17:54:44 UTC (rev 1130)
+++ trunk/LedgerSMB/OE.pm 2007-05-06 17:56:02 UTC (rev 1131)
@@ -171,8 +171,9 @@
}
if ( $form->{$ordnumber} ne "" ) {
- $query .= " AND lower(?) LIKE ?";
- push @queryargs, $ordnumber, $number;
+ $ordnumber = ($ordnumber eq 'ordnumber') ? 'ordnumber' : 'quonumber';
+ $query .= " AND lower($ordnumber) LIKE ?";
+ push @queryargs, $number;
$form->{open} = 1;
$form->{closed} = 1;
}
Modified: trunk/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql
===================================================================
--- trunk/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql 2007-05-06 17:54:44 UTC (rev 1130)
+++ trunk/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql 2007-05-06 17:56:02 UTC (rev 1131)
@@ -58,8 +58,12 @@
ALTER TABLE status ADD PRIMARY KEY (trans_id);
-ALTER TABLE tax ADD PRIMARY KEY (chart_id);
-ALTER TABLE tax ADD FOREIGN KEY (chart_id) REFERENCES chart (id);
+-- Removing the primary key below since this is not quite the best way
+-- do this. The tax table could have multiple rows per chart_id.
+-- We need a better fix for 1.3 (perhaps changing date to timestamp and
+-- and defaulting to infinity.
+-- ALTER TABLE tax ADD PRIMARY KEY (chart_id);
+-- ALTER TABLE tax ADD FOREIGN KEY (chart_id) REFERENCES chart (id);
ALTER TABLE translation ADD PRIMARY KEY (trans_id, language_code);
Modified: trunk/utils/fixme/fixme.pgsql
===================================================================
--- trunk/utils/fixme/fixme.pgsql 2007-05-06 17:54:44 UTC (rev 1130)
+++ trunk/utils/fixme/fixme.pgsql 2007-05-06 17:56:02 UTC (rev 1131)
@@ -25,11 +25,11 @@
CREATE TEMPORARY VIEW id_view1 AS
SELECT id, count(*) AS num_rows FROM id_agregator
-GROUP BY id HAVING num_rows > 1;
+GROUP BY id HAVING count(*) > 1;
-select setval('id', select max(id) + 1 from id_agregator);
+select setval('id', (select max(id) + 1 from id_agregator));
-create function fix_dupes() RETURNS OPAQUE AS
+create function fix_dupes() RETURNS opaque AS
'
DECLARE
dupe_id id_agregator%ROWTYPE;
@@ -38,20 +38,23 @@
WHERE id IN (SELECT id FROM id_view1)
LOOP
EXECUTE ''UPDATE '' || dupe_id.table_name ||
- SET id = nextval(''''id'''') WHERE
+ '' SET id = nextval(''''id'''') WHERE
id = '' ||dupe_id.id;
UPDATE acc_trans SET trans_id = currval(''id'') WHERE
- id = '' ||dupe_id.id;
+ id = ||dupe_id.id;
INSERT INTO acc_trans (trans_id, amount, chart_id) VALUES (
- currval(''id''), '1', (
+ currval(''id''), ''1'', (
SELECT id FROM chart WHERE accno = ''1000000000''
)
);
INSERT INTO acc_trans (trans_id, amount, chart_id) VALUES (
- currval(''id''), '-1', (
+ currval(''id''), ''-1'', (
SELECT id FROM chart WHERE accno = ''1000000000''
)
);
+
+END LOOP;
+RETURN NULL;
END;
' LANGUAGE PLPGSQL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.