Work on adding patron search to patron card generation feature.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
766639aa0a
commit
4cfbf45e35
3 changed files with 24 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
|||
<!-- TMPL_IF EXPR="(batch_type eq 'labels')" -->
|
||||
<!-- TMPL_IF EXPR="(type eq 'labels')" -->
|
||||
<div id="toolbar">
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
@ -38,13 +38,14 @@
|
|||
<li><a id="dedup" href="/cgi-bin/koha/labels/label-manager.pl?op=deduplicate&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="batch_type" -->">Remove duplicate barcodes</a></li>
|
||||
<li><a id="generate" href="/cgi-bin/koha/labels/label-print-pdf.pl?batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="batch_type" -->">Generate PDF for Batch</a></li>
|
||||
</ul></div>
|
||||
<!-- TMPL_ELSIF EXPR="(batch_type eq 'patroncards')" -->
|
||||
<!-- TMPL_ELSIF EXPR="(type eq 'patroncards')" -->
|
||||
<div id="toolbar">
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
function Plugin(batch_id) {
|
||||
window.open("label-patron-search.pl?batch_id="+batch_id+"",'FindABibIndex','width=640,height=400,toolbar=no,scrollbars=yes');
|
||||
function Plugin(batch_id, batch_type) {
|
||||
// window.open("label-item-search.pl?batch_id="+batch_id+"",'FindABibIndex','width=640,height=400,toolbar=no,scrollbars=yes');
|
||||
window.open("pcard-member-search.pl?batch_id="+batch_id+"&type="+batch_type+"",'FindAPatronIndex','width=1280,height=400,toolbar=no,scrollbars=yes');
|
||||
}
|
||||
|
||||
// prepare DOM for YUI Toolbar
|
||||
|
@ -62,7 +63,7 @@
|
|||
type: "button",
|
||||
label: "Add patron(s) to batch",
|
||||
container: "addpatronsc",
|
||||
onclick: {fn:function(){Plugin(<!-- TMPL_VAR NAME="batch_id" -->)}}
|
||||
onclick: {fn:function(){Plugin(<!-- TMPL_VAR NAME="batch_id" -->,"<!-- TMPL_VAR NAME="type" -->")}}
|
||||
});
|
||||
new YAHOO.widget.Button("deletebatch");
|
||||
new YAHOO.widget.Button("dedup");
|
||||
|
@ -72,7 +73,7 @@
|
|||
//]]>
|
||||
</script>
|
||||
<ul class="toolbar">
|
||||
<li id="addpatronsc"><a id="addpatrons" href="#" onclick="Plugin(<!-- TMPL_VAR NAME="batch_id" -->); return false;">Add item(s) to batch</a></li>
|
||||
<li id="addpatronsc"><a id="addpatrons" href="#" onclick="Plugin(<!-- TMPL_VAR NAME="batch_id" -->,"<!-- TMPL_VAR NAME="type" -->"); return false;">Add item(s) to batch</a></li>
|
||||
<li><a id="deletebatch" href="/cgi-bin/koha/labels/label-manager.pl?op=delete_batch&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="batch_type" -->">Delete current batch</a></li>
|
||||
<!-- FIXME: should use POST to change server state, not GET -->
|
||||
<li><a id="dedup" href="/cgi-bin/koha/labels/label-manager.pl?op=deduplicate&batch_id=<!-- TMPL_VAR NAME="batch_id" -->&type=<!-- TMPL_VAR NAME="batch_type" -->">Remove duplicate barcodes</a></li>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><title>Koha › <!-- TMPL_IF EXPR="(batch_type eq 'labels')" -->Labels<!-- TMPL_ELSIF EXPR="(batch_type eq 'patroncards')" -->Patron Cards<!-- /TMPL_IF --></title>
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><title>Koha › <!-- TMPL_IF EXPR="(type eq 'labels')" -->Labels<!-- TMPL_ELSIF EXPR="(type eq 'patroncards')" -->Patron Cards<!-- /TMPL_IF --></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> › <!-- TMPL_IF EXPR="(batch_type eq 'labels')" -->Labels<!-- TMPL_ELSIF EXPR="(batch_type eq 'patroncards')" -->Patron Cards<!-- /TMPL_IF --></div>
|
||||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <!-- TMPL_IF EXPR="(type eq 'labels')" -->Labels<!-- TMPL_ELSIF EXPR="(type eq 'patroncards')" -->Patron Cards<!-- /TMPL_IF --></div>
|
||||
<div id="doc3" class="yui-t2">
|
||||
<div id="bd">
|
||||
<div id="yui-main">
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
<!-- TMPL_IF NAME="batch_id" -->
|
||||
<!-- TMPL_INCLUDE NAME="tools-labels-batches-toolbar.inc" -->
|
||||
<!-- TMPL_IF EXPR="(batch_type eq 'labels')" -->
|
||||
<!-- TMPL_IF EXPR="(type eq 'labels')" -->
|
||||
<h2>Items to be Printed for Batch <!-- TMPL_VAR NAME="batch_id" --> (<!-- TMPL_VAR NAME="batch_count" --> items)</h2>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -40,7 +40,7 @@
|
|||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</table>
|
||||
<!-- TMPL_ELSIF EXPR="(batch_type eq 'patroncards')" -->
|
||||
<!-- TMPL_ELSIF EXPR="(type eq 'patroncards')" -->
|
||||
<h2>Patron Cards to be Printed for Batch <!-- TMPL_VAR NAME="batch_id" --> (<!-- TMPL_VAR NAME="batch_count" --> items)</h2>
|
||||
<table>
|
||||
<tr>
|
||||
|
@ -61,10 +61,10 @@
|
|||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</table>
|
||||
<!-- /TMPL_IF --><!-- /batch_type -->
|
||||
<!-- /TMPL_IF --><!-- /type -->
|
||||
<!-- TMPL_ELSE -->
|
||||
<!-- TMPL_INCLUDE NAME="tools-labels-toolbar.inc" -->
|
||||
<!-- TMPL_IF EXPR="(batch_type eq 'labels')" -->
|
||||
<!-- TMPL_IF EXPR="(type eq 'labels')" -->
|
||||
<!-- TMPL_IF NAME="batches" -->
|
||||
<div class="yui-g">
|
||||
<div class="yui-u first">
|
||||
|
@ -102,7 +102,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- /TMPL_IF --><!-- /batches -->
|
||||
<!-- TMPL_ELSIF EXPR="(batch_type eq 'patroncards')" -->
|
||||
<!-- TMPL_ELSIF EXPR="(type eq 'patroncards')" -->
|
||||
<!-- TMPL_IF NAME="batches" -->
|
||||
<div class="yui-g">
|
||||
<div class="yui-u first">
|
||||
|
@ -140,7 +140,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- /TMPL_IF --><!-- /batches -->
|
||||
<!-- /TMPL_IF --><!-- /batch_type -->
|
||||
<!-- /TMPL_IF --><!-- /type -->
|
||||
<!-- /TMPL_IF --><!-- batch_id -->
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,7 @@ use C4::Labels;
|
|||
use C4::Output;
|
||||
use HTML::Template::Pro;
|
||||
#use POSIX qw(ceil);
|
||||
#use Data::Dumper;
|
||||
use Data::Dumper;
|
||||
#use Smart::Comments;
|
||||
|
||||
use vars qw($debug);
|
||||
|
@ -40,7 +40,8 @@ my $startlabel = $query->param('startlabel');
|
|||
my $printingtype = $query->param('printingtype');
|
||||
my $guidebox = $query->param('guidebox');
|
||||
my $fontsize = $query->param('fontsize');
|
||||
my @itemnumber = $query->param('itemnumber');
|
||||
my @itemnumber = $query->param('itemnumber') if ($query->param('type') eq 'labels');
|
||||
my @itemnumber = $query->param('borrowernumber') if ($query->param('type') eq 'patroncards');
|
||||
my $batch_type = $query->param('type');
|
||||
|
||||
# little block for displaying active layout/template/batch in templates
|
||||
|
@ -109,9 +110,13 @@ elsif ( $op eq 'add_layout' ) {
|
|||
# FIXME: The trinary conditionals here really need to be replaced with a more robust form of db abstraction -fbcit
|
||||
|
||||
elsif ( $op eq 'add' ) { # add item
|
||||
my $query2 = "INSERT INTO $batch_type ( " . (($batch_type eq 'labels') ? 'itemnumber' : 'borrowernumber') . ", batch_id ) values ( ?,? )";
|
||||
warn "op \'add\': batch id = $batch_id, type = $batch_type";
|
||||
my $query2 = "INSERT INTO $batch_type ( " . (($batch_type eq 'labels') ? 'itemnumber' : 'borrowernumber') . ", batch_id ) values ( ?,? )";
|
||||
warn "op \'add\' \$query2=$query2";
|
||||
my $sth2 = $dbh->prepare($query2);
|
||||
warn Dumper($itemnumber);
|
||||
for my $inum (@itemnumber) {
|
||||
warn "INSERTing " . (($batch_type eq 'labels') ? 'itemnumber' : 'borrowernumber') . ":$inum for batch $batch_id";
|
||||
$sth2->execute($inum, $batch_id);
|
||||
}
|
||||
$sth2->finish;
|
||||
|
@ -176,7 +181,7 @@ if (scalar @messages) {
|
|||
$template->param(message_loop => \@complex);
|
||||
}
|
||||
$template->param(
|
||||
batch_type => $batch_type,
|
||||
type => $batch_type,
|
||||
batch_id => $batch_id,
|
||||
batch_count => scalar @resultsloop,
|
||||
active_layout_name => $active_layout_name,
|
||||
|
|
Loading…
Reference in a new issue