diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-09-25 00:45:13 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-09-25 00:45:13 +0000 |
commit | 1b8d009a5234eda0e46f8ceef5aeeb4939e53078 (patch) | |
tree | 1a7901e0b53a3b434eda4a87e63a063e34dc4fac | |
parent | 15db230d7da157a0378b2d52ed4c782158d53615 (diff) |
Revides the dbquote to use DBI::quote.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@145 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-x | LedgerSMB/Form.pm | 14 | ||||
-rwxr-xr-x | LedgerSMB/IS.pm | 2 |
2 files changed, 6 insertions, 10 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 9e2eeb3a..4813411a 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -1381,17 +1381,13 @@ sub dbconnect_noauto { sub dbquote { - my ($self, $var, $type) = @_; + my ($self, $var) = @_; - # DBI does not return NULL for SQL_DATE if the date is empty - if ($type eq 'SQL_DATE') { - $_ = ($var) ? "'$var'" : "NULL"; - } - - if ($type eq 'SQL_INT') { - $_ = $var * 1; + if ($var eq ''){ + $_ = "NULL"; + } else { + $_ = $self->{dbh}->quote($var); } - $_; } diff --git a/LedgerSMB/IS.pm b/LedgerSMB/IS.pm index 1e4714fa..c88d527e 100755 --- a/LedgerSMB/IS.pm +++ b/LedgerSMB/IS.pm @@ -998,7 +998,7 @@ sub post_invoice { my $till = ($form->{till}) ? qq|'$form->{till}'| : "NULL"; $form->{invnumber} = $form->update_defaults($myconfig, "sinumber", $dbh) unless $form->{invnumber}; - + # save AR record $query = qq|UPDATE ar set invnumber = |.$dbh->quote($form->{invnumber}).qq|, |