Lines 104-109
BEGIN {
Link Here
|
104 |
&GetReserveFee |
104 |
&GetReserveFee |
105 |
&GetReserveInfo |
105 |
&GetReserveInfo |
106 |
&GetReserveStatus |
106 |
&GetReserveStatus |
|
|
107 |
&GetReserve |
107 |
|
108 |
|
108 |
&GetOtherReserves |
109 |
&GetOtherReserves |
109 |
|
110 |
|
Lines 119-124
BEGIN {
Link Here
|
119 |
&CanBookBeReserved |
120 |
&CanBookBeReserved |
120 |
&CanItemBeReserved |
121 |
&CanItemBeReserved |
121 |
&CancelReserve |
122 |
&CancelReserve |
|
|
123 |
&CancelReserveFromId |
122 |
&CancelExpiredReserves |
124 |
&CancelExpiredReserves |
123 |
|
125 |
|
124 |
&AutoUnsuspendReserves |
126 |
&AutoUnsuspendReserves |
Lines 814-819
sub GetReserveStatus {
Link Here
|
814 |
return ''; # empty string here will remove need for checking undef, or less log lines |
816 |
return ''; # empty string here will remove need for checking undef, or less log lines |
815 |
} |
817 |
} |
816 |
|
818 |
|
|
|
819 |
=head2 GetReserve |
820 |
|
821 |
my $reserve = C4::Reserves::GetReserve($reserve_id); |
822 |
|
823 |
Take a reserve_id and returns a hashref containing reserve informations. |
824 |
Return undef if reserve_id doesn't exist. |
825 |
|
826 |
=cut |
827 |
|
828 |
sub GetReserve { |
829 |
my ($reserve_id) = @_; |
830 |
|
831 |
return unless $reserve_id; |
832 |
|
833 |
my $dbh = C4::Context->dbh; |
834 |
my $query = qq{ |
835 |
SELECT * |
836 |
FROM reserves |
837 |
WHERE reserve_id = ? |
838 |
}; |
839 |
my $sth = $dbh->prepare($query); |
840 |
|
841 |
$sth->execute($reserve_id); |
842 |
my $reserve = $sth->fetchrow_hashref; |
843 |
|
844 |
return $reserve; |
845 |
} |
846 |
|
817 |
=head2 CheckReserves |
847 |
=head2 CheckReserves |
818 |
|
848 |
|
819 |
($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); |
849 |
($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); |
Lines 1037-1042
sub CancelReserve {
Link Here
|
1037 |
_FixPriority( $reserve_id ); |
1067 |
_FixPriority( $reserve_id ); |
1038 |
} |
1068 |
} |
1039 |
|
1069 |
|
|
|
1070 |
=head2 CancelReserveFromId |
1071 |
|
1072 |
C4::Reserves::CancelReserveFromId($reserve_id); |
1073 |
|
1074 |
Cancel a reserve, given its reserve_id |
1075 |
|
1076 |
=cut |
1077 |
|
1078 |
sub CancelReserveFromId { |
1079 |
my ($reserve_id) = @_; |
1080 |
|
1081 |
my $reserve = GetReserve($reserve_id); |
1082 |
if ($reserve) { |
1083 |
my $dbh = C4::Context->dbh; |
1084 |
|
1085 |
# update the database, removing the record... |
1086 |
my $query = qq{ |
1087 |
UPDATE reserves |
1088 |
SET cancellationdate = NOW(), |
1089 |
found = NULL, |
1090 |
priority = 0 |
1091 |
WHERE reserve_id = ? |
1092 |
}; |
1093 |
my $sth = $dbh->prepare($query); |
1094 |
$sth->execute($reserve_id); |
1095 |
$sth->finish; |
1096 |
|
1097 |
$query = qq{ |
1098 |
INSERT INTO old_reserves |
1099 |
SELECT * FROM reserves |
1100 |
WHERE reserve_id = ? |
1101 |
}; |
1102 |
$sth = $dbh->prepare($query); |
1103 |
$sth->execute($reserve_id); |
1104 |
|
1105 |
$query = qq{ |
1106 |
DELETE FROM reserves |
1107 |
WHERE reserve_id = ? |
1108 |
}; |
1109 |
$sth = $dbh->prepare($query); |
1110 |
$sth->execute($reserve_id); |
1111 |
|
1112 |
# now fix the priority on the others... |
1113 |
_FixPriority( $reserve->{biblionumber}, $reserve->{borrowernumber} ); |
1114 |
} |
1115 |
|
1116 |
return $reserve; |
1117 |
} |
1118 |
|
1119 |
|
1040 |
=head2 ModReserve |
1120 |
=head2 ModReserve |
1041 |
|
1121 |
|
1042 |
ModReserve({ rank => $rank, |
1122 |
ModReserve({ rank => $rank, |
1043 |
- |
|
|