Lines 176-201
sub AddReserve {
Link Here
|
176 |
# updates take place here |
176 |
# updates take place here |
177 |
if ( $fee > 0 ) { |
177 |
if ( $fee > 0 ) { |
178 |
my $nextacctno = &getnextacctno( $borrowernumber ); |
178 |
my $nextacctno = &getnextacctno( $borrowernumber ); |
179 |
my $query = qq/ |
179 |
my $query = qq{ |
180 |
INSERT INTO accountlines |
180 |
INSERT INTO accountlines |
181 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding) |
181 |
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding) |
182 |
VALUES |
182 |
VALUES |
183 |
(?,?,now(),?,?,'Res',?) |
183 |
(?,?,now(),?,?,'Res',?) |
184 |
/; |
184 |
}; |
185 |
my $usth = $dbh->prepare($query); |
185 |
my $usth = $dbh->prepare($query); |
186 |
$usth->execute( $borrowernumber, $nextacctno, $fee, |
186 |
$usth->execute( $borrowernumber, $nextacctno, $fee, |
187 |
"Reserve Charge - $title", $fee ); |
187 |
"Reserve Charge - $title", $fee ); |
188 |
} |
188 |
} |
189 |
|
189 |
|
190 |
#if ($const eq 'a'){ |
190 |
#if ($const eq 'a'){ |
191 |
my $query = qq/ |
191 |
my $query = qq{ |
192 |
INSERT INTO reserves |
192 |
INSERT INTO reserves |
193 |
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype, |
193 |
(borrowernumber,biblionumber,reservedate,branchcode,constrainttype, |
194 |
priority,reservenotes,itemnumber,found,waitingdate,expirationdate) |
194 |
priority,reservenotes,itemnumber,found,waitingdate,expirationdate) |
195 |
VALUES |
195 |
VALUES |
196 |
(?,?,?,?,?, |
196 |
(?,?,?,?,?, |
197 |
?,?,?,?,?,?) |
197 |
?,?,?,?,?,?) |
198 |
/; |
198 |
}; |
199 |
my $sth = $dbh->prepare($query); |
199 |
my $sth = $dbh->prepare($query); |
200 |
$sth->execute( |
200 |
$sth->execute( |
201 |
$borrowernumber, $biblionumber, $resdate, $branch, |
201 |
$borrowernumber, $biblionumber, $resdate, $branch, |
Lines 234-245
sub AddReserve {
Link Here
|
234 |
|
234 |
|
235 |
#} |
235 |
#} |
236 |
($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? |
236 |
($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? |
237 |
$query = qq/ |
237 |
$query = qq{ |
238 |
INSERT INTO reserveconstraints |
238 |
INSERT INTO reserveconstraints |
239 |
(borrowernumber,biblionumber,reservedate,biblioitemnumber) |
239 |
(borrowernumber,biblionumber,reservedate,biblioitemnumber) |
240 |
VALUES |
240 |
VALUES |
241 |
(?,?,?,?) |
241 |
(?,?,?,?) |
242 |
/; |
242 |
}; |
243 |
$sth = $dbh->prepare($query); # keep prepare outside the loop! |
243 |
$sth = $dbh->prepare($query); # keep prepare outside the loop! |
244 |
foreach (@$bibitems) { |
244 |
foreach (@$bibitems) { |
245 |
$sth->execute($borrowernumber, $biblionumber, $resdate, $_); |
245 |
$sth->execute($borrowernumber, $biblionumber, $resdate, $_); |
Lines 643-653
sub GetReserveFee {
Link Here
|
643 |
#check for issues; |
643 |
#check for issues; |
644 |
my $dbh = C4::Context->dbh; |
644 |
my $dbh = C4::Context->dbh; |
645 |
my $const = lc substr( $constraint, 0, 1 ); |
645 |
my $const = lc substr( $constraint, 0, 1 ); |
646 |
my $query = qq/ |
646 |
my $query = qq{ |
647 |
SELECT * FROM borrowers |
647 |
SELECT * FROM borrowers |
648 |
LEFT JOIN categories ON borrowers.categorycode = categories.categorycode |
648 |
LEFT JOIN categories ON borrowers.categorycode = categories.categorycode |
649 |
WHERE borrowernumber = ? |
649 |
WHERE borrowernumber = ? |
650 |
/; |
650 |
}; |
651 |
my $sth = $dbh->prepare($query); |
651 |
my $sth = $dbh->prepare($query); |
652 |
$sth->execute($borrowernumber); |
652 |
$sth->execute($borrowernumber); |
653 |
my $data = $sth->fetchrow_hashref; |
653 |
my $data = $sth->fetchrow_hashref; |
Lines 1776-1782
sub _Findgroupreserve {
Link Here
|
1776 |
|
1776 |
|
1777 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1777 |
# TODO: consolidate at least the SELECT portion of the first 2 queries to a common $select var. |
1778 |
# check for exact targetted match |
1778 |
# check for exact targetted match |
1779 |
my $item_level_target_query = qq/ |
1779 |
my $item_level_target_query = qq{ |
1780 |
SELECT reserves.biblionumber AS biblionumber, |
1780 |
SELECT reserves.biblionumber AS biblionumber, |
1781 |
reserves.borrowernumber AS borrowernumber, |
1781 |
reserves.borrowernumber AS borrowernumber, |
1782 |
reserves.reservedate AS reservedate, |
1782 |
reserves.reservedate AS reservedate, |
Lines 1798-1804
sub _Findgroupreserve {
Link Here
|
1798 |
AND itemnumber = ? |
1798 |
AND itemnumber = ? |
1799 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1799 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1800 |
AND suspend = 0 |
1800 |
AND suspend = 0 |
1801 |
/; |
1801 |
}; |
1802 |
my $sth = $dbh->prepare($item_level_target_query); |
1802 |
my $sth = $dbh->prepare($item_level_target_query); |
1803 |
$sth->execute($itemnumber, $lookahead||0); |
1803 |
$sth->execute($itemnumber, $lookahead||0); |
1804 |
my @results; |
1804 |
my @results; |
Lines 1808-1814
sub _Findgroupreserve {
Link Here
|
1808 |
return @results if @results; |
1808 |
return @results if @results; |
1809 |
|
1809 |
|
1810 |
# check for title-level targetted match |
1810 |
# check for title-level targetted match |
1811 |
my $title_level_target_query = qq/ |
1811 |
my $title_level_target_query = qq{ |
1812 |
SELECT reserves.biblionumber AS biblionumber, |
1812 |
SELECT reserves.biblionumber AS biblionumber, |
1813 |
reserves.borrowernumber AS borrowernumber, |
1813 |
reserves.borrowernumber AS borrowernumber, |
1814 |
reserves.reservedate AS reservedate, |
1814 |
reserves.reservedate AS reservedate, |
Lines 1830-1836
sub _Findgroupreserve {
Link Here
|
1830 |
AND hold_fill_targets.itemnumber = ? |
1830 |
AND hold_fill_targets.itemnumber = ? |
1831 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1831 |
AND reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1832 |
AND suspend = 0 |
1832 |
AND suspend = 0 |
1833 |
/; |
1833 |
}; |
1834 |
$sth = $dbh->prepare($title_level_target_query); |
1834 |
$sth = $dbh->prepare($title_level_target_query); |
1835 |
$sth->execute($itemnumber, $lookahead||0); |
1835 |
$sth->execute($itemnumber, $lookahead||0); |
1836 |
@results = (); |
1836 |
@results = (); |
Lines 1839-1845
sub _Findgroupreserve {
Link Here
|
1839 |
} |
1839 |
} |
1840 |
return @results if @results; |
1840 |
return @results if @results; |
1841 |
|
1841 |
|
1842 |
my $query = qq/ |
1842 |
my $query = qq{ |
1843 |
SELECT reserves.biblionumber AS biblionumber, |
1843 |
SELECT reserves.biblionumber AS biblionumber, |
1844 |
reserves.borrowernumber AS borrowernumber, |
1844 |
reserves.borrowernumber AS borrowernumber, |
1845 |
reserves.reservedate AS reservedate, |
1845 |
reserves.reservedate AS reservedate, |
Lines 1863-1869
sub _Findgroupreserve {
Link Here
|
1863 |
AND (reserves.itemnumber IS NULL OR reserves.itemnumber = ?) |
1863 |
AND (reserves.itemnumber IS NULL OR reserves.itemnumber = ?) |
1864 |
AND reserves.reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1864 |
AND reserves.reservedate <= DATE_ADD(NOW(),INTERVAL ? DAY) |
1865 |
AND suspend = 0 |
1865 |
AND suspend = 0 |
1866 |
/; |
1866 |
}; |
1867 |
$sth = $dbh->prepare($query); |
1867 |
$sth = $dbh->prepare($query); |
1868 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1868 |
$sth->execute( $biblio, $bibitem, $itemnumber, $lookahead||0); |
1869 |
@results = (); |
1869 |
@results = (); |
1870 |
- |
|
|