format.
Each listref value can be a column name or a code reference. Coderefs are run
-with the row object and data as the two parameters. For example, this coderef
-does the same thing as using the "columnname" string:
+with the row object, data and a FS::Conf object as the three parameters.
+For example, this coderef does the same thing as using the "columnname" string:
sub {
- my( $record, $data ) = @_;
+ my( $record, $data, $conf ) = @_;
$record->columnname( $data );
},
+Coderefs are run after all "column name" fields are assigned.
+
=item format_types
Optional format hashref of types. Keys are field names, values are "csv",
while ( scalar(@later) ) {
my $sub = shift @later;
my $data = shift @later;
- &{$sub}($record, $data); # $record->&{$sub}($data);
+ &{$sub}($record, $data, $conf); # $record->&{$sub}($data, $conf);
}
my $error = $record->insert;
: '';
}
-=item ut_agentnum_acl
+=item ut_agentnum_acl COLUMN [ NULL_RIGHT | NULL_RIGHT_LISTREF ]
Checks this column as an agentnum, taking into account the current users's
-ACLs.
+ACLs. NULL_RIGHT or NULL_RIGHT_LISTREF, if specified, indicates the access
+right or rights allowing no agentnum.
=cut
sub ut_agentnum_acl {
- my( $self, $field, $null_acl ) = @_;
+ my( $self, $field ) = (shift, shift);
+ my $null_acl = scalar(@_) ? shift : [];
+ $null_acl = [ $null_acl ] unless ref($null_acl);
my $error = $self->ut_foreign_keyn($field, 'agent', 'agentnum');
return "Illegal agentnum: $error" if $error;
} else {
return "Access denied"
- unless $curuser->access_right($null_acl);
+ unless grep $curuser->access_right($_), @$null_acl;
}