$1;
}
-=item config KEY
+=item config KEY [ AGENTNUM ]
Returns the configuration value or values (depending on context) for key.
+The optional agent number selects an agent specific value instead of the
+global default if one is present.
=cut
}
sub _config {
- my($self,$name,$agent)=@_;
+ my($self,$name,$agentnum)=@_;
my $hashref = { 'name' => $name };
- if (defined($agent) && $agent) {
- $hashref->{agent} = $agent;
- }
+ $hashref->{agentnum} = $agentnum;
local $FS::Record::conf = undef; # XXX evil hack prevents recursion
my $cv = FS::Record::qsearchs('conf', $hashref);
- if (!$cv && exists($hashref->{agent})) {
- delete($hashref->{agent});
+ if (!$cv && defined($agentnum)) {
+ $hashref->{agentnum} = '';
$cv = FS::Record::qsearchs('conf', $hashref);
}
return $cv;
my $self = shift;
return $self->_usecompat('config', @_) if use_confcompat;
- my($name,$agent)=@_;
- my $cv = $self->_config($name, $agent) or return;
+ my($name,$agentnum)=@_;
+ my $cv = $self->_config($name, $agentnum) or return;
if ( wantarray ) {
my $v = $cv->value;
}
}
-=item config_binary KEY
+=item config_binary KEY [ AGENTNUM ]
Returns the exact scalar value for key.
my $self = shift;
return $self->_usecompat('config_binary', @_) if use_confcompat;
- my($name,$agent)=@_;
- my $cv = $self->_config($name, $agent) or return;
+ my($name,$agentnum)=@_;
+ my $cv = $self->_config($name, $agentnum) or return;
decode_base64($cv->value);
}
-=item exists KEY
+=item exists KEY [ AGENTNUM ]
Returns true if the specified key exists, even if the corresponding value
is undefined.
my $self = shift;
return $self->_usecompat('exists', @_) if use_confcompat;
- my($name,$agent)=@_;
- defined($self->_config($name, $agent));
+ my($name,$agentnum)=@_;
+ defined($self->_config($name, $agentnum));
}
-=item config_orbase KEY SUFFIX
-
-Returns the configuration value or values (depending on context) for
-KEY_SUFFIX, if it exists, otherwise for KEY
-
-=cut
+#=item config_orbase KEY SUFFIX
+#
+#Returns the configuration value or values (depending on context) for
+#KEY_SUFFIX, if it exists, otherwise for KEY
+#
+#=cut
+# outmoded as soon as we shift to agentnum based config values
+# well, mostly. still useful for e.g. late notices, etc. in that we want
+# these to fall back to standard values
sub config_orbase {
my $self = shift;
return $self->_usecompat('config_orbase', @_) if use_confcompat;
}
}
-=item touch KEY
+=item invoice_templatenames
+
+Returns all possible invoice template names.
+
+=cut
+
+sub invoice_templatenames {
+ my( $self ) = @_;
+
+ my %templatenames = ();
+ foreach my $item ( $self->config_items ) {
+ foreach my $base ( @base_items ) {
+ my( $main, $ext) = split(/\./, $base);
+ $ext = ".$ext" if $ext;
+ if ( $item->key =~ /^${main}_(.+)$ext$/ ) {
+ $templatenames{$1}++;
+ }
+ }
+ }
+
+ sort keys %templatenames;
+
+}
+
+=item touch KEY [ AGENT ];
Creates the specified configuration key if it does not exist.
my $self = shift;
return $self->_usecompat('touch', @_) if use_confcompat;
- my($name, $agent) = @_;
- unless ( $self->exists($name, $agent) ) {
- $self->set($name, '', $agent);
+ my($name, $agentnum) = @_;
+ unless ( $self->exists($name, $agentnum) ) {
+ $self->set($name, '', $agentnum);
}
}
-=item set KEY VALUE
+=item set KEY VALUE [ AGENTNUM ];
Sets the specified configuration key to the given value.
my $self = shift;
return $self->_usecompat('set', @_) if use_confcompat;
- my($name, $value, $agent) = @_;
+ my($name, $value, $agentnum) = @_;
$value =~ /^(.*)$/s;
$value = $1;
warn "[FS::Conf] SET $name\n" if $DEBUG;
- my $old = FS::Record::qsearchs('conf', {name => $name, agent => $agent});
+ my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
my $new = new FS::conf { $old ? $old->hash
- : ('name' => $name, 'agent' => $agent)
+ : ('name' => $name, 'agentnum' => $agentnum)
};
$new->value($value);
}
-=item set_binary KEY VALUE
+=item set_binary KEY VALUE [ AGENTNUM ]
Sets the specified configuration key to an exact scalar value which
can be retrieved with config_binary.
my $self = shift;
return if use_confcompat;
- my($name, $value, $agent)=@_;
- $self->set($name, encode_base64($value), $agent);
+ my($name, $value, $agentnum)=@_;
+ $self->set($name, encode_base64($value), $agentnum);
}
-=item delete KEY
+=item delete KEY [ AGENTNUM ];
Deletes the specified configuration key.
my $self = shift;
return $self->_usecompat('delete', @_) if use_confcompat;
- my($name, $agent) = @_;
- if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agent => $agent}) ) {
- warn "[FS::Conf] DELETE $file\n";
+ my($name, $agentnum) = @_;
+ if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
+ warn "[FS::Conf] DELETE $name\n";
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
"Solo",
);
+@base_items = qw (
+ invoice_template
+ invoice_latex
+ invoice_latexreturnaddress
+ invoice_latexfooter
+ invoice_latexsmallfooter
+ invoice_latexnotes
+ invoice_html
+ invoice_htmlreturnaddress
+ invoice_htmlfooter
+ invoice_htmlnotes
+ logo.png
+ logo.eps
+ );
+
@base_items = qw (
invoice_template
invoice_latex
{
'key' => 'emailcancel',
'section' => 'billing',
- 'description' => 'Enable emailing of cancellation notices.',
+ 'description' => 'Enable emailing of cancellation notices. Make sure to fill in the cancelmessage and cancelsubject configuration values as well.',
'type' => 'checkbox',
},
'section' => '',
'description' => 'Template file for welcome email. Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created. See the <a href="http://search.cpan.org/~mjd/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language. The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code></ul>',
'type' => 'textarea',
+ 'per_agent' => 1,
},
{
'section' => '',
'description' => 'From: address header for welcome email',
'type' => 'text',
+ 'per_agent' => 1,
},
{
'section' => '',
'description' => 'Subject: header for welcome email',
'type' => 'text',
+ 'per_agent' => 1,
},
{
'description' => 'MIME type for welcome email',
'type' => 'select',
'select_enum' => [ 'text/plain', 'text/html' ],
+ 'per_agent' => 1,
},
{
'select_enum' => \@card_types,
},
+ {
+ 'key' => 'disable-fuzzy',
+ 'section' => 'UI',
+ 'description' => 'Disable fuzzy searching. Speeds up searching for large sites, but only shows exact matches.',
+ 'type' => 'checkbox',
+ },
+
+ { 'key' => 'pkg_referral',
+ 'section' => '',
+ 'description' => 'Enable package-specific advertising sources.',
+ 'type' => 'checkbox',
+ },
+
+ { 'key' => 'pkg_referral-multiple',
+ 'section' => '',
+ 'description' => 'In addition, allow multiple advertising sources to be associated with a single package.',
+ 'type' => 'checkbox',
+ },
+
{
'key' => 'dashboard-toplist',
'section' => 'UI',