From 64d6c04d02f5415e45c8323e4e5c3b34fd4e966f Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 21 May 2013 10:12:15 -0700 Subject: [PATCH] bug 8215: (followup) avoid SQL syntax error in logs ModItem currently will attempt to update an item even if no field updates are specified. This patch avoids (harmless) error messages in the Apache logs if an item is not actually being changed when it is placed or taken off reserve. Signed-off-by: Galen Charlton --- C4/CourseReserves.pm | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index 12b6375..39cd3d2 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -568,7 +568,7 @@ sub _UpdateCourseItem { $mod_params{$_} = $params{$_}; } } - ModItem( \%mod_params, undef, $course_item->{'itemnumber'} ); + ModItem( \%mod_params, undef, $course_item->{'itemnumber'} ) if %mod_params; ## Update fields that didn't have an original value, but now do ## We must save the original value in course_items, and also @@ -583,7 +583,7 @@ sub _UpdateCourseItem { } } _ModStoredFields( 'ci_id' => $params{'ci_id'}, %mod_params_old ); - ModItem( \%mod_params_new, undef, $course_item->{'itemnumber'} ); + ModItem( \%mod_params_new, undef, $course_item->{'itemnumber'} ) if %mod_params_new; } @@ -648,7 +648,7 @@ sub _RevertFields { } } } - ModItem( $mod_item_params, undef, $course_item->{'itemnumber'} ); + ModItem( $mod_item_params, undef, $course_item->{'itemnumber'} ) if $mod_item_params && %$mod_item_params; my $query = "UPDATE course_items SET " . join( ',', map { "$_=NULL" } @fields_to_null ) . " WHERE ci_id = ?"; @@ -677,7 +677,7 @@ sub _SwapAllFields { } } - ModItem( \%course_item_fields, undef, $course_item->{'itemnumber'} ); + ModItem( \%course_item_fields, undef, $course_item->{'itemnumber'} ) if %course_item_fields; _ModStoredFields( %item_fields, ci_id => $ci_id ); } -- 1.7.2.5