diff options
author | aurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-20 20:06:53 +0000 |
---|---|---|
committer | aurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-09-20 20:06:53 +0000 |
commit | 5f24c101474901bf5607fcad189d287b43c5d799 (patch) | |
tree | 001cc0f7b8d04799ed8198bc455f56a623fe45a0 | |
parent | a26ee3caf4e289a749069444faa989b7bbe7bde8 (diff) |
Removal of extra new_user function from admin.pl.
Updates to DBObject.pm to remove treatment of argument list as a hashref.
Update to LedgerSMB.pm to add s bare sub DESTROY so as not to trigger weird behaviour from using AUTOLOAD.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1636 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-x | LedgerSMB.pm | 15 | ||||
-rw-r--r-- | LedgerSMB/DBObject.pm | 11 | ||||
-rw-r--r-- | lsmb-request.pl | 2 | ||||
-rw-r--r-- | scripts/admin.pl | 17 |
4 files changed, 26 insertions, 19 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 502b81e6..27abf20f 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -740,5 +740,20 @@ sub merge { } } +sub type { + + my $self = shift @_; + + if (!$ENV{REQUEST_METHOD} or + ( $ENV{REQUEST_METHOD} ne ("HEAD" or "GET" or "POST") ) ) { + + $self->error("Request method unset or set to unknown value"); + } + + return $ENV{REQUEST_METHOD}; +} + +sub DESTROY {} + 1; diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 097b85dc..42f15736 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -60,13 +60,13 @@ sub AUTOLOAD { sub new { my $class = shift @_; - my $args = shift @_; - my $base = $args->{base}; - my $mode = $args->{copy}; + my %args = @_; + my $base = $args{base}; + my $mode = $args{copy}; my $self = bless {}, $class; my @mergelist; - if (defined $args->{merge}){ - @mergelist = @{$args->{merge}}; + if ( defined $args{merge} ){ + @mergelist = @{ $args{merge} }; } elsif (defined $mode && ( $mode eq 'list')) { $self->error('Mergelist not set'); } @@ -289,6 +289,7 @@ sub set { $self->{$arg} = $args{$arg}; } return 1; + } 1; diff --git a/lsmb-request.pl b/lsmb-request.pl index 2edd45be..5c75d6f3 100644 --- a/lsmb-request.pl +++ b/lsmb-request.pl @@ -56,5 +56,5 @@ $script = "LedgerSMB::Scripts::$script"; $script->can($request->{action}) || $request->error($locale->text("Action Not Defined: ") . $request->{action}); -$script->can($request->{action})->($request); +$script->can( $request->{action} )->($request); 1; diff --git a/scripts/admin.pl b/scripts/admin.pl index 2d16d369..9947b501 100644 --- a/scripts/admin.pl +++ b/scripts/admin.pl @@ -9,12 +9,14 @@ use LedgerSMB::DBObject::Admin; sub new_user { # uses the same page as create_user, only pre-populated. - my ($class, $request) = @_; + #my ($class, $request) = @_; + my $class = shift @_; + my $request = shift @_; my $admin = LedgerSMB::DBObject::Admin->new(base=>$request, copy=>'all'); my $sal = $admin->get_salutations(); - if ($request->type() == 'POST') { + if ($request->type() eq 'POST') { # do the save stuff @@ -132,17 +134,6 @@ sub delete_user { $template->render($status); } -sub new_user { - - my ($class, $request) = @_; - - my $template = LedgerSMB::Template->new( user=>$user, - template=>'Admin/edit_user', language=>$user->{language}, - format=>'HTML', path=>'UI'); - - $template->render(); -} - sub new_group { my ($class, $request) = @_; |