From d59352175cc03a397ae75bd71756e9a0cc35d972 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 5 May 2003 11:21:31 +0000 Subject: [PATCH] fix for 394 --- .../opac-tmpl/default/en/opac-reserve.tmpl | 7 +- .../opac-tmpl/default/fr/opac-reserve.tmpl | 201 +++++++++--------- opac/opac-reserve.pl | 173 ++++++++------- 3 files changed, 190 insertions(+), 191 deletions(-) diff --git a/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl index 7f84802613..1439a2721e 100644 --- a/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl +++ b/koha-tmpl/opac-tmpl/default/en/opac-reserve.tmpl @@ -16,17 +16,18 @@ Sorry, you cannot make more than reserves. You already have a reserve placed on this item. You must select at least on item type! + You must select a branch for pickup!

-

Reserve page for item: ( )

+

Reserve page for item: ( )

There are reserves already on this item.

Please select which item types are ok for you. The first of these item that matches one of these types that becomes available will be set kept for you.

- + "> @@ -47,7 +48,7 @@
Request

Please select the branch from which you want to collect the item: -
+

diff --git a/koha-tmpl/opac-tmpl/default/fr/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/default/fr/opac-reserve.tmpl index ff9b270fbc..b5ced47978 100755 --- a/koha-tmpl/opac-tmpl/default/fr/opac-reserve.tmpl +++ b/koha-tmpl/opac-tmpl/default/fr/opac-reserve.tmpl @@ -1,101 +1,100 @@ - - -
- - -

Connecté: [Accueil usagers][Déconnexion]

- -

Se connecter à Koha

-
- - -
- -
-Désolé, vous ne pouvez pas réserver, vous avez une amende de . -Désolé, vous ne pouvez pas faire plus de réservations. -Vous avez déjà une réservation en cours pour ce document. -Vous devez sélectionner au moins un type de document! -

- - - - - - -

-Réservation du document suivant: ( ) -

-

Il y a déjà réservations pour ce document.

-

-Veuillez sélectionner les types de documents qui vous conviennent. Le premier document qui correspond à l'un de ces types sera mis de côté pour vous. -

- - - - - - - - - - - - - - - - - - - - - - -
RéservationType de documentExemplaires
Exclu du prêt
-Veuillez sélectionner la bibliothèque dans laquelle vous voulez retirer le document: -
- - - - -

- - - - - - -

-Veuillez confirmer que vous souhaitez réserver ces types de documents: -

- -

- - - - - - - - - - - - - - -
Type de document
- -Qui devra être retiré à la bibliothèque : .
- - - -
Attention, il y aura des frais de réservation de
-
- - - -
- -
+ + +
+ + +

Connecté: [Accueil usagers][Déconnexion]

+ +

Se connecter à Koha

+
+ + + + +
+Désolé, vous ne pouvez pas réserver, vous avez une amende de . +Désolé, vous ne pouvez pas faire plus de réservations. +Vous avez déjà une réservation en cours pour ce document. +Vous devez sélectionner au moins un type de document! +Vous devez sélectionner une bibliothèque où prendre le document!

+
+ + + + + +

+Réservation du document suivant: ( ) +

+

Il y a déjà réservations pour ce document.

+

+Veuillez sélectionner les types de documents qui vous conviennent. Le premier document qui correspond à l'un de ces types sera mis de côté pour vous. +

+ +

+ + + + + + + + + + + + + + + + + + + + +
RéservationType de documentExemplaires
Exclu du prêt
+Veuillez sélectionner la bibliothèque dans laquelle vous voulez retirer le document: +
+ + + + + +
+ + + + +

+Veuillez confirmer que vous souhaitez réserver ces types de documents: +

+ +

+ + + + + + + + + + + + + + +
Type de document
+ +Qui devra être retiré à la bibliothèque : .
+ + + +
Attention, il y aura des frais de réservation de
+
+ + + +
+ +
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 0c23b768d1..58015da747 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -16,10 +16,8 @@ use C4::Date; my $MAXIMUM_NUMBER_OF_RESERVES = 5; -my $MAXIMUM_NUMBER_OF_RESERVES = 10; - my $query = new CGI; -my ($template, $borrowernumber, $cookie) +my ($template, $borrowernumber, $cookie) = get_template_and_user({template_name => "opac-reserve.tmpl", query => $query, type => "opac", @@ -55,7 +53,6 @@ foreach my $res (@$reserves) { $rank++; $template->param(rank => $rank); - # pass the pickup branch along.... my $branch = $query->param('branch'); $template->param(branch => $branch); @@ -65,19 +62,21 @@ $template->param(branchname => $branches->{$branch}->{'branchname'}); # make branch selection options... -my $branchoptions = ''; +#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 .= "\n"; - push @branches, {branchcode => $br, branchname => $branches->{$br}->{'branchname'}, selected => $selected}; +my @select_branch; +my %select_branches; + +foreach my $branch (keys %$branches) { + push @select_branch, $branch; + $select_branches{$branch} = $branches->{$branch}->{'branchname'}; } -$template->param( branchoptions => $branchoptions); -$template->param(BRANCHES => \@branches); +my $CGIbranch=CGI::scrolling_list( -name => 'branch', + -values => \@select_branch, + -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! # get the itemtype data.... @@ -172,86 +171,86 @@ $width = 2*$width -1; $template->param(totalwidth => 2*$width-1); 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}; + # 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 => \@types); + 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',\@reqbibs); + } + $proceed = 1; + } elsif ($query->param('all')) { + $template->param(all => 1); + $fee = 1; + $proceed = 1; } - my @types = values %newtypes; - $template->param(TYPES => \@types); + 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) { + my @reqbibs; + foreach my $item (@items) { if ($item->{'itemtype'} eq $type) { - push @reqbibs, $item->{'biblioitemnumber'}; + push @reqbibs, $item->{'biblioitemnumber'}; + } } - } - $fee += CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',\@reqbibs); + CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title); } - $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'}; - } + if ($query->param('all')) { + CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef, $rank,'',$title); } - CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title); - } - if ($query->param('all')) { - CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef, $rank,'',$title); - } - print $query->redirect("/cgi-bin/koha/opac-user.pl"); + 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); + # 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 => \@types_old); + $template->param(select_item_types => 1); } - } - unless ($noreserves) { - $template->param(TYPES => \@types_old); - $template->param(select_item_types => 1); - } } # check that you can actually make the reserve. -- 2.39.5