From 8255344215e79a5274b05033cae4bcad8d441391 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Sun, 26 Feb 2017 20:41:27 -0500 Subject: [PATCH] Revert "Bug 12461 - Add patron clubs feature" This reverts commit 4f1eefdbb8bf4df07b03fc451c1c18ebe989c8b7. Signed-off-by: Kyle M Hall --- C4/Auth.pm | 5 +- C4/Members.pm | 16 +- Koha/Club.pm | 92 ------- Koha/Club/Enrollment.pm | 78 ------ Koha/Club/Enrollment/Field.pm | 56 ---- Koha/Club/Enrollment/Fields.pm | 60 ----- Koha/Club/Enrollments.pm | 60 ----- Koha/Club/Field.pm | 66 ----- Koha/Club/Fields.pm | 60 ----- Koha/Club/Template.pm | 75 ------ Koha/Club/Template/EnrollmentField.pm | 54 ---- Koha/Club/Template/EnrollmentFields.pm | 60 ----- Koha/Club/Template/Field.pm | 54 ---- Koha/Club/Template/Fields.pm | 60 ----- Koha/Club/Templates.pm | 60 ----- Koha/Clubs.pm | 92 ------- Koha/Patron.pm | 38 --- Koha/Schema/Result/AuthorisedValue.pm | 4 +- Koha/Schema/Result/Borrower.pm | 15 -- Koha/Schema/Result/Branch.pm | 49 +--- Koha/Schema/Result/Club.pm | 197 -------------- Koha/Schema/Result/ClubEnrollment.pm | 201 -------------- Koha/Schema/Result/ClubEnrollmentField.pm | 112 -------- Koha/Schema/Result/ClubField.pm | 112 -------- Koha/Schema/Result/ClubTemplate.pm | 195 -------------- .../Result/ClubTemplateEnrollmentField.pm | 119 --------- Koha/Schema/Result/ClubTemplateField.pm | 119 --------- Koha/Template/Plugin/AuthorisedValues.pm | 4 +- Koha/Template/Plugin/Borrowers.pm | 1 + clubs/clubs-add-modify.pl | 107 -------- clubs/clubs.pl | 60 ----- clubs/patron-clubs-tab.pl | 55 ---- clubs/patron-enroll.pl | 50 ---- clubs/templates-add-modify.pl | 152 ----------- .../data/mysql/atomicupdate/bug_12461.sql | 131 --------- installer/data/mysql/kohastructure.sql | 126 --------- installer/data/mysql/userflags.sql | 3 +- installer/data/mysql/userpermissions.sql | 5 +- .../prog/en/includes/permissions.inc | 4 - .../prog/en/includes/tools-menu.inc | 3 - .../prog/en/modules/circ/circulation.tt | 23 -- .../prog/en/modules/clubs/clubs-add-modify.tt | 115 -------- .../prog/en/modules/clubs/clubs.tt | 252 ------------------ .../prog/en/modules/clubs/patron-clubs-tab.tt | 102 ------- .../prog/en/modules/clubs/patron-enroll.tt | 66 ----- .../en/modules/clubs/templates-add-modify.tt | 216 --------------- .../prog/en/modules/members/moremember.tt | 22 -- .../prog/en/modules/tools/tools-home.tt | 5 - .../bootstrap/en/modules/clubs/clubs-tab.tt | 102 ------- .../bootstrap/en/modules/clubs/enroll.tt | 66 ----- .../bootstrap/en/modules/opac-user.tt | 24 +- members/moremember.pl | 2 - opac/clubs/clubs-tab.pl | 52 ---- opac/clubs/enroll.pl | 49 ---- opac/svc/club/cancel_enrollment | 47 ---- opac/svc/club/enroll | 77 ------ svc/club/cancel_enrollment | 46 ---- svc/club/delete | 48 ---- svc/club/enroll | 74 ----- svc/club/template/delete | 49 ---- t/db_dependent/Clubs.t | 221 --------------- 61 files changed, 25 insertions(+), 4443 deletions(-) delete mode 100644 Koha/Club.pm delete mode 100644 Koha/Club/Enrollment.pm delete mode 100644 Koha/Club/Enrollment/Field.pm delete mode 100644 Koha/Club/Enrollment/Fields.pm delete mode 100644 Koha/Club/Enrollments.pm delete mode 100644 Koha/Club/Field.pm delete mode 100644 Koha/Club/Fields.pm delete mode 100644 Koha/Club/Template.pm delete mode 100644 Koha/Club/Template/EnrollmentField.pm delete mode 100644 Koha/Club/Template/EnrollmentFields.pm delete mode 100644 Koha/Club/Template/Field.pm delete mode 100644 Koha/Club/Template/Fields.pm delete mode 100644 Koha/Club/Templates.pm delete mode 100644 Koha/Clubs.pm delete mode 100644 Koha/Schema/Result/Club.pm delete mode 100644 Koha/Schema/Result/ClubEnrollment.pm delete mode 100644 Koha/Schema/Result/ClubEnrollmentField.pm delete mode 100644 Koha/Schema/Result/ClubField.pm delete mode 100644 Koha/Schema/Result/ClubTemplate.pm delete mode 100644 Koha/Schema/Result/ClubTemplateEnrollmentField.pm delete mode 100644 Koha/Schema/Result/ClubTemplateField.pm delete mode 100755 clubs/clubs-add-modify.pl delete mode 100755 clubs/clubs.pl delete mode 100755 clubs/patron-clubs-tab.pl delete mode 100755 clubs/patron-enroll.pl delete mode 100755 clubs/templates-add-modify.pl delete mode 100644 installer/data/mysql/atomicupdate/bug_12461.sql delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt delete mode 100755 opac/clubs/clubs-tab.pl delete mode 100755 opac/clubs/enroll.pl delete mode 100755 opac/svc/club/cancel_enrollment delete mode 100755 opac/svc/club/enroll delete mode 100755 svc/club/cancel_enrollment delete mode 100755 svc/club/delete delete mode 100755 svc/club/enroll delete mode 100755 svc/club/template/delete delete mode 100755 t/db_dependent/Clubs.t diff --git a/C4/Auth.pm b/C4/Auth.pm index 367c1ba1f4..20d64a56ae 100644 --- a/C4/Auth.pm +++ b/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 ); } diff --git a/C4/Members.pm b/C4/Members.pm index 4915cd2e00..a50104192a 100644 --- a/C4/Members.pm +++ b/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 diff --git a/Koha/Club.pm b/Koha/Club.pm deleted file mode 100644 index 89f940902f..0000000000 --- a/Koha/Club.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Enrollment.pm b/Koha/Club/Enrollment.pm deleted file mode 100644 index f7489d0660..0000000000 --- a/Koha/Club/Enrollment.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Enrollment/Field.pm b/Koha/Club/Enrollment/Field.pm deleted file mode 100644 index d524b6aa7b..0000000000 --- a/Koha/Club/Enrollment/Field.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Enrollment/Fields.pm b/Koha/Club/Enrollment/Fields.pm deleted file mode 100644 index ac9dbac8e0..0000000000 --- a/Koha/Club/Enrollment/Fields.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Enrollments.pm b/Koha/Club/Enrollments.pm deleted file mode 100644 index b1724c02a3..0000000000 --- a/Koha/Club/Enrollments.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Field.pm b/Koha/Club/Field.pm deleted file mode 100644 index 6f92d83f31..0000000000 --- a/Koha/Club/Field.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Fields.pm b/Koha/Club/Fields.pm deleted file mode 100644 index a9ea99777c..0000000000 --- a/Koha/Club/Fields.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Template.pm b/Koha/Club/Template.pm deleted file mode 100644 index f4c5750336..0000000000 --- a/Koha/Club/Template.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Template/EnrollmentField.pm b/Koha/Club/Template/EnrollmentField.pm deleted file mode 100644 index 76e47dfc4b..0000000000 --- a/Koha/Club/Template/EnrollmentField.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Template/EnrollmentFields.pm b/Koha/Club/Template/EnrollmentFields.pm deleted file mode 100644 index b90bfd8fdc..0000000000 --- a/Koha/Club/Template/EnrollmentFields.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Template/Field.pm b/Koha/Club/Template/Field.pm deleted file mode 100644 index 3a8223a55f..0000000000 --- a/Koha/Club/Template/Field.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Template/Fields.pm b/Koha/Club/Template/Fields.pm deleted file mode 100644 index 392a9589db..0000000000 --- a/Koha/Club/Template/Fields.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Club/Templates.pm b/Koha/Club/Templates.pm deleted file mode 100644 index c7065d14e1..0000000000 --- a/Koha/Club/Templates.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Clubs.pm b/Koha/Clubs.pm deleted file mode 100644 index fff88d80fa..0000000000 --- a/Koha/Clubs.pm +++ /dev/null @@ -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 - -=cut - -1; diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 759d2d684f..b79b58a907 100644 --- a/Koha/Patron.pm +++ b/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 diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm index ddb2758225..394844d6d9 100644 --- a/Koha/Schema/Result/AuthorisedValue.pm +++ b/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 diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index b4b63132df..547028f592 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/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 - -=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 diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index e25b6f8fd7..ec44cded06 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/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 - -=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 - -=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 - -=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 -> 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 diff --git a/Koha/Schema/Result/Club.pm b/Koha/Schema/Result/Club.pm deleted file mode 100644 index b7af22769e..0000000000 --- a/Koha/Schema/Result/Club.pm +++ /dev/null @@ -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 - -=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 - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 branchcode - -Type: belongs_to - -Related object: L - -=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 - -=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 - -=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 - -=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; diff --git a/Koha/Schema/Result/ClubEnrollment.pm b/Koha/Schema/Result/ClubEnrollment.pm deleted file mode 100644 index 177527e6b4..0000000000 --- a/Koha/Schema/Result/ClubEnrollment.pm +++ /dev/null @@ -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 - -=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 - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 borrowernumber - -Type: belongs_to - -Related object: L - -=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 - -=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 - -=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 - -=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; diff --git a/Koha/Schema/Result/ClubEnrollmentField.pm b/Koha/Schema/Result/ClubEnrollmentField.pm deleted file mode 100644 index 6ba0fded46..0000000000 --- a/Koha/Schema/Result/ClubEnrollmentField.pm +++ /dev/null @@ -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 - -=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 - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 club_enrollment - -Type: belongs_to - -Related object: L - -=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 - -=cut - -__PACKAGE__->belongs_to( - "club_template_enrollment_field", - "Koha::Schema::Result::ClubTemplateEnrollmentField", - { id => "club_template_enrollment_field_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:2ANAs3mh3i/kd3Qxrcd5IA - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; diff --git a/Koha/Schema/Result/ClubField.pm b/Koha/Schema/Result/ClubField.pm deleted file mode 100644 index eab0f4b322..0000000000 --- a/Koha/Schema/Result/ClubField.pm +++ /dev/null @@ -1,112 +0,0 @@ -use utf8; -package Koha::Schema::Result::ClubField; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::ClubField - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("club_fields"); - -=head1 ACCESSORS - -=head2 id - - data_type: 'integer' - is_auto_increment: 1 - is_nullable: 0 - -=head2 club_template_field_id - - data_type: 'integer' - is_foreign_key: 1 - is_nullable: 0 - -=head2 club_id - - data_type: 'integer' - is_foreign_key: 1 - is_nullable: 0 - -=head2 value - - data_type: 'text' - is_nullable: 1 - -=cut - -__PACKAGE__->add_columns( - "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, - "club_template_field_id", - { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, - "club_id", - { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, - "value", - { data_type => "text", is_nullable => 1 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 club - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "club", - "Koha::Schema::Result::Club", - { id => "club_id" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - -=head2 club_template_field - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "club_template_field", - "Koha::Schema::Result::ClubTemplateField", - { id => "club_template_field_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:m4GLLIVIHgRpRhCGLh12DQ - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; diff --git a/Koha/Schema/Result/ClubTemplate.pm b/Koha/Schema/Result/ClubTemplate.pm deleted file mode 100644 index 2c6f37a411..0000000000 --- a/Koha/Schema/Result/ClubTemplate.pm +++ /dev/null @@ -1,195 +0,0 @@ -use utf8; -package Koha::Schema::Result::ClubTemplate; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::ClubTemplate - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("club_templates"); - -=head1 ACCESSORS - -=head2 id - - data_type: 'integer' - is_auto_increment: 1 - is_nullable: 0 - -=head2 name - - data_type: 'tinytext' - is_nullable: 0 - -=head2 description - - data_type: 'text' - is_nullable: 1 - -=head2 is_enrollable_from_opac - - data_type: 'tinyint' - default_value: 0 - is_nullable: 0 - -=head2 is_email_required - - data_type: 'tinyint' - default_value: 0 - is_nullable: 0 - -=head2 branchcode - - data_type: 'varchar' - is_foreign_key: 1 - is_nullable: 1 - size: 10 - -=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 - -=head2 is_deletable - - data_type: 'tinyint' - default_value: 1 - is_nullable: 0 - -=cut - -__PACKAGE__->add_columns( - "id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, - "name", - { data_type => "tinytext", is_nullable => 0 }, - "description", - { data_type => "text", is_nullable => 1 }, - "is_enrollable_from_opac", - { data_type => "tinyint", default_value => 0, is_nullable => 0 }, - "is_email_required", - { data_type => "tinyint", default_value => 0, is_nullable => 0 }, - "branchcode", - { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, - "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, - }, - "is_deletable", - { data_type => "tinyint", default_value => 1, is_nullable => 0 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 branchcode - -Type: belongs_to - -Related object: L - -=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_template_enrollment_fields - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "club_template_enrollment_fields", - "Koha::Schema::Result::ClubTemplateEnrollmentField", - { "foreign.club_template_id" => "self.id" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 club_template_fields - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "club_template_fields", - "Koha::Schema::Result::ClubTemplateField", - { "foreign.club_template_id" => "self.id" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 clubs - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "clubs", - "Koha::Schema::Result::Club", - { "foreign.club_template_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:j5aiACVUGzrdng4+jt6mfg - -1; diff --git a/Koha/Schema/Result/ClubTemplateEnrollmentField.pm b/Koha/Schema/Result/ClubTemplateEnrollmentField.pm deleted file mode 100644 index 3b3907d96a..0000000000 --- a/Koha/Schema/Result/ClubTemplateEnrollmentField.pm +++ /dev/null @@ -1,119 +0,0 @@ -use utf8; -package Koha::Schema::Result::ClubTemplateEnrollmentField; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::ClubTemplateEnrollmentField - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("club_template_enrollment_fields"); - -=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 authorised_value_category - - data_type: 'varchar' - is_nullable: 1 - size: 16 - -=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 }, - "authorised_value_category", - { data_type => "varchar", is_nullable => 1, size => 16 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 club_enrollment_fields - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "club_enrollment_fields", - "Koha::Schema::Result::ClubEnrollmentField", - { "foreign.club_template_enrollment_field_id" => "self.id" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 club_template - -Type: belongs_to - -Related object: L - -=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:KGo2mEIAkTVYSPsOLoaBCg - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; diff --git a/Koha/Schema/Result/ClubTemplateField.pm b/Koha/Schema/Result/ClubTemplateField.pm deleted file mode 100644 index ecbca855d8..0000000000 --- a/Koha/Schema/Result/ClubTemplateField.pm +++ /dev/null @@ -1,119 +0,0 @@ -use utf8; -package Koha::Schema::Result::ClubTemplateField; - -# Created by DBIx::Class::Schema::Loader -# DO NOT MODIFY THE FIRST PART OF THIS FILE - -=head1 NAME - -Koha::Schema::Result::ClubTemplateField - -=cut - -use strict; -use warnings; - -use base 'DBIx::Class::Core'; - -=head1 TABLE: C - -=cut - -__PACKAGE__->table("club_template_fields"); - -=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 authorised_value_category - - data_type: 'varchar' - is_nullable: 1 - size: 16 - -=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 }, - "authorised_value_category", - { data_type => "varchar", is_nullable => 1, size => 16 }, -); - -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("id"); - -=head1 RELATIONS - -=head2 club_fields - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "club_fields", - "Koha::Schema::Result::ClubField", - { "foreign.club_template_field_id" => "self.id" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 club_template - -Type: belongs_to - -Related object: L - -=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:P73ABSn2tzlTYbD3nov21g - - -# You can replace this text with custom content, and it will be preserved on regeneration -1; diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm index a50446535c..39ec785131 100644 --- a/Koha/Template/Plugin/AuthorisedValues.pm +++ b/Koha/Template/Plugin/AuthorisedValues.pm @@ -35,8 +35,8 @@ sub GetByCode { } sub Get { - my ( $self, $category, $selected, $opac ) = @_; - return GetAuthorisedValues( $category, $selected, $opac ); + my ( $self, $category, $opac ) = @_; + return GetAuthorisedValues( $category, $opac ); } sub GetAuthValueDropbox { diff --git a/Koha/Template/Plugin/Borrowers.pm b/Koha/Template/Plugin/Borrowers.pm index 327431ba34..cb50312d55 100644 --- a/Koha/Template/Plugin/Borrowers.pm +++ b/Koha/Template/Plugin/Borrowers.pm @@ -57,4 +57,5 @@ sub HasOverdues { return Koha::Patrons->find( $borrowernumber )->has_overdues; } + 1; diff --git a/clubs/clubs-add-modify.pl b/clubs/clubs-add-modify.pl deleted file mode 100755 index d1873d4fbd..0000000000 --- a/clubs/clubs-add-modify.pl +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; -use Koha::Database; -use Koha::DateUtils qw(dt_from_string); -use Koha::Clubs; -use Koha::Club::Fields; - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => 'clubs/clubs-add-modify.tt', - query => $cgi, - type => 'intranet', - authnotrequired => 0, - flagsrequired => { clubs => 'edit_clubs' }, - } -); - -my $schema = Koha::Database->new()->schema(); - -my $id = $cgi->param('id'); -my $club = $id ? Koha::Clubs->find($id) : Koha::Club->new(); -my $stored = $cgi->param('name') ? $id ? 'updated' : 'stored' : undef; - -my $club_template_id = $cgi->param('club_template_id'); -my $club_template = $club->club_template() || Koha::Club::Templates->find($club_template_id); -$club_template_id ||= $club_template->id(); - -my $date_start = $cgi->param('date_start'); -$date_start = $date_start ? dt_from_string($date_start) : undef; -my $date_end = $cgi->param('date_end'); -$date_end = $date_end ? dt_from_string($date_end) : undef; - -if ( $cgi->param('name') ) { # Update or create club - $club->set( - { - club_template_id => $cgi->param('club_template_id') || undef, - name => $cgi->param('name') || undef, - description => $cgi->param('description') || undef, - branchcode => $cgi->param('branchcode') || undef, - date_start => $date_start, - date_end => $date_end, - date_updated => dt_from_string(), - } - )->store(); - - my @club_template_field_id = $cgi->multi_param('club_template_field_id'); - my @club_field_id = $cgi->multi_param('club_field_id'); - my @club_field = $cgi->multi_param('club_field'); - - for ( my $i = 0 ; $i < @club_template_field_id ; $i++ ) { - my $club_template_field_id = $club_template_field_id[$i] || undef; - my $club_field_id = $club_field_id[$i] || undef; - my $club_field = $club_field[$i] || undef; - - my $field = - $club_field_id - ? Koha::Club::Fields->find($club_field_id) - : Koha::Club::Field->new(); - - $field->set( - { - club_id => $club->id(), - club_template_field_id => $club_template_field_id, - value => $club_field, - } - )->store(); - } - - $id ||= $club->id(); - - print $cgi->redirect("/cgi-bin/koha/clubs/clubs.pl?stored=$stored&club_id=$id"); - exit; -} - -$club = Koha::Clubs->find($id); - -$template->param( - club_template => $club_template, - club => $club, -); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/clubs/clubs.pl b/clubs/clubs.pl deleted file mode 100755 index 4429e236a8..0000000000 --- a/clubs/clubs.pl +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; - -use Koha::Clubs; -use Koha::Club::Templates; - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "clubs/clubs.tt", - query => $cgi, - type => "intranet", - authnotrequired => 0, - flagsrequired => { clubs => '*' }, - } -); - -my $stored = $cgi->param('stored'); -my $club_template_id = $cgi->param('club_template_id'); -my $club_id = $cgi->param('club_id'); - -my $club_template = $club_template_id ? Koha::Club::Templates->find( $club_template_id ) : undef; -my $club = $club_id ? Koha::Clubs->find( $club_id ) : undef; - -my @club_templates = Koha::Club::Templates->search(); -my @clubs = Koha::Clubs->search(); - -$template->param( - stored => $stored, - club_template => $club_template, - club => $club, - club_templates => \@club_templates, - clubs => \@clubs, -); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/clubs/patron-clubs-tab.pl b/clubs/patron-clubs-tab.pl deleted file mode 100755 index f50da65a5a..0000000000 --- a/clubs/patron-clubs-tab.pl +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; - -use Koha::Patrons; -use Koha::Club::Enrollments; - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "clubs/patron-clubs-tab.tt", - query => $cgi, - type => "intranet", - authnotrequired => 0, - flagsrequired => { clubs => '*' }, - } -); - -my $patronnumber = $cgi->param('borrowernumber'); - -my $patron = Koha::Patrons->find($patronnumber); - -my @enrollments = $patron->get_club_enrollments(); -my @clubs = $patron->get_enrollable_clubs(); - -$template->param( - enrollments => \@enrollments, - clubs => \@clubs, - borrowernumber => $patronnumber -); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/clubs/patron-enroll.pl b/clubs/patron-enroll.pl deleted file mode 100755 index bc836277af..0000000000 --- a/clubs/patron-enroll.pl +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; -use Koha::Clubs; - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "clubs/patron-enroll.tt", - query => $cgi, - type => "intranet", - authnotrequired => 0, - flagsrequired => { clubs => '*' }, - } -); - -my $id = $cgi->param('id'); -my $borrowernumber = $cgi->param('borrowernumber'); - -my $club = Koha::Clubs->find($id); - -$template->param( - club => $club, - borrowernumber => $borrowernumber, -); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/clubs/templates-add-modify.pl b/clubs/templates-add-modify.pl deleted file mode 100755 index ae46178508..0000000000 --- a/clubs/templates-add-modify.pl +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; - -use Koha::DateUtils qw(dt_from_string); -use Koha::Club::Templates; -use Koha::Club::Template::Fields; -use Koha::Club::Template::EnrollmentFields; - -use Koha::Database; -my $schema = Koha::Database->new()->schema(); - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => 'clubs/templates-add-modify.tt', - query => $cgi, - type => 'intranet', - authnotrequired => 0, - flagsrequired => { clubs => 'edit_templates' }, - } -); - -my $id = $cgi->param('id'); - -my $club_template; -my $stored; - -if ( $cgi->param('name') ) { # Update or create club - if ($id) { - $club_template = Koha::Club::Templates->find($id); - $stored = 'updated'; - } - else { - $club_template = Koha::Club::Template->new(); - $stored = 'created'; - } - - $club_template->set( - { - id => $id || undef, - name => $cgi->param('name') || undef, - description => $cgi->param('description') || undef, - branchcode => $cgi->param('branchcode') || undef, - date_updated => dt_from_string(), - is_email_required => $cgi->param('is_email_required') ? 1 : 0, - is_enrollable_from_opac => $cgi->param('is_enrollable_from_opac') ? 1 : 0, - } - )->store(); - - $id ||= $club_template->id(); - - # Update club creation fields - my @field_id = $cgi->multi_param('club_template_field_id'); - my @field_name = $cgi->multi_param('club_template_field_name'); - my @field_description = $cgi->multi_param('club_template_field_description'); - my @field_authorised_value_category = $cgi->multi_param('club_template_field_authorised_value_category'); - - my @field_delete = $cgi->multi_param('club_template_field_delete'); - - for ( my $i = 0 ; $i < @field_id ; $i++ ) { - my $field_id = $field_id[$i]; - my $field_name = $field_name[$i]; - my $field_description = $field_description[$i]; - my $field_authorised_value_category = $field_authorised_value_category[$i]; - - my $field = - $field_id - ? Koha::Club::Template::Fields->find($field_id) - : Koha::Club::Template::Field->new(); - - if ( grep( /^$field_id$/, @field_delete ) ) { - $field->delete(); - } - else { - $field->set( - { - club_template_id => $id, - name => $field_name, - description => $field_description, - authorised_value_category => $field_authorised_value_category, - } - )->store(); - } - } - - # Update club enrollment fields - @field_id = $cgi->multi_param('club_template_enrollment_field_id'); - @field_name = $cgi->multi_param('club_template_enrollment_field_name'); - @field_description = $cgi->multi_param('club_template_enrollment_field_description'); - @field_authorised_value_category = $cgi->multi_param('club_template_enrollment_field_authorised_value_category'); - - @field_delete = $cgi->multi_param('club_template_enrollment_field_delete'); - - for ( my $i = 0 ; $i < @field_id ; $i++ ) { - my $field_id = $field_id[$i]; - my $field_name = $field_name[$i]; - my $field_description = $field_description[$i]; - my $field_authorised_value_category = $field_authorised_value_category[$i]; - - my $field = - $field_id - ? Koha::Club::Template::EnrollmentFields->find($field_id) - : Koha::Club::Template::EnrollmentField->new(); - - if ( grep( /^$field_id$/, @field_delete ) ) { - $field->delete(); - } - else { - $field->set( - { - id => $field_id, - club_template_id => $id, - name => $field_name, - description => $field_description, - authorised_value_category => $field_authorised_value_category, - } - )->store(); - } - } - - print $cgi->redirect("/cgi-bin/koha/clubs/clubs.pl?stored=$stored&club_template_id=$id"); - exit; -} - -$club_template ||= Koha::Club::Templates->find($id); -$template->param( club_template => $club_template ); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/installer/data/mysql/atomicupdate/bug_12461.sql b/installer/data/mysql/atomicupdate/bug_12461.sql deleted file mode 100644 index f038ba5ccb..0000000000 --- a/installer/data/mysql/atomicupdate/bug_12461.sql +++ /dev/null @@ -1,131 +0,0 @@ --- --- Table structure for table 'club_templates' --- - -CREATE TABLE IF NOT EXISTS club_templates ( - id int(11) NOT NULL AUTO_INCREMENT, - `name` tinytext NOT NULL, - description text, - is_enrollable_from_opac tinyint(1) NOT NULL DEFAULT '0', - is_email_required tinyint(1) NOT NULL DEFAULT '0', - branchcode varchar(10) NULL DEFAULT NULL, - date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - date_updated timestamp NULL DEFAULT NULL, - is_deletable tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (id), - KEY ct_branchcode (branchcode), - CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (branchcode) REFERENCES `branches` (branchcode) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'clubs' --- - -CREATE TABLE IF NOT EXISTS clubs ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, - description text, - date_start date DEFAULT NULL, - date_end date DEFAULT NULL, - branchcode varchar(10) NULL DEFAULT NULL, - date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - date_updated timestamp NULL DEFAULT NULL, - PRIMARY KEY (id), - KEY club_template_id (club_template_id), - KEY branchcode (branchcode), - CONSTRAINT clubs_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT clubs_ibfk_2 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_enrollments' --- - -CREATE TABLE IF NOT EXISTS club_enrollments ( - id int(11) NOT NULL AUTO_INCREMENT, - club_id int(11) NOT NULL, - borrowernumber int(11) NOT NULL, - date_enrolled timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - date_canceled timestamp NULL DEFAULT NULL, - date_created timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - date_updated timestamp NULL DEFAULT NULL, - branchcode varchar(10) NULL DEFAULT NULL, - PRIMARY KEY (id), - KEY club_id (club_id), - KEY borrowernumber (borrowernumber), - KEY branchcode (branchcode), - CONSTRAINT club_enrollments_ibfk_1 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_enrollments_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_enrollments_ibfk_3 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_template_enrollment_fields' --- - -CREATE TABLE IF NOT EXISTS club_template_enrollment_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, - description text, - authorised_value_category varchar(16) DEFAULT NULL, - PRIMARY KEY (id), - KEY club_template_id (club_template_id), - CONSTRAINT club_template_enrollment_fields_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_enrollment_fields' --- - -CREATE TABLE IF NOT EXISTS club_enrollment_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_enrollment_id int(11) NOT NULL, - club_template_enrollment_field_id int(11) NOT NULL, - `value` text NOT NULL, - PRIMARY KEY (id), - KEY club_enrollment_id (club_enrollment_id), - KEY club_template_enrollment_field_id (club_template_enrollment_field_id), - CONSTRAINT club_enrollment_fields_ibfk_1 FOREIGN KEY (club_enrollment_id) REFERENCES club_enrollments (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_enrollment_fields_ibfk_2 FOREIGN KEY (club_template_enrollment_field_id) REFERENCES club_template_enrollment_fields (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_template_fields' --- - -CREATE TABLE IF NOT EXISTS club_template_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, - description text, - authorised_value_category varchar(16) DEFAULT NULL, - PRIMARY KEY (id), - KEY club_template_id (club_template_id), - CONSTRAINT club_template_fields_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_fields' --- - -CREATE TABLE IF NOT EXISTS club_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_field_id int(11) NOT NULL, - club_id int(11) NOT NULL, - `value` text, - PRIMARY KEY (id), - KEY club_template_field_id (club_template_field_id), - KEY club_id (club_id), - CONSTRAINT club_fields_ibfk_3 FOREIGN KEY (club_template_field_id) REFERENCES club_template_fields (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_fields_ibfk_4 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) VALUES (21, 'clubs', 'Patron clubs', '0'); - -INSERT IGNORE INTO permissions (module_bit, code, description) VALUES - (21, 'edit_templates', 'Create and update club templates'), - (21, 'edit_clubs', 'Create and update clubs'), - (21, 'enroll', 'Enroll patrons in clubs') -; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 34bed1f7b2..985ee27626 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3955,132 +3955,6 @@ CREATE TABLE deletedbiblio_metadata ( CONSTRAINT `deletedrecord_metadata_fk_1` FOREIGN KEY (biblionumber) REFERENCES deletedbiblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --- --- Table structure for table 'club_templates' --- - -CREATE TABLE IF NOT EXISTS club_templates ( - id int(11) NOT NULL AUTO_INCREMENT, - `name` tinytext NOT NULL, - description text, - is_enrollable_from_opac tinyint(1) NOT NULL DEFAULT '0', - is_email_required tinyint(1) NOT NULL DEFAULT '0', - branchcode varchar(10) NULL DEFAULT NULL, - date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - date_updated timestamp NULL DEFAULT NULL, - is_deletable tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (id), - KEY ct_branchcode (branchcode), - CONSTRAINT `club_templates_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'clubs' --- - -CREATE TABLE IF NOT EXISTS clubs ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, - description text, - date_start date DEFAULT NULL, - date_end date DEFAULT NULL, - branchcode varchar(10) NULL DEFAULT NULL, - date_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - date_updated timestamp NULL DEFAULT NULL, - PRIMARY KEY (id), - KEY club_template_id (club_template_id), - KEY branchcode (branchcode), - CONSTRAINT clubs_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT clubs_ibfk_2 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_enrollments' --- - -CREATE TABLE IF NOT EXISTS club_enrollments ( - id int(11) NOT NULL AUTO_INCREMENT, - club_id int(11) NOT NULL, - borrowernumber int(11) NOT NULL, - date_enrolled timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - date_canceled timestamp NULL DEFAULT NULL, - date_created timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - date_updated timestamp NULL DEFAULT NULL, - branchcode varchar(10) NULL DEFAULT NULL, - PRIMARY KEY (id), - KEY club_id (club_id), - KEY borrowernumber (borrowernumber), - KEY branchcode (branchcode), - CONSTRAINT club_enrollments_ibfk_1 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_enrollments_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_enrollments_ibfk_3 FOREIGN KEY (branchcode) REFERENCES branches (branchcode) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_template_enrollment_fields' --- - -CREATE TABLE IF NOT EXISTS club_template_enrollment_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, - description text, - authorised_value_category varchar(16) DEFAULT NULL, - PRIMARY KEY (id), - KEY club_template_id (club_template_id), - CONSTRAINT club_template_enrollment_fields_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_enrollment_fields' --- - -CREATE TABLE IF NOT EXISTS club_enrollment_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_enrollment_id int(11) NOT NULL, - club_template_enrollment_field_id int(11) NOT NULL, - `value` text NOT NULL, - PRIMARY KEY (id), - KEY club_enrollment_id (club_enrollment_id), - KEY club_template_enrollment_field_id (club_template_enrollment_field_id), - CONSTRAINT club_enrollment_fields_ibfk_1 FOREIGN KEY (club_enrollment_id) REFERENCES club_enrollments (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_enrollment_fields_ibfk_2 FOREIGN KEY (club_template_enrollment_field_id) REFERENCES club_template_enrollment_fields (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_template_fields' --- - -CREATE TABLE IF NOT EXISTS club_template_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_id int(11) NOT NULL, - `name` tinytext NOT NULL, - description text, - authorised_value_category varchar(16) DEFAULT NULL, - PRIMARY KEY (id), - KEY club_template_id (club_template_id), - CONSTRAINT club_template_fields_ibfk_1 FOREIGN KEY (club_template_id) REFERENCES club_templates (id) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - --- --- Table structure for table 'club_fields' --- - -CREATE TABLE IF NOT EXISTS club_fields ( - id int(11) NOT NULL AUTO_INCREMENT, - club_template_field_id int(11) NOT NULL, - club_id int(11) NOT NULL, - `value` text, - PRIMARY KEY (id), - KEY club_template_field_id (club_template_field_id), - KEY club_id (club_id), - CONSTRAINT club_fields_ibfk_3 FOREIGN KEY (club_template_field_id) REFERENCES club_template_fields (id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT club_fields_ibfk_4 FOREIGN KEY (club_id) REFERENCES clubs (id) ON DELETE CASCADE ON UPDATE CASCADE ->>>>>>> Bug 12461 - Add patron clubs feature ->>>>>>> Bug 12461 - Add patron clubs feature -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; diff --git a/installer/data/mysql/userflags.sql b/installer/data/mysql/userflags.sql index cf2adff28a..d8e3626a2b 100644 --- a/installer/data/mysql/userflags.sql +++ b/installer/data/mysql/userflags.sql @@ -17,6 +17,5 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (17,'staffaccess','Allow staff members to modify permissions for other staff members',0), (18,'coursereserves','Course reserves',0), (19, 'plugins', 'Koha plugins', '0'), -(20, 'lists', 'Lists', 0), -(21, 'clubs', 'Patron clubs', '0') +(20, 'lists', 'Lists', 0) ; diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index 172f4c6ea1..6b72278fe0 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -78,8 +78,5 @@ INSERT INTO permissions (module_bit, code, description) VALUES (19, 'tool', 'Use tool plugins'), (19, 'report', 'Use report plugins'), (19, 'configure', 'Configure plugins'), - (20, 'delete_public_lists', 'Delete public lists'), - (21, 'edit_templates', 'Create and update club templates'), - (21, 'edit_clubs', 'Create and update clubs'), - (21, 'enroll', 'Enroll patrons in clubs') + (20, 'delete_public_lists', 'Delete public lists') ; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index 7c6275ab51..bcff76b663 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -19,7 +19,6 @@ [%- CASE 'coursereserves' -%]Course reserves [%- CASE 'plugins' -%]Koha plugins [%- CASE 'lists' -%]Lists - [%- CASE 'clubs' -%]Patron clubs [%- END -%] [%- END -%] @@ -104,8 +103,5 @@ [%- CASE 'delete_public_lists' -%]Delete public lists [%- CASE 'upload_general_files' -%]Upload any file [%- CASE 'upload_manage' -%]Manage uploaded files (Useless without upload_general_files) - [%- CASE 'edit_clubs' -%]Create and edit clubs - [%- CASE 'edit_templates' -%]Create and edit club templates - [%- CASE 'enroll' -%]Enroll patrons in clubs [%- END -%] [%- END -%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc index d7b40cfdb5..09c6bda8d8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-menu.inc @@ -25,9 +25,6 @@ [% IF ( CAN_user_tools_manage_patron_lists ) %]
  • Patron lists
  • [% END %] - [% IF (CAN_user_clubs) %] -
  • Patron clubs
  • - [% END %] [% IF ( CAN_user_tools_moderate_comments ) %]
  • Comments
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index c7d544c3e5..d6608d7077 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -97,13 +97,6 @@ $(document).ready(function() { } }); - if ( $('#clubs-tab').length ) { - $('#clubs-tab-link').on('click', function() { - $('#clubs-tab').text(_("Loading...")); - $('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber %]'); - }); - } - [% IF !( CircAutoPrintQuickSlip == 'clear' ) %] // listen submit to trigger qslip on empty checkout $('#mainform').bind('submit',function() { @@ -898,16 +891,6 @@ No patron matched [% message | html %] [% END %] - [% SET enrollments = patron.get_club_enrollments.size || 0 %] - [% SET enrollable = patron.get_enrollable_clubs.size || 0 %] - [% IF CAN_user_clubs && ( enrollable || enrollments ) %] -
  • - - Clubs ([% enrollments %]/[% enrollable %]) - -
  • - [% END %] - [% IF relatives_issues_count %]
  • Relatives' checkouts
  • [% END %] @@ -956,12 +939,6 @@ No patron matched [% message | html %] [% END %] -[% IF CAN_user_clubs && ( enrollable || enrollments ) %] -
    - Loading... -
    -[% END %] - [% INCLUDE borrower_debarments.inc %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt deleted file mode 100644 index 51f4a59723..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs-add-modify.tt +++ /dev/null @@ -1,115 +0,0 @@ -[% USE KohaDates %] -[% USE Branches %] -[% USE AuthorisedValues %] -[% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %] -[% INCLUDE 'doc-head-open.inc' %] -Koha › Tools › Patron clubs › Club -[% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - -
    -
    -
    - - - -
    - - - [% IF club %] - Modify club [% club.name %] - [% ELSE %] - Create a new [% club_template.name %] club - [% END %] - - -
      -
    1. - - - Required -
    2. - -
    3. - - -
    4. - -
    5. - - -
    6. - -
    7. - - -
    8. - -
    9. - - -
    10. - - [% IF club %] - [% FOREACH f IN club.club_fields %] -
    11. - - - - - [% IF f.club_template_field.authorised_value_category %] - - [% ELSE %] - - [% END %] -
    12. - [% END %] - [% ELSE %] - [% FOREACH f IN club_template.club_template_fields %] -
    13. - - - - [% IF f.authorised_value_category %] - - [% ELSE %] - - [% END %] -
    14. - [% END %] - [% END %] - -
    - -
    - -
    - - Cancel -
    -
    -
    -
    - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt deleted file mode 100644 index 15680bb98c..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt +++ /dev/null @@ -1,252 +0,0 @@ -[% USE Branches %] -[% USE Koha %] -[% INCLUDE 'doc-head-open.inc' %] -Koha › Tools › Patron clubs -[% INCLUDE 'doc-head-close.inc' %] - - -[% INCLUDE 'datatables.inc' %] - - - - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - -
    -
    -
    -
    -

    Patron clubs

    - - [% IF club_template %] -
    - [% IF stored == 'updated' %] -

    Club template [% club_template.name %] was updated.

    - [% ELSE %] -

    Club template [% club_template.name %] was saved.

    - [% END %] -
    - [% ELSIF club %] -
    - [% IF stored == 'updated' %] -

    Club [% club.name %] was updated.

    - [% ELSE %] -

    Club [% club.name %] was saved.

    - [% END %] -
    - [% END %] - -

    Club templates

    - - [% IF CAN_user_clubs_edit_templates %] - - [% END %] - - - - - - - - - - - - - - - - [% IF club_templates %] - [% FOREACH t IN club_templates %] - - - - - - - - - - [% END %] - [% ELSE %] - - - - [% END %] - -
    NameDescriptionPublic enrollmentEmail requiredLibrary  
    [% t.name %][% t.description %] - [% IF t.is_enrollable_from_opac %] - Yes - [% ELSE %] - No - [% END %] - - [% IF t.is_email_required %] - Yes - [% ELSE %] - No - [% END %] - [% Branches.GetName( t.branchcode ) %] - [% IF CAN_user_clubs_edit_templates %] - - Edit - - [% END %] - - [% IF CAN_user_clubs_edit_templates %] - - Delete - - [% END %] -
    - No club templates defined. -
    - -

    Clubs

    - - [% IF CAN_user_clubs_edit_clubs %] -
    -
    - - -
    -
    - [% END %] - - - - - - - - - - - - - - - - - [% IF clubs %] - [% FOREACH c IN clubs %] - - - - - - - - - - - [% END %] - [% ELSE %] - - - - [% END %] - -
    NameTemplateDescriptionPublic enrollmentEmail requiredLibrary  
    [% c.name %][% c.club_template.name %][% c.description %] - [% IF c.club_template.is_enrollable_from_opac %] - Yes - [% ELSE %] - No - [% END %] - - [% IF c.club_template.is_email_required %] - Yes - [% ELSE %] - No - [% END %] - [% Branches.GetName( c.branchcode ) %] - [% IF CAN_user_clubs_edit_clubs %] - - Edit - - [% END %] - - [% IF CAN_user_clubs_edit_clubs %] - - Delete - - [% END %] -
    - No club templates defined. -
    -
    -
    -
    - [% INCLUDE 'tools-menu.inc' %] -
    -
    -
    -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt deleted file mode 100644 index 30cb710724..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt +++ /dev/null @@ -1,102 +0,0 @@ -[% USE KohaDates %] - -[% IF enrollments %] - - - - - - - - - - [% IF CAN_user_clubs_enroll %][% END %] - - - - - [% FOREACH e IN enrollments %] - - - - - [% IF CAN_user_clubs_enroll %] - - [% END %] - - [% END %] - -
    - Clubs currently enrolled in -
    NameDescriptionDate enrolled 
    [% e.club.name %][% e.club.description %][% e.date_enrolled | $KohaDates %] - - Cancel - -
    -[% END %] - -[% IF clubs %] - - - - - - - - - [% IF CAN_user_clubs_enroll %][% END %] - - - - - [% FOREACH c IN clubs %] - - - - [% IF CAN_user_clubs_enroll %] - - [% END %] - - [% END %] - -
    - Clubs not enrolled in -
    NameDescription 
    [% c.name %][% c.description %] - - Enroll - -
    -[% END %] - -[% IF CAN_user_clubs_enroll %] - -[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt deleted file mode 100644 index 25ee4ca67c..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt +++ /dev/null @@ -1,66 +0,0 @@ -[% USE AuthorisedValues %] -[% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %] - -

    - Enroll in [% club.name %] -

    - -
    -
    - - -
    -
      - [% FOREACH f IN club.club_template.club_template_enrollment_fields %] -
    1. - - [% IF f.authorised_value_category %] - - [% ELSE %] - - [% END %] - [% f.description %] -
    2. - [% END %] - -
    3. - Enroll - Cancel -
    4. -
    -
    -
    -
    - - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt deleted file mode 100644 index 16d0106207..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt +++ /dev/null @@ -1,216 +0,0 @@ -[% USE Branches %] -[% USE AuthorisedValues %] -[% INCLUDE 'doc-head-open.inc' %] -Koha › Tools › Patron clubs › Club template -[% INCLUDE 'doc-head-close.inc' %] - - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - -
    -
    -
    - - -
    - - - [% IF club_template %] - Modify club template [% club_template.name %] - [% ELSE %] - Create a new club template - [% END %] - - -
      -
    1. - - - Required -
    2. - -
    3. - - -
    4. - -
    5. - - [% IF club_template.is_enrollable_from_opac %] - - [% ELSE %] - - [% END %] - If a template allows public enrollment, patrons can enroll in a club based on this template from the public catalog. -
    6. - -
    7. - - [% IF club_template.is_email_required %] - - [% ELSE %] - - [% END %] - If set, a club based on this template can only be enrolled in by patrons with a valid email address. -
    8. - -
    9. - - - If set, only librarians logged in with this branch will be able to modify this club template. -
    10. - -
    - -

    Club fields:

    -

    These fields will be used in the creation of clubs based on this template

    - - [% FOREACH f IN club_template.club_template_fields %] -
      - -
    • - - -
    • - -
    • - - -
    • - -
    • - - -
    • - -
    • - - -
    • - -
      -
    - [% END %] -
    - - -

    Enrollment fields:

    -

    These fields will be used when enrolling a patron in a club based on this template

    - - [% FOREACH f IN club_template.club_template_enrollment_fields %] -
      - -
    • - - -
    • - -
    • - - -
    • - -
    • - - -
    • - -
    • - - -
    • - -
      -
    - [% END %] -
    - - -
    - -
    - - - Cancel -
    -
    -
    -
    - - - - - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index a2e9979db2..271b30bc03 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -48,13 +48,6 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) %] $(document).ready(function() { - if ( $('#clubs-tab').length ) { - $('#clubs-tab-link').on('click', function() { - $('#clubs-tab').text(_("Loading...")); - $('#clubs-tab').load('/cgi-bin/koha/clubs/patron-clubs-tab.pl?borrowernumber=[% borrowernumber %]'); - }); - } - $('#finesholdsissues').tabs({ // Correct table sizing for tables hidden in tabs // http://www.datatables.net/examples/api/tabs_and_scrolling.html @@ -526,15 +519,6 @@ function validate1(date) { [% END %]
  • [% debarments.size %] Restrictions
  • - [% SET enrollments = borrower.get_club_enrollments.size || 0 %] - [% SET enrollable = borrower.get_enrollable_clubs.size || 0 %] - [% IF CAN_user_clubs && ( enrollments || enrollable ) %] -
  • - - Clubs ([% enrollments %]/[% enrollable %]) - -
  • - [% END %] [% INCLUDE "checkouts-table.inc" %] @@ -570,12 +554,6 @@ function validate1(date) { [% END %]
    -[% IF CAN_user_clubs && ( enrollments || enrollable ) %] -
    - Loading... -
    -[% END %] - [% INCLUDE borrower_debarments.inc %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index 4c8cca9192..3220aad4f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -20,11 +20,6 @@
    Manage lists of patrons.
    [% END %] - [% IF (CAN_user_clubs) %] -
    Patron clubs -
    Manage patron clubs..
    - [% END %] - [% IF ( CAN_user_tools_moderate_comments ) %]
    Comments [% IF ( pendingcomments ) %][% pendingcomments %][% END %]
    Moderate patron comments.
    diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt deleted file mode 100644 index 76ed1fc905..0000000000 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt +++ /dev/null @@ -1,102 +0,0 @@ -[% USE KohaDates %] - -[% IF enrollments %] - - - - - - - - - - - - - - - [% FOREACH e IN enrollments %] - - - - - [% IF e.club.club_template.is_enrollable_from_opac %] - - [% END %] - - [% END %] - -
    - Clubs you are currently enrolled in -
    NameDescriptionDate enrolled 
    [% e.club.name %][% e.club.description %][% e.date_enrolled | $KohaDates %] - - Cancel - -
    -[% END %] - -[% IF clubs %] - - - - - - - - - - - - - - [% FOREACH c IN clubs %] - - - - - - [% END %] - -
    - Clubs you can enroll in -
    NameDescription 
    [% c.name %][% c.description %] - [% IF !c.club_template.is_email_required || ( c.club_template.is_email_required && borrower.FirstValidEmailAddress ) %] - - Enroll - - [% ELSE %] - You must have an email address to enroll - [% END %] -
    -[% END %] - - diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt deleted file mode 100644 index 6ea5094f04..0000000000 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/enroll.tt +++ /dev/null @@ -1,66 +0,0 @@ -[% USE AuthorisedValues %] -[% SET AuthorisedValuesCategories = AuthorisedValues.GetCategories %] - -

    - Enroll in [% club.name %] -

    - -
    -
    - - -
    -
      - [% FOREACH f IN club.club_template.club_template_enrollment_fields %] -
    1. - - [% IF f.authorised_value_category %] - - [% ELSE %] - - [% END %] - [% f.description %] -
    2. - [% END %] - -
    3. - Enroll - Cancel -
    4. -
    -
    -
    -
    - - diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 67cbf89d67..c862a14e36 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -82,7 +82,7 @@ Using this account is not recommended because some parts of Koha will not functi [% ELSIF error == 'too_soon' %] It is too soon after the checkout date for this item to be renewed. [% ELSIF error == 'on_reserve' %] - This item is on hold for another borrower. + This item is on hold for another patron. [% END %] [% END %] @@ -133,15 +133,6 @@ Using this account is not recommended because some parts of Koha will not functi [% IF ( BORROWER_INFO.amountoverzero ) %]
  • Fines ([% amountoutstanding | $Price %])
  • [% END %] [% IF ( BORROWER_INFO.amountlessthanzero ) %]
  • Credits ([% amountoutstanding | $Price %])
  • [% END %] [% END %] - - [% IF borrower.get_club_enrollments.size || borrower.get_enrollable_clubs(1).size %] -
  • - - Clubs ([% borrower.get_club_enrollments.size %]/[% borrower.get_enrollable_clubs(1).size || 0 %]) - -
  • - [% END %] - [% IF ( RESERVES.count ) %]
  • Holds ([% RESERVES.count %])
  • [% END %] [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current %]
  • Article requests ([% borrower.article_requests_current.count %])
  • [% END %] [% IF ( OverDriveCirculation ) %] @@ -324,12 +315,6 @@ Using this account is not recommended because some parts of Koha will not functi [% END # IF issues_count %]
    - [% IF borrower.get_club_enrollments_count.size || borrower.get_enrollable_clubs(1).size %] -
    - Loading... -
    - [% END %] - [% IF ( OPACFinesTab ) %] [% IF BORROWER_INFO.amountoverfive %] @@ -908,13 +893,6 @@ Using this account is not recommended because some parts of Koha will not functi [% END %] $( ".suspend-until" ).datepicker({ minDate: 1 }); // Require that "until date" be in the future - - if ( $('#opac-user-clubs').length ) { - $('#opac-user-clubs-tab-link').on('click', function() { - $('#opac-user-clubs').text(_("Loading...")); - $('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrowernumber %]'); - }); - } }); //]]> diff --git a/members/moremember.pl b/members/moremember.pl index ae7ce28507..b3e8d767ab 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -64,7 +64,6 @@ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen use DateTime; use Koha::DateUtils; use Koha::Database; -use Koha::Patrons; use Koha::Patron::Categories; use Koha::Token; @@ -357,7 +356,6 @@ $template->param( PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20, relatives_issues_count => $relatives_issues_count, relatives_borrowernumbers => \@relatives, - borrower => Koha::Patrons->find( $borrowernumber ), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/clubs/clubs-tab.pl b/opac/clubs/clubs-tab.pl deleted file mode 100755 index 82a4be0f54..0000000000 --- a/opac/clubs/clubs-tab.pl +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; -use Koha::Patrons; - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "clubs/clubs-tab.tt", - query => $cgi, - type => "opac", - authnotrequired => 0, - } -); - -my $borrowernumber = $cgi->param('borrowernumber'); - -my $borrower = Koha::Patrons->find($borrowernumber); - -my @enrollments = $borrower->get_club_enrollments(); -my @clubs = $borrower->get_enrollable_clubs( my $opac = 1 ); - -$template->param( - enrollments => \@enrollments, - clubs => \@clubs, - borrower => $borrower, -); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/opac/clubs/enroll.pl b/opac/clubs/enroll.pl deleted file mode 100755 index e6d6adc9d7..0000000000 --- a/opac/clubs/enroll.pl +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2013 ByWater Solutions -# -# 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, see . - -use Modern::Perl; - -use CGI; - -use C4::Auth; -use C4::Output; -use Koha::Clubs; - -my $cgi = new CGI; - -my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { - template_name => "clubs/enroll.tt", - query => $cgi, - type => "opac", - authnotrequired => 0, - } -); - -my $id = $cgi->param('id'); -my $borrowernumber = $cgi->param('borrowernumber'); - -my $club = Koha::Clubs->find($id); - -$template->param( - club => $club, - borrowernumber => $borrowernumber, -); - -output_html_with_http_headers( $cgi, $cookie, $template->output ); diff --git a/opac/svc/club/cancel_enrollment b/opac/svc/club/cancel_enrollment deleted file mode 100755 index be922dda39..0000000000 --- a/opac/svc/club/cancel_enrollment +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2014 ByWater Solutions -# -# 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 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 CGI; -use JSON qw(to_json); - -use C4::Auth qw(check_cookie_auth); -use Koha::Club::Enrollments; - -my $cgi = new CGI; - -my ( $auth_status, $sessionID ) = - check_cookie_auth( $cgi->cookie('CGISESSID') ); -if ( $auth_status ne "ok" ) { - exit 0; -} - -my $borrowernumber = C4::Context->userenv->{'number'}; - -my $id = $cgi->param('id'); - -my $enrollment = Koha::Club::Enrollments->find($id); -$enrollment->cancel(); - -binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); - -print to_json( { success => $enrollment ? 1 : 0 } ); diff --git a/opac/svc/club/enroll b/opac/svc/club/enroll deleted file mode 100755 index 8291c8b0c5..0000000000 --- a/opac/svc/club/enroll +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2014 ByWater Solutions -# -# 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 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 CGI; -use JSON qw(to_json); - -use C4::Auth qw(check_cookie_auth); -use Koha::Club::Enrollment::Field; -use Koha::Club::Enrollment; -use Koha::Clubs; - -my $cgi = new CGI; - -my ( $auth_status, $sessionID ) = - check_cookie_auth( $cgi->cookie('CGISESSID') ); -if ( $auth_status ne "ok" ) { - exit 0; -} - -my $borrowernumber = C4::Context->userenv->{'number'}; - -my $id = $cgi->param('id'); - -my $enrollment; -if ( $borrowernumber && $id ) { - my $club = Koha::Clubs->find($id); - - if ( $club->club_template()->is_enrollable_from_opac() ) { - $enrollment = Koha::Club::Enrollment->new()->set( - { - club_id => $club->id(), - borrowernumber => $borrowernumber, - date_enrolled => \'NOW()', - date_created => \'NOW()', - branchcode => C4::Context->userenv - ? C4::Context->userenv->{'branch'} - : undef, - } - )->store(); - - my @enrollment_fields = $club->club_template()->club_template_enrollment_fields(); - - foreach my $e (@enrollment_fields) { - Koha::Club::Enrollment::Field->new()->set( - { - club_enrollment_id => $enrollment->id(), - club_template_enrollment_field_id => $e->id(), - value => $cgi->param( $e->id() ), - } - )->store(); - } - } -} - -binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); - -print to_json( { success => $enrollment ? 1 : 0 } ); diff --git a/svc/club/cancel_enrollment b/svc/club/cancel_enrollment deleted file mode 100755 index 4416537b85..0000000000 --- a/svc/club/cancel_enrollment +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2014 ByWater Solutions -# -# 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 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 CGI; -use JSON qw(to_json); - -use C4::Auth qw(check_cookie_auth); - -use Koha::Club::Enrollments; - -my $cgi = new CGI; - -my ( $auth_status, $sessionID ) = - check_cookie_auth( $cgi->cookie('CGISESSID'), { clubs => 'enroll' } ); -if ( $auth_status ne "ok" ) { - exit 0; -} - -my $id = $cgi->param('id'); - -my $enrollment = Koha::Club::Enrollments->find($id); -$enrollment->cancel() if $enrollment; - -binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); - -print to_json( { success => $enrollment ? 1 : 0 } ); diff --git a/svc/club/delete b/svc/club/delete deleted file mode 100755 index c254a5e626..0000000000 --- a/svc/club/delete +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2014 ByWater Solutions -# -# 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 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 CGI; -use JSON qw(to_json); - -use C4::Auth qw(check_cookie_auth); -use Koha::Clubs; - -my $cgi = new CGI; - -my ( $auth_status, $sessionID ) = check_cookie_auth( $cgi->cookie('CGISESSID'), { clubs => 'edit_clubs' } ); -if ( $auth_status ne "ok" ) { - exit 0; -} - -my $success = 0; - -my $id = $cgi->param('id'); - -my $club = Koha::Clubs->find($id); -if ($club) { - $success = $club->delete(); -} - -binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); - -print to_json( { success => $success ? 1 : 0 } ); diff --git a/svc/club/enroll b/svc/club/enroll deleted file mode 100755 index ee6c085ce6..0000000000 --- a/svc/club/enroll +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2014 ByWater Solutions -# -# 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 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 CGI; -use JSON qw(to_json); - -use C4::Auth qw(check_cookie_auth); -use Koha::Club::Enrollment::Fields; -use Koha::Club::Enrollments; -use Koha::Clubs; - -my $cgi = new CGI; - -my ( $auth_status, $sessionID ) = - check_cookie_auth( $cgi->cookie('CGISESSID'), { clubs => 'enroll' } ); -if ( $auth_status ne "ok" ) { - exit 0; -} - -my $id = $cgi->param('id'); -my $borrowernumber = $cgi->param('borrowernumber'); - -my $club = Koha::Clubs->find($id); - -my $enrollment; -if ($club) { - $enrollment = Koha::Club::Enrollment->new( - { - club_id => $club->id(), - borrowernumber => $borrowernumber, - date_enrolled => \'NOW()', - date_created => \'NOW()', - branchcode => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, - } - )->store(); - - if ($enrollment) { - my @enrollment_fields = $club->club_template()->club_template_enrollment_fields(); - - foreach my $e (@enrollment_fields) { - my $club_enrollment_field = Koha::Club::Enrollment::Field->new( - { - club_enrollment_id => $enrollment->id(), - club_template_enrollment_field_id => $e->id(), - value => $cgi->param( $e->id() ), - } - )->store(); - } - } -} - -binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); - -print to_json( { success => $enrollment ? 1 : 0 } ); diff --git a/svc/club/template/delete b/svc/club/template/delete deleted file mode 100755 index 2948dc4656..0000000000 --- a/svc/club/template/delete +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2014 ByWater Solutions -# -# 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 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 CGI; -use JSON qw(to_json); - -use C4::Auth qw(check_cookie_auth); - -use Koha::Club::Templates; - -my $cgi = new CGI; - -my ( $auth_status, $sessionID ) = check_cookie_auth( $cgi->cookie('CGISESSID'), { clubs => 'edit_templates' } ); -if ( $auth_status ne "ok" ) { - exit 0; -} - -my $success = 0; - -my $id = $cgi->param('id'); - -my $club_template = Koha::Club::Templates->find($id); -if ($club_template) { - $success = $club_template->delete(); -} - -binmode STDOUT, ':encoding(UTF-8)'; -print $cgi->header( -type => 'text/plain', -charset => 'UTF-8' ); - -print to_json( { success => $success ? 1 : 0 } ); diff --git a/t/db_dependent/Clubs.t b/t/db_dependent/Clubs.t deleted file mode 100755 index 1ca9321e6a..0000000000 --- a/t/db_dependent/Clubs.t +++ /dev/null @@ -1,221 +0,0 @@ -#!/usr/bin/perl - -# 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, see . - -use Modern::Perl; - -use Test::More tests => 36; -use Test::Warn; - -use C4::Context; -use Koha::Database; -use Koha::Patrons; - -use t::lib::TestBuilder; - -BEGIN { - use_ok('Koha::Club'); - use_ok('Koha::Clubs'); - use_ok('Koha::Club::Field'); - use_ok('Koha::Club::Fields'); - use_ok('Koha::Club::Template'); - use_ok('Koha::Club::Templates'); - use_ok('Koha::Club::Template::Field'); - use_ok('Koha::Club::Template::Fields'); - use_ok('Koha::Club::Enrollment::Field'); - use_ok('Koha::Club::Enrollment::Fields'); - use_ok('Koha::Club::Template::EnrollmentField'); - use_ok('Koha::Club::Template::EnrollmentFields'); -} - -# Start transaction -my $database = Koha::Database->new(); -my $schema = $database->schema(); -my $dbh = C4::Context->dbh; -my $builder = t::lib::TestBuilder->new; - -$schema->storage->txn_begin(); -$dbh->do("DELETE FROM club_templates"); - -my $categorycode = $builder->build( { source => 'Category' } )->{categorycode}; -my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; - -my $patron = Koha::Patron->new( - { - surname => 'Test 1', - branchcode => $branchcode, - categorycode => $categorycode - } -); -$patron->store(); - -my $club_template = Koha::Club::Template->new( - { - name => "Test Club Template", - is_enrollable_from_opac => 0, - is_email_required => 0, - } -)->store(); -is( ref($club_template), 'Koha::Club::Template', 'Club template created' ); - -# Add some template fields -my $club_template_field_1 = Koha::Club::Template::Field->new( - { - club_template_id => $club_template->id, - name => 'Test Club Template Field 1', - } -)->store(); -is( ref($club_template_field_1), - 'Koha::Club::Template::Field', 'Club template field 1 created' ); - -my $club_template_field_2 = Koha::Club::Template::Field->new( - { - club_template_id => $club_template->id, - name => 'Test Club Template Field 2', - } -)->store(); -is( ref($club_template_field_2), - 'Koha::Club::Template::Field', 'Club template field 2 created' ); - -is( $club_template->club_template_fields->count, - 2, 'Club template has two fields' ); - -## Add some template enrollment fields -my $club_template_enrollment_field_1 = - Koha::Club::Template::EnrollmentField->new( - { - club_template_id => $club_template->id, - name => 'Test Club Template EnrollmentField 1', - } - )->store(); -is( - ref($club_template_enrollment_field_1), - 'Koha::Club::Template::EnrollmentField', - 'Club template field 1 created' -); - -my $club_template_enrollment_field_2 = - Koha::Club::Template::EnrollmentField->new( - { - club_template_id => $club_template->id, - name => 'Test Club Template EnrollmentField 2', - } - )->store(); -is( - ref($club_template_enrollment_field_2), - 'Koha::Club::Template::EnrollmentField', - 'Club template field 2 created' -); - -is( $club_template->club_template_enrollment_fields->count, - 2, 'Club template has two enrollment fields' ); - -## Create a club based on this template -my $club = Koha::Club->new( - { - club_template_id => $club_template->id, - name => "Test Club", - branchcode => $branchcode, - } -)->store(); - -my $club_field_1 = Koha::Club::Field->new( - { - club_template_field_id => $club_template_field_1->id, - club_id => $club->id, - value => 'TEST', - } -)->store(); -is( ref($club_field_1), 'Koha::Club::Field', 'Club field 1 created' ); -is( - $club_field_1->club_template_field->id, - $club_template_field_1->id, - 'Field 2 is linked to correct template field' -); - -my $club_field_2 = Koha::Club::Field->new( - { - club_template_field_id => $club_template_field_2->id, - club_id => $club->id, - value => 'TEST', - } -)->store(); -is( ref($club_field_2), 'Koha::Club::Field', 'Club field 2 created' ); -is( - $club_field_2->club_template_field->id, - $club_template_field_2->id, - 'Field 2 is linked to correct template field' -); - -is( ref($club), 'Koha::Club', 'Club created' ); -is( $club->club_template->id, - $club_template->id, 'Club is using correct template' ); -is( $club->branch->id, $branchcode, 'Club is using correct branch' ); -is( $club->club_fields->count, 2, 'Club has correct number of fields' ); -is( Koha::Clubs->get_enrollable( { borrower => $patron } )->count, - 1, 'Koha::Clubs->get_enrollable returns 1 enrollable club for patron' ); -is( $patron->get_enrollable_clubs->count, - 1, 'There is 1 enrollable club for patron' ); - -## Create an enrollment for this club -my $club_enrollment = Koha::Club::Enrollment->new( - { - club_id => $club->id, - borrowernumber => $patron->id, - branchcode => $branchcode, - } -)->store(); -is( ref($club_enrollment), 'Koha::Club::Enrollment', - 'Club enrollment created' ); - -my $club_enrollment_field_1 = Koha::Club::Enrollment::Field->new( - { - club_enrollment_id => $club_enrollment->id, - club_template_enrollment_field_id => - $club_template_enrollment_field_1->id, - value => 'TEST', - } -)->store(); -is( - ref($club_enrollment_field_1), - 'Koha::Club::Enrollment::Field', - 'Enrollment field 1 created' -); - -my $club_enrollment_field_2 = Koha::Club::Enrollment::Field->new( - { - club_enrollment_id => $club_enrollment->id, - club_template_enrollment_field_id => - $club_template_enrollment_field_2->id, - value => 'TEST', - } -)->store(); -is( - ref($club_enrollment_field_2), - 'Koha::Club::Enrollment::Field', - 'Enrollment field 2 created' -); - -is( $club_enrollment->club->id, $club->id, 'Got correct club for enrollment' ); -is( Koha::Clubs->get_enrollable( { borrower => $patron } )->count, - 0, 'Koha::Clubs->get_enrollable returns 0 enrollable clubs for patron' ); -is( $patron->get_club_enrollments->count, - 1, 'Got 1 club enrollment for patron' ); -is( $patron->get_enrollable_clubs->count, - 0, 'No more enrollable clubs for patron' ); - -$schema->storage->txn_rollback(); -1; -- 2.39.5