koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/opac opac-reserve.pl,1.14,1.15


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/opac opac-reserve.pl,1.14,1.15
Date: Mon, 05 May 2003 04:21:33 -0700

Update of /cvsroot/koha/koha/opac
In directory sc8-pr-cvs1:/tmp/cvs-serv15430/opac

Modified Files:
        opac-reserve.pl 
Log Message:
fix for 394

Index: opac-reserve.pl
===================================================================
RCS file: /cvsroot/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** opac-reserve.pl     29 Apr 2003 16:51:54 -0000      1.14
--- opac-reserve.pl     5 May 2003 11:21:31 -0000       1.15
***************
*** 17,24 ****
  my $MAXIMUM_NUMBER_OF_RESERVES = 5;
  
- my $MAXIMUM_NUMBER_OF_RESERVES = 10;
- 
  my $query = new CGI;
! my ($template, $borrowernumber, $cookie) 
      = get_template_and_user({template_name => "opac-reserve.tmpl",
                             query => $query,
--- 17,22 ----
  my $MAXIMUM_NUMBER_OF_RESERVES = 5;
  
  my $query = new CGI;
! my ($template, $borrowernumber, $cookie)
      = get_template_and_user({template_name => "opac-reserve.tmpl",
                             query => $query,
***************
*** 56,60 ****
  $template->param(rank => $rank);
  
- 
  # pass the pickup branch along....
  my $branch = $query->param('branch');
--- 54,57 ----
***************
*** 66,82 ****
  
  # make branch selection options...
! my $branchoptions = '';
  my @branches;
! foreach my $br (keys %$branches) {
!     #(next) unless $branches->{$br}->{'IS'}; # FIXME disabled to fix bug 202
!     my $selected = "";
!     if ($br eq $branch) {
!       $selected = "selected";
!     }
!     $branchoptions .= "<option value=$br 
$selected>$branches->{$br}->{'branchname'}</option>\n";
!     push @branches, {branchcode => $br, branchname => 
$branches->{$br}->{'branchname'}, selected => $selected};
! }
! $template->param( branchoptions => $branchoptions);
! $template->param(BRANCHES => address@hidden);
  
  #### THIS IS A BIT OF A HACK BECAUSE THE BIBLIOITEMS DATA IS A LITTLE MESSED 
UP!
--- 63,81 ----
  
  # make branch selection options...
! #my $branchoptions = '';
  my @branches;
! my @select_branch;
! my %select_branches;
! 
! foreach my $branch (keys %$branches) {
!       push @select_branch, $branch;
!       $select_branches{$branch} = $branches->{$branch}->{'branchname'};
! }
! my $CGIbranch=CGI::scrolling_list( -name     => 'branch',
!                       -values   => address@hidden,
!                       -labels   => \%select_branches,
!                       -size     => 1,
!                       -multiple => 0 );
! $template->param( CGIbranch => $CGIbranch);
  
  #### THIS IS A BIT OF A HACK BECAUSE THE BIBLIOITEMS DATA IS A LITTLE MESSED 
UP!
***************
*** 173,256 ****
  
  if ($query->param('item_types_selected')) {
! # this is what happens after the itemtypes have been selected. Stage 2
!     my @itemtypes = $query->param('itemtype');
!     my $fee = 0;
!     my $proceed = 0;
!     if (@itemtypes) {
!       my %newtypes;
!       foreach my $itmtype (@itemtypes) {
!           $newtypes{$itmtype} = $itemtypes{$itmtype};
        }
!       my @types = values %newtypes;
!       $template->param(TYPES => address@hidden);
        foreach my $type (@itemtypes) {
!           my @reqbibs;
!           foreach my $item (@items) {
                if ($item->{'itemtype'} eq $type) {
!                   push @reqbibs, $item->{'biblioitemnumber'};
                }
!           }
!           $fee += 
CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',address@hidden);
        }
!       $proceed = 1;
!     } elsif ($query->param('all')) {
!       $template->param(all => 1);
!       $fee = 1;
!       $proceed = 1;
!     }
!     if ($proceed) {
!       $fee = sprintf "%.02f", $fee;
!       $template->param(fee => $fee);
!       $template->param(item_types_selected => 1);
!     } else {
!       $template->param(message => 1);
!       $template->param(no_items_selected => 1);
!     }
! 
! 
! } elsif ($query->param('place_reserve')) {
! # here we actually do the reserveration. Stage 3.
!     my $title = $bibdata->{'title'};
!     my @itemtypes = $query->param('itemtype');
!     foreach my $type (@itemtypes) {
!       my @reqbibs;
!       foreach my $item (@items) {
!           if ($item->{'itemtype'} eq $type) {
!               push @reqbibs, $item->{'biblioitemnumber'};
!           }
        }
!       
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',address@hidden,$rank,'',$title);
!     }
!     if ($query->param('all')) {
!       CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef, 
$rank,'',$title);
!     }
!     print $query->redirect("/cgi-bin/koha/opac-user.pl");
  } else {
! # Here we check that the borrower can actually make reserves Stage 1.
!     my $noreserves = 0;
!     if ($borr->{'amountoutstanding'} > 5) {
!       my $amount = sprintf "\$%.02f", $borr->{'amountoutstanding'};
!       $template->param(message => 1);
!       $noreserves = 1;
!       $template->param(too_much_oweing => $amount);
!     }
!     my ($resnum, $reserves) = FindReserves('', $borrowernumber);
!     $template->param(RESERVES => $reserves);
!     if ($resnum >= $MAXIMUM_NUMBER_OF_RESERVES) {
!       $template->param(message => 1);
!       $noreserves = 1;
!       $template->param(too_many_reserves => $resnum);
!     }
!     foreach my $res (@$reserves) {
!       if ($res->{'biblionumber'} == $biblionumber) {
!           $template->param(message => 1);
!           $noreserves = 1;
!           $template->param(already_reserved => 1);
        }
-     }
-     unless ($noreserves) {
-       $template->param(TYPES => address@hidden);
-       $template->param(select_item_types => 1);
-     }
  }
  
--- 172,255 ----
  
  if ($query->param('item_types_selected')) {
!       # this is what happens after the itemtypes have been selected. Stage 2
!       my @itemtypes = $query->param('itemtype');
!       my $fee = 0;
!       my $proceed = 0;
!       if (@itemtypes) {
!               my %newtypes;
!               foreach my $itmtype (@itemtypes) {
!               $newtypes{$itmtype} = $itemtypes{$itmtype};
!               }
!               my @types = values %newtypes;
!               $template->param(TYPES => address@hidden);
!               foreach my $type (@itemtypes) {
!               my @reqbibs;
!               foreach my $item (@items) {
!                       if ($item->{'itemtype'} eq $type) {
!                       push @reqbibs, $item->{'biblioitemnumber'};
!                       }
!               }
!               $fee += 
CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',address@hidden);
!               }
!               $proceed = 1;
!       } elsif ($query->param('all')) {
!               $template->param(all => 1);
!               $fee = 1;
!               $proceed = 1;
!       }
!       warn "branch :$branch:";
!       if ($proceed && $branch) {
!               $fee = sprintf "%.02f", $fee;
!               $template->param(fee => $fee);
!               $template->param(item_types_selected => 1);
!       } else {
!               $template->param(message => 1);
!               $template->param(no_items_selected => 1) unless ($proceed);
!               $template->param(no_branch_selected =>1) unless ($branch);
        }
! } elsif ($query->param('place_reserve')) {
!       # here we actually do the reserveration. Stage 3.
!       my $title = $bibdata->{'title'};
!       my @itemtypes = $query->param('itemtype');
        foreach my $type (@itemtypes) {
!               my @reqbibs;
!               foreach my $item (@items) {
                if ($item->{'itemtype'} eq $type) {
!                       push @reqbibs, $item->{'biblioitemnumber'};
!               }
                }
!               
CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',address@hidden,$rank,'',$title);
        }
!       if ($query->param('all')) {
!               CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', 
undef, $rank,'',$title);
        }
!       print $query->redirect("/cgi-bin/koha/opac-user.pl");
  } else {
!       # Here we check that the borrower can actually make reserves Stage 1.
!       my $noreserves = 0;
!       if ($borr->{'amountoutstanding'} > 5) {
!               my $amount = sprintf "\$%.02f", $borr->{'amountoutstanding'};
!               $template->param(message => 1);
!               $noreserves = 1;
!               $template->param(too_much_oweing => $amount);
!       }
!       my ($resnum, $reserves) = FindReserves('', $borrowernumber);
!       $template->param(RESERVES => $reserves);
!       if ($resnum >= $MAXIMUM_NUMBER_OF_RESERVES) {
!               $template->param(message => 1);
!               $noreserves = 1;
!               $template->param(too_many_reserves => $resnum);
!       }
!       foreach my $res (@$reserves) {
!               if ($res->{'biblionumber'} == $biblionumber) {
!               $template->param(message => 1);
!               $noreserves = 1;
!               $template->param(already_reserved => 1);
!               }
!       }
!       unless ($noreserves) {
!               $template->param(TYPES => address@hidden);
!               $template->param(select_item_types => 1);
        }
  }
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]