Chris Nighswonger
15 years ago
5 changed files with 0 additions and 1043 deletions
@ -1,291 +0,0 @@ |
|||
package C4::Labels::PDF; |
|||
|
|||
# Copyright 2009 Foundations Bible College. |
|||
# |
|||
# This file is part of Koha. |
|||
# |
|||
# Koha is free software; you can redistribute it and/or modify it under the |
|||
# terms of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# |
|||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
|||
# 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 |
|||
|
|||
use strict; |
|||
use warnings; |
|||
use PDF::Reuse; |
|||
use PDF::Reuse::Barcode; |
|||
|
|||
BEGIN { |
|||
use version; our $VERSION = qv('1.0.0_1'); |
|||
} |
|||
|
|||
sub _InitVars { |
|||
my $self = shift; |
|||
my $param = shift; |
|||
prInitVars($param); |
|||
} |
|||
|
|||
sub new { |
|||
my $invocant = shift; |
|||
my $type = ref($invocant) || $invocant; |
|||
my %opts = @_; |
|||
my $self = {}; |
|||
_InitVars() if ($opts{InitVars} == 0); |
|||
_InitVars($opts{InitVars}) if ($opts{InitVars} > 0); |
|||
delete($opts{InitVars}); |
|||
prDocDir($opts{'DocDir'}) if $opts{'DocDir'}; |
|||
delete($opts{'DocDir'}); |
|||
prFile(%opts); |
|||
bless ($self, $type); |
|||
return $self; |
|||
} |
|||
|
|||
sub End { |
|||
my $self = shift; |
|||
prEnd(); |
|||
} |
|||
|
|||
sub Add { |
|||
my $self = shift; |
|||
my $string = shift; |
|||
prAdd($string); |
|||
} |
|||
|
|||
sub Bookmark { |
|||
my $self = shift; |
|||
my $reference = shift; |
|||
prBookmark($reference); |
|||
} |
|||
|
|||
sub Compress { |
|||
my $self = shift; |
|||
my $directive = shift; |
|||
prCompress($directive); |
|||
} |
|||
|
|||
sub Doc { |
|||
my $self = shift; |
|||
my %params = @_; |
|||
prDoc(%params); |
|||
} |
|||
|
|||
sub DocForm { |
|||
my $self = shift; |
|||
my %params = @_; |
|||
return prDocForm(%params); |
|||
} |
|||
|
|||
sub Extract { |
|||
my $self = shift; |
|||
my ($pdfFile, $pageNo, $oldInternalName) = @_; |
|||
return prExtract($pdfFile, $pageNo, $oldInternalName); |
|||
} |
|||
|
|||
sub Field { |
|||
my $self = shift; |
|||
my ($fieldName, $value) = @_; |
|||
prField($fieldName, $value); |
|||
} |
|||
|
|||
sub Font { |
|||
my $self = shift; |
|||
my $fontName = shift; |
|||
return prFont($fontName); |
|||
} |
|||
|
|||
sub FontSize { |
|||
my $self = shift; |
|||
my $size = shift; |
|||
return prFontSize($size); |
|||
} |
|||
|
|||
sub Form { |
|||
my $self = shift; |
|||
my %params = @_; |
|||
return prForm(%params); |
|||
} |
|||
|
|||
sub GetLogBuffer { |
|||
my $self = shift; |
|||
return prGetLogBuffer(); |
|||
} |
|||
|
|||
sub GraphState { |
|||
my $self = shift; |
|||
my $string = shift; |
|||
prGraphState($string); |
|||
} |
|||
|
|||
sub Image { |
|||
my $self = shift; |
|||
my %params = @_; |
|||
return prImage(%params); |
|||
} |
|||
|
|||
sub Init { |
|||
my $self = shift; |
|||
my ($string, $duplicateCode) = @_; |
|||
prInit($string, $duplicateCode); |
|||
} |
|||
|
|||
sub Jpeg { |
|||
my $self = shift; |
|||
my ($imageData, $width, $height, $imageFormat) = @_; |
|||
return prJpeg($imageData, $width, $height, $imageFormat); |
|||
} |
|||
|
|||
sub Js { |
|||
my $self = shift; |
|||
my $string_or_fileName = shift; |
|||
prJs($string_or_fileName); |
|||
} |
|||
|
|||
sub Link { |
|||
my $self = shift; |
|||
my %params = @_; |
|||
prLink(%params); |
|||
} |
|||
|
|||
sub Log { |
|||
my $self = shift; |
|||
my $string = shift; |
|||
prLog($string); |
|||
} |
|||
|
|||
sub LogDir { |
|||
my $self = shift; |
|||
my $directory = shift; |
|||
prLogDir($directory); |
|||
} |
|||
|
|||
sub Mbox { |
|||
my $self = shift; |
|||
my ($lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY) = @_; |
|||
prMbox($lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY); |
|||
} |
|||
|
|||
sub Page { |
|||
my $self = shift; |
|||
my $noLog = shift; |
|||
prPage($noLog); |
|||
} |
|||
|
|||
sub SinglePage { |
|||
my $self = shift; |
|||
my ($file, $pageNumber) = @_; |
|||
return prSinglePage($file, $pageNumber); |
|||
} |
|||
|
|||
sub StrWidth { |
|||
my $self = shift; |
|||
my ($string, $font, $fontSize) = @_; |
|||
return prStrWidth($string, $font, $fontSize); |
|||
} |
|||
|
|||
sub Text { |
|||
my $self = shift; |
|||
my ($x, $y, $string, $align, $rotation) = @_; |
|||
return prText($x, $y, $string, $align, $rotation); |
|||
} |
|||
|
|||
sub TTFont { |
|||
my $self = shift; |
|||
my $path = shift; |
|||
return prTTFont($path); |
|||
} |
|||
|
|||
sub Code128 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::Code128(%opts); |
|||
} |
|||
|
|||
sub Code39 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::Code39(%opts); |
|||
} |
|||
|
|||
sub COOP2of5 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::COOP2of5(%opts); |
|||
} |
|||
|
|||
sub EAN13 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::EAN13(%opts); |
|||
} |
|||
|
|||
sub EAN8 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::EAN8(%opts); |
|||
} |
|||
|
|||
sub IATA2of5 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::IATA2of5(%opts); |
|||
} |
|||
|
|||
sub Industrial2of5 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::Industrial2of5(%opts); |
|||
} |
|||
|
|||
sub ITF { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::ITF(%opts); |
|||
} |
|||
|
|||
sub Matrix2of5 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::Matrix2of5(%opts); |
|||
} |
|||
|
|||
sub NW7 { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::NW7(%opts); |
|||
} |
|||
|
|||
sub UPCA { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::UPCA(%opts); |
|||
} |
|||
|
|||
sub UPCE { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
PDF::Reuse::Barcode::UPCE(%opts); |
|||
} |
|||
|
|||
1; |
|||
__END__ |
|||
|
|||
|
|||
=head1 NAME |
|||
|
|||
C4::Labels::PDF - A class wrapper for PDF::Reuse and PDF::Reuse::Barcode to allow usage as a psuedo-object. For usage see |
|||
PDF::Reuse documentation and C4::Labels::PDF code. |
|||
|
|||
=cut |
|||
|
|||
=head1 AUTHOR |
|||
|
|||
Chris Nighswonger <cnighswonger AT foundations DOT edu> |
|||
|
|||
=cut |
@ -1,292 +0,0 @@ |
|||
package C4::Labels::Patroncard; |
|||
|
|||
# Copyright 2009 Foundations Bible College. |
|||
# |
|||
# This file is part of Koha. |
|||
# |
|||
# Koha is free software; you can redistribute it and/or modify it under the |
|||
# terms of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# |
|||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
|||
# 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 |
|||
|
|||
use strict; |
|||
use warnings; |
|||
|
|||
use C4::Context; |
|||
use C4::Debug; |
|||
use C4::Biblio; |
|||
use C4::Labels::Layout 1.000000; # use version 1.0.0 or better |
|||
use C4::Labels::Template 1.000000; |
|||
use Data::Dumper; |
|||
|
|||
BEGIN { |
|||
use version; our $VERSION = qv('1.0.0_1'); |
|||
} |
|||
|
|||
sub _check_params { |
|||
my $given_params = {}; |
|||
my $exit_code = 0; |
|||
my @valid_template_params = ( |
|||
'layout_id', |
|||
'tmpl_id', |
|||
'prof_id', |
|||
); |
|||
if (scalar(@_) >1) { |
|||
$given_params = {@_}; |
|||
foreach my $key (keys %{$given_params}) { |
|||
if (!(grep m/$key/, @valid_template_params)) { |
|||
warn sprintf('Unrecognized parameter type of "%s".', $key); |
|||
$exit_code = 1; |
|||
} |
|||
} |
|||
} |
|||
else { |
|||
if (!(grep m/$_/, @valid_template_params)) { |
|||
warn sprintf('Unrecognized parameter type of "%s".', $_); |
|||
$exit_code = 1; |
|||
} |
|||
} |
|||
return $exit_code; |
|||
} |
|||
|
|||
=head1 NAME |
|||
|
|||
C4::Labels::Batch - A class for creating and manipulating batch objects in Koha |
|||
|
|||
=cut |
|||
|
|||
=head1 METHODS |
|||
|
|||
=head2 C4::Labels::Batch->new(layout_id => layout_id, tmpl_id => template_id, prof_id => prof_id) |
|||
|
|||
Invoking the I<new> method constructs a new batch object with no items. |
|||
|
|||
example: |
|||
my $batch = C4::Labels::Batch->new(layout_id => layout_id, tmpl_id => template_id, prof_id => prof_id); |
|||
# Creates and returns a new batch object |
|||
|
|||
B<NOTE:> This batch is I<not> written to the database untill $batch->save() is invoked. You have been warned! |
|||
|
|||
=cut |
|||
|
|||
sub new { |
|||
my ($invocant, %params) = @_; |
|||
my $type = ref($invocant) || $invocant; |
|||
my $self = { |
|||
batch_id => 0, |
|||
layout_id => $params{layout_id}, |
|||
tmpl_id => $params{tmpl_id}, |
|||
prof_id => $params{prof_id}, |
|||
items => [], |
|||
batch_stat => 0, # False if any data has changed and the db has not been updated |
|||
}; |
|||
bless ($self, $type); |
|||
return $self; |
|||
} |
|||
|
|||
=head2 $batch->add_item($item_number) |
|||
|
|||
Invoking the I<add_item> method will add the supplied item to the batch object. |
|||
|
|||
example: |
|||
$batch->add_item($item_number); |
|||
|
|||
=cut |
|||
|
|||
sub add_item { |
|||
my $self = shift; |
|||
my $item_num = shift; |
|||
push (@{$self->{items}}, $item_num); |
|||
$self->{batch_stat} = 0; |
|||
} |
|||
|
|||
=head2 $batch->get_attr() |
|||
|
|||
Invoking the I<get_attr> method will return the requested attribute. |
|||
|
|||
example: |
|||
my @items = $batch->get_attr($attr); |
|||
|
|||
=cut |
|||
|
|||
sub get_attr { |
|||
my $self = shift; |
|||
return $self->{$_[0]}; |
|||
} |
|||
|
|||
=head2 $batch->delete_item() |
|||
|
|||
Invoking the I<delete_item> method will delete the supplied item from the batch object. |
|||
|
|||
example: |
|||
$batch->delete_item(); |
|||
|
|||
=cut |
|||
|
|||
sub delete_item { |
|||
my $self = shift; |
|||
my $item_num = shift; |
|||
my $index = 0; |
|||
++$index until $$self->{items}[$index] == $item_num or $item_num > $#$self->{items}; |
|||
delete ($$self->{items}[$index]); |
|||
$self->{batch_stat} = 0; |
|||
} |
|||
|
|||
=head2 $batch->save() |
|||
|
|||
Invoking the I<save> method attempts to insert the batch into the database if the batch is new and |
|||
update the existing batch record if the batch exists. The method returns the new record batch_id upon |
|||
success and -1 upon failure (This avoids conflicting with a record batch_id of 1). Errors are |
|||
logged to the Apache log. |
|||
|
|||
example: |
|||
my $exitstat = $batch->save(); # to save the record behind the $batch object |
|||
|
|||
=cut |
|||
|
|||
sub save { |
|||
my $self = shift; |
|||
if ($self->{batch_id} > 0) { |
|||
foreach my $item_number (@$self->{items}) { |
|||
my $query = "UPDATE labels_batches SET item_number=?, layout_id=?, tmpl_id=?, prof_id=? WHERE batch_id=?;"; |
|||
warn "DEBUG: Updating: $query\n" if $debug; |
|||
my $sth->C4::Context->dbh->prepare($query); |
|||
$sth->execute($item_number, $self->{layout_id}, $self->{tmpl_id}, $self->{prof_id}, $self->{batch_id}); |
|||
if ($sth->err) { |
|||
warn sprintf('Database returned the following error: %s', $sth->errstr); |
|||
return -1; |
|||
} |
|||
} |
|||
} |
|||
else { |
|||
foreach my $item_number (@$self->{items}) { |
|||
my $query = "INSERT INTO labels_batches (item_number, layout_id, tmpl_id, prof_id) VALUES (?,?,?,?);"; |
|||
warn "DEBUG: Inserting: $query\n" if $debug; |
|||
my $sth->C4::Context->dbh->prepare($query); |
|||
$sth->execute($item_number, $self->{layout_id}, $self->{tmpl_id}, $self->{prof_id}); |
|||
if ($sth->err) { |
|||
warn sprintf('Database returned the following error: %s', $sth->errstr); |
|||
return -1; |
|||
} |
|||
my $sth1 = C4::Context->dbh->prepare("SELECT MAX(batch_id) FROM labels_batches;"); |
|||
$sth1->execute(); |
|||
my $batch_id = $sth1->fetchrow_array; |
|||
$self->{batch_id} = $batch_id; |
|||
return $batch_id; |
|||
} |
|||
} |
|||
$self->{batch_stat} = 1; |
|||
} |
|||
|
|||
=head2 C4::Labels::Template->retrieve(template_id) |
|||
|
|||
Invoking the I<retrieve> method constructs a new template object containing the current values for template_id. The method returns |
|||
a new object upon success and 1 upon failure. Errors are logged to the Apache log. Two further options may be accessed. See the example |
|||
below for further description. |
|||
|
|||
examples: |
|||
|
|||
my $template = C4::Labels::Template->retrieve(template_id => 1); # Retrieves template record 1 and returns an object containing the record |
|||
|
|||
my $template = C4::Labels::Template->retrieve(template_id => 1, convert => 1); # Retrieves template record 1, converts the units to points, |
|||
and returns an object containing the record |
|||
|
|||
my $template = C4::Labels::Template->retrieve(template_id => 1, prof_id => prof_id); # Retrieves template record 1, converts the units |
|||
to points, applies the given profile id, and returns an object containing the record |
|||
|
|||
=cut |
|||
|
|||
sub retrieve { |
|||
my $invocant = shift; |
|||
my %opts = @_; |
|||
my $type = ref($invocant) || $invocant; |
|||
my $query = "SELECT * FROM labels_batches WHERE batch_id = ? ORDER BY label_id"; |
|||
my $sth = C4::Context->dbh->prepare($query); |
|||
$sth->execute($opts{batch_id}); |
|||
if ($sth->err) { |
|||
warn sprintf('Database returned the following error: %s', $sth->errstr); |
|||
return 1; |
|||
} |
|||
my $self = { |
|||
items => [], |
|||
}; |
|||
while (my $record = $sth->fetchrow_hashref) { |
|||
$self->{batch_id} = $record->{batch_id}; # FIXME: seems a bit wasteful to re-initialize these every trip: is there a better way? |
|||
$self->{layout_id} = $record->{layout_id}; |
|||
$self->{tmpl_id} = $record->{tmpl_id}; |
|||
$self->{prof_id} = $record->{prof_id}; |
|||
push (@{$self->{items}}, $record->{item_number}); |
|||
} |
|||
$self->{batch_stat} = 1; |
|||
bless ($self, $type); |
|||
return $self; |
|||
} |
|||
|
|||
=head2 C4::Labels::Batch->delete(batch_id => batch_id) | $batch->delete() |
|||
|
|||
Invoking the delete method attempts to delete the batch from the database. The method returns 0 upon success |
|||
and 1 upon failure. Errors are logged to the Apache log. |
|||
|
|||
examples: |
|||
my $exitstat = $batch->delete(); # to delete the record behind the $batch object |
|||
my $exitstat = C4::Labels::Batch->delete(batch_id => 1); # to delete batch record 1 |
|||
|
|||
=cut |
|||
|
|||
sub delete { |
|||
my $self = shift; |
|||
my %opts = @_; |
|||
if ((ref $self) && !$self->{'batch_id'}) { # If there is no batch batch_id then we cannot delete it from the db |
|||
warn 'Cannot delete batch: Batch has not been saved.'; |
|||
return 1; |
|||
} |
|||
elsif (!$opts{batch_id}) { |
|||
warn 'Cannot delete batch: Missing batch_id.'; |
|||
return 1; |
|||
} |
|||
my $query = "DELETE FROM labels_batches WHERE batch_id = ?"; |
|||
my $sth = C4::Context->dbh->prepare($query); |
|||
$sth->execute($self->{'batch_id'}); |
|||
return 0; |
|||
} |
|||
|
|||
|
|||
1; |
|||
__END__ |
|||
|
|||
=head1 AUTHOR |
|||
|
|||
Chris Nighswonger <cnighswonger AT foundations DOT edu> |
|||
|
|||
=cut |
|||
|
|||
|
|||
# |
|||
# elsif ( $label_type eq 'PATCRD' ) { |
|||
# my $patron_data = $item; |
|||
# |
|||
# #FIXME: This needs to be paramatized and passed in from the user... |
|||
# #Each element of this hash is a separate line on the patron card. Keys are the text to print and the associated data is the point size. |
|||
# my $text = { |
|||
# $patron_data->{'description'} => $template->get_attr('font_size'), |
|||
# $patron_data->{'branchname'} => ($template->get_attr('font_size') + 3), |
|||
# }; |
|||
# |
|||
# $debug and warn "Generating patron card for cardnumber $patron_data->{'cardnumber'}"; |
|||
# |
|||
# my $barcode_height = $label_height / 2.75; #FIXME: Scaling barcode height; this needs to be a user parameter. |
|||
# $label->barcode( $llx, $lly, $barcode_height, $label_width, $patron_data->{'cardnumber'}, |
|||
# $barcodetype ); |
|||
# DrawPatronCardText( $llx, $lly, $label_height, $label_width, $template->get_attr('font'), $template->get_attr('font_size'), |
|||
# $left_text_margin, $text_wrap_cols, $text, $label_type ); |
|||
# _calc_next_label_pos(); |
|||
# } |
|||
|
@ -1,156 +0,0 @@ |
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><title>Koha › Tools › Labels › <!-- TMPL_IF NAME="batch_is_labels" -->Label<!-- TMPL_ELSIF NAME="batch_is_patroncards" -->Patron Card<!-- TMPL_ELSE -->Unknown Batchtype<!-- /TMPL_IF --> Batch</title> |
|||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" --> |
|||
</head> |
|||
<body> |
|||
<!-- TMPL_INCLUDE NAME="header.inc" --> |
|||
<!-- TMPL_INCLUDE NAME="cat-search.inc" --> |
|||
|
|||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › <a href="/cgi-bin/koha/labels/label-home.pl">Labels</a> › <!-- TMPL_IF NAME="batch_is_labels" -->Label<!-- TMPL_ELSIF NAME="batch_is_patroncards" -->Patron Card<!-- TMPL_ELSE -->Unknown Batchtype<!-- /TMPL_IF --> Batch</div> |
|||
<div id="doc3" class="yui-t2"> |
|||
<div id="bd"> |
|||
<div id="yui-main"> |
|||
<div class="yui-b"> |
|||
|
|||
<!-- TMPL_IF NAME="message" --> |
|||
<!-- TMPL_LOOP NAME="message_loop" --> |
|||
<div class="dialog message"><!-- TMPL_VAR NAME="message_text" --></div> |
|||
<!-- /TMPL_LOOP --> |
|||
<!-- /TMPL_IF --> |
|||
|
|||
<!-- TMPL_IF NAME="batch_id" --> |
|||
<!-- TMPL_INCLUDE NAME="labels-batches-toolbar.inc" --> |
|||
<div class="yui-g"> |
|||
<div class="yui-u first"> |
|||
<!-- TMPL_IF NAME="batch_is_labels" --> |
|||
<h2>Items to be Printed for Batch <!-- TMPL_VAR NAME="batch_id" --> (<!-- TMPL_VAR NAME="batch_count" --> items)</h2> |
|||
<table> |
|||
<tr> |
|||
<th>Label Num.</th> |
|||
<th>Summary</th> |
|||
<th>Item Type</th> |
|||
<th>Barcode</th> |
|||
<th>Delete</th> |
|||
</tr> |
|||
<!-- TMPL_LOOP NAME="resultsloop" --> |
|||
<tr> |
|||
<td><!-- TMPL_VAR NAME="labelno" --></td> |
|||
<td><b><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"> <!-- TMPL_VAR NAME="title" escape="html" --></a></b> : <!-- TMPL_VAR NAME="author" --> : <!-- TMPL_VAR NAME="isbn" --></td> |
|||
<td><!-- TMPL_VAR NAME="itemtype" --></td> |
|||
<td><!-- TMPL_VAR NAME="barcode" --></td> |
|||
<td><a href="/cgi-bin/koha/labels/label-manager.pl?op=delete&labelid=<!-- TMPL_VAR NAME="labelid" -->&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=labels">Delete</a></td> |
|||
<!-- FIXME: should use POST to change server state, not GET --> |
|||
</tr> |
|||
<!-- /TMPL_LOOP --> |
|||
</table> |
|||
<!-- TMPL_ELSIF NAME="batch_is_patroncards" --> |
|||
<h2>Patron Cards to be Printed for Batch <!-- TMPL_VAR NAME="batch_id" --> (<!-- TMPL_VAR NAME="batch_count" --> items)</h2> |
|||
<table> |
|||
<tr> |
|||
<th>Card<br />Num.</th> |
|||
<th>Patron Name</th> |
|||
<th>Borrower Number</th> |
|||
<th>Card Number</th> |
|||
<th>Delete</th> |
|||
</tr> |
|||
<!-- TMPL_LOOP NAME="resultsloop" --> |
|||
<tr> |
|||
<td><!-- TMPL_VAR NAME="cardno" --></td> |
|||
<td><b><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"> <!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></a></b></td> |
|||
<td><!-- TMPL_VAR NAME="borrowernumber" --></td> |
|||
<td><!-- TMPL_VAR NAME="cardnumber" --></td> |
|||
<td><a href="/cgi-bin/koha/labels/label-manager.pl?op=delete&cardid=<!-- TMPL_VAR NAME="cardid" -->&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=patroncards">Remove</a></td> |
|||
<!-- FIXME: should use POST to change server state, not GET --> |
|||
</tr> |
|||
<!-- /TMPL_LOOP --> |
|||
</table> |
|||
<!-- TMPL_ELSE --> |
|||
<div class="dialog alert">Error: Unknown Batch Type "<!-- TMPL_VAR NAME="batch_type" -->"</div> |
|||
<!-- /TMPL_IF --> |
|||
</div> |
|||
<div class="yui-u"> |
|||
<!-- TMPL_INCLUDE NAME="label-status.inc" --> |
|||
</div> |
|||
</div> |
|||
<!-- TMPL_ELSE --> |
|||
<!-- TMPL_INCLUDE NAME="labels-toolbar.inc" --> |
|||
<!-- TMPL_IF NAME="batch_is_labels" --> |
|||
<div class="yui-g"> |
|||
<div class="yui-u first"> |
|||
<!-- TMPL_IF NAME="batches" --> |
|||
<h2>Label Batches</h2> |
|||
<table> |
|||
<tr> |
|||
<th>ID</th> |
|||
<th>#</th> |
|||
<th>Edit</th> |
|||
<th>Delete</th> |
|||
<th>Print</th> |
|||
</tr> |
|||
<!-- TMPL_LOOP NAME="batches" --> |
|||
<tr> |
|||
<td><!-- TMPL_VAR NAME="batch_id" --></td> |
|||
<td><!-- TMPL_VAR NAME="num" --> records</td> |
|||
<td><a href="/cgi-bin/koha/labels/label-manager.pl?batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=labels">Edit</a></td> |
|||
<td><a href="/cgi-bin/koha/labels/label-manager.pl?op=delete_batch&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=labels">Delete</a><!-- FIXME: should use POST to change server state, not GET --></td> |
|||
<td><a style="float: left;" href="/cgi-bin/koha/labels/label-print-<!-- TMPL_VAR NAME="outputformat" -->.pl?batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=labels">Generate and download <!-- TMPL_VAR NAME="batch_id" --></a></td> |
|||
</tr> |
|||
<!-- /TMPL_LOOP --> |
|||
</table> |
|||
<!-- TMPL_ELSE --> |
|||
<fieldset class="brief"> |
|||
<legend>No Label Batches Currently Defined</legend> |
|||
<div class="hint"> |
|||
Select "New Label Batch" to create a Label batch. |
|||
</div> |
|||
</fieldset> |
|||
<!-- /TMPL_IF --><!-- /batches --> |
|||
</div> |
|||
<div class="yui-u"> |
|||
<!-- TMPL_INCLUDE NAME="label-status.inc" --> |
|||
</div> |
|||
</div> |
|||
<!-- TMPL_ELSIF NAME="batch_is_patroncards" --> |
|||
<div class="yui-g"> |
|||
<div class="yui-u first"> |
|||
<!-- TMPL_IF NAME="batches" --> |
|||
<h2>Patron Card Batches</h2> |
|||
<table> |
|||
<tr> |
|||
<th>ID</th> |
|||
<th>#</th> |
|||
<th>Edit</th> |
|||
<th>Delete</th> |
|||
<th>Print</th> |
|||
</tr> |
|||
<!-- TMPL_LOOP NAME="batches" --> |
|||
<tr> |
|||
<td><!-- TMPL_VAR NAME="batch_id" --></td> |
|||
<td><!-- TMPL_VAR NAME="num" --> records</td> |
|||
<td><a href="/cgi-bin/koha/labels/label-manager.pl?batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=patroncards">Edit</a></td> |
|||
<td><a href="/cgi-bin/koha/labels/label-manager.pl?op=delete_batch&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=patroncards">Delete</a><!-- FIXME: should use POST to change server state, not GET --></td> |
|||
<td><a style="float: left;" href="/cgi-bin/koha/labels/label-print-<!-- TMPL_VAR NAME="outputformat" -->.pl?batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=patroncards">Generate and download <!-- TMPL_VAR NAME="batch_id" --></a></td> |
|||
</tr> |
|||
<!-- /TMPL_LOOP --> |
|||
</table> |
|||
<!-- TMPL_ELSE --> |
|||
<fieldset class="brief"> |
|||
<legend>No Patron Card Batches Currently Defined</legend> |
|||
<div class="hint"> |
|||
Select "New Patron Card Batch" to create a Label batch. |
|||
</div> |
|||
</fieldset> |
|||
<!-- /TMPL_IF --><!-- /batches --> |
|||
</div> |
|||
<div class="yui-u"> |
|||
<!-- TMPL_INCLUDE NAME="label-status.inc" --> |
|||
</div> |
|||
</div> |
|||
<!-- /TMPL_IF --><!-- /type --> |
|||
<!-- /TMPL_IF --><!-- batch_id --> |
|||
</div> |
|||
</div> |
|||
<div class="yui-b"> |
|||
<!-- TMPL_INCLUDE NAME="labels-menu.inc" --> |
|||
</div> |
|||
</div> |
|||
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" --> |
@ -1,140 +0,0 @@ |
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --> |
|||
<title>Koha › Patrons <!-- TMPL_IF NAME="searching" -->› Search Results<!-- /TMPL_IF --></title> |
|||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" --> |
|||
<style type="text/css"> |
|||
#custom-doc { width:47.23em;*width:46.04em;min-width:600px; margin:auto; text-align:left; } |
|||
</style> |
|||
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.min.js"></script> |
|||
<script type="text/javascript"> |
|||
//<![CDATA[ |
|||
$(document).ready(function(){ |
|||
$("#CheckAll").click(function(){ |
|||
$(".checkboxed").checkCheckboxes(); |
|||
return false; |
|||
}); |
|||
$("#CheckNone").click(function(){ |
|||
$(".checkboxed").unCheckCheckboxes(); |
|||
return false; |
|||
}); |
|||
}); |
|||
function add_item(borrowernum,batch_id,type_id){ |
|||
var getstr=''; |
|||
if (borrowernum == 'checked') { |
|||
itms= new Array; |
|||
if(document.resultform.borrowernumber.length > 0) { |
|||
for (var i=0; i < document.resultform.borrowernumber.length; i++) { |
|||
if (document.resultform.borrowernumber[i].checked) { |
|||
itms.push("borrowernumber=" + document.resultform.borrowernumber[i].value); |
|||
} |
|||
} |
|||
getstr = itms.join("&"); |
|||
} else { |
|||
getstr = "borrowernumber="+document.resultform.borrowernumber.value; |
|||
} |
|||
} else { |
|||
getstr = "borrowernumber="+borrowernum; |
|||
} |
|||
var myurl = "label-manager.pl?op=add&batch_id="+batch_id+"&type="+type_id+"&"+getstr; |
|||
window.opener.location.href = myurl; |
|||
} |
|||
function add_item3(borrowernumber){ |
|||
var myurl = "label-manager.pl?op=add&borrowernumber="+borrowernumber+""; |
|||
window.opener.location.href = myurl; |
|||
} |
|||
//]]> |
|||
</script> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id="custom-doc" class="yui-t7"> |
|||
<div id="bd"> |
|||
<div class="yui-g"> |
|||
<h3>Patron Search</h3> |
|||
|
|||
<div class="browse"> |
|||
Browse by last name: |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=a&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">A</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=b&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">B</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=c&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">C</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=d&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">D</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=e&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">E</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=f&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">F</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=g&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">G</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=h&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">H</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=i&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">I</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=j&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">J</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=k&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">K</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=l&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">L</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=m&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">M</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=n&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">N</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=o&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">O</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=p&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">P</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=q&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">Q</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=r&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">R</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=s&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">S</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=t&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">T</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=u&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">U</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=v&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">V</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=w&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">W</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=x&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">X</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=y&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">Y</a> |
|||
<a href="/cgi-bin/koha/labels/pcard-member-search.pl?member=z&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->">Z</a> |
|||
</div> |
|||
|
|||
<form method="get" action="/cgi-bin/koha/labels/pcard-member-search.pl"><p> |
|||
<input type="hidden" name="batch_id" value="<!-- TMPL_VAR NAME="batch_id" -->" /> |
|||
<input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" /> |
|||
<label for="member">Name</label> |
|||
<input id="member" name="member" /> |
|||
<label for="category">Category code</label> |
|||
<input id="category" name="category" /> |
|||
<input type="submit" value="Search" /></p> |
|||
</form> |
|||
|
|||
<!-- TMPL_IF NAME="resultsloop" --> |
|||
<div id="searchheader"> <h3>Results <!-- TMPL_VAR Name ="from" --> to <!-- TMPL_VAR Name ="to" --> of <!-- TMPL_VAR Name ="numresults" --> found for '<span class="ex"><!-- TMPL_VAR NAME="member" --></span>'</h3></div> |
|||
<!-- TMPL_IF NAME="paginationbar" --><div id="pagination_top"><!-- TMPL_VAR Name ="paginationbar" --></div><!-- /TMPL_IF --> |
|||
<form name="resultform" action="/cgi-bin/koha/labels/pcard-member-search.pl" method="get" class="checkboxed"><div style="float: right; margin-top: .5em;"><input type="submit" class="icon addchecked" value="Add checked" onclick="add_item('checked',<!-- TMPL_VAR NAME="batch_id" -->,'<!-- TMPL_VAR NAME="type" -->'); return false" /> <input type="button" class="close" value="Done" /></div> |
|||
<div style="line-height: 2em; margin-left: .7em;"><a id="CheckAll" href="/cgi-bin/koha/labels/pcard-member-search.pl">Select All</a><a id="CheckNone" href="/cgi-bin/koha/labels/pcard-member-search.pl">Clear All</a></div> |
|||
<div class="searchresults"> |
|||
|
|||
<table style="float: left; margin: .5em 0;"> |
|||
<tr> |
|||
<th><label style="font-weight:bold;">Select</label></th> |
|||
<th><a href="pcard-member-search.pl?member=<!--TMPL_VAR Name="member" -->&category=<!--TMPL_VAR Name="category_type" -->&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->&orderby=cardnumber">Card</a></th> |
|||
<th><a href="pcard-member-search.pl?member=<!--TMPL_VAR Name="member" -->&category=<!--TMPL_VAR Name="category_type" -->&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->&orderby=surname">Name</a></th> |
|||
<th><a href="pcard-member-search.pl?member=<!--TMPL_VAR Name="member" -->&category=<!--TMPL_VAR Name="category_type" -->&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->&orderby=borrowers.categorycode">Category</a></th> |
|||
<th><a href="pcard-member-search.pl?member=<!--TMPL_VAR Name="member" -->&category=<!--TMPL_VAR Name="category_type" -->&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->&orderby=branchcode">Library</a></th> |
|||
<th>Expires on</th> |
|||
<th>Notes</th> |
|||
<th></th> |
|||
</tr> |
|||
<!-- TMPL_LOOP NAME="resultsloop" --> |
|||
<!-- TMPL_UNLESS NAME="__odd__" --> |
|||
<tr class="highlight"> |
|||
<!-- TMPL_ELSE --> |
|||
<tr> |
|||
<!-- /TMPL_UNLESS --> |
|||
<td> <input type="checkbox" name="borrowernumber" id="patron<!-- TMPL_VAR NAME="borrowernumber" -->" value="<!-- TMPL_VAR NAME="borrowernumber" -->" /> </td> |
|||
<td><!-- TMPL_VAR NAME="cardnumber" --></td> |
|||
<td style="white-space: nowrap;"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="surname" -->, <!-- TMPL_VAR NAME="firstname" --></a> <br /> <!-- TMPL_VAR NAME="address" --><!-- TMPL_IF NAME="address2" --><br /><!-- TMPL_VAR NAME="address2" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="city" --><br /><!-- TMPL_VAR NAME=city --><!-- /TMPL_IF --></td> |
|||
<td><!-- TMPL_VAR NAME="category_description" --> (<!-- TMPL_VAR name="category_type" -->)</td> |
|||
<td><!-- TMPL_VAR NAME="branchcode" --></td> |
|||
<td><!-- TMPL_VAR NAME="dateexpiry" --></td> |
|||
<td><!-- TMPL_VAR NAME="borrowernotes" --></td> |
|||
<td><a onclick="add_item('<!-- TMPL_VAR NAME="borrowernumber" -->',<!-- TMPL_VAR NAME="batch_id" -->,'<!-- TMPL_VAR NAME="type" -->'); return false" href="/cgi-bin/koha/barcodes/label-manager.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&batch_id=<!-- TMPL_VAR name="batch_id" -->&type=<!-- TMPL_VAR NAME="type" -->&op=add">Add</a></td> |
|||
</tr> |
|||
<!-- /TMPL_LOOP --> |
|||
</table> |
|||
</div> |
|||
</form> |
|||
|
|||
<!-- TMPL_ELSE --> |
|||
<!-- TMPL_IF NAME="searching" --> |
|||
No results found |
|||
<!-- /TMPL_IF --> |
|||
<!-- /TMPL_IF --> |
|||
|
|||
</div> |
|||
</div> |
|||
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" --> |
@ -1,164 +0,0 @@ |
|||
#!/usr/bin/perl |
|||
|
|||
|
|||
#script to do a borrower enquiry/bring up borrower details etc |
|||
#written 20/12/99 by chris@katipo.co.nz |
|||
|
|||
|
|||
# Copyright 2000-2002 Katipo Communications |
|||
# |
|||
# This file is part of Koha. |
|||
# |
|||
# Koha is free software; you can redistribute it and/or modify it under the |
|||
# terms of the GNU General Public License as published by the Free Software |
|||
# Foundation; either version 2 of the License, or (at your option) any later |
|||
# version. |
|||
# |
|||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
|||
# 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 |
|||
|
|||
use strict; |
|||
use C4::Auth; |
|||
use C4::Output; |
|||
use CGI; |
|||
use C4::Members; |
|||
use C4::Debug; |
|||
|
|||
|
|||
my $input = new CGI; |
|||
my $batch_id = $input->param('batch_id'); |
|||
my $batch_type = $input->param('type'); |
|||
|
|||
$debug and warn "[In pcard-member-search] Batch Id: $batch_id, and Type: $batch_type"; |
|||
|
|||
my $quicksearch = $input->param('quicksearch'); |
|||
my $startfrom = $input->param('startfrom')||1; |
|||
my $resultsperpage = $input->param('resultsperpage')||C4::Context->preference("PatronsPerPage")||20; |
|||
my $category = $input->param('category'); |
|||
|
|||
my ($template, $loggedinuser, $cookie); |
|||
if($quicksearch){ |
|||
($template, $loggedinuser, $cookie) |
|||
= get_template_and_user({template_name => "members/member-quicksearch-results.tmpl", # FIXME: template doesn't exist |
|||
query => $input, |
|||
type => "intranet", |
|||
authnotrequired => 0, |
|||
flagsrequired => {borrowers => 1}, |
|||
debug => 1, |
|||
}); |
|||
} else { |
|||
($template, $loggedinuser, $cookie) |
|||
= get_template_and_user({template_name => "labels/pcard-members-search.tmpl", |
|||
query => $input, |
|||
type => "intranet", |
|||
authnotrequired => 0, |
|||
flagsrequired => {borrowers => 1}, |
|||
debug => 1, |
|||
}); |
|||
} |
|||
my $theme = $input->param('theme') || "default"; |
|||
# only used if allowthemeoverride is set |
|||
#my %tmpldata = pathtotemplate ( template => 'member.tmpl', theme => $theme, language => 'fi' ); |
|||
# FIXME - Error-checking |
|||
#my $template = HTML::Template->new( filename => $tmpldata{'path'}, |
|||
# die_on_bad_params => 0, |
|||
# loop_context_vars => 1 ); |
|||
|
|||
|
|||
my $member=$input->param('member'); |
|||
my $orderby=$input->param('orderby'); |
|||
$orderby = "surname,firstname" unless $orderby; |
|||
$member =~ s/,//g; #remove any commas from search string |
|||
$member =~ s/\*/%/g; |
|||
|
|||
unless ($member||$category) { |
|||
$template->param( batch_id => $batch_id, type => $batch_type,); |
|||
output_html_with_http_headers $input, $cookie, $template->output; |
|||
exit; |
|||
} |
|||
|
|||
my ($count,$results); |
|||
|
|||
if(length($member) == 1) |
|||
{ |
|||
($count,$results)=SearchMember($member,$orderby,"simple"); |
|||
} |
|||
else |
|||
{ |
|||
($count,$results)=SearchMember($member,$orderby,"advanced",$category); |
|||
} |
|||
|
|||
|
|||
my @resultsdata; |
|||
my $to=($count>($startfrom*$resultsperpage)?$startfrom*$resultsperpage:$count); |
|||
for (my $i=($startfrom-1)*$resultsperpage; $i < $to; $i++){ |
|||
#find out stats |
|||
my ($od,$issue,$fines)=GetMemberIssuesAndFines($results->[$i]{'borrowernumber'}); |
|||
|
|||
my %row = ( |
|||
count => $i+1, |
|||
borrowernumber => $results->[$i]{'borrowernumber'}, |
|||
cardnumber => $results->[$i]{'cardnumber'}, |
|||
surname => $results->[$i]{'surname'}, |
|||
firstname => $results->[$i]{'firstname'}, |
|||
categorycode => $results->[$i]{'categorycode'}, |
|||
category_type => $results->[$i]{'category_type'}, |
|||
category_description => $results->[$i]{'description'}, |
|||
address => $results->[$i]{'address'}, |
|||
address2 => $results->[$i]{'address2'}, |
|||
city => $results->[$i]{'city'}, |
|||
zipcode => $results->[$i]{'zipcode'}, |
|||
country => $results->[$i]{'country'}, |
|||
branchcode => $results->[$i]{'branchcode'}, |
|||
overdues => $od, |
|||
issues => $issue, |
|||
odissue => "$od/$issue", |
|||
fines => sprintf("%.2f",$fines), |
|||
borrowernotes => $results->[$i]{'borrowernotes'}, |
|||
sort1 => $results->[$i]{'sort1'}, |
|||
sort2 => $results->[$i]{'sort2'}, |
|||
dateexpiry => C4::Dates->new($results->[$i]{'dateexpiry'},'iso')->output('syspref'), |
|||
); |
|||
push(@resultsdata, \%row); |
|||
} |
|||
my $base_url = |
|||
'pcard-member-search.pl?' |
|||
. join( |
|||
'&', |
|||
map { $_->{term} . '=' . $_->{val} } ( |
|||
{ term => 'member', val => $member }, |
|||
{ term => 'category', val => $category }, |
|||
{ term => 'orderby', val => $orderby }, |
|||
{ term => 'resultsperpage', val => $resultsperpage }, |
|||
{ term => 'type', val => $batch_type }, |
|||
{ term => 'batch_id', val => $batch_id }, |
|||
) |
|||
); |
|||
|
|||
$template->param( |
|||
paginationbar => pagination_bar( |
|||
$base_url, int( $count / $resultsperpage ) + 1, |
|||
$startfrom, 'startfrom' |
|||
), |
|||
startfrom => $startfrom, |
|||
from => ($startfrom-1)*$resultsperpage+1, |
|||
to => $to, |
|||
multipage => ($count != $to || $startfrom!=1), |
|||
); |
|||
|
|||
$template->param( |
|||
searching => "1", |
|||
member => $member, |
|||
category_type => $category, |
|||
numresults => $count, |
|||
resultsloop => \@resultsdata, |
|||
batch_id => $batch_id, |
|||
type => $batch_type, |
|||
); |
|||
|
|||
output_html_with_http_headers $input, $cookie, $template->output; |
Loading…
Reference in new issue