Lines 26-31
use Koha::Database;
Link Here
|
26 |
use Koha::Club::Template::Fields; |
26 |
use Koha::Club::Template::Fields; |
27 |
|
27 |
|
28 |
use base qw(Koha::Object); |
28 |
use base qw(Koha::Object); |
|
|
29 |
use Koha::Exceptions; |
29 |
use Koha::Exceptions::ClubHold; |
30 |
use Koha::Exceptions::ClubHold; |
30 |
use Koha::Club::Hold::PatronHold; |
31 |
use Koha::Club::Hold::PatronHold; |
31 |
use Koha::Clubs; |
32 |
use Koha::Clubs; |
Lines 54-61
Class (static) method that returns a new Koha::Club::Hold instance
Link Here
|
54 |
sub add { |
55 |
sub add { |
55 |
my ( $params ) = @_; |
56 |
my ( $params ) = @_; |
56 |
|
57 |
|
57 |
Koha::Exceptions::ClubHold->throw() |
58 |
# check for mandatory params |
58 |
unless $params->{club_id} && $params->{biblio_id}; |
59 |
my @mandatory = ( 'biblio_id', 'club_id' ); |
|
|
60 |
for my $param (@mandatory) { |
61 |
unless ( defined( $params->{$param} ) ) { |
62 |
Koha::Exceptions::MissingParameter->throw( |
63 |
error => "The $param parameter is mandatory" ); |
64 |
} |
65 |
} |
59 |
|
66 |
|
60 |
my $club = Koha::Clubs->find($params->{club_id}); |
67 |
my $club = Koha::Clubs->find($params->{club_id}); |
61 |
my @enrollments = $club->club_enrollments->as_list; |
68 |
my @enrollments = $club->club_enrollments->as_list; |
62 |
- |
|
|