Browse Source

Revert "Bug 12461 - Add patron clubs feature"

This reverts commit 4f1eefdbb8.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
17.05.x
Kyle M Hall 6 years ago
parent
commit
8255344215
  1. 5
      C4/Auth.pm
  2. 16
      C4/Members.pm
  3. 92
      Koha/Club.pm
  4. 78
      Koha/Club/Enrollment.pm
  5. 56
      Koha/Club/Enrollment/Field.pm
  6. 60
      Koha/Club/Enrollment/Fields.pm
  7. 60
      Koha/Club/Enrollments.pm
  8. 66
      Koha/Club/Field.pm
  9. 60
      Koha/Club/Fields.pm
  10. 75
      Koha/Club/Template.pm
  11. 54
      Koha/Club/Template/EnrollmentField.pm
  12. 60
      Koha/Club/Template/EnrollmentFields.pm
  13. 54
      Koha/Club/Template/Field.pm
  14. 60
      Koha/Club/Template/Fields.pm
  15. 60
      Koha/Club/Templates.pm
  16. 92
      Koha/Clubs.pm
  17. 38
      Koha/Patron.pm
  18. 4
      Koha/Schema/Result/AuthorisedValue.pm
  19. 15
      Koha/Schema/Result/Borrower.pm
  20. 49
      Koha/Schema/Result/Branch.pm
  21. 197
      Koha/Schema/Result/Club.pm
  22. 201
      Koha/Schema/Result/ClubEnrollment.pm
  23. 112
      Koha/Schema/Result/ClubEnrollmentField.pm
  24. 112
      Koha/Schema/Result/ClubField.pm
  25. 195
      Koha/Schema/Result/ClubTemplate.pm
  26. 119
      Koha/Schema/Result/ClubTemplateEnrollmentField.pm
  27. 119
      Koha/Schema/Result/ClubTemplateField.pm
  28. 4
      Koha/Template/Plugin/AuthorisedValues.pm
  29. 1
      Koha/Template/Plugin/Borrowers.pm
  30. 107
      clubs/clubs-add-modify.pl
  31. 60
      clubs/clubs.pl
  32. 55
      clubs/patron-clubs-tab.pl
  33. 50
      clubs/patron-enroll.pl
  34. 152
      clubs/templates-add-modify.pl
  35. 131
      installer/data/mysql/atomicupdate/bug_12461.sql
  36. 126
      installer/data/mysql/kohastructure.sql
  37. 3
      installer/data/mysql/userflags.sql
  38. 5
      installer/data/mysql/userpermissions.sql
  39. 4
      koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
  40. 3
      koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc
  41. 23
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
  42. 115
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt
  43. 252
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt
  44. 102
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt
  45. 66
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt
  46. 216
      koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt
  47. 22
      koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
  48. 5
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
  49. 102
      koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt
  50. 66
      koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt
  51. 24
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
  52. 2
      members/moremember.pl
  53. 52
      opac/clubs/clubs-tab.pl
  54. 49
      opac/clubs/enroll.pl
  55. 47
      opac/svc/club/cancel_enrollment
  56. 77
      opac/svc/club/enroll
  57. 46
      svc/club/cancel_enrollment
  58. 48
      svc/club/delete
  59. 74
      svc/club/enroll
  60. 49
      svc/club/template/delete
  61. 221
      t/db_dependent/Clubs.t

5
C4/Auth.pm

