Lines 103-108
BEGIN {
Link Here
|
103 |
&GetReserveFee |
103 |
&GetReserveFee |
104 |
&GetReserveInfo |
104 |
&GetReserveInfo |
105 |
&GetReserveStatus |
105 |
&GetReserveStatus |
|
|
106 |
&GetReserve |
106 |
|
107 |
|
107 |
&GetOtherReserves |
108 |
&GetOtherReserves |
108 |
|
109 |
|
Lines 118-123
BEGIN {
Link Here
|
118 |
&CanBookBeReserved |
119 |
&CanBookBeReserved |
119 |
&CanItemBeReserved |
120 |
&CanItemBeReserved |
120 |
&CancelReserve |
121 |
&CancelReserve |
|
|
122 |
&CancelReserveFromId |
121 |
&CancelExpiredReserves |
123 |
&CancelExpiredReserves |
122 |
|
124 |
|
123 |
&AutoUnsuspendReserves |
125 |
&AutoUnsuspendReserves |
Lines 260-266
sub GetReservesFromBiblionumber {
Link Here
|
260 |
|
262 |
|
261 |
# Find the desired items in the reserves |
263 |
# Find the desired items in the reserves |
262 |
my $query = " |
264 |
my $query = " |
263 |
SELECT branchcode, |
265 |
SELECT reserve_id, |
|
|
266 |
branchcode, |
264 |
timestamp AS rtimestamp, |
267 |
timestamp AS rtimestamp, |
265 |
priority, |
268 |
priority, |
266 |
biblionumber, |
269 |
biblionumber, |
Lines 771-776
sub GetReserveStatus {
Link Here
|
771 |
#empty string here will remove need for checking undef, or less log lines |
774 |
#empty string here will remove need for checking undef, or less log lines |
772 |
} |
775 |
} |
773 |
|
776 |
|
|
|
777 |
=head2 GetReserve |
778 |
|
779 |
my $reserve = C4::Reserves::GetReserve($reserve_id); |
780 |
|
781 |
Take a reserve_id and returns a hashref containing reserve informations. |
782 |
Return undef if reserve_id doesn't exist. |
783 |
|
784 |
=cut |
785 |
|
786 |
sub GetReserve { |
787 |
my ($reserve_id) = @_; |
788 |
|
789 |
return unless $reserve_id; |
790 |
|
791 |
my $dbh = C4::Context->dbh; |
792 |
my $query = qq{ |
793 |
SELECT * |
794 |
FROM reserves |
795 |
WHERE reserve_id = ? |
796 |
}; |
797 |
my $sth = $dbh->prepare($query); |
798 |
|
799 |
$sth->execute($reserve_id); |
800 |
my $reserve = $sth->fetchrow_hashref; |
801 |
|
802 |
return $reserve; |
803 |
} |
804 |
|
774 |
=head2 CheckReserves |
805 |
=head2 CheckReserves |
775 |
|
806 |
|
776 |
($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); |
807 |
($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); |
Lines 1047-1052
sub CancelReserve {
Link Here
|
1047 |
} |
1078 |
} |
1048 |
} |
1079 |
} |
1049 |
|
1080 |
|
|
|
1081 |
=head2 CancelReserveFromId |
1082 |
|
1083 |
C4::Reserves::CancelReserveFromId($reserve_id); |
1084 |
|
1085 |
Cancel a reserve, given its reserve_id |
1086 |
|
1087 |
=cut |
1088 |
|
1089 |
sub CancelReserveFromId { |
1090 |
my ($reserve_id) = @_; |
1091 |
|
1092 |
my $reserve = GetReserve($reserve_id); |
1093 |
if ($reserve) { |
1094 |
my $dbh = C4::Context->dbh; |
1095 |
|
1096 |
# update the database, removing the record... |
1097 |
my $query = qq{ |
1098 |
UPDATE reserves |
1099 |
SET cancellationdate = NOW(), |
1100 |
found = NULL, |
1101 |
priority = 0 |
1102 |
WHERE reserve_id = ? |
1103 |
}; |
1104 |
my $sth = $dbh->prepare($query); |
1105 |
$sth->execute($reserve_id); |
1106 |
$sth->finish; |
1107 |
|
1108 |
$query = qq{ |
1109 |
INSERT INTO old_reserves |
1110 |
SELECT * FROM reserves |
1111 |
WHERE reserve_id = ? |
1112 |
}; |
1113 |
$sth = $dbh->prepare($query); |
1114 |
$sth->execute($reserve_id); |
1115 |
|
1116 |
$query = qq{ |
1117 |
DELETE FROM reserves |
1118 |
WHERE reserve_id = ? |
1119 |
}; |
1120 |
$sth = $dbh->prepare($query); |
1121 |
$sth->execute($reserve_id); |
1122 |
|
1123 |
# now fix the priority on the others... |
1124 |
_FixPriority( $reserve->{biblionumber}, $reserve->{borrowernumber} ); |
1125 |
} |
1126 |
|
1127 |
return $reserve; |
1128 |
} |
1129 |
|
1130 |
|
1050 |
=head2 ModReserve |
1131 |
=head2 ModReserve |
1051 |
|
1132 |
|
1052 |
ModReserve($rank, $biblio, $borrower, $branch[, $itemnumber]) |
1133 |
ModReserve($rank, $biblio, $borrower, $branch[, $itemnumber]) |
1053 |
- |
|
|