From 43334b8cec0d122a7386f1e667d7acb7db7fbcae Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Mon, 24 Dec 2007 01:40:42 -0500 Subject: [PATCH] bugfixing request.pl Major Fix: Fixing bug where 'expected' label existed for items that were 'waiting' Minor Cleanup: Show correct statuses Show itemtypes at correct levels depending on global system preference Display branch names, not branch codes Adding in visibility option for 'canreservefromotherbranches' syspref Signed-off-by: Joshua Ferraro --- C4/Auth.pm | 1 + .../prog/en/modules/reserve/request.tmpl | 70 ++++++++++--------- reserve/request.pl | 44 ++++++------ 3 files changed, 59 insertions(+), 56 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 5d8fbdd7ba..b76c3c4330 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -266,6 +266,7 @@ sub get_template_and_user { FRBRizeEditions => C4::Context->preference("FRBRizeEditions"), AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"), 'item-level_itypes' => C4::Context->preference('item-level_itypes'), + canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'), ); } else { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl index 7428d4fdb9..80f6bdc7df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl @@ -178,16 +178,31 @@ if (alreadyreserved > "0"){ + +
  • + +
  • + + " /> + " /> + +
    + + + +
    +
    1. Item type:
    2. Publication year:
    - - + +
    + @@ -195,10 +210,17 @@ if (alreadyreserved > "0"){ - "> + + -
    Hold Item type BarcodeLast Location Call number InformationCancel Hold
    + + " /> + + " /> + + " alt="" title=""/> @@ -222,38 +244,27 @@ if (alreadyreserved > "0"){ Due - - - - - - - Item on hold since - - - Item unavailable (lost or missing) + Unavailable (lost or missing) - This item is not for loan () + Not for loan () - - Item in transit from , - to , on + In transit from , + to , since - + - Can't be cancelled when item is on transfer - - Item on hold for - , expected at . &CancelBorrowerNumber=&CancelItemnumber=" onclick="if (window.confirm('Are you sure you want to delete this hold?')) {return true;} else {return false;}">Cancel hold - + Can't be cancelled when item is in transit + + WaitingOn hold + for "> atexpected at + since + . &CancelBorrowerNumber=&CancelItemnumber=" onclick="if (window.confirm('Are you sure you want to delete this hold?')) {return true;} else {return false;}">Cancel hold + Not on hold @@ -264,13 +275,6 @@ if (alreadyreserved > "0"){
    -

    - -

    - - " /> - " /> -
    diff --git a/reserve/request.pl b/reserve/request.pl index 96023c2b11..e6f8d5f2ef 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -52,6 +52,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( } ); +# get Branches and Itemtypes +my $branches = GetBranches(); +my $itemtypes = GetItemTypes(); + # get biblio information.... my $biblionumber = $input->param('biblionumber'); my $dat = GetBiblioData($biblionumber); @@ -214,51 +218,37 @@ my @itemnumbers = @{ get_itemnumbers_of($biblionumber)->{$biblionumber} }; my $iteminfos_of = GetItemInfosOf(@itemnumbers); foreach my $itemnumber (@itemnumbers) { - push( @branchcodes, - $iteminfos_of->{$itemnumber}->{homebranch}, - $iteminfos_of->{$itemnumber}->{holdingbranch} ); - my $biblioitemnumber = $iteminfos_of->{$itemnumber}->{biblioitemnumber}; push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber ); } -# @branchcodes = uniq @branchcodes; - my @biblioitemnumbers = keys %itemnumbers_of_biblioitem; -my $branchinfos_of = get_branchinfos_of(@branchcodes); my $notforloan_label_of = get_notforloan_label_of(); my $biblioiteminfos_of = GetBiblioItemInfosOf(@biblioitemnumbers); -my @itemtypes; -foreach my $biblioitemnumber (@biblioitemnumbers) { - push @itemtypes, $biblioiteminfos_of->{$biblioitemnumber}{itemtype}; -} - -my $itemtypeinfos_of = get_itemtypeinfos_of(@itemtypes); - my @bibitemloop; foreach my $biblioitemnumber (@biblioitemnumbers) { my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber}; $biblioitem->{description} = - $itemtypeinfos_of->{ $biblioitem->{itemtype} }{description}; + $itemtypes->{ $biblioitem->{itemtype} }{description}; foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } ) { my $item = $iteminfos_of->{$itemnumber}; - $item->{itypename} = $itemtypeinfos_of->{ $item->{itype} }{description}; - $item->{imageurl} = getitemtypeimagesrc() . "/".$itemtypeinfos_of->{ $item->{itype} }{imageurl}; + $item->{itypename} = $itemtypes->{ $item->{itype} }{description}; + $item->{imageurl} = getitemtypeimagesrc() . "/".$itemtypes->{ $item->{itype} }{imageurl}; $item->{homebranchname} = - $branchinfos_of->{ $item->{homebranch} }{branchname}; + $branches->{ $item->{homebranch} }{branchname}; # if the holdingbranch is different than the homebranch, we show the # holdingbranch of the document too if ( $item->{homebranch} ne $item->{holdingbranch} ) { $item->{holdingbranchname} = - $branchinfos_of->{ $item->{holdingbranch} }{branchname}; + $branches->{ $item->{holdingbranch} }{branchname}; } # add information @@ -282,7 +272,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { $item->{ReservedForBorrowernumber} = $reservedfor; $item->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'}; $item->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'}; - $item->{ExpectedAtLibrary} = $expectedAt; + $item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname}; } @@ -311,8 +301,8 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { if ( $transfertwhen ne '' ) { $item->{transfertwhen} = format_date($transfertwhen); $item->{transfertfrom} = - $branchinfos_of->{$transfertfrom}{branchname}; - $item->{transfertto} = $branchinfos_of->{$transfertto}{branchname}; + $branches->{$transfertfrom}{branchname}; + $item->{transfertto} = $branches->{$transfertto}{branchname}; $item->{nocancel} = 1; } @@ -330,6 +320,8 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { } } } + + # FIXME: every library will define this differently # An item is available only if: if ( not defined $reservedate # not reserved yet @@ -343,6 +335,13 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { $item->{available} = 1; } + # FIXME: need to indicate if the item is already waiting and if so, for whom and since when + my $dbh2 = C4::Context->dbh; + my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W' AND cancellationdate IS NULL"); + $sth2->execute($item->{ReservedForBorrowernumber},$item->{itemnumber}); + while (my $wait_hashref = $sth2->fetchrow_hashref) { + $item->{waitingdate} = format_date($wait_hashref->{waitingdate}); + } push @{ $biblioitem->{itemloop} }, $item; } @@ -351,7 +350,6 @@ foreach my $biblioitemnumber (@biblioitemnumbers) { # existingreserves building my @reserveloop; -my $branches = GetBranches(); ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber); foreach my $res ( sort { $a->{found} cmp $b->{found} } @$reserves ) { my %reserve; -- 2.39.5