summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/Schema.pm14
-rw-r--r--FS/FS/invoice_conf.pm61
-rw-r--r--httemplate/edit/invoice_conf.html32
3 files changed, 22 insertions, 85 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 2300c07..1661f35 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -6330,21 +6330,9 @@ sub tables_hashref {
'latexnotes', 'text', 'NULL', '', '', '',
'latexfooter', 'text', 'NULL', '', '', '',
'latexsummary', 'text', 'NULL', '', '', '',
- 'latexcoupon', 'text', 'NULL', '', '', '',
'latexsmallfooter', 'text', 'NULL', '', '', '',
'latexreturnaddress', 'text', 'NULL', '', '', '',
- 'latextopmargin', 'varchar', 'NULL', 16, '', '',
- 'latexheadsep', 'varchar', 'NULL', 16, '', '',
- 'latexaddresssep', 'varchar', 'NULL', 16, '', '',
- 'latextextheight', 'varchar', 'NULL', 16, '', '',
- 'latexextracouponspace','varchar', 'NULL', 16, '', '',
- 'latexcouponfootsep', 'varchar', 'NULL', 16, '', '',
- 'latexcouponamountenclosedsep', 'varchar', 'NULL', 16, '', '',
- 'latexcoupontoaddresssep', 'varchar', 'NULL', 16, '', '',
- 'latexverticalreturnaddress', 'char', 'NULL', 1, '', '',
- 'latexcouponaddcompanytoaddress', 'char', 'NULL', 1, '', '',
- 'logo_png', 'blob', 'NULL', '', '', '',
- 'logo_eps', 'blob', 'NULL', '', '', '',
+ 'with_latexcoupon', 'char', 'NULL', '1', '', '',
'lpr', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'confnum',
diff --git a/FS/FS/invoice_conf.pm b/FS/FS/invoice_conf.pm
index 043cab0..da448b8 100644
--- a/FS/FS/invoice_conf.pm
+++ b/FS/FS/invoice_conf.pm
@@ -57,38 +57,9 @@ and supports the FS::Conf interface. The following fields are supported:
=item latexreturnaddress - return address (LaTeX)
-=item latexcoupon - payment coupon section (LaTeX)
-
=item latexsmallfooter - footer for pages after the first (LaTeX)
-=item latextopmargin - top margin
-
-=item latexheadsep - distance from bottom of header to top of body
-
-=item latexaddresssep - distance from top of body to customer address
-
-=item latextextheight - maximum height of invoice body text
-
-=item latexextracouponspace - additional footer space to allow for coupon
-
-=item latexcouponfootsep - distance from bottom of coupon content to top
-of page footer
-
-=item latexcouponamountenclosedsep - distance from coupon balance line to
-"Amount Enclosed" box
-
-=item latexcoupontoaddresssep - distance from "Amount Enclosed" box to
-coupon mailing address
-
-=item latexverticalreturnaddress - 'Y' to place the return address below
-the company logo rather than beside it
-
-=item latexcouponaddcompanytoaddress - 'Y' to add the company name to the
-address on the payment coupon
-
-=item logo_png - company logo, as a PNG, for HTML invoices
-
-=item logo_eps - company logo, as an EPS, for LaTeX invoices
+=item with_latexcoupon - 'Y' to print the payment coupon (LaTeX)
=item lpr - command to print the invoice (passed on stdin as a PDF)
@@ -109,6 +80,12 @@ L<"insert">.
sub table { 'invoice_conf'; }
+# fields (prefixed with 'with_') that turn on certain conf variables
+# (set them to their conf values, rather than to null)
+my %flags = (
+ latexcoupon => 1
+);
+
=item insert
Adds this record to the database. If there is an error, returns the error,
@@ -198,8 +175,10 @@ sub check {
my $error =
$self->ut_numbern('confnum')
+ # core properties
|| $self->ut_number('modenum')
|| $self->ut_textn('locale')
+ # direct overrides of conf variables
|| $self->ut_anything('notice_name')
|| $self->ut_anything('subject')
|| $self->ut_anything('htmlnotes')
@@ -209,21 +188,10 @@ sub check {
|| $self->ut_anything('latexnotes')
|| $self->ut_anything('latexfooter')
|| $self->ut_anything('latexsummary')
- || $self->ut_anything('latexcoupon')
|| $self->ut_anything('latexsmallfooter')
|| $self->ut_anything('latexreturnaddress')
- || $self->ut_textn('latextopmargin')
- || $self->ut_textn('latexheadsep')
- || $self->ut_textn('latexaddresssep')
- || $self->ut_textn('latextextheight')
- || $self->ut_textn('latexextracouponspace')
- || $self->ut_textn('latexcouponfootsep')
- || $self->ut_textn('latexcouponamountenclosedsep')
- || $self->ut_textn('latexcoupontoaddresssep')
- || $self->ut_flag('latexverticalreturnaddress')
- || $self->ut_flag('latexcouponaddcompanytoaddress')
- || $self->ut_anything('logo_png')
- || $self->ut_anything('logo_eps')
+ # flags
+ || $self->ut_flag('with_latexcoupon')
;
return $error if $error;
@@ -243,6 +211,13 @@ sub _config {
if ( $key =~ /^invoice_(.*)$/ ) {
$colname = $1;
}
+ if ( $flags{$colname} and !$self->get("with_$colname") ) {
+ # then a flag field is defined, and the flag is off, so act as though
+ # the config entry doesn't exist
+ # (currently only used for "latexcoupon", to allow invoice modes
+ # where the coupon is not printed)
+ return undef;
+ }
if ( length($self->get($colname)) ) {
return FS::conf->new({ 'name' => $key,
'value' => $self->get($colname) });
diff --git a/httemplate/edit/invoice_conf.html b/httemplate/edit/invoice_conf.html
index b7b3a4e..7122653 100644
--- a/httemplate/edit/invoice_conf.html
+++ b/httemplate/edit/invoice_conf.html
@@ -49,14 +49,8 @@ my @fields = (
'Footer',
'Summary header',
'Return address',
- 'Coupon',
'Small footer',
- 'Top margin',
- 'Header separation',
- 'Address separation',
- 'Text height',
- 'Coupon height',
- 'Footer separation',
+ 'Enable coupon',
),
{ type => 'columnnext' },
@@ -65,19 +59,8 @@ my @fields = (
{ field => 'latexfooter', %textarea },
{ field => 'latexsummary', %textarea },
{ field => 'latexreturnaddress', %textarea },
- { field => 'latexcoupon', %textarea },
{ field => 'latexsmallfooter', %textarea },
- { field => 'latextopmargin', size => 16 },
- { field => 'latexheadsep', size => 16 },
- { field => 'latexaddresssep', size => 16 },
- { field => 'latextextheight', size => 16 },
- { field => 'latexextracouponspace', size => 16 },
- { field => 'latexcouponfootsep', size => 16 },
- # are these still used?
- #{ field => 'latexcouponamountenclosedsep', size => 16 },
- #{ field => 'latexverticalreturnaddress', type => 'checkbox' },
- #{ field => 'latexcouponaddcompanytoaddress',type => 'checkbox' },
- # logo -- implement if someone really needs it...
+ { field => 'with_latexcoupon', type => 'checkbox', value => 'Y' },
{ type => 'columnnext' },
{ type => 'title', value => 'HTML' },
@@ -104,20 +87,12 @@ my %labels = (
latexfooter
latexsummary
latexreturnaddress
- latexcoupon
+ with_latexcoupon
latexsmallfooter
- latextopmargin
- latexheadsep
- latexaddresssep
- latextextheight
- latexextracouponspace
- latexcouponfootsep
htmlnotes
htmlfooter
htmlsummary
htmlreturnaddress
- logo_png
- logo_eps
) ),
);
@@ -211,7 +186,6 @@ sub edit_callback {
or die "invoice mode $modenum not found";
$object->set('modename', $invoice_mode->modename);
$object->set('agentnum', $invoice_mode->agentnum);
-
}
sub menubar_opt_callback {