Bug 28762: Use Koha::Course in course-details controller
This patch updates Koha::Course to include the 'instructors' relation accessor and then update the course-details controller to use the Koha::Course object and pass it to the template instead of building a hash using GetCourse. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
316c14c1bf
commit
7f38c77d09
2 changed files with 21 additions and 3 deletions
|
@ -17,14 +17,32 @@ package Koha::Course;
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
|
||||
use base qw(Koha::Object);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Koha::Course - Koha Course Object class
|
||||
|
||||
=head1 API
|
||||
=head2 Relations
|
||||
|
||||
=head3 instructors
|
||||
|
||||
my $instructors = $course->instructors();
|
||||
|
||||
Returns the related Koha::Patrons object containing the instructors for this course
|
||||
|
||||
=cut
|
||||
|
||||
sub instructors {
|
||||
my ($self) = @_;
|
||||
|
||||
my $instructors = Koha::Patrons->search(
|
||||
{ 'course_instructors.course_id' => $self->course_id },
|
||||
{ join => 'course_instructors' }
|
||||
);
|
||||
|
||||
return $instructors;
|
||||
}
|
||||
|
||||
=head2 Internal methods
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ if ( $op eq 'cud-del_reserve' ) {
|
|||
}
|
||||
}
|
||||
|
||||
my $course = GetCourse($course_id);
|
||||
my $course = Koha::Courses->find($course_id);
|
||||
my $course_reserves = GetCourseReserves(
|
||||
course_id => $course_id,
|
||||
include_items => 1,
|
||||
|
|
Loading…
Reference in a new issue