Added the possiblity of deleting waiting reservesm or setting them back to not waiting.
uses UpdateReserve now, instead of updatereserves from Reserves2.pm
This commit is contained in:
parent
3120194e94
commit
13e7c898df
3 changed files with 57 additions and 29 deletions
|
@ -31,7 +31,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
||||||
$VERSION = 0.01;
|
$VERSION = 0.01;
|
||||||
|
|
||||||
@ISA = qw(Exporter);
|
@ISA = qw(Exporter);
|
||||||
@EXPORT = qw(&FindReserves &CheckReserves &CheckWaiting &CancelReserve &FillReserve &ReserveWaiting &CreateReserve &updatereserves &getreservetitle &Findgroupreserve);
|
@EXPORT = qw(&FindReserves &CheckReserves &CheckWaiting &CancelReserve &FillReserve &ReserveWaiting &CreateReserve &updatereserves &UpdateReserve &getreservetitle &Findgroupreserve);
|
||||||
|
|
||||||
# make all your functions, whether exported or not;
|
# make all your functions, whether exported or not;
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ sub updatereserves{
|
||||||
my ($rank,$biblio,$borrower,$del,$branch)=@_;
|
my ($rank,$biblio,$borrower,$del,$branch)=@_;
|
||||||
my $dbh=C4Connect;
|
my $dbh=C4Connect;
|
||||||
my $query="Update reserves ";
|
my $query="Update reserves ";
|
||||||
if ($del ==0){
|
if ($del == 0){
|
||||||
$query.="set priority='$rank',branchcode='$branch' where
|
$query.="set priority='$rank',branchcode='$branch' where
|
||||||
biblionumber=$biblio and borrowernumber=$borrower";
|
biblionumber=$biblio and borrowernumber=$borrower";
|
||||||
} else {
|
} else {
|
||||||
|
@ -543,6 +543,32 @@ sub updatereserves{
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
$dbh->disconnect;
|
$dbh->disconnect;
|
||||||
}
|
}
|
||||||
|
sub UpdateReserve {
|
||||||
|
#subroutine to update a reserve
|
||||||
|
my ($rank,$biblio,$borrower,$branch)=@_;
|
||||||
|
return if $rank eq "W";
|
||||||
|
my $dbh=C4Connect;
|
||||||
|
if ($rank eq "del") {
|
||||||
|
my $query = "UPDATE reserves SET cancellationdate=now()
|
||||||
|
WHERE biblionumber = ?
|
||||||
|
AND borrowernumber = ?
|
||||||
|
AND cancellationdate is NULL
|
||||||
|
AND (found <> 'F' or found is NULL)";
|
||||||
|
my $sth=$dbh->prepare($query);
|
||||||
|
$sth->execute($biblio, $borrower);
|
||||||
|
$sth->finish;
|
||||||
|
} else {
|
||||||
|
my $query = "UPDATE reserves SET priority = ? ,branchcode = ?, itemnumber = NULL, found = NULL
|
||||||
|
WHERE biblionumber = ?
|
||||||
|
AND borrowernumber = ?
|
||||||
|
AND cancellationdate is NULL
|
||||||
|
AND (found <> 'F' or found is NULL)";
|
||||||
|
my $sth=$dbh->prepare($query);
|
||||||
|
$sth->execute($rank, $branch, $biblio, $borrower);
|
||||||
|
$sth->finish;
|
||||||
|
}
|
||||||
|
$dbh->disconnect;
|
||||||
|
}
|
||||||
|
|
||||||
sub getreservetitle {
|
sub getreservetitle {
|
||||||
my ($biblio,$bor,$date,$timestamp)=@_;
|
my ($biblio,$bor,$date,$timestamp)=@_;
|
||||||
|
|
|
@ -39,17 +39,13 @@ my @biblio=$input->param('biblio');
|
||||||
my @borrower=$input->param('borrower');
|
my @borrower=$input->param('borrower');
|
||||||
my @branch=$input->param('pickup');
|
my @branch=$input->param('pickup');
|
||||||
my $count=@rank;
|
my $count=@rank;
|
||||||
my $del=0;
|
|
||||||
|
# goes through and manually changes the reserves record....
|
||||||
|
# no attempt is made to check consistency.
|
||||||
for (my $i=0;$i<$count;$i++){
|
for (my $i=0;$i<$count;$i++){
|
||||||
if ($rank[$i] ne 'del' && $del == 0){
|
UpdateReserve($rank[$i],$biblio[$i],$borrower[$i],$branch[$i]); #from C4::Reserves2
|
||||||
updatereserves($rank[$i],$biblio[$i],$borrower[$i],0,$branch[$i]); #from C4::Reserves2
|
|
||||||
|
|
||||||
} elsif ($rank[$i] eq 'del'){
|
|
||||||
updatereserves($rank[$i],$biblio[$i],$borrower[$i],1); #from C4::Reserves2
|
|
||||||
$del=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $from=$input->param('from');
|
my $from=$input->param('from');
|
||||||
if ($from eq 'borrower'){
|
if ($from eq 'borrower'){
|
||||||
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$borrower[0]");
|
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$borrower[0]");
|
||||||
|
|
42
request.pl
42
request.pl
|
@ -39,6 +39,7 @@ my $dat = bibdata($bib);
|
||||||
|
|
||||||
# get existing reserves .....
|
# get existing reserves .....
|
||||||
my ($count,$reserves) = FindReserves($bib);
|
my ($count,$reserves) = FindReserves($bib);
|
||||||
|
my $totalcount = $count;
|
||||||
foreach my $res (@$reserves) {
|
foreach my $res (@$reserves) {
|
||||||
if ($res->{'found'} eq 'W') {
|
if ($res->{'found'} eq 'W') {
|
||||||
$count--;
|
$count--;
|
||||||
|
@ -111,7 +112,7 @@ EOF
|
||||||
|
|
||||||
my $existingreserves = "";
|
my $existingreserves = "";
|
||||||
foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
|
foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
|
||||||
my $prioropt = priorityoptions($count, $res->{'priority'});
|
my $prioropt = priorityoptions($totalcount, $res->{'priority'});
|
||||||
my $bropt = branchoptions($res->{'branchcode'});
|
my $bropt = branchoptions($res->{'branchcode'});
|
||||||
my $bor=$res->{'borrowernumber'};
|
my $bor=$res->{'borrowernumber'};
|
||||||
$date = slashifyDate($res->{'reservedate'});
|
$date = slashifyDate($res->{'reservedate'});
|
||||||
|
@ -126,26 +127,26 @@ foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
|
||||||
my $notes = $res->{'reservenotes'}." ";
|
my $notes = $res->{'reservenotes'}." ";
|
||||||
my $rank;
|
my $rank;
|
||||||
my $pickup;
|
my $pickup;
|
||||||
my $change;
|
|
||||||
if ($res->{'found'} eq 'W') {
|
if ($res->{'found'} eq 'W') {
|
||||||
my %env;
|
my %env;
|
||||||
my $item = $res->{'itemnumber'};
|
my $item = $res->{'itemnumber'};
|
||||||
$item = getiteminformation(\%env,$item);
|
$item = getiteminformation(\%env,$item);
|
||||||
$item = "<a href=/cgi-bin/koha/detail.pl?bib=$item->{'biblionumber'} &type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$item->{'barcode'}</a>";
|
$item = "<a href=/cgi-bin/koha/detail.pl?bib=$item->{'biblionumber'} &type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$item->{'barcode'}</a>";
|
||||||
my $wbra = $branches->{$res->{'branchcode'}}->{'branchname'};
|
my $wbrcd = $res->{'branchcode'};
|
||||||
$rank = "Item waiting";
|
my $wbra = $branches->{$wbrcd}->{'branchname'};
|
||||||
$type = $item;
|
$type = $item;
|
||||||
$pickup = "at <b>".$wbra."</b>";
|
$rank = "<select name=rank-request><option value=W selected>Waiting</option>$prioropt<option value=del>Del</option></select>";
|
||||||
$change = "<input type=checkbox name=rank-request value=del>delete";
|
$pickup = "Item waiting at <b>".$wbra."</b> <input type=hidden name=pickup value=$wbrcd>";
|
||||||
} else {
|
} else {
|
||||||
$rank = "<select name=rank-request>$prioropt<option value=del>Del</select>";
|
$rank = "<select name=rank-request>$prioropt<option value=del>Del</option></select>";
|
||||||
$pickup = "<select name=pickup>$bropt</select>";
|
$pickup = "<select name=pickup>$bropt</select>";
|
||||||
}
|
}
|
||||||
$existingreserves .= <<"EOF";
|
$existingreserves .= <<"EOF";
|
||||||
|
<tr VALIGN=TOP>
|
||||||
|
<TD>
|
||||||
<input type=hidden name=borrower value=$res->{'borrowernumber'}>
|
<input type=hidden name=borrower value=$res->{'borrowernumber'}>
|
||||||
<input type=hidden name=biblio value=$res->{'biblionumber'}>
|
<input type=hidden name=biblio value=$res->{'biblionumber'}>
|
||||||
<tr VALIGN=TOP>
|
$rank</td>
|
||||||
<TD>$rank</td>
|
|
||||||
<TD>
|
<TD>
|
||||||
<a href=/cgi-bin/koha/moremember.pl?bornum=$bor>$res->{'firstname'} $res->{'surname'}</a>
|
<a href=/cgi-bin/koha/moremember.pl?bornum=$bor>$res->{'firstname'} $res->{'surname'}</a>
|
||||||
</td>
|
</td>
|
||||||
|
@ -167,7 +168,7 @@ sub priorityoptions {
|
||||||
if ($sel == $i){
|
if ($sel == $i){
|
||||||
$out .= " selected";
|
$out .= " selected";
|
||||||
}
|
}
|
||||||
$out .= ">$i\n";
|
$out .= ">$i</option>\n";
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
@ -182,21 +183,25 @@ sub branchoptions {
|
||||||
if ($br eq $selbr) {
|
if ($br eq $selbr) {
|
||||||
$selected = "selected";
|
$selected = "selected";
|
||||||
}
|
}
|
||||||
$out .= "<option value=$br $selected>$branches->{$br}->{'branchname'}\n";
|
$out .= "<option value=$br $selected>$branches->{$br}->{'branchname'}</option>\n";
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#get the time for the form name...
|
||||||
|
my $time = time();
|
||||||
|
|
||||||
|
|
||||||
# printout the page
|
# printout the page
|
||||||
|
|
||||||
|
|
||||||
print $input->header;
|
|
||||||
|
|
||||||
|
print $input->header(-expires=>'now');
|
||||||
|
|
||||||
|
|
||||||
#setup colours
|
#setup colours
|
||||||
print startpage();
|
|
||||||
print startmenu('catalogue');
|
print startmenu('catalogue');
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,7 +220,7 @@ print <<printend
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
|
|
||||||
<!----------------BIBLIO RESERVE TABLE-------------->
|
|
||||||
|
|
||||||
|
|
||||||
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
|
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
|
||||||
|
@ -240,7 +245,7 @@ $branchoptions
|
||||||
<td><input type=checkbox name=request value=any>Next Available,
|
<td><input type=checkbox name=request value=any>Next Available,
|
||||||
<br>(or choose from list below)</td>
|
<br>(or choose from list below)</td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
|
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
|
||||||
|
@ -255,13 +260,15 @@ $branchoptions
|
||||||
</TR>
|
</TR>
|
||||||
$bibitemrows
|
$bibitemrows
|
||||||
</table>
|
</table>
|
||||||
</p>
|
|
||||||
</form>
|
</form>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-----------MODIFY EXISTING REQUESTS----------------->
|
|
||||||
|
|
||||||
|
<form name=T$time action=modrequest.pl method=post>
|
||||||
|
|
||||||
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
|
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 >
|
||||||
|
|
||||||
|
@ -269,7 +276,6 @@ $bibitemrows
|
||||||
|
|
||||||
<td bgcolor="99cc33" background="/images/background-mem.gif" colspan=7><B>MODIFY EXISTING REQUESTS </b></TD>
|
<td bgcolor="99cc33" background="/images/background-mem.gif" colspan=7><B>MODIFY EXISTING REQUESTS </b></TD>
|
||||||
</TR>
|
</TR>
|
||||||
<form action=modrequest.pl method=post>
|
|
||||||
<TR VALIGN=TOP>
|
<TR VALIGN=TOP>
|
||||||
|
|
||||||
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
|
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>Rank</b></TD>
|
||||||
|
|
Loading…
Reference in a new issue