Delivered-To: oleonard@myacpl.org Received: by 10.220.45.75 with SMTP id d11cs975744vcf; Sat, 30 May 2009 16:03:47 -0700 (PDT) Received: by 10.210.10.8 with SMTP id 8mr2044236ebj.26.1243724625959; Sat, 30 May 2009 16:03:45 -0700 (PDT) Return-Path: Received: from koha.paulpoulain.com (paulpoulain.com [212.85.152.90]) by mx.google.com with ESMTP id 22si4331027ewy.40.2009.05.30.16.03.45; Sat, 30 May 2009 16:03:45 -0700 (PDT) Received-SPF: neutral (google.com: 212.85.152.90 is neither permitted nor denied by best guess record for domain of koha-patches-bounces@lists.koha.org) client-ip=212.85.152.90; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.85.152.90 is neither permitted nor denied by best guess record for domain of koha-patches-bounces@lists.koha.org) smtp.mail=koha-patches-bounces@lists.koha.org Received: from localhost (localhost [127.0.0.1]) by koha.paulpoulain.com (Postfix) with ESMTP id EB3CA2ADA7; Sun, 31 May 2009 01:03:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at koha Received: from koha.paulpoulain.com ([127.0.0.1]) by localhost (listes.koha-fr.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NSFbOnoB90y7; Sun, 31 May 2009 01:03:41 +0200 (CEST) Received: from koha.paulpoulain.com (localhost [127.0.0.1]) by koha.paulpoulain.com (Postfix) with ESMTP id 7BEED2AD90; Sun, 31 May 2009 01:03:41 +0200 (CEST) X-Original-To: koha-patches@lists.koha.org Delivered-To: koha-patches@lists.koha.org Received: from localhost (localhost [127.0.0.1]) by koha.paulpoulain.com (Postfix) with ESMTP id 1DD102AD82 for ; Sun, 31 May 2009 01:03:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at koha Received: from koha.paulpoulain.com ([127.0.0.1]) by localhost (listes.koha-fr.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7r4E4HtUSzkq for ; Sun, 31 May 2009 01:03:35 +0200 (CEST) Received: from mail-ew0-f207.google.com (mail-ew0-f207.google.com [209.85.219.207]) by koha.paulpoulain.com (Postfix) with ESMTP id 11EDF2AD90 for ; Sun, 31 May 2009 01:03:35 +0200 (CEST) Received: by ewy3 with SMTP id 3so6909120ewy.20 for ; Sat, 30 May 2009 16:03:34 -0700 (PDT) Received: by 10.210.39.2 with SMTP id m2mr2036941ebm.30.1243724614612; Sat, 30 May 2009 16:03:34 -0700 (PDT) X-Forwarded-To: koha-patches@lists.koha.org X-Forwarded-For: patches@koha.org koha-patches@lists.koha.org Delivered-To: patches@koha.org Received: by 10.210.71.19 with SMTP id t19cs148735eba; Sat, 30 May 2009 16:03:33 -0700 (PDT) Received: by 10.151.79.20 with SMTP id g20mr8308834ybl.90.1243724612360; Sat, 30 May 2009 16:03:32 -0700 (PDT) Received: from ryansmac.local (71-20-182-182.war.clearwire-wmx.net [71.20.182.182]) by mx.google.com with ESMTP id 25si2827645gxk.46.2009.05.30.16.03.31; Sat, 30 May 2009 16:03:32 -0700 (PDT) Received-SPF: neutral (google.com: 71.20.182.182 is neither permitted nor denied by best guess record for domain of rch@ryansmac.local) client-ip=71.20.182.182; Authentication-Results: mx.google.com; spf=neutral (google.com: 71.20.182.182 is neither permitted nor denied by best guess record for domain of rch@ryansmac.local) smtp.mail=rch@ryansmac.local Received: by ryansmac.local (Postfix, from userid 502) id 7BD003F92DC; Sat, 30 May 2009 16:03:29 -0700 (PDT) From: Ryan Higgins To: patches@koha.org Date: Sat, 30 May 2009 16:03:29 -0700 Message-Id: <1243724609-31102-1-git-send-email-rch@liblime.com> X-Mailer: git-send-email 1.5.6.2 Subject: [Koha-patches] [PATCH] Bug 3146: OPAC Holds broken in Single Branch Mode. X-BeenThere: koha-patches@lists.koha.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: koha-patches-bounces@lists.koha.org Errors-To: koha-patches-bounces@lists.koha.org Forces branch definition in multi-hold processing. Also (somewhat arbitrarily) limits the number of holds that can be simultaneously processed to either the maxReserves syspref or 36 if that's not defined. --- .../opac-tmpl/prog/en/modules/opac-reserve.tmpl | 5 ++- opac/opac-reserve.pl | 43 ++++++-------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl index 4e015a2..d05acf5 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl @@ -110,6 +110,7 @@ // Find the items with the 'Hold' box checked var badBib = null; + var i = 0; $(".confirmjs:checked").each(function() { var biblioNum = $(this).val(); biblionumbers += biblioNum + "/"; @@ -133,7 +134,9 @@ if (branchSel.size() > 0) { selections += $(branchSel).val(); } - selections += "/"; + if(++i < $(".confirmjs:checked").length){ + selections += "/"; + } return true; }); diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 4395f38..ea39c5f 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -33,6 +33,7 @@ use C4::Debug; # use Data::Dumper; my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); +my $MAX_SIMULTANEOUS_RESERVES = ($MAXIMUM_NUMBER_OF_RESERVES > 36) ? 36 : $MAXIMUM_NUMBER_OF_RESERVES; my $query = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( @@ -92,20 +93,12 @@ my $branch = $query->param('branch') || C4::Context->userenv->{branch} || '' ; ($branches->{$branch}) or $branch = ""; # Confirm branch is real $template->param( branch => $branch ); +my $singleBranchMode = C4::Context->preference('singleBranchMode'); + # make branch selection options... my $CGIbranchloop = GetBranchesLoop($branch); $template->param( CGIbranch => $CGIbranchloop ); -#Debug -#output_html_with_http_headers($query,$cookie," @biblionumbers \n"); -#exit; -#my %bibdata; -#my $rank; -#my $biblionumber; -#my $bibdata; -#my %itemhash; -#my $forloan; - # # # Build hashes of the requested biblio(item)s and items. @@ -155,7 +148,6 @@ if ( $query->param('place_reserve') ) { # List is composed of alternating biblio/item/branch my $selectedItems = $query->param('selecteditems'); - if ($query->param('reserve_mode') eq 'single') { # This indicates non-JavaScript mode, so there was # only a single biblio number selected. @@ -165,15 +157,15 @@ if ( $query->param('place_reserve') ) { $item = ''; } my $branch = $query->param('branch'); - $selectedItems = "$bib/$item/$branch/"; + $selectedItems = "$bib/$item/$branch"; } - - my @selectedItems = split /\//, $selectedItems; + my @selectedItems = split(/\//, $selectedItems, $MAX_SIMULTANEOUS_RESERVES); + # split's limit param forces trailing empty strings to be included in array. # Make sure there is a biblionum/itemnum/branch triplet for each item. - # The itemnum can be 'any', meaning next available. - my $selectionCount = @selectedItems; - if (($selectionCount == 0) || (($selectionCount % 3) != 0)) { + # The itemnum can be '', meaning next available. + my $selectionCount = scalar @selectedItems; + if (($selectionCount == 0) || ($selectionCount % 3)) { $template->param(message=>1, bad_data=>1); &get_out($query, $cookie, $template->output); } @@ -181,12 +173,7 @@ if ( $query->param('place_reserve') ) { while (@selectedItems) { my $biblioNum = shift(@selectedItems); my $itemNum = shift(@selectedItems); - my $branch = shift(@selectedItems); # i.e., branch code, not name - - my $singleBranchMode = $template->param('singleBranchMode'); - if ($singleBranchMode) { - $branch = $borr->{'branchcode'}; - } + my $branch = ($singleBranchMode) ? $borr->{'branchcode'} : shift(@selectedItems); my $biblioData = $biblioDataHash{$biblioNum}; my $found; @@ -454,13 +441,9 @@ if ( $numBibsAvailable == 0 ) { $template->param( none_available => 1, message => 1 ); } -my $itemTableColspan = 5; -if (!$template->param('OPACItemHolds')) { - $itemTableColspan--; -} -if ($template->param('singleBranchMode')) { - $itemTableColspan--; -} +my $itemTableColspan = ($template->param('OPACItemHolds')) ? 4 : 5 ; +$singleBranchMode and $itemTableColspan--; + $template->param(itemtable_colspan => $itemTableColspan); # display infos -- 1.5.6.2 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha.org http://lists.koha.org/mailman/listinfo/koha-patches