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 808-813
sub GetReserveStatus {
Link Here
|
808 |
#empty string here will remove need for checking undef, or less log lines |
810 |
#empty string here will remove need for checking undef, or less log lines |
809 |
} |
811 |
} |
810 |
|
812 |
|
|
|
813 |
=head2 GetReserve |
814 |
|
815 |
my $reserve = C4::Reserves::GetReserve($reserve_id); |
816 |
|
817 |
Take a reserve_id and returns a hashref containing reserve informations. |
818 |
Return undef if reserve_id doesn't exist. |
819 |
|
820 |
=cut |
821 |
|
822 |
sub GetReserve { |
823 |
my ($reserve_id) = @_; |
824 |
|
825 |
return unless $reserve_id; |
826 |
|
827 |
my $dbh = C4::Context->dbh; |
828 |
my $query = qq{ |
829 |
SELECT * |
830 |
FROM reserves |
831 |
WHERE reserve_id = ? |
832 |
}; |
833 |
my $sth = $dbh->prepare($query); |
834 |
|
835 |
$sth->execute($reserve_id); |
836 |
my $reserve = $sth->fetchrow_hashref; |
837 |
|
838 |
return $reserve; |
839 |
} |
840 |
|
811 |
=head2 CheckReserves |
841 |
=head2 CheckReserves |
812 |
|
842 |
|
813 |
($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); |
843 |
($status, $reserve, $all_reserves) = &CheckReserves($itemnumber); |
Lines 1030-1035
sub CancelReserve {
Link Here
|
1030 |
_FixPriority( $reserve_id ); |
1060 |
_FixPriority( $reserve_id ); |
1031 |
} |
1061 |
} |
1032 |
|
1062 |
|
|
|
1063 |
=head2 CancelReserveFromId |
1064 |
|
1065 |
C4::Reserves::CancelReserveFromId($reserve_id); |
1066 |
|
1067 |
Cancel a reserve, given its reserve_id |
1068 |
|
1069 |
=cut |
1070 |
|
1071 |
sub CancelReserveFromId { |
1072 |
my ($reserve_id) = @_; |
1073 |
|
1074 |
my $reserve = GetReserve($reserve_id); |
1075 |
if ($reserve) { |
1076 |
my $dbh = C4::Context->dbh; |
1077 |
|
1078 |
# update the database, removing the record... |
1079 |
my $query = qq{ |
1080 |
UPDATE reserves |
1081 |
SET cancellationdate = NOW(), |
1082 |
found = NULL, |
1083 |
priority = 0 |
1084 |
WHERE reserve_id = ? |
1085 |
}; |
1086 |
my $sth = $dbh->prepare($query); |
1087 |
$sth->execute($reserve_id); |
1088 |
$sth->finish; |
1089 |
|
1090 |
$query = qq{ |
1091 |
INSERT INTO old_reserves |
1092 |
SELECT * FROM reserves |
1093 |
WHERE reserve_id = ? |
1094 |
}; |
1095 |
$sth = $dbh->prepare($query); |
1096 |
$sth->execute($reserve_id); |
1097 |
|
1098 |
$query = qq{ |
1099 |
DELETE FROM reserves |
1100 |
WHERE reserve_id = ? |
1101 |
}; |
1102 |
$sth = $dbh->prepare($query); |
1103 |
$sth->execute($reserve_id); |
1104 |
|
1105 |
# now fix the priority on the others... |
1106 |
_FixPriority( $reserve->{biblionumber}, $reserve->{borrowernumber} ); |
1107 |
} |
1108 |
|
1109 |
return $reserve; |
1110 |
} |
1111 |
|
1112 |
|
1033 |
=head2 ModReserve |
1113 |
=head2 ModReserve |
1034 |
|
1114 |
|
1035 |
ModReserve({ rank => $rank, |
1115 |
ModReserve({ rank => $rank, |
1036 |
- |
|
|