1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: accounting.coretag,v 1.5 2007-03-30 23:40:49 pajamian Exp $
10 UserTag accounting Order function
11 UserTag accounting addAttr
12 UserTag accounting Version $Revision: 1.5 $
13 UserTag accounting Routine <<EOR
14 my %account_super = (qw/
17 my %account_admin = (qw/
22 my ($func, $opt) = @_;
25 die "Accounting not enabled!"
26 unless $Vend::Cfg->{Accounting};
29 if($account_super{$func}) {
31 $enable = $Vend::admin && $Tag->if_mm('super');
34 elsif($account_admin{$func}) {
35 $enable = $Vend::admin;
42 die errmsg("Function '%s' not enabled for current user level.", $func);
45 if(my $sys = $opt->{system}) {
46 my $former = $Vend::Cfg->{Accounting};
47 $Vend::Cfg->{Accounting} = $Vend::Cfg->{Accounting_repository}{$sys}
50 "Failed to change accounting system to %s, returning to %s.",
54 $Vend::Cfg->{Accounting} = $former;
59 my $a = $Vend::Cfg->{Accounting}
61 logError("No accounting system present. Aborting.");
65 my $class = $a->{Class};
66 my $self = new $class;
68 unless( $can = $self->can($func) ) {
70 "No function '%s' in accounting system %s. Aborting.",
77 return $can if $opt->{can_do_function};
79 return $self->$func($opt);