From e7b123225031965dc2ca97d1239098e54d9e277c Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Tue, 8 Jan 2008 12:57:26 -0600 Subject: [PATCH] Adding feature : multiple returns via moremember page. Adding Connection for renewScript Adding javascript functions to moremeber.tmpl Adding error management for returns. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- C4/Biblio.pm | 5 +- .../prog/en/modules/members/moremember.tmpl | 72 +++++++++++++++++-- members/moremember.pl | 6 +- reserve/renewscript.pl | 29 +++++++- 4 files changed, 100 insertions(+), 12 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 3cae75327f..bb81ed4f35 100755 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -437,12 +437,11 @@ sub GetBiblioItemData { my ($biblioitemnumber) = @_; my $dbh = C4::Context->dbh; my $query = "SELECT *,biblioitems.notes AS bnotes - FROM biblio, biblioitems "; + FROM biblio LEFT JOIN biblioitems on biblio.biblionumber=biblioitems.biblioitemnumber "; unless(C4::Context->preference('item-level_itypes')) { $query .= "LEFT JOIN itemtypes on biblioitems.itemtype=itemtypes.itemtype "; } - $query .= " WHERE biblio.biblionumber = biblioitems.biblionumber - AND biblioitemnumber = ? "; + $query .= " WHERE biblioitemnumber = ? "; my $sth = $dbh->prepare($query); my $data; $sth->execute($biblioitemnumber); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl index f3b5dd5730..361a0ca4ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl @@ -9,6 +9,61 @@ $(document).ready(function() { $(window).load(function() { verify_patron_images(); }); +function uncheck_sibling(me){ +nodename=me.getAttribute("name"); +if (nodename =="barcodes[]"){ + var Node=me.parentNode.previousSibling; + while (Node.nodeName!="TD"){Node=Node.previousSibling} + var Nodes=Node.childNodes; + for (var i=0;i @@ -267,17 +322,19 @@ $(document).ready(function() { ">On Hold - " checked="checked" /> + " checked="checked" onClick="javascript:uncheck_sibling(this);" /> - " /> + " onClick="javascript:uncheck_sibling(this);" /> - " checked="checked" style="display: none;" /> - ">Check In + " onClick="javascript:uncheck_sibling(this);" /> Renewal Failed + + Return Failed + @@ -287,8 +344,11 @@ $(document).ready(function() {
- - + + + + +

Patron has nothing checked out.

diff --git a/members/moremember.pl b/members/moremember.pl index 8128d50e6c..13cd8ebc1c 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -61,9 +61,12 @@ my $input = new CGI; $debug or $debug = $input->param('debug') || 0; my $print = $input->param('print'); my @failedrenews = $input->param('failedrenew'); +my @failedreturns = $input->param('failedreturn'); my $error = $input->param('error'); my @renew_failed; -for (@failedrenews) { $renew_failed[$_] = 1; } +for my $renew (@failedrenews) { $renew_failed[$renew] = 1; } +my @return_failed; +for my $failedret (@failedreturns) { $return_failed[$failedret] = 1; } my $template_name; @@ -239,6 +242,7 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { my ( $restype, $reserves ) = CheckReserves( $issue->[$i]{'itemnumber'} ); $row{'norenew'} = ($restype) ? 1 : 0; $row{'renew_failed'} = $renew_failed[$issue->[$i]{'itemnumber'}]; + $row{'return_failed'} = $return_failed[$issue->[$i]{'barcode'}]; push( @issuedata, \%row ); } diff --git a/reserve/renewscript.pl b/reserve/renewscript.pl index 804f2fab95..b01c43eb13 100755 --- a/reserve/renewscript.pl +++ b/reserve/renewscript.pl @@ -24,9 +24,24 @@ use CGI; use C4::Circulation; +use C4::Auth; my $input = new CGI; +#Set Up User_env +# And assures user is loggedin and has correct accreditations. + +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "members/moremember.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { borrowers => 1 }, + debug => 1, + } +); + # # find items to renew, all items or a selection of items # @@ -38,7 +53,10 @@ if ($input->param('renew_all')) { else { @data = $input->param('items[]'); } +my @barcodes = $input->param('barcodes[]'); my $branch=$input->param('branch'); + +# warn "barcodes : @barcodes"; # # renew items # @@ -54,17 +72,24 @@ foreach my $itemno (@data) { $failedrenews.="&failedrenew=$itemno"; } } +my $failedreturn; +foreach my $barcode (@barcodes) { + # check status before renewing issue + my ( $returned, $messages, $issueinformation, $borrower ) = + AddReturn($barcode,$branch,1); + $failedreturn.="&failedreturn=$barcode" unless ($returned); +} # # redirection to the referrer page # if ($input->param('destination') eq "circ"){ print $input->redirect( - '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews + '/cgi-bin/koha/circ/circulation.pl?findborrower='.$cardnumber.$failedrenews.$failedreturn ); } else { print $input->redirect( - '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews + '/cgi-bin/koha/members/moremember.pl?borrowernumber='.$borrowernumber.$failedrenews.$failedreturn ); } -- 2.39.5