From bcad4c564e42b4f5857772da8ff748855f5283ee Mon Sep 17 00:00:00 2001 From: einhverfr Date: Wed, 27 Jun 2007 15:57:40 +0000 Subject: * Fixed user@company logins * Fixed closed books detection * Fixed AR/AP print and post endless loop git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1336 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Form.pm | 46 +++++++++++++++++----------------------------- LedgerSMB/Mailer.pm | 5 +++++ LedgerSMB/Session/DB.pm | 6 +++--- 3 files changed, 25 insertions(+), 32 deletions(-) (limited to 'LedgerSMB') diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 5d539185..b7a33278 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -76,14 +76,14 @@ sub new { $self->{nextsub} =~ s/( |-|,|\#|\/|\.$)/_/g; } - $self->{login} =~ s/[^a-zA-Z0-9._+@'-]//g; + $self->{login} =~ s/[^a-zA-Z0-9._+\@'-]//g; $self->{menubar} = 1 if $self->{path} =~ /lynx/i; #menubar will be deprecated, replaced with below $self->{lynx} = 1 if $self->{path} =~ /lynx/i; - $self->{version} = "1.2.6"; + $self->{version} = "1.2.7"; $self->{dbversion} = "1.2.0"; bless $self, $type; @@ -2340,32 +2340,26 @@ sub create_links { $sth->finish; - for (qw(curr closedto revtrans)) { - $query = qq| - SELECT value FROM defaults - WHERE setting_key = '$_'|; - - $sth = $dbh->prepare($query); - $sth->execute || $self->dberror($query); - - ($val) = $sth->fetchrow_array(); - if ( $_ eq 'curr' ) { - $self->{currencies} = $val; - } - else { - $self->{$_} = $val; - } - $sth->finish; - } } else { - for (qw(curr closedto revtrans)) { - $query = qq| + if ( !$self->{"$self->{vc}_id"} ) { + $self->lastname_used( $myconfig, $dbh, $vc, $module ); + } + } + for (qw(current_date curr closedto revtrans)) { + if ($_ eq 'current_date'){ + $query = "SELECT $_"; + } elsif ($_ eq 'closedto'){ + $query = qq| + SELECT value::date FROM defaults + WHERE setting_key = '$_'|; + } else { + $query = qq| SELECT value FROM defaults WHERE setting_key = '$_'|; - + } $sth = $dbh->prepare($query); $sth->execute || $self->dberror($query); @@ -2378,13 +2372,7 @@ sub create_links { } $sth->finish; } - - $self->{transdate} = $self->current_date; - if ( !$self->{"$self->{vc}_id"} ) { - $self->lastname_used( $myconfig, $dbh, $vc, $module ); - } - } - + $self->{transdate} = $self->{current_date} if (!$self->{id}); $self->all_vc( $myconfig, $vc, $module, $dbh, $self->{transdate}, $job ); $self->{dbh}->commit; } diff --git a/LedgerSMB/Mailer.pm b/LedgerSMB/Mailer.pm index eb1d4a9b..0e14c8f4 100755 --- a/LedgerSMB/Mailer.pm +++ b/LedgerSMB/Mailer.pm @@ -50,10 +50,13 @@ sub send { my ($self) = @_; my $domain = $self->{from}; + my $boundary = time; + $boundary = "LSMB-$boundary"; $domain =~ s/(.*?\@|>)//g; my $msgid = "$boundary\@$domain"; $self->{contenttype} = "text/plain" unless $self->{contenttype}; + my $msgid = "$boundary\@$domain"; my %h; for (qw(from to cc bcc)) { @@ -77,7 +80,9 @@ sub send { 'Subject' => $self->{subject}, 'Type' => 'TEXT', 'Data' => $self->{message}, + 'Message-ID' => $msg_id, ); + $msg->attr("Content-Type" => $self->{contenttype}); $msg->add( 'Disposition-Notification-To' => $self->{from} ) if $self->{notify}; $msg->replace( 'X-Mailer' => "LedgerSMB $self->{version}" ); diff --git a/LedgerSMB/Session/DB.pm b/LedgerSMB/Session/DB.pm index df9b36ff..600ebcae 100755 --- a/LedgerSMB/Session/DB.pm +++ b/LedgerSMB/Session/DB.pm @@ -170,7 +170,7 @@ sub session_create { # this is assuming that $form->{login} is safe, which might be a bad assumption # so, I'm going to remove some chars, which might make previously valid logins invalid my $login = $form->{login}; - $login =~ s/[^a-zA-Z0-9._+@'-]//g; + $login =~ s/[^a-zA-Z0-9._+\@'-]//g; #delete any existing stale sessions with this login if they exist if ( !$myconfig{timeout} ) { @@ -211,7 +211,7 @@ sub session_destroy { my ($form) = @_; my $login = $form->{login}; - $login =~ s/[^a-zA-Z0-9._+@'-]//g; + $login =~ s/[^a-zA-Z0-9._+\@'-]//g; # use the central database handle my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; @@ -236,7 +236,7 @@ sub password_check { my ( $form, $username, $password ) = @_; - $username =~ s/[^a-zA-Z0-9._+@'-]//g; + $username =~ s/[^a-zA-Z0-9._+\@'-]//g; # use the central database handle my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; -- cgit v1.2.3