@ -260,7 +260,7 @@ sub get_template_and_user {
my $all_perms = get_all_subpermissions();
my @flagroots = qw(circulate catalogue parameters borrowers permissions reserveforothers borrow
editcatalogue updatecharges management tools editauthorities serials reports acquisition clubs);
editcatalogue updatecharges management tools editauthorities serials reports acquisition);
# We are going to use the $flags returned by checkauth
# to create the template's parameters that will indicate
@ -283,9 +283,8 @@ sub get_template_and_user {
$template->param( CAN_user_staffaccess => 1 );
$template->param( CAN_user_plugins => 1 );
$template->param( CAN_user_coursereserves => 1 );
$template->param( CAN_user_clubs => 1 );
foreach my $module ( keys %$all_perms ) {
foreach my $subperm ( keys %{ $all_perms->{$module} } ) {
$template->param( "CAN_user_${module}_${subperm}" => 1 );
}

16
C4/Members.pm

@ -974,10 +974,20 @@ addresses.
sub GetFirstValidEmailAddress {
my $borrowernumber = shift;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare( "SELECT email, emailpro, B_email FROM borrowers where borrowernumber = ? ");
$sth->execute( $borrowernumber );
my $data = $sth->fetchrow_hashref;
my $borrower = Koha::Patrons->find( $borrowernumber );
return $borrower->first_valid_email_address();
if ($data->{'email'}) {
return $data->{'email'};
} elsif ($data->{'emailpro'}) {
return $data->{'emailpro'};
} elsif ($data->{'B_email'}) {
return $data->{'B_email'};
} else {
return '';
}
}
=head2 GetNoticeEmailAddress

92
Koha/Club.pm

@ -1,92 +0,0 @@
package Koha::Club;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Templates;
use Koha::Club::Fields;
use Koha::Libraries;
use base qw(Koha::Object);
=head1 NAME
Koha::Club - Koha Club Object class
=head1 API
=head2 Class Methods
=cut
=head3 club_template
=cut
sub club_template {
my ($self) = @_;
return unless $self->club_template_id();
return Koha::Club::Templates->find( $self->club_template_id() );
}
=head3 club_fields
=cut
sub club_fields {
my ($self) = @_;
return unless $self->id();
return Koha::Club::Fields->search( { club_id => $self->id() } );
}
=head3 club_fields
=cut
sub branch {
my ($self) = @_;
return unless $self->branchcode();
return Koha::Libraries->find( $self->branchcode() );
}
=head3 type
=cut
sub _type {
return 'Club';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

78
Koha/Club/Enrollment.pm

@ -1,78 +0,0 @@
package Koha::Club::Enrollment;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Clubs;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Enrollment
Represents a "pattern" on which many clubs can be created.
In this way we can directly compare different clubs of the same 'template'
for statistical purposes.
=head1 API
=head2 Class Methods
=cut
=head3 cancel
=cut
sub cancel {
my ( $self ) = @_;
$self->_result()->update( { date_canceled => \'NOW()' } );
return $self;
}
=head3 club
=cut
sub club {
my ( $self ) = @_;
return Koha::Clubs->find( $self->club_id() );
}
=head3 type
=cut
sub _type {
return 'ClubEnrollment';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

56
Koha/Club/Enrollment/Field.pm

@ -1,56 +0,0 @@
package Koha::Club::Enrollment::Field;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Enrollment::Field
Represents a "pattern" on which many clubs can be created.
In this way we can directly compare different clubs of the same 'template'
for statistical purposes.
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubEnrollmentField';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

60
Koha/Club/Enrollment/Fields.pm

@ -1,60 +0,0 @@
package Koha::Club::Enrollment::Fields;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Enrollment::Field;
use base qw(Koha::Objects);
=head1 NAME
Koha::Club::Enrollment::Fields
This object represents a collection of club enrollemnt fields.
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubEnrollmentField';
}
sub object_class {
return 'Koha::Club::Enrollment::Field';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

60
Koha/Club/Enrollments.pm

@ -1,60 +0,0 @@
package Koha::Club::Enrollments;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Enrollment;
use base qw(Koha::Objects);
=head1 NAME
Koha::Club::Enrollments
This object represents a collection of club templates.
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubEnrollment';
}
sub object_class {
return 'Koha::Club::Enrollment';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

66
Koha/Club/Field.pm

@ -1,66 +0,0 @@
package Koha::Club::Field;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Template::Fields;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Field
Represents the value set at creation time for a Koha::Club::Template::Field
=head1 API
=head2 Class Methods
=cut
=head3 club_template_field
=cut
sub club_template_field {
my ( $self ) = @_;
return Koha::Club::Template::Fields->find( $self->club_template_field_id );
}
=head3 type
=cut
sub _type {
return 'ClubField';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

60
Koha/Club/Fields.pm

@ -1,60 +0,0 @@
package Koha::Club::Fields;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Field;
use base qw(Koha::Objects);
=head1 NAME
Koha::Club::Fields
Represents a collection of club fields.
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubField';
}
sub object_class {
return 'Koha::Club::Field';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

75
Koha/Club/Template.pm

@ -1,75 +0,0 @@
package Koha::Club::Template;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Template::Fields;
use Koha::Club::Template::EnrollmentFields;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Template
Represents a "pattern" on which many clubs can be created.
In this way we can directly compare different clubs of the same 'template'
for statistical purposes.
=head1 API
=head2 Class Methods
=cut
=head3 club_template_fields
=cut
sub club_template_fields {
my ($self) = @_;
return Koha::Club::Template::Fields->search( { club_template_id => $self->id() } );
}
sub club_template_enrollment_fields {
my ($self) = @_;
return Koha::Club::Template::EnrollmentFields->search( { club_template_id => $self->id() } );
}
=head3 type
=cut
sub _type {
return 'ClubTemplate';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

54
Koha/Club/Template/EnrollmentField.pm

@ -1,54 +0,0 @@
package Koha::Club::Template::EnrollmentField;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Template::EnrollemntField
Represents a club field that is only set at the time a patron is enrolled
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubTemplateEnrollmentField';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

60
Koha/Club/Template/EnrollmentFields.pm

@ -1,60 +0,0 @@
package Koha::Club::Template::EnrollmentFields;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Template::EnrollmentField;
use base qw(Koha::Objects);
=head1 NAME
Koha::Club::Template::EnrollemntFields
Represents a colleciton of club fields that are only set at the time a patron is enrolled
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubTemplateEnrollmentField';
}
sub object_class {
return 'Koha::Club::Template::EnrollmentField';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

54
Koha/Club/Template/Field.pm

@ -1,54 +0,0 @@
package Koha::Club::Template::Field;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use base qw(Koha::Object);
=head1 NAME
Koha::Club::Template::Field
Represents a club field that is set when the club is created
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubTemplateField';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

60
Koha/Club/Template/Fields.pm

@ -1,60 +0,0 @@
package Koha::Club::Template::Fields;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Template::Field;
use base qw(Koha::Objects);
=head1 NAME
Koha::Club::Template::Fields
Represents a collection of club fields that are set when the club is created
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubTemplateField';
}
sub object_class {
return 'Koha::Club::Template::Field';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

60
Koha/Club/Templates.pm

@ -1,60 +0,0 @@
package Koha::Club::Templates;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club::Template;
use base qw(Koha::Objects);
=head1 NAME
Koha::Club::Templates
This object represents a collection of club templates.
=head1 API
=head2 Class Methods
=cut
=head3 type
=cut
sub _type {
return 'ClubTemplate';
}
sub object_class {
return 'Koha::Club::Template';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

92
Koha/Clubs.pm

@ -1,92 +0,0 @@
package Koha::Clubs;
# Copyright ByWater Solutions 2014
#
# 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 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.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use Carp;
use Koha::Database;
use Koha::Club;
use base qw(Koha::Objects);
=head1 NAME
Koha::Clubs - Koha Clubs Object class
This object represents a collection of clubs a patron may enroll in.
=head1 API
=head2 Class Methods
=cut
=head3 get_enrollable
=cut
sub get_enrollable {
my ( $self, $params ) = @_;
# We need to filter out all the already enrolled in clubs
my $borrower = $params->{borrower};
if ($borrower) {
delete( $params->{borrower} );
my @enrollments = $borrower->get_club_enrollments();
if (@enrollments) {
$params->{'me.id'} = { -not_in => [ map { $_->club()->id() } @enrollments ] };
}
}
my $rs = $self->_resultset()->search( $params, { prefetch => 'club_template' } );
if (wantarray) {
my $class = ref($self) ? ref($self) : $self;
return $class->_wrap( $rs->all() );
}
else {
my $class = ref($self) ? ref($self) : $self;
return $class->_new_from_dbic($rs);
}
}
=head3 type
=cut
sub _type {
return 'Club';
}
sub object_class {
return 'Koha::Club';
}
=head1 AUTHOR
Kyle M Hall <kyle@bywatersolutions.com>
=cut
1;

38
Koha/Patron.pm

@ -35,7 +35,6 @@ use Koha::Patron::HouseboundRole;
use Koha::Patron::Images;
use Koha::Patrons;
use Koha::Virtualshelves;
use Koha::Club::Enrollments;
use base qw(Koha::Object);
@ -585,43 +584,6 @@ sub holds {
return Koha::Holds->_new_from_dbic($holds_rs);
}
=head3 first_valid_email_address
=cut
sub first_valid_email_address {
my ($self) = @_;
return $self->email() || $self->emailpro() || $self->B_email() || q{};
}
=head3 get_club_enrollments
=cut
sub get_club_enrollments {
my ($self) = @_;
return Koha::Club::Enrollments->search( { borrowernumber => $self->borrowernumber(), date_canceled => undef } );
}
=head3 get_enrollable_clubs
=cut
sub get_enrollable_clubs {
my ( $self, $is_enrollable_from_opac ) = @_;
my $params;
$params->{is_enrollable_from_opac} = $is_enrollable_from_opac
if $is_enrollable_from_opac;
$params->{is_email_required} = 0 unless $self->first_valid_email_address();
$params->{borrower} = $self;
return Koha::Clubs->get_enrollable($params);
}
=head3 type
=cut

4
Koha/Schema/Result/AuthorisedValue.pm

@ -130,8 +130,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-01-12 09:54:50
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IzI/WpMbwvfZ8BpHtRCsiQ
# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-30 11:52:45
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LOArv8JQ0aiTZgcy+jb7pA
# You can replace this text with custom content, and it will be preserved on regeneration

15
Koha/Schema/Result/Borrower.pm

@ -860,21 +860,6 @@ __PACKAGE__->belongs_to(
{ is_deferrable => 1, on_delete => "RESTRICT", on_update => "RESTRICT" },
);
=head2 club_enrollments
Type: has_many
Related object: L<Koha::Schema::Result::ClubEnrollment>
=cut
__PACKAGE__->has_many(
"club_enrollments",
"Koha::Schema::Result::ClubEnrollment",
{ "foreign.borrowernumber" => "self.borrowernumber" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 course_instructors
Type: has_many

49
Koha/Schema/Result/Branch.pm

@ -352,51 +352,6 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 club_enrollments
Type: has_many
Related object: L<Koha::Schema::Result::ClubEnrollment>
=cut
__PACKAGE__->has_many(
"club_enrollments",
"Koha::Schema::Result::ClubEnrollment",
{ "foreign.branchcode" => "self.branchcode" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 club_templates
Type: has_many
Related object: L<Koha::Schema::Result::ClubTemplate>
=cut
__PACKAGE__->has_many(
"club_templates",
"Koha::Schema::Result::ClubTemplate",
{ "foreign.branchcode" => "self.branchcode" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 clubs
Type: has_many
Related object: L<Koha::Schema::Result::Club>
=cut
__PACKAGE__->has_many(
"clubs",
"Koha::Schema::Result::Club",
{ "foreign.branchcode" => "self.branchcode" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 collections
Type: has_many
@ -588,8 +543,8 @@ Composing rels: L</branchrelations> -> categorycode
__PACKAGE__->many_to_many("categorycodes", "branchrelations", "categorycode");
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-01-12 09:56:17
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lvjA8x8u5RKeZQ0+uiLm7A
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-24 13:56:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/9YwsU+GXK+fzc6IX2Tj5g
# You can replace this text with custom code or comments, and it will be preserved on regeneration

197
Koha/Schema/Result/Club.pm

@ -1,197 +0,0 @@
use utf8;
package Koha::Schema::Result::Club;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::Club
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<clubs>
=cut
__PACKAGE__->table("clubs");
=head1 ACCESSORS
=head2 id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 club_template_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
=head2 name
data_type: 'tinytext'
is_nullable: 0
=head2 description
data_type: 'text'
is_nullable: 1
=head2 date_start
data_type: 'date'
datetime_undef_if_invalid: 1
is_nullable: 1
=head2 date_end
data_type: 'date'
datetime_undef_if_invalid: 1
is_nullable: 1
=head2 branchcode
data_type: 'varchar'
is_foreign_key: 1
is_nullable: 1
size: 11
=head2 date_created
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: current_timestamp
is_nullable: 0
=head2 date_updated
data_type: 'timestamp'
datetime_undef_if_invalid: 1
is_nullable: 1
=cut
__PACKAGE__->add_columns(
"id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"club_template_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"name",
{ data_type => "tinytext", is_nullable => 0 },
"description",
{ data_type => "text", is_nullable => 1 },
"date_start",
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
"date_end",
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
"branchcode",
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 11 },
"date_created",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
"date_updated",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
);
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=cut
__PACKAGE__->set_primary_key("id");
=head1 RELATIONS
=head2 branchcode
Type: belongs_to
Related object: L<Koha::Schema::Result::Branch>
=cut
__PACKAGE__->belongs_to(
"branchcode",
"Koha::Schema::Result::Branch",
{ branchcode => "branchcode" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "RESTRICT",
on_update => "RESTRICT",
},
);
=head2 club_enrollments
Type: has_many
Related object: L<Koha::Schema::Result::ClubEnrollment>
=cut
__PACKAGE__->has_many(
"club_enrollments",
"Koha::Schema::Result::ClubEnrollment",
{ "foreign.club_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 club_fields
Type: has_many
Related object: L<Koha::Schema::Result::ClubField>
=cut
__PACKAGE__->has_many(
"club_fields",
"Koha::Schema::Result::ClubField",
{ "foreign.club_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 club_template
Type: belongs_to
Related object: L<Koha::Schema::Result::ClubTemplate>
=cut
__PACKAGE__->belongs_to(
"club_template",
"Koha::Schema::Result::ClubTemplate",
{ id => "club_template_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-01-12 09:56:17
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nMwJy/qR8aWu12hQq4rORQ
# You can replace this text with custom content, and it will be preserved on regeneration
1;

201
Koha/Schema/Result/ClubEnrollment.pm

@ -1,201 +0,0 @@
use utf8;
package Koha::Schema::Result::ClubEnrollment;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ClubEnrollment
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<club_enrollments>
=cut
__PACKAGE__->table("club_enrollments");
=head1 ACCESSORS
=head2 id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 club_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
=head2 borrowernumber
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
=head2 date_enrolled
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: current_timestamp
is_nullable: 0
=head2 date_canceled
data_type: 'timestamp'
datetime_undef_if_invalid: 1
is_nullable: 1
=head2 date_created
data_type: 'timestamp'
datetime_undef_if_invalid: 1
default_value: '0000-00-00 00:00:00'
is_nullable: 0
=head2 date_updated
data_type: 'timestamp'
datetime_undef_if_invalid: 1
is_nullable: 1
=head2 branchcode
data_type: 'varchar'
is_foreign_key: 1
is_nullable: 1
size: 11
=cut
__PACKAGE__->add_columns(
"id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"club_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"borrowernumber",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"date_enrolled",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => \"current_timestamp",
is_nullable => 0,
},
"date_canceled",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
"date_created",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
default_value => "0000-00-00 00:00:00",
is_nullable => 0,
},
"date_updated",
{
data_type => "timestamp",
datetime_undef_if_invalid => 1,
is_nullable => 1,
},
"branchcode",
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 11 },
);
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=cut
__PACKAGE__->set_primary_key("id");
=head1 RELATIONS
=head2 borrowernumber
Type: belongs_to
Related object: L<Koha::Schema::Result::Borrower>
=cut
__PACKAGE__->belongs_to(
"borrowernumber",
"Koha::Schema::Result::Borrower",
{ borrowernumber => "borrowernumber" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
=head2 branchcode
Type: belongs_to
Related object: L<Koha::Schema::Result::Branch>
=cut
__PACKAGE__->belongs_to(
"branchcode",
"Koha::Schema::Result::Branch",
{ branchcode => "branchcode" },
{
is_deferrable => 1,
join_type => "LEFT",
on_delete => "SET NULL",
on_update => "CASCADE",
},
);
=head2 club
Type: belongs_to
Related object: L<Koha::Schema::Result::Club>
=cut
__PACKAGE__->belongs_to(
"club",
"Koha::Schema::Result::Club",
{ id => "club_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
=head2 club_enrollment_fields
Type: has_many
Related object: L<Koha::Schema::Result::ClubEnrollmentField>
=cut
__PACKAGE__->has_many(
"club_enrollment_fields",
"Koha::Schema::Result::ClubEnrollmentField",
{ "foreign.club_enrollment_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
# Created by DBIx::Class::Schema::Loader v0.07040 @ 2015-01-12 09:56:17
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9ypc+smG/VlgtWW66PhvHQ
# You can replace this text with custom content, and it will be preserved on regeneration
1;

112
Koha/Schema/Result/ClubEnrollmentField.pm

@ -1,112 +0,0 @@
use utf8;
package Koha::Schema::Result::ClubEnrollmentField;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::ClubEnrollmentField
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<club_enrollment_fields>
=cut
__PACKAGE__->table("club_enrollment_fields");
=head1 ACCESSORS
=head2 id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 club_enrollment_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
=head2 club_template_enrollment_field_id
data_type: 'integer'
is_foreign_key: 1
is_nullable: 0
=head2 value
data_type: 'text'
is_nullable: 0
=cut
__PACKAGE__->add_columns(
"id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"club_enrollment_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"club_template_enrollment_field_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"value",
{ data_type => "text", is_nullable => 0 },
);
=head1 PRIMARY KEY
=over 4
=item * L</id>
=back
=cut
__PACKAGE__->set_primary_key("id");
=head1 RELATIONS
=head2 club_enrollment
Type: belongs_to
Related object: L<Koha::Schema::Result::ClubEnrollment>
=cut
__PACKAGE__->belongs_to(
"club_enrollment",
"Koha::Schema::Result::ClubEnrollment",
{ id => "club_enrollment_id" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
=head2 club_template_enrollment_field
Type: belongs_to
Related object: L<Koha::Schema::Result::ClubTemplateEnrollmentField>