diff options
-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|, |