From 1b3fe156b5ddfd588c1e55af5e21a36e84d9caf8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 22 Feb 2007 16:56:43 +0000 Subject: [PATCH] Erste Version Druckqueue. Es ist nun wieder moeglich aus der Warteschlange zu drucken, und zwar auf selektierte Drucker. --- SL/Form.pm | 12 ++++++++++++ bin/mozilla/bp.pl | 23 +++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 7636b1659..0e59786d9 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1520,6 +1520,18 @@ sub get_lists { $params{"all_projects"} ? 1 : 0); } + if ($params{"printers"}) { + $query = qq|SELECT id, printer_description, printer_command FROM printers|; + $sth = $dbh->prepare($query); + $sth->execute() || $self->dberror($query); + + $self->{$params{"printers"}} = []; + while ($ref = $sth->fetchrow_hashref(NAME_lc)) { + push(@{ $self->{$params{"printers"}} }, $ref); + } + $sth->finish; + } + $dbh->disconnect(); $main::lxdebug->leave_sub(); diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index 3afd23a7c..2269ab4f1 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -32,6 +32,7 @@ #====================================================================== use SL::BP; +use Data::Dumper; 1; @@ -310,6 +311,10 @@ sub yes { sub print { $lxdebug->enter_sub(); + $form->get_lists(printers => 'ALL_PRINTERS'); + # use the command stored in the databse or fall back to $myconfig{printer} + my $selected_printer = (grep { $_->{id} eq $form->{printer} } @{ $form->{ALL_PRINTERS} })[0]->{'printer_command'} || $myconfig{printer}; + if ($form->{callback}) { map { $form->{callback} .= "&checked_$_=1" if $form->{"checked_$_"} } (1 .. $form->{rowcount}); @@ -318,7 +323,7 @@ sub print { for $i (1 .. $form->{rowcount}) { if ($form->{"checked_$i"}) { - $form->{OUT} = "| $myconfig{printer}"; + $form->{OUT} = "| $selected_printer"; $form->info($locale->text('Printing ... ')); if (BP->print_spool(\%myconfig, \%$form, $spool)) { @@ -553,7 +558,7 @@ sub list_spool { {password}> |; - if ($myconfig{printer}) { +# if ($myconfig{printer}) { print qq| {transdateto}> {transdatefrom}> @@ -564,12 +569,18 @@ sub list_spool { {vendor}> - + |; - } + +$form->get_lists(printers=>"ALL_PRINTERS"); +print qq||; + +# } print qq| @@ -578,7 +589,7 @@ sub list_spool { |; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub select_all { -- 2.20.1