projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
aa97e36
)
per-agent lpr command, RT#18549
author
Ivan Kohler
<ivan@freeside.biz>
Wed, 30 Jan 2013 08:13:54 +0000
(
00:13
-0800)
committer
Ivan Kohler
<ivan@freeside.biz>
Wed, 30 Jan 2013 08:13:54 +0000
(
00:13
-0800)
FS/FS/Conf.pm
patch
|
blob
|
history
FS/FS/Misc.pm
patch
|
blob
|
history
FS/FS/cust_bill.pm
patch
|
blob
|
history
FS/FS/cust_main.pm
patch
|
blob
|
history
FS/FS/msg_template.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Conf.pm
b/FS/FS/Conf.pm
index
9a064b6
..
25d4727
100644
(file)
--- a/
FS/FS/Conf.pm
+++ b/
FS/FS/Conf.pm
@@
-1616,6
+1616,7
@@
and customer address. Include units.',
'section' => 'required',
'description' => 'Print command for paper invoices, for example `lpr -h\'',
'type' => 'text',
'section' => 'required',
'description' => 'Print command for paper invoices, for example `lpr -h\'',
'type' => 'text',
+ 'per_agent' => 1,
},
{
},
{
diff --git
a/FS/FS/Misc.pm
b/FS/FS/Misc.pm
index
096ec8a
..
5e89abc
100644
(file)
--- a/
FS/FS/Misc.pm
+++ b/
FS/FS/Misc.pm
@@
-800,16
+800,32
@@
sub _pslatex {
}
}
-=item do_print ARRAYREF
+=item do_print ARRAYREF
[, OPTION => VALUE ... ]
Sends the lines in ARRAYREF to the printer.
Sends the lines in ARRAYREF to the printer.
+Options available are:
+
+=over 4
+
+=item agentnum
+
+Uses this agent's 'lpr' configuration setting override instead of the global
+value.
+
+=item lpr
+
+Uses this command instead of the configured lpr command (overrides both the
+global value and agentnum).
+
=cut
sub do_print {
=cut
sub do_print {
- my
$data = shift
;
+ my
( $data, %opt ) = @_
;
- my $lpr = $conf->config('lpr');
+ my $lpr = ( exists($opt{'lpr'}) && $opt{'lpr'} )
+ ? $opt{'lpr'}
+ : $conf->config('lpr', $opt{'agentnum'} );
my $outerr = '';
run3 $lpr, $data, \$outerr, \$outerr;
my $outerr = '';
run3 $lpr, $data, \$outerr, \$outerr;
diff --git
a/FS/FS/cust_bill.pm
b/FS/FS/cust_bill.pm
index
e7622d7
..
b3ae290
100644
(file)
--- a/
FS/FS/cust_bill.pm
+++ b/
FS/FS/cust_bill.pm
@@
-1584,7
+1584,10
@@
sub print {
$self->batch_invoice(\%opt);
}
else {
$self->batch_invoice(\%opt);
}
else {
- do_print $self->lpr_data(\%opt);
+ do_print(
+ $self->lpr_data(\%opt),
+ 'agentnum' => $self->cust_main->agentnum,
+ );
}
}
}
}
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
45d57cd
..
1920e9f
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-4917,7
+4917,10
@@
sub queueable_print {
sub print {
my ($self, $template) = (shift, shift);
sub print {
my ($self, $template) = (shift, shift);
- do_print [ $self->print_ps($template) ];
+ do_print(
+ [ $self->print_ps($template) ],
+ 'agentnum' => $self->agentnum,
+ );
}
#these three subs should just go away once agent stuff is all config overrides
}
#these three subs should just go away once agent stuff is all config overrides
diff --git
a/FS/FS/msg_template.pm
b/FS/FS/msg_template.pm
index
e38346a
..
011ce24
100644
(file)
--- a/
FS/FS/msg_template.pm
+++ b/
FS/FS/msg_template.pm
@@
-484,13
+484,15
@@
Render a PDF and send it to the printer. OPTIONS are as for 'render'.
=cut
sub print {
=cut
sub print {
- my $file = render(@_);
- my @lpr = $conf->config('lpr');
- run ([@lpr, '-r'], '<', $file)
+ my( $self, %opt ) = @_;
+ my $file = $self->render(%opt);
+
+ my $lpr = $conf->config('lpr', $opt{'cust_main'}->agentnum );
+
+ run ( $lpr, '<', $file)
or die "lpr error:\n$?\n";
}
or die "lpr error:\n$?\n";
}
-
# helper sub for package dates
my $ymd = sub { $_[0] ? time2str('%Y-%m-%d', $_[0]) : '' };
# helper sub for package dates
my $ymd = sub { $_[0] ? time2str('%Y-%m-%d', $_[0]) : '' };