bug_8056: sorted out slip print calls
authorSrdjan <srdjan@catalyst.net.nz>
Mon, 14 May 2012 03:17:13 +0000 (15:17 +1200)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 28 May 2012 11:52:39 +0000 (13:52 +0200)
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
preference works as expected.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Tested that CircAutoPrintQuickSlip clear the screen still works well

C4/Members.pm
C4/Print.pm
circ/circulation.pl
t/db_dependent/lib/KohaTest/Print.pm

index b11d976..343a0db 100644 (file)
@@ -998,7 +998,6 @@ sub GetPendingIssues {
     # must avoid biblioitems.* to prevent large marc and marcxml fields from killing performance
     # FIXME: namespace collision: each table has "timestamp" fields.  Which one is "timestamp" ?
     # FIXME: circ/ciculation.pl tries to sort by timestamp!
-    # FIXME: C4::Print::printslip tries to sort by timestamp!
     # FIXME: namespace collision: other collisions possible.
     # FIXME: most of this data isn't really being used by callers.
     my $query =
index c0b37c8..2ee0116 100644 (file)
@@ -28,7 +28,7 @@ BEGIN {
        $VERSION = 3.01;
        require Exporter;
        @ISA    = qw(Exporter);
-       @EXPORT = qw(&printslip);
+    @EXPORT = qw(&NetworkPrint);
 }
 
 =head1 NAME
@@ -45,45 +45,16 @@ The functions in this module handle sending text to a printer.
 
 =head1 FUNCTIONS
 
-=cut
-
-=for comment
-    my $slip = <<"EOF";
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Date: $todaysdate;
-
-ITEM RESERVED:
-$itemdata->{'title'} ($itemdata->{'author'})
-barcode: $itemdata->{'barcode'}
-
-COLLECT AT: $branchname
-
-BORROWER:
-$bordata->{'surname'}, $bordata->{'firstname'}
-card number: $bordata->{'cardnumber'}
-Phone: $bordata->{'phone'}
-$bordata->{'streetaddress'}
-$bordata->{'suburb'}
-$bordata->{'town'}
-$bordata->{'emailaddress'}
+=head2 NetworkPrint
 
+  &NetworkPrint($text)
 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-EOF
-=cut
-
-=head2 printslip
-
-  &printslip($slip)
-
-print a slip for the given $borrowernumber and $branchcode
+Queue some text for printing on the selected branch printer
 
 =cut
 
-sub printslip ($) {
-    my ($slip) = @_;
-
-    return unless ( C4::Context->boolean_preference('printcirculationslips') );
+sub NetworkPrint {
+    my ($text) = @_;
 
 # FIXME - It'd be nifty if this could generate pretty PostScript.
 
@@ -112,7 +83,7 @@ sub printslip ($) {
 
     #  print $queue;
     #open (FILE,">/tmp/$file");
-    print PRINTER $slip;
+    print PRINTER $text;
     print PRINTER "\r\n" x 7 ;
     close PRINTER;
 
index bcbcb6f..c89abff 100755 (executable)
@@ -25,6 +25,7 @@ use strict;
 use warnings;
 use CGI;
 use C4::Output;
+use C4::Print;
 use C4::Auth qw/:DEFAULT get_session/;
 use C4::Dates qw/format_date/;
 use C4::Branch; # GetBranches
@@ -172,7 +173,10 @@ if ( $barcode eq '' && $query->param('charges') eq 'yes' ) {
 }
 
 if ( $print eq 'yes' && $borrowernumber ne '' ) {
-    PrintIssueSlip($session->param('branch') || $branch, $borrowernumber);
+    if ( C4::Context->boolean_preference('printcirculationslips') ) {
+        my $letter = IssueSlip($branch, $borrowernumber, "QUICK");
+        NetworkPrint($letter->{content});
+    }
     $query->param( 'borrowernumber', '' );
     $borrowernumber = '';
 }
index d35ab34..f720fee 100644 (file)
@@ -12,7 +12,7 @@ sub testing_class { 'C4::Print' };
 
 sub methods : Test( 1 ) {
     my $self = shift;
-    my @methods = qw( printslip );
+    my @methods = qw( NetworkPrint );
     
     can_ok( $self->testing_class, @methods );    
 }