diff options
-rwxr-xr-x | LedgerSMB/AM.pm | 6 | ||||
-rw-r--r-- | LedgerSMB/CreditCard.pm | 13 | ||||
-rwxr-xr-x | LedgerSMB/Form.pm | 2 | ||||
-rwxr-xr-x | LedgerSMB/HR.pm | 2 | ||||
-rwxr-xr-x | LedgerSMB/Session/DB.pm | 18 | ||||
-rw-r--r-- | sql/upgrade/1.2-1.3.sql | 2 |
6 files changed, 23 insertions, 20 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm index ac5da385..66795305 100755 --- a/LedgerSMB/AM.pm +++ b/LedgerSMB/AM.pm @@ -1316,7 +1316,7 @@ sub save_preferences { my @queryargs; my $query = qq| SELECT login - FROM employee + FROM employees WHERE login = ?|; @queryargs = ($form->{login}); my $sth = $dbh->prepare($query); @@ -1328,7 +1328,7 @@ sub save_preferences { # update name $query = qq| - UPDATE employee + UPDATE employees SET name = ? WHERE login = ?|; @@ -1770,7 +1770,7 @@ sub post_yearend { $query = qq| INSERT INTO gl (reference, employee_id) - VALUES (?, (SELECT id FROM employee + VALUES (?, (SELECT id FROM employees WHERE login = ?))|; $dbh->prepare($query)->execute($uid, $form->{login}) diff --git a/LedgerSMB/CreditCard.pm b/LedgerSMB/CreditCard.pm index d924ce53..8e2a4e1a 100644 --- a/LedgerSMB/CreditCard.pm +++ b/LedgerSMB/CreditCard.pm @@ -15,12 +15,13 @@ # POS Credit card processing-- could be extended for ecommerce package CreditCard; -use LedgerSMB::CreditCard::Config; -BEGIN { - $gateway_module = ${Config::gateway_module}; - require "LedgerSMB/CreditCard/$gateway_module.pm"; - import $gateway_module qw(sale credit); -} +use LedgerSMB; +use LedgerSMB::DBObject; + +our @ISA qw(LedgerSMB::DBObject); +# use LedgerSMB::CreditCard::Config; # moving elsewhere + +## TODO: Add code for credit card number validation and the like 1; diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index b8fc4540..f0b7a3cb 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -1864,7 +1864,7 @@ sub all_employees { my @whereargs = (); # setup employees/sales contacts my $query = qq|SELECT id, name - FROM employee + FROM employees WHERE 1 = 1|; if ($transdate) { diff --git a/LedgerSMB/HR.pm b/LedgerSMB/HR.pm index 6b6b6eff..33e9b18a 100755 --- a/LedgerSMB/HR.pm +++ b/LedgerSMB/HR.pm @@ -80,7 +80,7 @@ sub get_employee { # get managers $query = qq| SELECT id, name - FROM employee + FROM employees WHERE sales = '1' AND role = 'manager' $notid diff --git a/LedgerSMB/Session/DB.pm b/LedgerSMB/Session/DB.pm index ecd87814..eb550c62 100755 --- a/LedgerSMB/Session/DB.pm +++ b/LedgerSMB/Session/DB.pm @@ -133,11 +133,11 @@ sub session_create { my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; # TODO Change this to use %myconfig - my $deleteExisting = $dbh->prepare("DELETE FROM session - USING users - WHERE users.username = ? - AND users.id = session.users_id - AND age(last_used) > ?::interval"); + my $deleteExisting = $dbh->prepare( + "DELETE + FROM session + WHERE session.users_id = (select id from users where username = ?) + AND age(last_used) > ?::interval"); my $seedRandom = $dbh->prepare("SELECT setseed(?);"); @@ -195,10 +195,10 @@ sub session_destroy { # use the central database handle my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; - my $deleteExisting = $dbh->prepare("DELETE FROM session - USING users - WHERE users.username = ? - AND users.id = session.users_id;"); + my $deleteExisting = $dbh->prepare(" + DELETE FROM session + WHERE users_id = (select id from users where username = ?) + "); $deleteExisting->execute($login) || $form->dberror(__FILE__.':'.__LINE__.': Delete from session: '); diff --git a/sql/upgrade/1.2-1.3.sql b/sql/upgrade/1.2-1.3.sql index 0a336ce4..d12ca25a 100644 --- a/sql/upgrade/1.2-1.3.sql +++ b/sql/upgrade/1.2-1.3.sql @@ -23,4 +23,6 @@ ALTER TABLE employees ALTER COLUMN id SET DEFAULT nextval('employee_id_seq'); DROP RULE employee_id_track_i ON employees; -- no longer needed +CREATE TABLE account_links AS + COMMIT; |