X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FPrint.pm;h=09c18bf977ad054147a0d6ab88faa0ee8ffef819;hb=f91441f5f5202047193c303b917af271afec773a;hp=e7c7b32f459b047bf57957a2eb434b554ccfa33c;hpb=3082ad80bc022164d8dbbb52f5ac6ece54b4d1e1;p=koha.git diff --git a/C4/Print.pm b/C4/Print.pm index e7c7b32f45..09c18bf977 100644 --- a/C4/Print.pm +++ b/C4/Print.pm @@ -13,27 +13,26 @@ package C4::Print; # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA - -# $Id$ +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; -require Exporter; - +#use warnings; FIXME - Bug 2505 use C4::Context; use C4::Circulation; use C4::Members; -use C4::Date; +use C4::Dates qw(format_date); use vars qw($VERSION @ISA @EXPORT); -# set the version for version checking -# set the version for version checking -$VERSION = do { my @v = '$Revision$' =~ /\d+/g; - shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); -}; +BEGIN { + # set the version for version checking + $VERSION = 3.01; + require Exporter; + @ISA = qw(Exporter); + @EXPORT = qw(&remoteprint &printreserve &printslip); +} =head1 NAME @@ -49,14 +48,7 @@ The functions in this module handle sending text to a printer. =head1 FUNCTIONS -=over 2 - -=cut - -@ISA = qw(Exporter); -@EXPORT = qw(&remoteprint &printreserve &printslip); - -=item remoteprint +=head2 remoteprint &remoteprint($items, $borrower); @@ -73,8 +65,8 @@ from C<&GetBorrowerIssues>. =cut # FIXME - It'd be nifty if this could generate pretty PostScript. -sub remoteprint { - my ($items, $borrower ) = @_; +sub remoteprint ($$) { + my ($items, $borrower) = @_; (return) unless ( C4::Context->boolean_preference('printcirculationslips') ); @@ -127,7 +119,7 @@ sub remoteprint { print PRINTER "$itemdata->{'date_due'}\r\n"; $i++; } - print PRINTER "\r\n\r\n\r\n\r\n\r\n\r\n\r\n"; + print PRINTER "\r\n" x 7 ; close PRINTER; #system("lpr /tmp/$file"); @@ -135,20 +127,18 @@ sub remoteprint { sub printreserve { my ( $branchname, $bordata, $itemdata ) = @_; - my $file = time; my $printer = ''; (return) unless ( C4::Context->boolean_preference('printreserveslips') ); if ( $printer eq "" || $printer eq 'nulllp' ) { - open( PRINTER, ">>/tmp/kohares" ); + open( PRINTER, ">>/tmp/kohares" ) + or die "Could not write to /tmp/kohares"; } else { open( PRINTER, "| lpr -P $printer >/dev/null" ) or die "Couldn't write to queue:$!\n"; } - my @da = localtime( time() ); - my $todaysdate = "$da[2]:$da[1] $da[3]/$da[4]/$da[5]"; - -#(1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]); + my @da = localtime(); + my $todaysdate = "$da[2]:$da[1] " . C4::Dates->today(); my $slip = <<"EOF"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Date: $todaysdate; @@ -176,19 +166,19 @@ EOF return $slip; } -=item printslip +=head2 printslip &printslip($borrowernumber) - print a slip for the given $borrowernumber - +print a slip for the given $borrowernumber + =cut #' -sub printslip { - my ( $borrowernumber ) = @_; - my ( $borrower, $flags ) = GetMemberDetails( $borrowernumber); - my ($countissues,$issueslist) = GetPendingIssues($borrowernumber); +sub printslip ($) { + my $borrowernumber = shift; + my $borrower = GetMemberDetails($borrowernumber); + my $issueslist = GetPendingIssues($borrowernumber); foreach my $it (@$issueslist){ $it->{'date_due'}=format_date($it->{'date_due'}); } @@ -201,11 +191,9 @@ END { } # module clean-up code here (global destructor) 1; __END__ -=back - =head1 AUTHOR -Koha Developement team +Koha Development Team =head1 SEE ALSO