fix for 394
This commit is contained in:
parent
fa5d7968a2
commit
d59352175c
3 changed files with 192 additions and 193 deletions
|
@ -16,17 +16,18 @@
|
|||
<TMPL_IF NAME="too_many_reserves">Sorry, you cannot make more than <TMPL_VAR NAME="too_many_reserves"> reserves. </TMPL_IF>
|
||||
<TMPL_IF NAME="already_reserved">You already have a reserve placed on this item.</TMPL_IF>
|
||||
<TMPL_IF NAME="no_items_selected">You must select at least on item type!</TMPL_IF>
|
||||
<TMPL_IF NAME="no_branch_selected">You must select a branch for pickup!</TMPL_IF>
|
||||
</B></font><P></td></tr></table>
|
||||
</TMPL_IF>
|
||||
<TMPL_IF NAME="select_item_types">
|
||||
<!-- The first time round you select which bibitems you want -->
|
||||
<p>Reserve page for item: <b><TMPL_VAR NAME="title"> ( <TMPL_VAR NAME="author"> )</b></p>
|
||||
<p>Reserve page for item: <b><TMPL_VAR NAME="title"> ( <TMPL_VAR NAME="author"> <TMPL_VAR name="biblionumber">)</b></p>
|
||||
<p> There are <b><TMPL_VAR NAME="rank"></b> reserves already on this item. </p>
|
||||
<p>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.<p>
|
||||
|
||||
<FORM ACTION="/cgi-bin/koha/opac-reserve.pl" method=post>
|
||||
<input type="hidden" name="item_types_selected" value="1">
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='biblionumber'>">
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR name="biblionumber">">
|
||||
<TABLE border=1>
|
||||
<tr bgcolor="#99cccc" background='<TMPL_VAR NAME="themelang">/images/background-opac.gif'>
|
||||
<th>Request</th>
|
||||
|
@ -47,7 +48,7 @@
|
|||
</table>
|
||||
<p>
|
||||
Please select the branch from which you want to collect the item:
|
||||
<select name="branch"><TMPL_VAR NAME="branchoptions"></select><br>
|
||||
<TMPL_VAR NAME="CGIbranch"><br>
|
||||
<p>
|
||||
<table border=0 cellpadding=0 cellspacing=0>
|
||||
<tr>
|
||||
|
|
|
@ -1,101 +1,100 @@
|
|||
<TMPL_INCLUDE NAME="members-top.inc">
|
||||
|
||||
<center>
|
||||
|
||||
<TMPL_IF NAME="loggedinuser">
|
||||
<p align=left>Connecté: <TMPL_VAR NAME="loggedinuser"> [<a href=/cgi-bin/koha/opac-user.pl>Accueil usagers</a>][<a href=/cgi-bin/koha/opac-logout.pl>Déconnexion</a>]</p>
|
||||
<TMPL_ELSE>
|
||||
<p align=left><a href=/cgi-bin/koha/opac-user.pl>Se connecter</a> à Koha</p>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF NAME="message">
|
||||
<table cellpadding=5 cellspacing=0 border=1 >
|
||||
<tr bgcolor="#fecc99" >
|
||||
<td><font face="arial,helvetica" color="red" size=+1><B>
|
||||
<TMPL_IF NAME="too_much_oweing">Désolé, vous ne pouvez pas réserver, vous avez une amende de <TMPL_VAR NAME="too_much_oweing">. </TMPL_IF>
|
||||
<TMPL_IF NAME="too_many_reserves">Désolé, vous ne pouvez pas faire plus de <TMPL_VAR NAME="too_many_reserves"> réservations. </TMPL_IF>
|
||||
<TMPL_IF NAME="already_reserved">Vous avez déjà une réservation en cours pour ce document.</TMPL_IF>
|
||||
<TMPL_IF NAME="no_items_selected">Vous devez sélectionner au moins un type de document!</TMPL_IF>
|
||||
</B></font><P></td></tr></table>
|
||||
</TMPL_IF>
|
||||
|
||||
|
||||
<TMPL_IF NAME="select_item_types">
|
||||
<!-- The first time round you select which biblitems you want -->
|
||||
|
||||
<p>
|
||||
Réservation du document suivant: <b><TMPL_VAR NAME="title"> ( <TMPL_VAR NAME="author"> )</b>
|
||||
</p>
|
||||
<p> Il y a déjà <b><TMPL_VAR NAME="rank"></b> réservations pour ce document. </p>
|
||||
<p>
|
||||
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.
|
||||
<p>
|
||||
|
||||
<FORM ACTION="/cgi-bin/koha/opac-reserve.pl" method=post>
|
||||
<input type="hidden" name="item_types_selected" value="1">
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='biblionumber'>">
|
||||
<TABLE border=1>
|
||||
<tr bgcolor="#99cccc" background='<TMPL_VAR NAME="themelang">/images/background-opac.gif'><th>Réservation</th><th>Type de document</th><th>Exemplaires</th></tr>
|
||||
|
||||
<TMPL_LOOP NAME="TYPES">
|
||||
|
||||
<tr>
|
||||
<TMPL_UNLESS NAME="notforloan">
|
||||
<td><input type="checkbox" name="itemtype" value="<TMPL_VAR NAME='itemtype'>"></td>
|
||||
<TMPL_ELSE>
|
||||
<td>Exclu du prêt</td>
|
||||
</TMPL_UNLESS>
|
||||
<td><TMPL_VAR NAME="description"></td>
|
||||
<td><TMPL_VAR NAME="copies"></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</TMPL_LOOP>
|
||||
|
||||
</table>
|
||||
Veuillez sélectionner la bibliothèque dans laquelle vous voulez retirer le document:
|
||||
<select name="branch"><TMPL_VAR NAME="branchoptions"></select><br>
|
||||
|
||||
|
||||
<font size=4 face="arial,helvetica"><INPUT type="submit" value="Submit"></font>
|
||||
|
||||
</FORM>
|
||||
|
||||
</TMPL_IF>
|
||||
|
||||
<!-- if the bibitems have already been selected -->
|
||||
<TMPL_IF NAME="item_types_selected">
|
||||
|
||||
<p>
|
||||
Veuillez confirmer que vous souhaitez réserver ces types de documents:
|
||||
<p>
|
||||
|
||||
<FORM ACTION="/cgi-bin/koha/opac-reserve.pl" method=post>
|
||||
<input type="hidden" name="place_reserve" value="1">
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='biblionumber'>">
|
||||
<TABLE border=1>
|
||||
<tr><th bgcolor="#99cccc" background='<TMPL_VAR NAME="themelang">/images/background-opac.gif'>Type de document</th></tr>
|
||||
|
||||
<TMPL_LOOP NAME="TYPES">
|
||||
|
||||
<tr>
|
||||
<input type="hidden" name="itemtype" value="<TMPL_VAR NAME='itemtype'>"></td>
|
||||
<td><TMPL_VAR NAME="description"></td>
|
||||
</tr>
|
||||
|
||||
</TMPL_LOOP>
|
||||
|
||||
</table>
|
||||
|
||||
Qui devra être retiré à la bibliothèque : <b><TMPL_VAR NAME="branchname"></b>.<br>
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='branch'>">
|
||||
|
||||
<TMPL_IF NAME="fee">
|
||||
<br>Attention, il y aura des frais de réservation de <b><TMPL_VAR NAME="fee">€</b><br>
|
||||
</TMPL_IF>
|
||||
|
||||
<font size=4 face="arial,helvetica"><INPUT type="submit" value="Réserver"></font>
|
||||
|
||||
</FORM>
|
||||
|
||||
</TMPL_IF>
|
||||
<TMPL_INCLUDE NAME="members-top.inc">
|
||||
|
||||
<center>
|
||||
|
||||
<TMPL_IF NAME="loggedinuser">
|
||||
<p align=left>Connecté: <TMPL_VAR NAME="loggedinuser"> [<a href=/cgi-bin/koha/opac-user.pl>Accueil usagers</a>][<a href=/cgi-bin/koha/opac-logout.pl>Déconnexion</a>]</p>
|
||||
<TMPL_ELSE>
|
||||
<p align=left><a href=/cgi-bin/koha/opac-user.pl>Se connecter</a> à Koha</p>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF NAME="message">
|
||||
<table cellpadding=5 cellspacing=0 border=1 >
|
||||
<tr bgcolor="#fecc99" >
|
||||
<td><font face="arial,helvetica" color="red" size=+1><B>
|
||||
<TMPL_IF NAME="too_much_oweing">Désolé, vous ne pouvez pas réserver, vous avez une amende de <TMPL_VAR NAME="too_much_oweing">. </TMPL_IF>
|
||||
<TMPL_IF NAME="too_many_reserves">Désolé, vous ne pouvez pas faire plus de <TMPL_VAR NAME="too_many_reserves"> réservations. </TMPL_IF>
|
||||
<TMPL_IF NAME="already_reserved">Vous avez déjà une réservation en cours pour ce document.</TMPL_IF>
|
||||
<TMPL_IF NAME="no_items_selected">Vous devez sélectionner au moins un type de document!</TMPL_IF>
|
||||
<TMPL_IF NAME="no_items_selected">Vous devez sélectionner une bibliothèque où prendre le document!</TMPL_IF></B></font><P></td></tr></table>
|
||||
</TMPL_IF>
|
||||
|
||||
|
||||
<TMPL_IF NAME="select_item_types">
|
||||
<!-- The first time round you select which biblitems you want -->
|
||||
|
||||
<p>
|
||||
Réservation du document suivant: <b><TMPL_VAR NAME="title"> ( <TMPL_VAR NAME="author"> )</b>
|
||||
</p>
|
||||
<p> Il y a déjà <b><TMPL_VAR NAME="rank"></b> réservations pour ce document. </p>
|
||||
<p>
|
||||
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.
|
||||
<p>
|
||||
|
||||
<FORM ACTION="/cgi-bin/koha/opac-reserve.pl" method=post>
|
||||
<input type="hidden" name="item_types_selected" value="1">
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='biblionumber'>">
|
||||
<TABLE border=1>
|
||||
<tr bgcolor="#99cccc" background='<TMPL_VAR NAME="themelang">/images/background-opac.gif'><th>Réservation</th><th>Type de document</th><th>Exemplaires</th></tr>
|
||||
|
||||
<TMPL_LOOP NAME="TYPES">
|
||||
|
||||
<tr>
|
||||
<TMPL_UNLESS NAME="notforloan">
|
||||
<td><input type="checkbox" name="itemtype" value="<TMPL_VAR NAME='itemtype'>"></td>
|
||||
<TMPL_ELSE>
|
||||
<td>Exclu du prêt</td>
|
||||
</TMPL_UNLESS>
|
||||
<td><TMPL_VAR NAME="description"></td>
|
||||
<td><TMPL_VAR NAME="copies"></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</TMPL_LOOP>
|
||||
|
||||
</table>
|
||||
Veuillez sélectionner la bibliothèque dans laquelle vous voulez retirer le document:
|
||||
<TMPL_VAR NAME="CGIbranch"><br>
|
||||
|
||||
<font size=4 face="arial,helvetica"><INPUT type="submit" value="Submit"></font>
|
||||
|
||||
</FORM>
|
||||
|
||||
</TMPL_IF>
|
||||
|
||||
<!-- if the bibitems have already been selected -->
|
||||
<TMPL_IF NAME="item_types_selected">
|
||||
|
||||
<p>
|
||||
Veuillez confirmer que vous souhaitez réserver ces types de documents:
|
||||
<p>
|
||||
|
||||
<FORM ACTION="/cgi-bin/koha/opac-reserve.pl" method=post>
|
||||
<input type="hidden" name="place_reserve" value="1">
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='biblionumber'>">
|
||||
<TABLE border=1>
|
||||
<tr><th bgcolor="#99cccc" background='<TMPL_VAR NAME="themelang">/images/background-opac.gif'>Type de document</th></tr>
|
||||
|
||||
<TMPL_LOOP NAME="TYPES">
|
||||
|
||||
<tr>
|
||||
<input type="hidden" name="itemtype" value="<TMPL_VAR NAME='itemtype'>"></td>
|
||||
<td><TMPL_VAR NAME="description"></td>
|
||||
</tr>
|
||||
|
||||
</TMPL_LOOP>
|
||||
|
||||
</table>
|
||||
|
||||
Qui devra être retiré à la bibliothèque : <b><TMPL_VAR NAME="branchname"></b>.<br>
|
||||
<input type="hidden" name="bib" value="<TMPL_VAR NAME='branch'>">
|
||||
|
||||
<TMPL_IF NAME="fee">
|
||||
<br>Attention, il y aura des frais de réservation de <b><TMPL_VAR NAME="fee">€</b><br>
|
||||
</TMPL_IF>
|
||||
|
||||
<font size=4 face="arial,helvetica"><INPUT type="submit" value="Réserver"></font>
|
||||
|
||||
</FORM>
|
||||
|
||||
</TMPL_IF>
|
||||
|
|
|
@ -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 .= "<option value=$br $selected>$branches->{$br}->{'branchname'}</option>\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};
|
||||
}
|
||||
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'};
|
||||
# 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};
|
||||
}
|
||||
}
|
||||
$fee += CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',\@reqbibs);
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
$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'};
|
||||
}
|
||||
# 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',\@reqbibs,$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");
|
||||
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);
|
||||
# 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.
|
||||
|
|
Loading…
Reference in a new issue