Lines 179-204
sub AddReserve {
Link Here
|
179 |
# updates take place here |
179 |
# updates take place here |
180 |
if ( $fee > 0 ) { |
180 |
if ( $fee > 0 ) { |
181 |
my $nextacctno = &getnextacctno( $borrowernumber ); |
181 |
my $nextacctno = &getnextacctno( $borrowernumber ); |
182 |
my $query = qq/ |
182 |
my $query = qq{ |
183 |
INSERT INTO accountlines |
183 |
INSERT INTO accountlines |
184 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding) |
184 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding) |
185 |
VALUES |
185 |
VALUES |
186 |
(?,?,now(),?,?,'Res',?) |
186 |
(?,?,now(),?,?,'Res',?) |
187 |
/; |
187 |
}; |
188 |
my $usth = $dbh->prepare($query); |
188 |
my $usth = $dbh->prepare($query); |
189 |
$usth->execute( $borrowernumber, $nextacctno, $fee, |
189 |
$usth->execute( $borrowernumber, $nextacctno, $fee, |
190 |
"Reserve Charge - $title", $fee ); |
190 |
"Reserve Charge - $title", $fee ); |
191 |
} |
191 |
} |
192 |
|
192 |
|
193 |
#if ($const eq 'a'){ |
193 |
#if ($const eq 'a'){ |
194 |
my $query = qq/ |
194 |
my $query = qq{ |
195 |
INSERT INTO reserves |
195 |
INSERT INTO reserves |
196 |
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype, |
196 |
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype, |
197 |
priority,reservenotes,itemnumber,found,waitingdate,expirationdate) |
197 |
priority,reservenotes,itemnumber,found,waitingdate,expirationdate) |
198 |
VALUES |
198 |
VALUES |
199 |
(?,?,?,?,?, |
199 |
(?,?,?,?,?, |
200 |
?,?,?,?,?,?) |
200 |
?,?,?,?,?,?) |
201 |
/; |
201 |
}; |
202 |
my $sth = $dbh->prepare($query); |
202 |
my $sth = $dbh->prepare($query); |
203 |
$sth->execute( |
203 |
$sth->execute( |
204 |
$borrowernumber, $biblionumber, $resdate, $branch, |
204 |
$borrowernumber, $biblionumber, $resdate, $branch, |
Lines 237-248
sub AddReserve {
Link Here
|
237 |
|
237 |
|
238 |
#} |
238 |
#} |
239 |
($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? |
239 |
($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? |
240 |
$query = qq/ |
240 |
$query = qq{ |
241 |
INSERT INTO reserveconstraints |
241 |
INSERT INTO reserveconstraints |
242 |
(borrowernumber,biblionumber,reservedate,biblioitemnumber) |
242 |
(borrowernumber,biblionumber,reservedate,biblioitemnumber) |
243 |
VALUES |
243 |
VALUES |
244 |
(?,?,?,?) |
244 |
(?,?,?,?) |
245 |
/; |
245 |
}; |
246 |
$sth = $dbh->prepare($query); # keep prepare outside the loop! |
246 |
$sth = $dbh->prepare($query); # keep prepare outside the loop! |
247 |
foreach (@$bibitems) { |
247 |
foreach (@$bibitems) { |
248 |
$sth->execute($borrowernumber, $biblionumber, $resdate, $_); |
248 |
$sth->execute($borrowernumber, $biblionumber, $resdate, $_); |
Lines 684-694
sub GetReserveFee {
Link Here
|
684 |
#check for issues; |
684 |
#check for issues; |
685 |
my $dbh = C4::Context->dbh; |
685 |
my $dbh = C4::Context->dbh; |
686 |
my $const = lc substr( $constraint, 0, 1 ); |
686 |
my $const = lc substr( $constraint, 0, 1 ); |
687 |
my $query = qq/ |
687 |
my $query = qq{ |
688 |
SELECT * FROM borrowers |
688 |
SELECT * FROM borrowers |
689 |
LEFT JOIN categories ON borrowers.categorycode = categories.categorycode |
689 |
LEFT JOIN categories ON borrowers.categorycode = categories.categorycode |
690 |
WHERE borrowernumber = ? |
690 |
WHERE borrowernumber = ? |
691 |
/; |
691 |
}; |
692 |
my $sth = $dbh->prepare($query); |
692 |
my $sth = $dbh->prepare($query); |
693 |
$sth->execute($borrowernumber); |
693 |
$sth->execute($borrowernumber); |
694 |
my $data = $sth->fetchrow_hashref; |
694 |
my $data = $sth->fetchrow_hashref; |
Lines 1865-1871
sub _Findgroupreserve {
Link Here
|
1865 |
|
1865 |
|
1866 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1866 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1867 |
# check for exact targetted match |
1867 |
# check for exact targetted match |
1868 |
my $item_level_target_query = qq/ |
1868 |
my $item_level_target_query = qq{ |
1869 |
SELECT reserves.biblionumber AS biblionumber, |
1869 |
SELECT reserves.biblionumber AS biblionumber, |
1870 |
reserves.borrowernumber AS borrowernumber, |
1870 |
reserves.borrowernumber AS borrowernumber, |
1871 |
reserves.reservedate AS reservedate, |
1871 |
reserves.reservedate AS reservedate, |
Lines 1888-1894
sub _Findgroupreserve {
Link Here
|
1888 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1888 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1889 |
AND suspend = 0 |
1889 |
AND suspend = 0 |
1890 |
ORDER BY priority |
1890 |
ORDER BY priority |
1891 |
/; |
1891 |
}; |
1892 |
my $sth = $dbh->prepare($item_level_target_query); |
1892 |
my $sth = $dbh->prepare($item_level_target_query); |
1893 |
$sth->execute($itemnumber, $lookahead||0); |
1893 |
$sth->execute($itemnumber, $lookahead||0); |
1894 |
my @results; |
1894 |
my @results; |
Lines 1898-1904
sub _Findgroupreserve {
Link Here
|
1898 |
return @results if @results; |
1898 |
return @results if @results; |
1899 |
|
1899 |
|
1900 |
# check for title-level targetted match |
1900 |
# check for title-level targetted match |
1901 |
my $title_level_target_query = qq/ |
1901 |
my $title_level_target_query = qq{ |
1902 |
SELECT reserves.biblionumber AS biblionumber, |
1902 |
SELECT reserves.biblionumber AS biblionumber, |
1903 |
reserves.borrowernumber AS borrowernumber, |
1903 |
reserves.borrowernumber AS borrowernumber, |
1904 |
reserves.reservedate AS reservedate, |
1904 |
reserves.reservedate AS reservedate, |
Lines 1921-1927
sub _Findgroupreserve {
Link Here
|
1921 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1921 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1922 |
AND suspend = 0 |
1922 |
AND suspend = 0 |
1923 |
ORDER BY priority |
1923 |
ORDER BY priority |
1924 |
/; |
1924 |
}; |
1925 |
$sth = $dbh->prepare($title_level_target_query); |
1925 |
$sth = $dbh->prepare($title_level_target_query); |
1926 |
$sth->execute($itemnumber, $lookahead||0); |
1926 |
$sth->execute($itemnumber, $lookahead||0); |
1927 |
@results = (); |
1927 |
@results = (); |
Lines 1930-1936
sub _Findgroupreserve {
Link Here
|
1930 |
} |
1930 |
} |
1931 |
return @results if @results; |
1931 |
return @results if @results; |
1932 |
|
1932 |
|
1933 |
my $query = qq/ |
1933 |
my $query = qq{ |
1934 |
SELECT reserves.biblionumber AS biblionumber, |
1934 |
SELECT reserves.biblionumber AS biblionumber, |
1935 |
reserves.borrowernumber AS borrowernumber, |
1935 |
reserves.borrowernumber AS borrowernumber, |
1936 |
reserves.reservedate AS reservedate, |
1936 |
reserves.reservedate AS reservedate, |
Lines 1955-1961
sub _Findgroupreserve {
Link Here
|
1955 |
AND reserves.reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1955 |
AND reserves.reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1956 |
AND suspend = 0 |
1956 |
AND suspend = 0 |
1957 |
ORDER BY priority |
1957 |
ORDER BY priority |
1958 |
/; |
1958 |
}; |
1959 |
$sth = $dbh->prepare($query); |
1959 |
$sth = $dbh->prepare($query); |
1960 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1960 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1961 |
@results = (); |
1961 |
@results = (); |
1962 |
- |
|
|