[interchange-cvs] interchange - heins modified code/SystemTag/accounting.coretag
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Tue Jul 23 11:23:04 2002
User: heins
Date: 2002-07-23 15:22:52 GMT
Modified: code/SystemTag accounting.coretag
Log:
* Add changes that should have gone in with last SQL-Ledger update.
Revision Changes Path
1.2 +29 -1 interchange/code/SystemTag/accounting.coretag
rev 1.2, prev_rev 1.1
Index: accounting.coretag
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /anon_cvs/repository/interchange/code/SystemTag/accounting.coreta=
g,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- accounting.coretag 7 Jul 2002 03:58:43 -0000 1.1
+++ accounting.coretag 23 Jul 2002 15:22:52 -0000 1.2
@@ -1,12 +1,37 @@
UserTag accounting Order function
UserTag accounting addAttr
UserTag accounting Routine <<EOR
+my %account_super =3D (qw/
+ noparts_update 1
+/);
+my %account_admin =3D (qw/
+ inventory_update 1
+/);
+
sub {
my ($func, $opt) =3D @_;
=20
+ use vars qw/$Tag/;
die "Accounting not enabled!"
unless $Vend::Cfg->{Accounting};
=20
+ my $enable;
+ if($account_super{$func}) {
+ eval {
+ $enable =3D $Vend::admin && $Tag->if_mm('super');
+ };
+ }
+ elsif($account_admin{$func}) {
+ $enable =3D $Vend::admin;
+ }
+ else {
+ $enable =3D 1;
+ }
+
+ if(! $enable) {
+ die errmsg("Function '%s' not enabled for current user level.", $func);
+ }
+
if(my $sys =3D $opt->{system}) {
my $former =3D $Vend::Cfg->{Accounting};
$Vend::Cfg->{Accounting} =3D $Vend::Cfg->{Accounting_repository}{$sys}
@@ -29,7 +54,8 @@
=20=09
my $class =3D $a->{Class};
my $self =3D new $class;
- unless( $self->can($func) ) {
+ my $can;
+ unless( $can =3D $self->can($func) ) {
logError(
"No function '%s' in accounting system %s. Aborting.",
$func,
@@ -37,6 +63,8 @@
);
return undef;
}
+
+ return $can if $opt->{can_do_function};
=20
return $self->$func($opt);
}