Bug 8037: (follow-up) fix various issues

[1] Add test for GetBudgetByOrderNumber()
[2] Remove unconditional warn.
[3] Remove MySQLism

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Kyle Hall 2013-03-22 03:35:41 -07:00 committed by Galen Charlton
parent 3910d5e8b4
commit dd22c0ec0f
2 changed files with 5 additions and 2 deletions

View file

@ -278,7 +278,6 @@ sub GetReservesFromBiblionumber {
my ($biblionumber) = shift or return (0, []);
my ($all_dates) = shift;
my ($itemnumber) = shift;
warn "ITEMNUMBER: $itemnumber";
my $dbh = C4::Context->dbh;
# Find the desired items in the reserves
@ -303,7 +302,7 @@ sub GetReservesFromBiblionumber {
WHERE biblionumber = ? ";
push( @params, $biblionumber );
unless ( $all_dates ) {
$query .= " AND reservedate <= CURRENT_DATE() ";
$query .= " AND reservedate <= CAST(NOW() AS DATE) ";
}
if ( $itemnumber ) {
$query .= " AND ( itemnumber IS NULL OR itemnumber = ? )";

View file

@ -92,6 +92,10 @@ ok($budget_id=AddBudget(
#| budget_owner_id | int(11) | YES | | NULL | |
#| budget_permission | int(1) | YES | | 0 | |
C4::Context::dbh->do('INSERT INTO aqorders ( ordernumber, budget_id ) VALUES ( 987654321, ? )', {}, ( $budget_id ) );
ok( GetBudgetByOrderNumber( '987654321' )->{'budget_id'} eq $budget_id, "GetBudgetByOrderNumber returns valid data" );
C4::Context::dbh->do('DELETE FROM aqorders WHERE ordernumber = 987654321');
my $budget;
ok($budget=GetBudget($budget_id) ,"GetBudget OK");
$$budget{budget_permission}=1;