# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
&SearchCourses
- &GetItemReservesInfo
+ &GetItemCourseReservesInfo
);
%EXPORT_TAGS = ( 'all' => \@EXPORT_OK );
$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
}
}
_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;
}
}
}
}
- 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 = ?";
}
}
- 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 );
}
=head2 GetReservesInfo
- my $arrayref = GetItemReservesInfo( itemnumber => $itemnumber );
+ my $arrayref = GetItemCourseReservesInfo( itemnumber => $itemnumber );
For a given item, returns an arrayref of reserves hashrefs,
with a course hashref under the key 'course'
=cut
-sub GetItemReservesInfo {
+sub GetItemCourseReservesInfo {
my (%params) = @_;
warn identify_myself(%params) if $DEBUG;
GROUP BY c.course_id
";
+ $term //= '';
$term = "%$term%";
@params = ($term) x 10;