From dd22c0ec0f06f0b47301ba8fa58385ffc2c1e8a1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 22 Mar 2013 03:35:41 -0700 Subject: [PATCH] Bug 8037: (follow-up) fix various issues [1] Add test for GetBudgetByOrderNumber() [2] Remove unconditional warn. [3] Remove MySQLism Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- C4/Reserves.pm | 3 +-- t/db_dependent/Budgets.t | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 9826f2c0f5..d1bca259a2 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -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 = ? )"; diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t index bfb910bf63..7c7d38677a 100755 --- a/t/db_dependent/Budgets.t +++ b/t/db_dependent/Budgets.t @@ -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; -- 2.39.5