From ef307c24088e3127a14dd0dfd6d181d64aed4af3 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 26 Aug 2022 11:25:24 +0200 Subject: [PATCH] Bug 26573: Limit patron attribute types to more than one patron category Test plan: 1. Create patron attribute types, some with a category limit, some without 2. Apply patch 3. Run installer/data/mysql/updatedatabase.pl 4. Run misc/devel/update_dbix_class_files.pl --koha-conf 5. Restart koha 6. Verify that existing category limits were kept 7. Create a new patron attribute type and select multiple category limits. Verify that they have been saved correctly. 8. Edit this patron attribute type and modify category limits. Verify that the changes have been saved correctly 9. Go to the patron creation form, and verify that patron attributes are shown/hidden accordingly when categorycode is changed. 10. Go to patron batch modification tool, enter a cardnumber (or a borrowernumber) and submit the form to go to the next step. Now select a patron attribute type that has category limits and verify that the message shown to the right is correct Signed-off-by: Aude Charillon Signed-off-by: Martin Renvoize --- Koha/Patron.pm | 8 +- Koha/Patron/Attribute/Type.pm | 22 + admin/patron-attr-types.pl | 6 +- .../data/mysql/atomicupdate/bug-26573.pl | 54 + installer/data/mysql/kohastructure.sql | 25 +- .../en/modules/admin/patron-attr-types.tt | 458 ---- .../prog/en/modules/members/memberentrygen.tt | 1996 ----------------- .../en/modules/reports/borrowers_stats.tt | 331 --- .../prog/en/modules/tools/modborrowers.tt | 652 ------ koha-tmpl/intranet-tmpl/prog/js/members.js | 2 +- .../bootstrap/en/modules/opac-memberentry.tt | 1372 ----------- members/memberentry.pl | 5 +- reports/borrowers_stats.pl | 11 +- t/db_dependent/Auth_with_ldap.t | 3 - t/db_dependent/Koha/Patron/Attribute.t | 9 +- t/db_dependent/Koha/Patron/Attribute/Type.t | 37 + t/db_dependent/Koha/Patron/Attribute/Types.t | 12 +- t/db_dependent/api/v1/patrons.t | 14 +- .../api/v1/patrons_extended_attributes.t | 63 +- tools/modborrowers.pl | 15 +- 20 files changed, 198 insertions(+), 4897 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug-26573.pl create mode 100755 t/db_dependent/Koha/Patron/Attribute/Type.t diff --git a/Koha/Patron.pm b/Koha/Patron.pm index ec7f6704983..3552db2f542 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -2272,9 +2272,9 @@ sub extended_attributes { # Check globally mandatory types my $interface = C4::Context->interface; my $params = { - mandatory => 1, - category_code => [ undef, $self->categorycode ], - 'borrower_attribute_types_branches.b_branchcode' => undef, + mandatory => 1, + 'borrower_attribute_types_categories.categorycode' => [ undef, $self->categorycode ], + 'borrower_attribute_types_branches.b_branchcode' => undef, }; if ( $interface eq 'opac' ) { @@ -2283,7 +2283,7 @@ sub extended_attributes { my @required_attribute_types = Koha::Patron::Attribute::Types->search( $params, - { join => 'borrower_attribute_types_branches' } + { join => [ 'borrower_attribute_types_branches', 'borrower_attribute_types_categories' ] } )->get_column('code'); for my $type (@required_attribute_types) { Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute->throw( diff --git a/Koha/Patron/Attribute/Type.pm b/Koha/Patron/Attribute/Type.pm index 75caa255d00..67eda5d6a9f 100644 --- a/Koha/Patron/Attribute/Type.pm +++ b/Koha/Patron/Attribute/Type.pm @@ -60,6 +60,28 @@ sub attributes { Koha::Patron::Attributes->_new_from_dbic($attributes_rs); } +=head3 categories + +Get or set attribute type's categories + + my @categories = $attribute_type->categories->as_list; + $attribute_type->categories(\@categories); + +=cut + +sub categories { + my ( $self, $categories ) = @_; + + if ($categories) { + my @categorycodes = map { $_->_result } @$categories; + $self->_result->set_categorycodes( \@categorycodes ); + return $self; + } + + my $rs = $self->_result->categorycodes; + return Koha::Patron::Categories->_new_from_dbic($rs); +} + =head2 Internal Methods =cut diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index 9b771b1ae3e..03e8b601ef5 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -118,7 +118,6 @@ sub add_update_attribute_type { my $mandatory = $input->param('mandatory') ? 1 : 0; my $authorised_value_category = $input->param('authorised_value_category'); my $display_checkout = $input->param('display_checkout') ? 1 : 0; - my $category_code = $input->param('category_code') || undef; my $class = $input->param('class'); my $attr_type = Koha::Patron::Attribute::Types->find($code); @@ -154,7 +153,6 @@ sub add_update_attribute_type { mandatory => $mandatory, authorised_value_category => $authorised_value_category, display_checkout => $display_checkout, - category_code => $category_code, class => $class, } )->store; @@ -162,6 +160,9 @@ sub add_update_attribute_type { my @branches = grep { !/^\s*$/ } $input->multi_param('branches'); $attr_type->library_limits( \@branches ); + my @categories = grep { !/^\s*$/ } $input->multi_param('category_code'); + $attr_type->categories( [ Koha::Patron::Categories->search( { categorycode => \@categories } )->as_list ] ); + if ( $op eq 'edit' ) { $template->param( edited_attribute_type => $attr_type->code() ); } else { @@ -235,6 +236,7 @@ sub edit_attribute_type_form { $can_be_set_to_unique = 0 if $@; $attr_type->unique_id(0); } + $template->param( attribute_type => $attr_type, attribute_type_form => 1, diff --git a/installer/data/mysql/atomicupdate/bug-26573.pl b/installer/data/mysql/atomicupdate/bug-26573.pl new file mode 100755 index 00000000000..b081280d551 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-26573.pl @@ -0,0 +1,54 @@ +use Modern::Perl; + +return { + bug_number => '26573', + description => 'Add table borrower_attribute_types_categories', + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do( + q{ + CREATE TABLE IF NOT EXISTS `borrower_attribute_types_categories` ( + `borrower_attribute_type_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL, + `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL, + KEY `borrower_attribute_type_code` (`borrower_attribute_type_code`), + KEY `categorycode` (`categorycode`), + CONSTRAINT `borrower_attribute_types_categories_borrower_attribute_type_code` FOREIGN KEY (`borrower_attribute_type_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `borrower_attribute_types_categories_categorycode` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE, + PRIMARY KEY (`borrower_attribute_type_code`, `categorycode`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + } + ); + + say $out "Table 'borrower_attribute_types_categories' created"; + + if ( column_exists( 'borrower_attribute_types', 'category_code' ) ) { + $dbh->do( + q{ + INSERT IGNORE INTO borrower_attribute_types_categories (borrower_attribute_type_code, categorycode) + SELECT `code`, `category_code` FROM `borrower_attribute_types` + WHERE `category_code` IS NOT NULL + } + ); + + say $out + "Data migrated from 'borrower_attribute_types.category_code' to 'borrower_attribute_types_categories'"; + + $dbh->do( + q{ + ALTER TABLE `borrower_attribute_types` + DROP FOREIGN KEY `borrower_attribute_types_ibfk_1` + } + ); + $dbh->do( + q{ + ALTER TABLE `borrower_attribute_types` + DROP COLUMN `category_code` + } + ); + + say $out "Column 'borrower_attribute_types.category_code' deleted"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 3bf15c1007d..e21ee8a756e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1257,14 +1257,11 @@ CREATE TABLE `borrower_attribute_types` ( `searched_by_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is included in "Standard" patron searches in the staff interface (1 for yes, 0 for no)', `authorised_value_category` varchar(32) DEFAULT NULL COMMENT 'foreign key from authorised_values that links this custom field to an authorized value category', `display_checkout` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field displays in checkout screens', - `category_code` varchar(10) DEFAULT NULL COMMENT 'defines a category for an attribute_type', `class` varchar(255) NOT NULL DEFAULT '' COMMENT 'defines a class for an attribute_type', `keep_for_pseudonymization` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if this field is copied to anonymized_borrower_attributes (1 for yes, 0 for no)', `mandatory` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'defines if the attribute is mandatory or not', PRIMARY KEY (`code`), - KEY `auth_val_cat_idx` (`authorised_value_category`), - KEY `category_code` (`category_code`), - CONSTRAINT `borrower_attribute_types_ibfk_1` FOREIGN KEY (`category_code`) REFERENCES `categories` (`categorycode`) + KEY `auth_val_cat_idx` (`authorised_value_category`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1285,6 +1282,24 @@ CREATE TABLE `borrower_attribute_types_branches` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `borrower_attribute_types_categories` +-- + +DROP TABLE IF EXISTS `borrower_attribute_types_categories`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `borrower_attribute_types_categories` ( + `borrower_attribute_type_code` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL, + `categorycode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL, + KEY `borrower_attribute_type_code` (`borrower_attribute_type_code`), + KEY `categorycode` (`categorycode`), + CONSTRAINT `borrower_attribute_types_categories_borrower_attribute_type_code` FOREIGN KEY (`borrower_attribute_type_code`) REFERENCES `borrower_attribute_types` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `borrower_attribute_types_categories_categorycode` FOREIGN KEY (`categorycode`) REFERENCES `categories` (`categorycode`) ON DELETE CASCADE ON UPDATE CASCADE, + PRIMARY KEY (`borrower_attribute_type_code`, `categorycode`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `borrower_attributes` -- @@ -6755,4 +6770,4 @@ CREATE TABLE `zebraqueue` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-11-25 12:13:27 +-- Dump completed on 2024-11-25 12:13:27 \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt index 2b916c26917..e69de29bb2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt @@ -1,458 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% USE Koha %] -[% USE AuthorisedValues %] -[% USE Branches %] -[% USE scalar %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% IF ( attribute_type_form ) %] - [% IF ( edit_attribute_type ) %] - [% tx("Modify patron attribute type '{code}'", { code = attribute_type.code }) | html %] - › - [% ELSE %] - [% t("New patron attribute type") | html %] - › - [% END %] - [% END %] - [% IF ( delete_attribute_type_form ) %] - [% tx("Confirm deletion of patron attribute type '{code}'", { code = code }) | html %] - › - [% END %] - [% t("Patron attribute types") | html %] - › [% t("Administration") | html %] › [% t("Koha") | html %] - [% END %] -[% INCLUDE 'doc-head-close.inc' %] - - - -[% WRAPPER 'header.inc' %] - [% INCLUDE 'prefs-admin-search.inc' %] -[% END %] - -[% WRAPPER 'sub-header.inc' %] - [% WRAPPER breadcrumbs %] - [% WRAPPER breadcrumb_item %] - Administration - [% END %] - - [% IF ( attribute_type_form || delete_attribute_type_form ) %] - [% WRAPPER breadcrumb_item %] - Patron attribute types - [% END %] - [% END %] - - [% IF ( attribute_type_form ) %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - [% IF ( edit_attribute_type ) %] - [% tx("Modify patron attribute type '{code}'", { code = attribute_type.code }) | html %] - [% ELSE %] - New patron attribute type - [% END %] - [% END %] - [% ELSIF ( delete_attribute_type_form ) %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - [% tx("Confirm deletion of patron attribute type '{code}'", { code = code }) | html %] - [% END %] - [% ELSE %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Patron attribute types - [% END %] - [% END %] - [% END #/ WRAPPER breadcrumbs %] -[% END #/ WRAPPER sub-header.inc %] - -[% WRAPPER 'main-container.inc' aside='admin-menu' %] - - [% IF ( WARNING_extended_attributes_off ) %] -
Because the 'ExtendedPatronAttributes` system preference is currently not enabled, extended patron attributes cannot be given to patron records.
Go to the - ExtendedPatronAttributes system preference if you wish to enable this feature.
- [% END %] - - [% IF ( attribute_type_form ) %] - [% IF ( edit_attribute_type ) %] -

[% tx("Modify patron attribute type '{code}'", { code = attribute_type.code }) | html %]

- [% ELSE %] -

New patron attribute type

- [% END %] - [% IF ( duplicate_code_error ) %] -
Could not add patron attribute type "[% duplicate_code_error | html %]" — one with that code already exists.
- [% END %] -
- [% INCLUDE 'csrf-token.inc' %] - -
-
    -
  1. - [% IF attribute_type %] - Patron attribute type code: - - [% attribute_type.code |html %] - [% ELSE %] - - - Required - [% END %] -
  2. -
  3. - - Required -
  4. - -
  5. - - [% IF attribute_type %] - [% IF attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %] - - - [% ELSIF attribute_type.repeatable %] - - [% ELSE %] - - [% END %] - [% ELSE %] - - [% END %] - Check to let a patron record have multiple values of this attribute. -
  6. - -
  7. - - [% IF attribute_type %] - [% IF attribute_type.unique_id %] - - [% ELSIF can_be_set_to_unique %] - - [% ELSE %] - - - [% END %] - [% ELSE %] - - [% END %] - If checked, attribute will be a unique identifier. If a value is given to a patron record, the same value cannot be given to a different record. -
  8. -
  9. - [% IF attribute_type AND attribute_type.is_date %] - - [% ELSE %] - - [% END %] - If checked, the attribute will be a date. Date attributes can be repeatable, but cannot be linked to an authorized value category. -
  10. -
  11. - [% IF attribute_type AND attribute_type.opac_display %] - - [% ELSE %] - - [% END %] - Check to display this attribute on a patron's details page in the OPAC. -
  12. -
  13. - [% IF attribute_type AND attribute_type.opac_editable %] - - [% ELSE %] - - [% END %] - Check to allow patrons to edit this attribute from their details page in the OPAC. (Requires above) -
  14. -
  15. - [% IF attribute_type AND attribute_type.staff_searchable %] - - [% ELSE %] - - [% END %] - Check to make this attribute searchable in staff patron searches. If checked, this attribute will appear in patron search dropdowns. -
  16. -
  17. - [% IF attribute_type AND attribute_type.searched_by_default %] - - [% ELSE %] - - [% END %] - If checked, this field will be included in 'Standard' patron searches. Requires field to be marked as searchable above -
  18. -
  19. - [% IF attribute_type AND attribute_type.mandatory %] - - [% ELSE %] - - [% END %] - Check to make this attribute mandatory when creating or editing a patron. -
  20. -
  21. - [% IF attribute_type AND attribute_type.display_checkout %] - - [% ELSE %] - - [% END %] - Check to show this attribute in the brief information panel in the patron's record (staff interface). -
  22. - - [% IF Koha.Preference('Pseudonymization') %] -
  23. - - [% IF attribute_type AND attribute_type.keep_for_pseudonymization %] - - [% ELSE %] - - [% END %] - Check to make this attribute copied to the patron's pseudonymized attributes. -
  24. - [% END %] - -
  25. - -
    If one is selected, the patron record input page will only allow values to be chosen from the authorized value list. However, an authorized value list is not enforced during batch patron import.
    -
  26. -
  27. - -
    Select "All libraries" if this attribute type should always be displayed. Otherwise select libraries you want to associate with this value.
    -
  28. -
  29. - - -
    Choose one to limit this attribute to one patron type. Please leave blank if you want these attributes to be available for all types of patrons.
    -
  30. -
  31. - - [% PROCESS 'av-build-dropbox.inc' name="class", category="PA_CLASS" default=attribute_type.class empty=1 %] -
    - [% IF ( CAN_user_parameters_manage_auth_values ) %] - Group attributes types with a block title (based on authorized values category 'PA_CLASS') - [% ELSE %] - Group attributes types with a block title (based on authorized values category 'PA_CLASS') - [% END %] -
    -
  32. -
-
-
- - Cancel -
-
- [% END %] - - [% IF ( delete_attribute_type_form ) %] -
-

[% tx("Confirm deletion of patron attribute type '{code}' ({description})?", { code = code, description = description }) | html %]

-
- [% INCLUDE 'csrf-token.inc' %] - - - -
-
- -
-
- [% END %] - - [% IF ( display_list ) %] - - -

Patron attribute types

- [% IF ( added_attribute_type ) %] -
Added patron attribute type "[% added_attribute_type | html %]"
- [% END %] - [% IF ( edited_attribute_type ) %] -
Modified patron attribute type "[% edited_attribute_type | html %]"
- [% END %] - [% IF ( deleted_attribute_type ) %] -
Deleted patron attribute type "[% deleted_attribute_type | html %]"
- [% END %] - [% IF ( ERROR_delete_in_use ) %] -
Could not delete patron attribute type "[% ERROR_delete_in_use | html %]" — it is in use by [% ERROR_num_patrons | html %] patron records
- [% END %] - [% IF ( ERROR_delete_not_found ) %] -
Could not delete patron attribute type "[% ERROR_delete_not_found | html %]" — it was already absent from the database.
- [% END %] - [% IF ( available_attribute_types ) %] - [% FOREACH attribute IN available_attribute_types %] -
- [% IF attribute.class %] -

[% attribute.lib | html %]

- [% ELSE %] -

Unclassified types

- [% END %] - - - - - - - - - - - - - - [% FOREACH item IN attribute.items %] - - - - - - - - - - [% END %] - -
CodeDescriptionLibrary limitationAuthorized value categoryMandatorySearchingActions
[% item.code | html %][% item.description | html %] - [% SET libraries = item.library_limits %] - [% IF ( libraries && libraries.count > 0 ) %] - [% branches_str = "" %] - [% FOREACH branch IN libraries %] - [% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %] - [% END %] - - [% IF libraries.count > 1 %] - [% libraries.count | html %] library limitations - [% ELSE %] - [% libraries.count | html %] library limitation - [% END %] - - [% ELSE %] - No limitation - [% END %] - - [% IF ( CAN_user_parameters_manage_auth_values ) %] - [% item.authorised_value_category | html %] - [% ELSE %] - [% item.authorised_value_category | html %] - [% END %] - - [% IF ( item.mandatory ) -%] - Yes - [% ELSE -%] - No - [% END %] - - [% IF ( item.staff_searchable ) %] - [% IF( item.searched_by_default ) %] - Searched by default - [% ELSE %] - Searchable - [% END %] - [% ELSE %] - Not searchable - [% END %] - - Edit - Delete -
- [% END %] - [% ELSE %] -

There are no saved patron attribute types.

- [% END %] - -
[% pagination_bar | $raw %]
- [% END %] -[% END %] -[% MACRO jsinclude BLOCK %] - [% Asset.js("js/admin-menu.js") | $raw %] - [% INCLUDE 'datatables.inc' %] - [% INCLUDE 'columns_settings.inc' %] - -[% END %] -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index a4f415881b8..e69de29bb2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1,1996 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% USE To %] -[% USE Koha %] -[% USE KohaDates %] -[% USE Branches %] -[% PROCESS 'member-main-address-style.inc' %] -[% PROCESS 'member-alt-address-style.inc' %] -[% PROCESS 'member-alt-contact-style.inc' %] -[% PROCESS 'restriction-types.inc' %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% PROCESS 'patron-search.inc' %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% UNLESS blocking_error %] - [% IF ( op == 'add_form' ) %] - [% t("Add patron") | html %] - [% ELSE %] - [% t("Modify patron") | html %] - [% END %] - [% INCLUDE 'patron-title.inc' no_html = 1 %] - [% IF patron_category %]([% patron_category.description | html %])[% END %] - [% END %] - › [% t("Patrons") | html %] › [% t("Koha") | html %] - [% END %] -[% INCLUDE 'doc-head-close.inc' %] -[% FILTER collapse %] - -[% END %] - - - -[% WRAPPER 'header.inc' %] - [% INCLUDE 'patron-search-header.inc' %] -[% END %] - -[% WRAPPER 'sub-header.inc' %] - [% WRAPPER breadcrumbs %] - [% WRAPPER breadcrumb_item %] - Patrons - [% END %] - [% UNLESS blocking_error %] - [% UNLESS op == 'add_form' %] - [% IF (borrower_data.firstname || borrower_data.surname ) %] - [% WRAPPER breadcrumb_item %] - [% INCLUDE 'patron-title.inc' %] - [% END %] - [% END %] - [% END %] - [% END %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - [% IF ( op == 'add_form' ) %] - Add patron - [% ELSE %] - Modify patron - [% END %] - [% IF patron_category %] - ([% patron_category.description | html %]) - [% END %] - [% END %] - [% END #/ WRAPPER breadcrumbs %] -[% END #/ WRAPPER sub-header.inc %] - -
-
- [% IF borrower_data.messages %] - [% FOR message IN borrower_data.messages %] - [% SWITCH message.error %] - [% CASE 'error_on_insert_patron' %] -
Something went wrong when creating the patron. Check the logs for details.
- [% CASE 'error_on_update_patron' %] -
Something went wrong when updating the patron. Check the logs for details.
- [% CASE %] -
Unhandled error: [% message.error | html %]
- [% END %] - [% END %] - [% END %] - [% IF ( op == 'add_form' ) %] - [% SET div_class = 'col-md-10 offset-md-1 col-lg-8 offset-lg-2' %] - [% ELSE %] - [% SET div_class = 'col-md-10 order-md-2 order-sm-1' %] - [% END %] -
-
- [% INCLUDE 'messages.inc' %] - - [% IF error_alert %] - [% IF ( error_alert == "no_email" ) %] -
This member has no email
- [% ELSE %] -
[% error_alert | html %]
- [% END %] - [% END %] - [% IF info_alert %] -
Email has been sent.
- [% END %] - - [% INCLUDE 'noadd-warnings.inc' %] - - [% UNLESS ( no_add ) %] -

- [% IF ( op == 'add_form' ) %] - Add patron - [% ELSIF ( op == 'duplicate' ) %] - Duplicate patron - [% ELSE %] - Modify patron - [% END %] - [% INCLUDE 'patron-title.inc' %] - [% IF patron_category %]([% patron_category.description | html %])[% END %] -

- - [% IF quickadd && op == 'add_form' && !check_member %] - Show full form - - [% END %] - - [% IF ( check_member ) %] -
-

Duplicate patron record?

-

[%- INCLUDE 'patron-title.inc' patron => check_patron hide_patron_infos_if_needed => 1 -%]

- [% IF logged_in_user.can_see_patron_infos( check_patron ) %] -

View existing record

- [% END %] - - It is a duplicate. Edit existing record - - -
- [% END %] - - [% IF ( nok ) %] -
-

The following fields are wrong. Please fix them.

-
    - [% IF ( ERROR_login_exist ) %] -
  • Username already exists or could not create unique new one.
  • - [% END %] - [% IF ERROR_cardnumber_already_exists %] -
  • Card number already in use.
  • - [% END %] - [% IF ERROR_cardnumber_length %] -
  • Card number length is incorrect.
  • - [% END %] - [% IF ( ERROR_age_limitations ) %] -
  • Patron's age is incorrect for their category. Ages allowed are [% age_low | html %]-[% age_high | html %].
  • - [% END %] - [% IF ( ERROR_branch ) %] -
  • Library is invalid.
  • - [% END %] - [% IF ( ERROR_dateofbirth ) %] -
  • Date of birth is invalid.
  • - [% END %] - [% IF ( ERROR_dateenrolled ) %] -
  • Date of enrollment is invalid.
  • - [% END %] - [% IF ( ERROR_dateexpiry ) %] -
  • Date of expiration is invalid.
  • - [% END %] - [% IF ( ERROR_password_too_short ) %] -
  • Password must be at least [% minPasswordLength | html %] characters long.
  • - [% END %] - [% IF ( ERROR_password_too_weak ) %] -
  • Password must contain at least one digit, one lowercase and one uppercase.
  • - [% END %] - [% IF ( ERROR_password_has_whitespaces ) %] -
  • Password must not contain leading or trailing whitespaces.
  • - [% END %] - [% IF ( ERROR_password_mismatch ) %] -
  • Passwords do not match.
  • - [% END %] - [% IF ( ERROR_password_expiration_date ) %] -
  • Password expiration date is invalid.
  • - [% END %] - [% IF ( ERROR_extended_unique_id_failed ) %] -
  • [% ERROR_extended_unique_id_failed_description | html %]: Attribute value "[% ERROR_extended_unique_id_failed_value | html %]" is already in use by another patron record.
  • - [% END %] - [% IF ERROR_bad_email %] -
  • The primary email is invalid.
  • - [% END %] - [% IF ERROR_bad_email_secondary %] -
  • The secondary email is invalid.
  • - [% END %] - [% IF ERROR_bad_email_alternative %] -
  • The alternative email is invalid.
  • - [% END %] - [% IF ( ERROR_child_no_guarantor ) %] -
  • A child patron needs a guarantor.
  • - [% END %] - [% IF ( ERROR_child_is_guarantor ) %] -
  • Child patron cannot be a guarantor.
  • - [% END %] - [% IF ( ERROR_guarantor_is_guarantee ) %] -
  • A guarantor cannot be a guarantee.
  • - [% END %] - [% IF ( ERROR_cannot_delete_guarantor ) %] -
  • Cannot delete guarantor(s). A child patron needs a guarantor.
  • - [% END %] - [% IF ( ERROR_invalid_relationship ) %] -
  • Guarantor relationship cannot be left blank according to configuration.
  • - [% END %] -
-
- [% END %] - - [% SET fieldstohide = Koha.Preference('CollapseFieldsPatronAddForm') %] - [% IF Koha.Preference('CollapseFieldsPatronAddForm') %][% UNLESS step %] -

- - [% FOREACH field IN fieldstohide.split(',') %] - [% SWITCH field %] - [% CASE 'identity' %] - Patron identity | - [% CASE 'guarantor' %] - Guarantor information | - [% CASE 'nonpatron_guarantor' %] - Non-patron guarantor | - [% CASE 'primary_address' %] - Main address | - [% CASE 'primary_contact' %] - Contact information | - [% CASE 'alt_address' %] - Alternate address | - [% CASE 'alt_contact' %] - Alternate contact | - [% CASE 'lib_mgmt' %] - Library management | - [% CASE 'lib_setup' %] - Library setup | - [% CASE 'login' %] - OPAC/Staff interface login | - [% CASE 'flags' %] - Patron account flags | - [% CASE 'debarments' %] - Patron restrictions | - [% CASE 'housebound' %] - [% IF Koha.Preference('HouseboundModule') %]Housebound roles |[% END %] - [% CASE 'additional' %] - Additional attributes and identifiers | - [% CASE 'messaging' %] - Patron messaging preferences | - [% END %] - [% END %] -

- [% END %][% END %] - - [% UNLESS ( check_member ) %] -
- [% IF quickadd && op == 'add_form' %] - - [% END %] - - [% IF op == 'add_form' %] - Cancel - [% ELSE %] - Cancel - [% END %] -
- [% END %] - -
- [% UNLESS ( check_member ) %] - - [% END %] - - - - - - - - [% INCLUDE 'csrf-token.inc' %] - [% IF ( step ) %] - - [% END %] - [% IF ( op == 'add_form' ) %] - - [% ELSIF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% IF step == 4 || step == 5 || step == 6 || step == 2 || step == 1 || step == 7 %] - [%# Only put the card number if we arent showing it in the form later %] - [% IF borrower_data.cardnumber %] - - [% END %] - [% END %] - [% END %] - - [% IF ( step_1 ) %] - [% UNLESS notitle && nosurname && nofirstname && nopreferred_name && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex && nopronouns %] -
- - - [% IF ( patron_category.category_type == 'I' ) %] - Organization identity - [% ELSE %] - Patron identity - [% END %] - -
    - [% UNLESS ( patron_category.category_type == 'I' ) %] - [% UNLESS notitle %] - [% IF Koha.Preference('BorrowersTitles') %] -
  1. - - - [% IF ( mandatorytitle ) %] - Required - [% END %] -
  2. - [% END # /IF Koha.Preference('BorrowersTitles') %] - [% END # /UNLESS notitle %] - [% END # /UNLESS ( I ) %] - - [% UNLESS nosurname %] -
  3. - [% IF ( patron_category.category_type == 'I' ) %] - - [% ELSE %] - - [% END %] - - [% IF ( uppercasesurnames ) %] - - [% ELSE %] - - [% END %] - [% IF ( mandatorysurname ) %] - Required - [% END %] -
  4. - [% END # /UNLESS nosurname %] - - [% UNLESS ( patron_category.category_type == 'I' ) %] - [% UNLESS nofirstname %] -
  5. - - - [% IF ( mandatoryfirstname ) %] - Required - [% END %] -
  6. - [% END #/UNLESS nofirstname %] - [% UNLESS nopreferred_name %] -
  7. - - - [% IF ( mandatorypreferred_name ) %] - Required - [% END %] -
  8. - [% END #/UNLESS nopreferred_name %] - [% UNLESS nomiddle_name %] -
  9. - - - [% IF ( mandatorymiddle_name ) %] - Required - [% END %] -
  10. - [% END #/UNLESS nomiddle_name %] - [% UNLESS nodateofbirth %] -
  11. - - - [% IF ( mandatorydateofbirth ) %] - Required - [% END %] - [% IF ( ERROR_dateofbirth ) %] - (Error) - [% END %] -
    [% INCLUDE 'date-format.inc' %]
    -
  12. - [% END # /UNLESS nodateofbirth %] - [% UNLESS noinitials %] -
  13. - - - [% IF ( mandatoryinitials ) %] - Required - [% END %] -
  14. - [% END # /UNLESS noinitials %] - [% UNLESS nopronouns %] -
  15. - - - [% IF ( mandatorypronouns ) %] - Required - [% END %] -
  16. - [% END # /UNLESS nopronouns %] - [% END #/UNLESS ( I ) %] - [% UNLESS noothernames %] -
  17. - - - [% IF ( mandatoryothernames ) %] - Required - [% END %] - [% IF ( patron_category.category_type == 'I' ) %][% END %] -
  18. - [% END #/UNLESS noothernames %] - - [% UNLESS ( patron_category.category_type == 'I' ) %] - [% UNLESS nosex %] -
  19. - [% UNLESS ( op == 'duplicate' ) %] - [% IF ( female ) %] - - [% ELSE %] - - [% END %] - [% IF ( male ) %] - - [% ELSE %] - - [% END %] - [% IF ( other ) %] - - [% ELSE %] - - [% END %] - [% IF ( none ) %] - - [% ELSE %] - - [% END %] - [% ELSE %] - - - - - [% END # /UNLESS ( op == 'duplicate' ) %] -
  20. - [% END # /UNLESS nosex %] - [% END # /UNLESS ( I ) %] -
-
- - [% END # hide fieldset %] - - [% IF show_guarantor || guarantor %] - [% SET possible_relationships = Koha.Preference('borrowerRelationship') %] -
-
- - - Patron guarantor - - -
- [% FOREACH r IN relationships %] -
-
    - [% IF patron_category.category_type == 'I' %] -
  1. - Organization: - [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %] -
  2. -
  3. - Relationship: - [% r.relationship | html %] -
  4. - [% ELSE %] -
  5. - Guarantor: - [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %] - -
  6. -
  7. - Relationship: - [% r.relationship | html %] - -
  8. - -
  9. - - -
  10. - [% END %] -
-
- [% END # END relationships foreach %] - [% IF guarantor && (!relationships) %] -
-
    -
  1. - Guarantor: - [% guarantor.firstname | html %] [% guarantor.surname | html %] ([% guarantor.cardnumber | html %]) - -
  2. - - [% UNLESS norelationship %] -
  3. - - - [% IF mandatoryrelationship %] - Required - [% END %] -
  4. - [% ELSE %] - - [% END %] - -
  5. - - Remove -
  6. -
-
- [% END %] -
- - -
-
    -
  1. - Guarantor: - - () - - -
  2. - - [% UNLESS norelationship %] -
  3. - - - [% IF mandatoryrelationship %] - Required - [% END %] -
  4. - [% ELSE %] - - [% END %] - -
  5. - - Remove -
  6. -
-
- -
    - - - - -
  1. - Add guarantor -
  2. - - [% IF Koha.Preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') %] -
  3. - - -
    Allow guarantors of this patron to view this patron's checkouts from the OPAC
    -
  4. - [% END %] - [% IF Koha.Preference('AllowStaffToSetFinesVisibilityForGuarantor') %] -
  5. - - -
    Allow guarantors of this patron to view this patron's charges from the OPAC
    -
  6. - [% END %] -
-
- -
- - - [% UNLESS nocontactname && nocontactfirstname && norelationship %] -
- - - Non-patron guarantor - -
    - [% UNLESS nocontactname %] -
  1. - - - [% IF ( mandatorycontactname ) %] - Required - [% END %] -
    Non-patron guarantor surname
    -
  2. - [% END # /UNLESS nocontactname %] - - [% UNLESS nocontactfirstname %] -
  3. - - - [% IF ( mandatorycontactfirstname ) %] - Required - [% END %] -
    Non-patron guarantor first name
    -
  4. - [% END # /UNLESS noaltcontactfirstname %] - - [% UNLESS norelationship %] -
  5. - - - [% IF mandatoryrelationship %] - Required - [% END %] -
  6. - [% END # /UNLESS norelationship %] -
-
- - [% END # /UNLESS nocontactname && nocontactfirstname && norelationship %] - [% END # /IF show_guarantor || guarantor %] - - [% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %] - [% PROCESS 'main-address-style' %] - [% END # /UNLESS nostreet && nocity etc group %] - - [% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %] -
- - - Contact information - -
    - [% UNLESS nophone %] -
  1. - - - [% IF ( mandatoryphone ) %] - Required - [% END %] -
    Shows on transit slips
    -
  2. - [% END # /UNLESS nophone %] - - [% UNLESS nophonepro %] -
  3. - - - [% IF ( mandatoryphonepro ) %] - Required - [% END %] -
  4. - [% END # /UNLESS nophonepro %] - - [% UNLESS nomobile %] -
  5. - - - [% IF ( mandatorymobile ) %] - Required - [% END %] -
  6. - [% END # /UNLESS nomobile %] - - [% UNLESS noemail %] -
  7. - - [% IF ( NoUpdateEmail ) %] - - [% ELSE %] - - [% END %] - [% IF ( mandatoryemail ) %] - Required - [% END %] -
    Shows on transit slips
    -
  8. - [% END #/UNLESS noemail %] - - [% UNLESS noemailpro %] -
  9. - - [% IF ( NoUpdateEmail ) %] - - [% ELSE %] - - [% END %] - [% IF ( mandatoryemailpro ) %] - Required - [% END %] -
  10. - [% END #/UNLESS noemailpro %] - - [% UNLESS nofax %] -
  11. - - - [% IF ( mandatoryfax ) %] - Required - [% END %] -
  12. - [% END #/UNLESS nofax %] - - [% UNLESS noprimary_contact_method %] -
  13. - - - - [% IF mandatoryprimary_contact_method %] - Required - [% END %] -
  14. - [% END %] -
-
- - [% END # hide fieldset %] - - - [% END # /IF ( step_1 ) %] - - [% IF ( step_6 ) %] - [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %] - [% PROCESS 'alt-address-style' %] - [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %] - [% END # /IF ( step_6 ) %] - - [% IF ( step_2 ) %] - [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %] - [% PROCESS 'alt-contact-style' %] - [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %] - [% END # /IF ( step_2 ) %] - - [% IF ( step_3 ) %] - [% SET autoMemberNum = Koha.Preference('autoMemberNum') %] -
- - - Library management - -
    - [% UNLESS nocardnumber %] -
  1. - - - [% IF minlength_cardnumber == maxlength_cardnumber %] - - [% IF mandatorycardnumber %] - Required - [% END %] - Card number must not be more than [% maxlength_cardnumber | html %] characters. -
    Card number must be exactly [% minlength_cardnumber | html %] characters.
    - [% ELSIF minlength_cardnumber && maxlength_cardnumber %] - - [% IF mandatorycardnumber %] - Required - [% END %] - Card number must not be more than [% maxlength_cardnumber | html %] characters. -
    Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.
    - [% ELSIF maxlength_cardnumber %] - - [% IF mandatorycardnumber %] - Required - [% END %] - Card number must not be more than [% maxlength_cardnumber | html %] characters. -
    Card number can be up to [% maxlength_cardnumber | html %] characters.
    - [% ELSE %] - - [% IF mandatorycardnumber %] - Required - [% END %] -
    There is no minimum or maximum character length.
    - [% END %] - [% IF autoMemberNum %] - [% IF mandatorycardnumber %] -
    autoMemberNum is set to enabled, but card number is marked as mandatory in BorrowerMandatoryField: auto calc has been disabled.
    - [% ELSE %] -
    Leave blank for auto calc during registration
    - [% END %] - [% END %] -
  2. - [% END # /UNLESS nocardnumber %] - - [% UNLESS nobranchcode %] -
  3. - - - Required -
  4. - [% END %] - -
  5. - - - [% IF limited_category %] - - [% END %] - Required -
  6. - - [% UNLESS nosort1 %] -
  7. - - [% PROCESS 'av-build-dropbox.inc' name="sort1", category="Bsort1", default=borrower_data.sort1, empty=1, size = 20 %] - [% IF ( mandatorysort1 ) %] - Required - [% END %] -
  8. - [% END # /UNLESS nosort1 %] - - [% UNLESS nosort2 %] -
  9. - - [% PROCESS 'av-build-dropbox.inc' name="sort2", category="Bsort2", default=borrower_data.sort2, empty=1, size = 20 %] - [% IF ( mandatorysort2 ) %] - Required - [% END %] -
  10. - [% END # /UNLESS nosort2 %] - - [% UNLESS noautorenew_checkouts %] -
  11. - - [% IF ( borrower_data.autorenew_checkouts || op == 'add_form' ) %] - - - [% ELSE %] - - - [% END %] -
  12. - [% END %] - - [% UNLESS noprotected || !CanUpdateProtectPatron %] -
  13. - - [% IF ( patron.protected == 1 ) %] - - - [% ELSE %] - - - [% END %] -
  14. - [% END %] - - [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %] -
  15. - - -
  16. - [% END # /IF ( Koha.Preference('CheckPrevCheckout') %] - - [% IF Koha.Preference('TranslateNotices') %] -
  17. - - - -
  18. - [% END #/IF Koha.Preference('TranslateNotices') %] -
-
- - - [% UNLESS nodateenrolled && noopacnote && noborrowernotes %] -
- - - Library setup - -
    - [% UNLESS nodateenrolled %] -
  1. - - - [% IF ( mandatorydateenrolled ) %] - Required - [% END %] - [% IF ( ERROR_dateenrolled ) %] - (Error) - [% END %] -
    [% INCLUDE 'date-format.inc' %]
    -
  2. - [% END # /UNLESS nodateenrolled %] - -
  3. - - [% UNLESS ( op == 'add_form' ) %] - - [% ELSE %] - - [% END %] - [% IF ( mandatorydateexpiry ) %] - Required - [% END %] - [% IF ( ERROR_dateexpiry ) %] - (Error) - [% END %] -
    [% INCLUDE 'date-format.inc' %]
    -
  4. - - [% UNLESS noopacnote %] -
  5. - - -
    This message appears on this patron's user page in the OPAC
    - [% IF ( mandatoryopacnote ) %] - Required - [% END %] -
  6. - [% END # /UNLESS noopacnote %] - - [% UNLESS noborrowernotes %] -
  7. - - -
    This message displays when checking out to this patron
    - [% IF ( mandatoryborrowernotes ) %] - Required - [% END %] -
  8. - [% END # /UNLESS noborrowernotes %] -
-
- - [% END # hide fieldset %] - - [% UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %] -
- - - OPAC/Staff interface login - -
    - [% UNLESS nouserid %] -
  1. - - - [% IF ( NoUpdateLogin ) %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% END # /IF ( NoUpdateLogin ) %] - - [%# Dummy input to avoid Firefox from using userid/password saved for authentication %] - - - [% IF ( mandatoryuserid ) %] - Required - [% END %] -
  2. - [% END # /UNLESS nouserid %] - - [% UNLESS nopassword %] -
  3. - - [% IF ( op == 'add_form' ) %] - [% IF ( NoUpdateLogin ) %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% END # /IF ( NoUpdateLogin ) %] - [% ELSE # IF ( op == 'add_form' ) %] - - [% IF ( borrower_data.password ) %] - [% IF ( NoUpdateLogin ) %] - - [% ELSE %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% ELSE %] - [% IF ( NoUpdateLogin ) %] - - [% ELSE %] - - [% END %] - [% END # /IF ( password ) %] - [% END # /IF ( op == 'add_form' ) %] - [% IF ( mandatorypassword ) %] - Required - [% END %] - [% IF ( ERROR_password_too_short ) %] - Password is too short - [% END %] - [% IF ( ERROR_password_too_weak ) %] - Password is too weak - [% END %] - [% IF ( ERROR_password_has_whitespaces ) %] - Password has leading or trailing whitespaces - [% END %] -
    Minimum password length: [% patron.category.effective_min_password_length | html %]
    -
  4. - -
  5. - - [% IF ( op == 'add_form' ) %] - [% IF ( NoUpdateLogin ) %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% ELSE # IF ( op == 'add_form' ) %] - [% IF ( borrower_data.password ) %] - [% IF ( NoUpdateLogin ) %] - - [% ELSE %] - [% IF ( op == 'duplicate' ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% ELSE %] - [% IF ( NoUpdateLogin ) %] - - [% ELSE %] - - [% END %] - [% END %] - [% END # /IF ( op == 'add_form' ) %] - - [% IF ( mandatorypassword ) %] - Required - [% END %] - [% IF ( ERROR_password_mismatch ) %] - Passwords do not match - [% END %] -
  6. - [% END # /UNLESS nopassword %] - [% UNLESS ( !CanUpdatePasswordExpiration ) %] -
  7. - - -
  8. - [% END %] -
-
- - [% END # UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %] - - - [% UNLESS ( op == 'add_form' || op == 'duplicate' || ( nogonenoaddress && nolost ) ) %] -
- - - Patron account flags - -

Setting a value here will prevent patron from circulating materials and placing holds on the OPAC

-
    - [% UNLESS nogonenoaddress %] -
  1. - - [% IF CAN_user_circulate_manage_restrictions %] - - - [% ELSE %] - [% IF borrower_data.gonenoaddress %]Yes[% ELSE %]No[% END %] - [% END # /IF CAN_user_circulate_manage_restrictions %] - [% IF mandatorygonenoaddress %] - Required - [% END %] -
  2. - [% END # /UNLESS nogonenoaddress %] - [% UNLESS nolost %] -
  3. - - [% IF CAN_user_circulate_manage_restrictions %] - - - [% ELSE %] - [% IF borrower_data.lost %]Yes[% ELSE %]No[% END %] - [% END # /IF CAN_user_circulate_manage_restrictions %] - [% IF mandatorylost %] - Required - [% END %] -
  4. - [% END # /UNLESS nogonenoaddress %] -
-
- - [% END %] -
- - - Patron restrictions - - [% IF ( patron.restrictions.count ) %] - - - - - - - - [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] - - [% END %] - - - - [% FOREACH restriction IN patron.restrictions %] - - - - - - [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] - - [% END %] - - [% END # /FOREACH d %] - -
TypeCommentExpiration[% tp('patron restriction created on', 'Created') | html %]Remove?
[% PROCESS restriction_type_description restriction_type=restriction.type %] - [% IF restriction.comment.search('OVERDUES_PROCESS') %] - Restriction added by overdues process [% restriction.comment.remove('OVERDUES_PROCESS ') | $raw %] - [% ELSE %] - [% restriction.comment | $raw %] - [% END %] - - [% IF restriction.expiration %] - [% restriction.expiration | $KohaDates %] - [% ELSE %] - Indefinite - [% END %] - [% restriction.created | $KohaDates %] - -
- [% ELSE %] -

Patron is currently unrestricted.

- [% END # /IF ( patron.restrictions.count ) %] - - [% IF CAN_user_borrowers_edit_borrowers && CAN_user_circulate_manage_restrictions %] -

Add manual restriction

-
- - Add manual restriction -
    - [% IF Koha.Preference('PatronRestrictionTypes') %] -
  1. - - -
  2. - [% END %] -
  3. - - -
  4. -
  5. - - - Clear date -
  6. -
-

- Cancel -

-
- - [% END # /IF CAN_user_borrowers_edit_borrowers %] -
- - [% END # /IF ( step_3 ) %] - - [% IF ( step_7 ) %] - [% IF Koha.Preference('HouseboundModule') %] -
- - - Housebound roles - -
    -
  1. - - [% IF ( housebound_role.housebound_chooser == 1 ) %] - - - - - [% ELSE %] - - - - - [% END %] -
  2. -
  3. - - [% IF ( housebound_role.housebound_deliverer == 1 ) %] - - - - - [% ELSE %] - - - - - [% END %] -
  4. -
- -
- - [% END # hide fieldset %] - [% END # IF step_7 %] - - [% IF ( step_4 ) %] - [% IF Koha.Preference('ExtendedPatronAttributes') %] - [% UNLESS ( no_patron_attribute_types ) %] -
- - - Additional attributes and identifiers - - - [% FOREACH pa_loo IN patron_attributes %] -
    -
    - [% IF pa_loo.class %] -

    [% pa_loo.lib | html %]

    - [% END %] - [% FOREACH patron_attribute IN pa_loo.items %] -
  1. - [% IF patron_attribute.mandatory %] - - [% ELSE %] - - [% END %] - [% IF ( patron_attribute.use_dropdown ) %] - - [% ELSE %] - [% IF patron_attribute.mandatory %] - [% IF patron_attribute.is_date %] - - [% ELSE %] - - [% END %] - [% ELSE %] - [% IF patron_attribute.is_date %] - - [% ELSE %] - - [% END %] - [% END %] - [% END # /IF ( patron_attribute.use_dropdown ) %] - - [% IF ( !patron_attribute.is_date ) %] - Clear - [% END %] - [% IF ( patron_attribute.repeatable ) %] - New - [% END %] - [% IF patron_attribute.mandatory %]Required[% END %] -
  2. - [% END # /FOREACH patron_attribute %] -
    -
- [% END # /FOREACH pa_loo %] -
- - [% END # UNLESS ( no_patron_attribute_types ) %] - [% END # IF Koha.Preference('ExtendedPatronAttributes') %] - [% END # IF ( step_4 ) %] - - [% IF ( step_5 ) %] - [% IF ( EnhancedMessagingPreferences ) %] -
- - - Patron messaging preferences - - - - [% INCLUDE 'messaging-preference-form.inc' %] - [% IF ( SMSSendDriver ) %] - [% IF !nosmsalertnumber %] -

- - - Please enter numbers only. Prefix the number with + or 00 if including the country code. -

- [% END %] - [% IF SMSSendDriver == 'Email' && !nosms_provider_id %] -

- - -

- [% END # /UNLESS nosms_provider_id %] - [% END # IF ( SMSSendDriver ) %] -
- [% END # IF ( EnhancedMessagingPreferences ) %] - [% END # /IF step_5 %] -
- - - [% IF quickadd && op == 'add_form' && !check_member %] -
-
Quick add -
-
-
- [% END %] - [% END # /UNLESS ( no_add ) %] -
-
- - - [% UNLESS ( op == 'add_form' ) %] -
- -
- - [% END %] -
- -
- - -[% MACRO jsinclude BLOCK %] - [% INCLUDE 'calendar.inc' %] - [% INCLUDE 'str/members-menu.inc' %] - [% Asset.js("js/members-menu.js") | $raw %] - - [% Asset.js("js/members.js") | $raw %] - [% Asset.js("js/messaging-preference-form.js") | $raw %] - [% PROCESS 'password_check.inc' new_password => 'password', category_selector => '#categorycode_entry', minPasswordLength => patron.category.effective_min_password_length, RequireStrongPassword => patron.category.effective_require_strong_password %] - - [% INCLUDE 'select2.inc' %] - [% SET columns = ['cardnumber','name','category','branch','dateofbirth','address-library','action'] %] - [% PROCESS patron_search_modal columns => columns, modal_title => t("Add guarantor") %] - [% PROCESS patron_search_js columns => columns, actions => ["select"], preview_on_name_click => 1 %] -[% END %] - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt index bf6c5904fac..e69de29bb2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt @@ -1,331 +0,0 @@ -[% USE raw %] -[% USE Branches %] -[% USE Koha %] -[% USE Asset %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% IF( do_it ) %] - [% t("Results") | html %] - › - [% END %] - [% t("Patrons statistics") | html %] - › [% t("Reports") | html %] › [% t("Koha") | html %] - [% END %] - -[% INCLUDE 'doc-head-close.inc' %] - - - - -[% WRAPPER 'header.inc' %] - [% INCLUDE 'cat-search.inc' %] -[% END %] - -[% WRAPPER 'sub-header.inc' %] - [% WRAPPER breadcrumbs %] - [% WRAPPER breadcrumb_item %] - Reports - [% END %] - [% IF ( do_it ) %] - [% WRAPPER breadcrumb_item %] - Patrons statistics - [% END %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Results - [% END %] - [% ELSE %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Patrons statistics - [% END %] - [% END %] - [% END #/ WRAPPER breadcrumbs %] -[% END #/ WRAPPER sub-header.inc %] - -[% WRAPPER 'main-container.inc' aside='reports-menu' %] -

Patrons statistics

- [% IF ( do_it ) %] - [% FOREACH mainloo IN mainloop %] - [% IF ( mainloo.loopfilter.size>0 ) %] -

Filtered on:

- [% FOREACH loopfilte IN mainloo.loopfilter %] -

[% loopfilte.crit | html %] = [% loopfilte.filter | html %]

- [% END %] - [% END %] - - - - [% FOREACH loopco IN mainloo.loopcol %] - - [% END %] - - - [% FOREACH loopro IN mainloo.looprow %] - - - [% FOREACH loopcel IN loopro.loopcell %] - - [% END %] - - - [% END %] - - - [% FOREACH loopfoote IN mainloo.loopfooter %] - - [% END %] - - -
[% mainloo.line | html %] / [% mainloo.column | html %][% IF ( loopco.coltitle_display ) %][% loopco.coltitle_display | html %][% ELSE %][% loopco.coltitle | html %][% END %] TOTAL
[% IF ( loopro.rowtitle_display ) %][% loopro.rowtitle_display | html %][% ELSE %][% loopro.rowtitle | html %][% END %] [% IF ( loopcel.value ) %][% loopcel.value | html %][% ELSE %] [% END %] [% loopro.totalrow | html %]
TOTAL[% loopfoote.totalcol | html %][% mainloo.total | html %]
- [% END %] - [% ELSE %] -
-
Patrons statistics - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [% IF ( SORT1_LOOP ) %] - - - - - - - [% ELSE %] - - [% END %] - [% IF ( SORT2_LOOP ) %] - - - - - - - [% ELSE %] - - [% END %] - [% IF Koha.Preference('ExtendedPatronAttributes') %] - - - - [% FOREACH pa_loo IN patron_attributes %] - [% IF (pa_loo.class) %] - - - - - [% END %] - [% FOREACH patron_attribute IN pa_loo.items %] - - - - - - - [% END %] - [% END %] - [% END %] - -
TitleRowColumnFilter
Patron category - -
Patron status
Patron activity - -
ZIP/Postal code -
- -  
Library - -
Date of birth - - - - - [% INCLUDE 'date-format.inc' %] -
Gender - -
Sort1 - -
Sort2 - -
Patron attributes
[% pa_loo.class | html %] ([% pa_loo.lib | html %])
[% patron_attribute.code | html %] ([% patron_attribute.description | html %]) - - - - - [% IF ( patron_attribute.use_dropdown ) %] - - [% ELSE %] - - [% END %] -
-
- -
- Output -
    -
  1. -
  2. - - - - -
  3. -
-
- -
- - - -
-
- [% END %] -[% END %] - -[% MACRO jsinclude BLOCK %] - [% INCLUDE 'calendar.inc' %] -[% END %] - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt index 4fc7daf7d70..e69de29bb2d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -1,652 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% USE Koha %] -[% USE KohaDates %] -[% USE Branches %] -[% USE Categories %] -[% USE TablesSettings %] -[% PROCESS 'i18n.inc' %] -[% SET footerjs = 1 %] -[% INCLUDE 'doc-head-open.inc' %] -[% FILTER collapse %] - [% IF ( op == 'show' or op == 'show_results' ) %] - [% IF ( op == 'show' ) %] - [% t("Modifications") | html %] - › - [% ELSE %] - [% t("Results") | html %] - › - [% END %] - [% END %] - [% t("Batch patron modification") | html %] - › [% t("Tools") | html %] › [% t("Koha") | html %] - [% END %] -[% INCLUDE 'doc-head-close.inc' %] - - - -[% WRAPPER 'header.inc' %] - [% INCLUDE 'cat-search.inc' %] -[% END %] - -[% WRAPPER 'sub-header.inc' %] - [% WRAPPER breadcrumbs %] - [% WRAPPER breadcrumb_item %] - Tools - [% END %] - [% IF ( op == 'show' or op == 'show_results' ) %] - [% WRAPPER breadcrumb_item %] - Batch patron modification - [% END %] - [% IF ( op == 'show' ) %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - [% t("Modifications") | html %] - [% END %] - [% ELSE %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - [% t("Results")| html %] - [% END %] - [% END %] - [% ELSE %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Batch patron modification - [% END %] - [% END %] - [% END #/ WRAPPER breadcrumbs %] -[% END #/ WRAPPER sub-header.inc %] - -[% WRAPPER 'main-container.inc' aside='tools-menu' %] - - [% IF ( op == 'show_form' ) %] -

Batch patron modification

-
- [% INCLUDE 'csrf-token.inc' %] - - - [% WRAPPER tabs id= "batch_patron_options" %] - [% WRAPPER tabs_nav %] - [% WRAPPER tab_item tabname= "usecardnumber" bt_active= 1 %]By card number[% END %] - [% WRAPPER tab_item tabname= "useborrowernumber" %]By borrowernumber[% END %] - [% IF patron_lists %] - [% WRAPPER tab_item tabname= "uselist" %]By patron list[% END %] - [% END %] - [% END # /WRAPPER tabs_nav %] - - [% WRAPPER tab_panels %] - [% WRAPPER tab_panel tabname="usecardnumber" bt_active= 1 %] -
- Use a file of card numbers -
    -
  1. - -
    File must contain one card number per line.
    -
  2. -
-
-
- Or list card numbers one by one -
    -
  1. - - -
  2. -
-
-
- - Cancel -
- [% END # /tab_panel# %] - - [% WRAPPER tab_panel tabname="useborrowernumber" %] -
- Use a file of borrowernumbers -
    -
  1. - -
    File must contain one borrowernumber per line.
    -
  2. -
-
-
- List borrowernumbers one by one -
    -
  1. - - -
  2. -
-
-
- - Cancel -
- [% END # /tab_panel# %] - - [% IF patron_lists %] - [% WRAPPER tab_panel tabname="uselist" %] -
- Use a patron list -
    -
  1. - - -
  2. -
-
-
- - Cancel -
- [% END # /tab_panel# %] - [% END %] - [% END # /WRAPPER tab_panels %] - [% END # /WRAPPER tabs %] -
- [% END %] - - [% IF ( op == 'show') && (!borrowers) && (!notfoundcardnumbers) # Alert if no patrons given %] - [% op = 'noshow' # Change op to prevent display in code below %] -

Batch patrons modification

-
-

No patron card numbers or borrowernumbers given.

-
- -
-
- [% END #Alert if no patrons %] - - [% IF ( op == 'show' or op == 'show_results' ) %] -

Batch patron modification

- [% UNLESS ( op == 'show' ) %] -

Results

- [% END %] - [% IF ( notfoundcardnumbers ) %] - [% IF ( useborrowernumbers ) -%] -

Warning, the following borrowernumbers were not found:

- [% ELSE -%] -

Warning, the following card numbers were not found:

- [% END %] - -
- - - [% IF ( useborrowernumbers ) -%] - - [% ELSE -%] - - [% END %] - - - [% FOREACH notfoundcardnumber IN notfoundcardnumbers %] - - [% END %] - -
Borrowernumbers not found
Card numbers not found
[% notfoundcardnumber.cardnumber | html %]
-
- - [% END %] - - [% IF ( op == 'show_results' ) %] - [% IF ( errors ) %] -
-

Errors occurred:

-
    - [% FOREACH error IN errors %] - [% IF ( error.error == 'can_not_update' ) %] -
  • Can not update patron. [% IF ( error.cardnumber ) %]Card number: [% error.cardnumber | html %][% END %] (Borrowernumber: [% error.borrowernumber | html %])
  • - [% ELSE %] -
  • [% error.error | html %]
  • - [% END %] - [% END %] -
-
- [% END %] - [% END %] - - [% BLOCK show_patron_list %] - [% IF borrowers %] -
- - - - [% IF ( op == 'show' ) %] - - [% ELSE %] - - [% END %] - - - - - - - - - - - - - - - - - - - [% IF CanUpdatePasswordExpiration %] - - [% END %] - [% IF CanUpdateProtectPatron %] - - [% END %] - - - - - - [% FOREACH attrh IN attributes_header %] - - [% END %] - - - - [% FOREACH borrower IN borrowers %] - - - - - - - - - - - - - - - - - - - - - [% IF CanUpdatePasswordExpiration %] - [% IF borrower.password_expiration_date %] - - [% ELSE %] - - [% END %] - [% END %] - [% IF CanUpdateProtectPatron %] - - [% END %] - - - - - - [% FOREACH pa IN borrower.patron_attributes %] - [% IF ( pa.code ) %] - [%# Replace pa.attribute with pa.description if we prefer to display the description %] - - [% ELSE %] - - [% END %] - [% END %] - - [% END %] - -
  Card numberSurnameFirst nameLibraryPatron categoryStreet numberAddressAddress 2CityStateZIP/Postal codeCountryPrimary emailPrimary phoneOther phoneFaxRegistration dateExpiry datePassword expiration dateProtectedCirculation noteOPAC noteMessageRestriction expirationRestriction comment[% attrh.attribute | html %]
- - [% borrower.cardnumber | html %][% borrower.surname | html %][% borrower.firstname | html %][% Branches.GetName( borrower.branchcode ) | html %][% Categories.GetName(borrower.categorycode) | html %][% borrower.streetnumber | html %][% borrower.address | html %][% borrower.address2 | html %][% borrower.city | html %][% borrower.state | html %][% borrower.zipcode | html %][% borrower.country | html %][% borrower.email | html %][% borrower.phone | html %][% borrower.mobile | html %][% borrower.fax | html %][% borrower.dateenrolled | $KohaDates %][% borrower.dateexpiry | $KohaDates %] [% borrower.password_expiration_date | $KohaDates %] Never - [% IF borrower.protected %] - Yes - [% ELSE %] - No - [% END %] - [% borrower.borrowernotes | $raw | html_line_break %][% borrower.opacnote | html %] - [% FOREACH patron_message IN borrower.patron_messages %] - [% patron_message.message | html %]
- - [% IF (patron_message.message_type == 'B') %] - ( OPAC ) - [% ELSE %] - ( Staff ) - [% END %]

- [% END %] -
[% borrower.debarred | $KohaDates %][% borrower.debarredcomment | html %][% pa.code | html %]=[% pa.attribute | html %]
-
- [% END %] - [% END %] - [% IF ( op == 'show' ) %] -
- [% INCLUDE 'csrf-token.inc' %] - - [% IF ( borrowers ) %] - - [% PROCESS show_patron_list %] -
-

Edit patrons

-
Checking the box right next to the label will disable the entry and delete the values of that field on all selected patrons
-
-
    - [% FOREACH field IN fields %] -
  1. - - [% IF ( field.type == 'text' ) %] - - [% END %] - [% IF ( field.type == 'message_type' ) %] - - - [% END %] - [% IF ( field.type == 'select' ) %] - [% IF field.option.size %] - - [% ELSE %] - There is no value defined for [% field.name | html %] - [% END %] - [% END %] - [% IF ( field.type == 'bool' ) %] - - [% END %] - [% IF ( field.type == 'date' ) %] - - Clear - [% END %] - [% IF field.mandatory %] - - Required fields cannot be cleared - [% ELSE %] - - [% IF ( field.type == 'message_type' ) %] - NOTE: Checking this box will remove ALL messages - [% END %] - [% END %] -
  2. - [% END %] - [% IF ( patron_attributes_codes ) %] -
  3. - - - - - - New - -
  4. -
    NOTE: Attributes set here will replace all attributes of the same type in the patron record.
    - [% END %] -
-
-
- - Cancel - [% PROCESS 'members-patron-selections.inc' id="batchmod-borrowers-form" %] -
-
- [% END %] -
- [% END %] - [% END %] - [% IF ( op == 'show_results' ) %] -

- New batch patron modification -

- [% END %] -[% END %] - -[% MACRO jsinclude BLOCK %] - [% INCLUDE 'calendar.inc' %] - [% INCLUDE 'datatables.inc' %] - [% INCLUDE 'columns_settings.inc' %] - [% Asset.js("js/tools-menu.js") | $raw %] - [% Asset.js("js/members-patron-selections.js") | $raw %] - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js index a20561cfe0b..e770b2c1d21 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members.js @@ -77,7 +77,7 @@ function update_category_code(category_code) { var mytables = $(".attributes_table"); $(mytables).find("li").hide(); $(mytables) - .find(" li[data-category_code='" + category_code + "']") + .find(" li[data-category_code~='" + category_code + "']") .show(); $(mytables).find(" li[data-category_code='']").show(); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index c86f9f39e14..e69de29bb2d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -1,1372 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% USE AuthorisedValues %] -[% USE Categories %] -[% USE Koha %] -[% USE Branches %] -[% USE KohaDates %] -[% USE Math %] -[% USE AdditionalContents %] -[% PROCESS 'i18n.inc' %] -[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] -[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] -[% SET userupdateview = 1 %] -[% BLOCK streetnumber %] - [% UNLESS hidden.defined('streetnumber') %] -
  • - - - -
    Required
    -
  • - [% END %] -[% END %] -[% BLOCK B_streetnumber %] - [% UNLESS hidden.defined('B_streetnumber') %] -
  • - - - -
    Required
    -
  • - [% END %] -[% END %] - -[% INCLUDE 'doc-head-open.inc' %] -[% IF op == 'edit' %]Update your personal details[% ELSE %]Register a new account[% END %] › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog -[% INCLUDE 'doc-head-close.inc' %] -[% BLOCK cssinclude %] -[% END %] - - -[% IF op == 'edit' %] - [% INCLUDE 'bodytag.inc' bodyid='opac-patron-update' %] -[% ELSE %] - -[% END %] -[% INCLUDE 'masthead.inc' %] - -
    - [% WRAPPER breadcrumbs %] - [% IF op == 'edit' %] - [% WRAPPER breadcrumb_item %] - [% INCLUDE 'patron-title.inc' patron = logged_in_user %] - [% END %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Your personal details - [% END %] - [% ELSE %] - [% WRAPPER breadcrumb_item bc_active= 1 %] - Register a new account - [% END %] - [% END %] - [% END #/ WRAPPER breadcrumbs %] - -
    -
    -
    - -
    -
    -

    Your personal details

    - - [% SET container_id = "add-content" %] - [% IF op == 'edit' %] - [% container_id = "update-account" %] - [% END %] -
    - [% IF op == 'edit' %] - [% UNLESS OPACPatronDetails %] -
    To make changes to your record please contact the library.
    - [% END %] - [% IF nochanges %] -
    No changes were made.
    - [% END %] - [% END %] - - [% IF empty_mandatory_fields %] -
    You have not filled out all required fields. Please fill in all missing fields and resubmit.
    - [% END %] - - [% IF invalid_form_fields %] -
    The following fields contain invalid information: -
      - [% FOREACH field IN invalid_form_fields %] - [% IF field == "email" %]
    • Contact information: primary email address
    • [% END %] - [% IF field == "emailpro" %]
    • Contact information: secondary email address
    • [% END %] - [% IF field == "B_email" %]
    • Alternate address information: email address
    • [% END %] - [% IF field == "password_match" %]
    • Passwords do not match! password
    • [% END %] - [% IF field == "password_too_short" %] -
    • Password must be at least [% patron.category.effective_min_password_length | html %] characters long.
    • - [% END %] - [% IF field == "password_too_weak" %] -
    • Password must contain at least one digit, one lowercase and one uppercase.
    • - [% END %] - [% IF field == "password_has_whitespaces" %] -
    • Password must not contain leading or trailing whitespaces.
    • - [% END %] - [% IF field == "duplicate_email" %] -
    • This email address already exists in our database.
    • - [% END %] - [% IF field == "email_match" %] -
    • Emails do not match! confirm email address
    • - [% END %] - [% IF field == "ERROR_age_limitations" %] -
    • Patron's age is incorrect for their category.
    • - [% END %] - [% END %] -
    - Please correct and resubmit. -
    - [% END %] - - [% IF cardnumber_wrong_length || cardnumber_already_exists %] -
    - [% IF cardnumber_wrong_length %] - The entered card number is the wrong length. - [% ELSIF cardnumber_already_exists %] - The entered card number is already in use. - [% END %] - Please correct and resubmit. -
    - [% END %] - - [% IF error_type OR error_info %] -
  • -

    There were problems processing your registration. Please contact your library for help.

    - [% IF error_type == 'Koha::Exceptions::Patron::InvalidUserid' %] -

    Error: Userid is not valid

    - [% ELSE %] -

    Error [% error_type | html %]: [% error_info | html %]

    - [% END %] -
  • - [% END %] - - [% IF failed_captcha %] -
    You typed in the wrong characters in the box before submitting. Please try again.
    - [% END %] - - [% IF has_guarantor_flag && !Koha.Preference('OPACPrivacy') && ( Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') || Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') ) %] -
    -
    -
    - Privacy -
      - [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] -
    1. - - - - Update - - -
    2. - [% END %] - - [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %] -
    3. - - - - Update - - -
    4. - [% END %] - -
    5. - - Guaranteed by - [% FOREACH gr IN patron.guarantor_relationships %] - [% SET g = gr.guarantor %] - [% g.preferred_name | html %] - [% g.middle_name | html %] - [% g.surname | html %] - [%- IF ! loop.last %],[% END %] - [% END %] - -
    6. -
    -
    -
    -
    - [% END %] - - [% IF ( extended_unique_id_failed_code ) %] -
    [% extended_unique_id_failed_description _ ': ' | html %] Value is already in use ([% extended_unique_id_failed_value | html %])
    - [% END %] - -
    - [% INCLUDE 'csrf-token.inc' %] - - [% FOREACH field = ['streetnumber' 'streettype' 'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'preferred_name' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' 'lang' ] %] - [% IF mandatory.defined( field ) %] - [% SET required.$field = 'required' %] - [% END %] - [% END %] - - [%# Following on one line for translatability %] - [% UNLESS ( hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) ) && hidden.defined('dateexpiry') && hidden.defined('branchcode') && hidden.defined('categorycode') %] -
    -
    -
    - Library -
      - [% UNLESS hidden.defined('cardnumber') || ( !borrower && Koha.Preference('autoMemberNum') ) %] -
    1. - - - [% IF borrower && !(cardnumber_wrong_length || cardnumber_already_exists) && op == 'edit' %] - [% borrower.cardnumber | html %] - [% ELSE %] - [% IF minlength_cardnumber == maxlength_cardnumber %] - -
      Required
      -
      Card number must be exactly [% minlength_cardnumber | html %] characters.
      - [% ELSIF minlength_cardnumber && maxlength_cardnumber %] - -
      Required
      -
      Card number must be between [% minlength_cardnumber | html %] and [% maxlength_cardnumber | html %] characters.
      - [% ELSIF maxlength_cardnumber %] - -
      Required
      -
      Card number can be up to [% maxlength_cardnumber | html %] characters.
      - [% ELSE %] - -
      Required
      -
      There is no minimum or maximum character length.
      - [% END %] - [% END %] -
    2. - [% END %] - - [% IF op != 'new' %] - [% UNLESS hidden.defined('userid') %] -
    3. - - [% borrower.userid | html %] -
    4. - [% END %] - [% END %] - - [% UNLESS hidden.defined('dateexpiry') %] -
    5. - - [% borrower.dateexpiry | $KohaDates %] -
    6. - [% END %] - - [% UNLESS hidden.defined('branchcode') %] -
    7. - [% IF libraries.count %] - - - -
      Required
      - [% ELSE %] - Home library: - [% FOREACH l IN libraries %] - [% l.branchname | html %] - - [% END %] - [% END %] -
    8. - [% END %] - - [% UNLESS hidden.defined('categorycode') %] -
    9. - - - [% IF borrower %] - [% Categories.GetName( borrower.categorycode ) | html %] - - [% ELSE %] - -
      Required
      - [% END %] -
    10. - [% END %] -
    -
    -
    - -
    - - [% END # / defined 'branchcode' %] - - [%# Following on one line for translatability %] - [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('preferred_name') && hidden.defined('middle_name') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('pronouns') && hidden.defined('othernames') && hidden.defined('sex') %] -
    -
    -
    - Identity - -
      - [% UNLESS hidden.defined('title') || !Koha.Preference('BorrowersTitles') %] -
    1. - - - -
      Required
      -
    2. - [% END %] - - [% UNLESS hidden.defined('surname') %] -
    3. - - - -
      Required
      -
    4. - [% END %] - - [% UNLESS hidden.defined('firstname') %] -
    5. - - - -
      Required
      -
    6. - [% END %] - - [% UNLESS hidden.defined('middle_name') %] -
    7. - - - -
      Required
      -
    8. - [% END %] - - [% UNLESS hidden.defined('preferred_name') %] -
    9. - - - -
      Required
      -
    10. - [% END %] - - [% UNLESS hidden.defined('dateofbirth') %] -
    11. - - - - -
      Required
      -
    12. - [% END %] - - [% UNLESS hidden.defined('initials') %] -
    13. - - - -
      Required
      -
    14. - [% END %] - - [% UNLESS hidden.defined('pronouns') %] -
    15. - - - -
      Required
      -
    16. - [% END %] - - [% UNLESS hidden.defined('othernames') %] -
    17. - - - -
      Required
      -
    18. - [% END %] - - [% UNLESS hidden.defined('sex') %] -
    19. -
      - - [% IF borrower.sex == 'F' %] - - [% ELSE %] - - [% END %] - - - [% IF borrower.sex == 'M' %] - - [% ELSE %] - - [% END %] - - - [% IF borrower.sex == 'O' %] - - [% ELSE %] - - [% END %] - - - [% IF borrower.sex == '' %] - - [% ELSE %] - - [% END %] -
    20. - [% END %] -
    -
    -
    - - [% IF ( display_patron_image ) %] -
    -

    - -

    -
    - [% END %] -
    - - [% END # /UNLESS fields hidden %] - - [%# Following on one line for translatability %] - [% UNLESS hidden.defined('streetnumber') && hidden.defined('address') && hidden.defined('address2') && hidden.defined('city') && hidden.defined('state') && hidden.defined('zipcode') && hidden.defined('country') %] -
    -
    -
    - Main address - -
      - [% IF Koha.Preference('AddressFormat') != 'de' %][% INCLUDE streetnumber %][% END %] - - [% SET roadtypes = AuthorisedValues.GetAuthValueDropbox('ROADTYPE') %] - [% IF roadtypes.count %] - [% UNLESS hidden.defined('streettype') %] -
    1. - - - -
      Required
      -
    2. - [% END %] - [% END %] - - [% UNLESS hidden.defined('address') %] -
    3. - - - -
      Required
      -
    4. - [% END %] - - [% IF Koha.Preference('AddressFormat') == 'de' %][% INCLUDE streetnumber %][% END %] - - [% UNLESS hidden.defined('address2') %] -
    5. - - - -
      Required
      -
    6. - [% END %] - - [% UNLESS hidden.defined('city') %] -
    7. - - - -
      Required
      -
    8. - [% END %] - - [% UNLESS hidden.defined('state') %] -
    9. - - - -
      Required
      -
    10. - [% END %] - - [% UNLESS hidden.defined('zipcode') %] -
    11. - - - -
      Required
      -
    12. - [% END %] - - [% UNLESS hidden.defined('country') %] -
    13. - - - -
      Required
      -
    14. - [% END %] -
    -
    -
    - -
    - - [% END %] - - [%# Following on one line for translatability %] - [% UNLESS hidden.defined('phone') && hidden.defined('phonepro') && hidden.defined('mobile') && hidden.defined('email') && hidden.defined('emailpro') && hidden.defined('fax') %] -
    -
    -
    - Contact information - -
      - [% UNLESS hidden.defined('phone') %] -
    1. - - - -
      Required
      -
    2. - [% END %] - - [% UNLESS hidden.defined('phonepro') %] -
    3. - - - -
      Required
      -
    4. - [% END %] - - [% UNLESS hidden.defined('mobile') %] -
    5. - - - -
      Required
      -
    6. - [% END %] - - [% UNLESS hidden.defined('email') %] -
    7. - - - -
      Required
      -
    8. - - [% IF op != 'edit' and Koha.Preference('PatronSelfRegistrationConfirmEmail') %] -
    9. - - - -
      Required
      -
    10. - [% END %] - [% END %] - - [% UNLESS hidden.defined('emailpro') %] -
    11. - - - -
      Required
      -
    12. - [% END %] - - [% UNLESS hidden.defined('fax') %] -
    13. - - - -
      Required
      -
    14. - [% END %] - - [% UNLESS hidden.defined('primary_contact_method') %] -
    15. - [% IF ( mandatory.defined('primary_contact_method') ) %] - - [% ELSE %] - - [% END %] - - - [% IF ( mandatory.defined('primary_contact_method') ) %]Required[% END %] -
    16. - [% UNLESS hidden.defined('lang') %] -
    17. - [% IF ( mandatory.defined('lang') ) %] - - [% ELSE %] - - [% END %] - - - [% IF ( mandatory.defined('lang') ) %]
      Required
      [% END %] -
    18. - [% END %] - [% END %] -
    -
    -
    - -
    - - [% END %] - - [%# Following on one line for translatability %] - [% UNLESS hidden.defined('B_streetnumber') && hidden.defined('B_address') && hidden.defined('B_address2') && hidden.defined('B_city') && hidden.defined('B_state') && hidden.defined('B_zipcode') && hidden.defined('B_country') && hidden.defined('B_phone') && hidden.defined('B_email') && hidden.defined('contactnote') %] -
    -
    -
    - Alternate address - -
      - [% IF Koha.Preference('AddressFormat') != 'de' %][% INCLUDE B_streetnumber %][% END %] - - [% SET roadtypes = AuthorisedValues.GetAuthValueDropbox('ROADTYPE') %] - [% IF roadtypes.count %] - [% UNLESS hidden.defined('B_streettype') %] -
    1. - - - -
      Required
      -
    2. - [% END %] - [% END %] - [% UNLESS hidden.defined('B_address') %] -
    3. - - - -
      Required
      -
    4. - [% END %] - - [% IF Koha.Preference('AddressFormat') == 'de' %][% INCLUDE streetnumber %][% END %] - - [% UNLESS hidden.defined('B_address2') %] -
    5. - - - -
      Required
      -
    6. - [% END %] - - [% UNLESS hidden.defined('B_city') %] -
    7. - - - -
      Required
      -
    8. - [% END %] - - [% UNLESS hidden.defined('B_state') %] -
    9. - - - -
      Required
      -
    10. - [% END %] - - [% UNLESS hidden.defined('B_zipcode') %] -
    11. - - - -
      Required
      -
    12. - [% END %] - - [% UNLESS hidden.defined('B_country') %] -
    13. - - - -
      Required
      -
    14. - [% END %] - - [% UNLESS hidden.defined('B_phone') %] -
    15. - - - -
      Required
      -
    16. - [% END %] - - [% UNLESS hidden.defined('B_email') %] -
    17. - - - -
      Required
      -
    18. - [% END %] - - [% UNLESS hidden.defined('contactnote') %] -
    19. - - - -
      Required
      -
    20. - [% END %] -
    -
    -
    - -
    - - [% END %] - - [%# Following on one line for translatability %] - [% UNLESS hidden.defined('altcontactsurname') && hidden.defined('altcontactfirstname') && hidden.defined('altcontactaddress1') && hidden.defined('altcontactaddress2') && hidden.defined('altcontactaddress3') && hidden.defined('altcontactstate') && hidden.defined('altcontactzipcode') && hidden.defined('altcontactcountry') && hidden.defined('altcontactphone') %] -
    -
    -
    - Alternate contact - -
      - [% UNLESS hidden.defined('altcontactsurname') %] -
    1. - - - -
      Required
      -
    2. - [% END %] - - [% UNLESS hidden.defined('altcontactfirstname') %] -
    3. - - - -
      Required
      -
    4. - [% END %] - - [% UNLESS hidden.defined('altcontactaddress1') %] -
    5. - - - -
      Required
      -
    6. - [% END %] - - [% UNLESS hidden.defined('altcontactaddress2') %] -
    7. - - - -
      Required
      -
    8. - [% END %] - - [% UNLESS hidden.defined('altcontactaddress3') %] -
    9. - - - -
      Required
      -
    10. - [% END %] - - [% UNLESS hidden.defined('altcontactstate') %] -
    11. - - - -
      Required
      -
    12. - [% END %] - - [% UNLESS hidden.defined('altcontactzipcode') %] -
    13. - - - -
      Required
      -
    14. - [% END %] - - [% UNLESS hidden.defined('altcontactcountry') %] -
    15. - - - -
      Required
      -
    16. - [% END %] - - [% UNLESS hidden.defined('altcontactphone') %] -
    17. - - - -
      Required
      -
    18. - [% END %] -
    -
    -
    - -
    - - [% END %] - - [% UNLESS op == 'edit' || hidden.defined('password') %] -
    -
    -
    - Password -
    - [% IF patron %] - [% IF ( patron.category.effective_require_strong_password ) %] -

    Your password must contain at least [% patron.category.effective_min_password_length | html %] characters, including UPPERCASE, lowercase and numbers.

    - [% ELSE %] -

    Your password must be at least [% patron.category.effective_min_password_length | html %] characters long.

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

    - [% END %] - [% UNLESS mandatory.defined('password') %] -

    If you do not enter a password a system generated password will be created.

    - [% END %] -
    - -
      -
    1. - -
      Required
      -
    2. -
    3. - -
      Required
      -
    4. -
    -
    -
    - -
    - - [% END %] - - [% IF ( Koha.Preference('ExtendedPatronAttributes') && patron_attribute_classes.size ) %] -
    -
    - [% SET fieldset_id = "" %] - [% SET legend = "Additional information" %] - [% FOREACH pa_class IN patron_attribute_classes %] - [% IF pa_class.class %] - [% fieldset_id = "aai_" _ pa_loo.class %] - [% legend = pa_class.lib %] - [% END %] -
    - [% legend | html %] -
      - [% FOREACH pa IN pa_class.items %] - [% FOREACH pa_value IN pa.values %] - [% IF loop.first %][% END %] - [% form_id = 'patron-attr-' _ Math.int( Math.rand(1000000) ) %] -
    1. - [% IF pa.type.mandatory && pa.type.opac_editable %] - - [% ELSE %] - - [% END %] - [% IF pa.type.opac_editable %] - - [% IF ( pa.type.authorised_value_category ) %] - - [% ELSE %] - [% IF ( pa.type.is_date && pa.type.mandatory ) %] - - [% ELSIF ( pa.type.is_date && !pa.type.mandatory ) %] - - [% ELSE %] - - [% END %] - [% END %] -
      - [% IF ( !pa.type.is_date ) %] - Clear - [% END %] - [% IF ( pa.type.repeatable ) %] - New - [% END %] - [% IF pa.type.mandatory %] - Required - [% END %] -
      - [% ELSE %] - [% IF ( pa.type.authorised_value_category ) %] - [% AuthorisedValues.GetByCode( pa.type.authorised_value_category, pa_value, 1 ) | html_line_break %] - [% ELSIF ( pa.type.is_date ) %] - [% pa_value | $KohaDates %] - [% ELSE %] - [% pa_value | html_line_break %] - [% END %] - [% END %] -
    2. - [% END %] - [% END %] -
    -
    - [% END %] -
    - -
    - - [% END %] - - [% IF Koha.Preference('PrivacyPolicyConsent') && op != 'edit' %] -
    -
    - -
    - -
    - - [% END %] - - [% UNLESS op == 'edit' %] -
    -
    -
    - Verification -
      -
    1. - - - -
      Required
      - - - Please type the following characters into the preceding box: [% captcha | html %] -
    2. -
    -
    -
    - -
    - - [% END %] - -
    -
    - [% IF op == 'edit' %] - [% IF OPACPatronDetails %] -
    - - -
    - [% END %] - [% ELSE %] -
    - - -
    - [% END %] -
    - -
    - -
    -
    -
    -
    -
    - -[% INCLUDE 'opac-bottom.inc' %] -[% BLOCK jsinclude %] - [% INCLUDE 'validator-strings.inc' %] - [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %] - [% INCLUDE 'calendar.inc' %] - - [% PROCESS 'password_check.inc' new_password => 'borrower_password', category_selector => '#borrower_categorycode', RequireStrongPassword => patron ? patron.category.effective_require_strong_password : defaultCategory.effective_require_strong_password, minPasswordLength => patron ? patron.category.effective_min_password_length : defaultCategory.effective_min_password_length %] -[% END %] diff --git a/members/memberentry.pl b/members/memberentry.pl index c2df4523366..e428d3a2a9b 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -297,8 +297,7 @@ foreach my $guarantor (@guarantors) { if ( ( $op eq 'cud-save' || $op eq 'cud-insert' ) && ( $guarantor->is_child || $guarantor->is_guarantee || ( $patron && $patron->is_guarantor ) ) ) { - push @errors, 'ERROR_child_is_guarantor' if ( $guarantor->is_child ); - push @errors, 'ERROR_guarantor_is_guarantee' if ( !$guarantor->is_child ); + push @errors, 'ERROR_guarantor_is_guarantee'; } } @@ -986,7 +985,7 @@ sub patron_attributes_form { description => $attr_type->description(), repeatable => $attr_type->repeatable(), category => $attr_type->authorised_value_category(), - category_code => $attr_type->category_code(), + categorycodes => [ map { $_->categorycode } $attr_type->categories->as_list ], mandatory => $attr_type->mandatory(), is_date => $attr_type->is_date(), }; diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl index fafd85ab26e..c6c84fdfb1d 100755 --- a/reports/borrowers_stats.pl +++ b/reports/borrowers_stats.pl @@ -506,12 +506,11 @@ sub patron_attributes_form { # TODO The following can be simplified easily my $entry = { - class => $attr_type->class(), - code => $attr_type->code(), - description => $attr_type->description(), - repeatable => $attr_type->repeatable(), - category => $attr_type->authorised_value_category(), - category_code => $attr_type->category_code(), + class => $attr_type->class(), + code => $attr_type->code(), + description => $attr_type->description(), + repeatable => $attr_type->repeatable(), + category => $attr_type->authorised_value_category(), }; my $newentry = {%$entry}; diff --git a/t/db_dependent/Auth_with_ldap.t b/t/db_dependent/Auth_with_ldap.t index 3b88d0e7a17..cd0309bc7bc 100755 --- a/t/db_dependent/Auth_with_ldap.t +++ b/t/db_dependent/Auth_with_ldap.t @@ -94,13 +94,11 @@ my $branchcode = $builder->build( { source => 'Branch' } )->{branchcode}; my $attr_type = $builder->build( { source => 'BorrowerAttributeType', - value => { category_code => $categorycode } } ); my $attr_type2 = $builder->build( { source => 'BorrowerAttributeType', - value => { category_code => $categorycode } } ); @@ -708,4 +706,3 @@ sub is_admin_bind { } $schema->storage->txn_rollback(); - diff --git a/t/db_dependent/Koha/Patron/Attribute.t b/t/db_dependent/Koha/Patron/Attribute.t index e233a39050a..a04afc7c97f 100755 --- a/t/db_dependent/Koha/Patron/Attribute.t +++ b/t/db_dependent/Koha/Patron/Attribute.t @@ -328,11 +328,10 @@ subtest 'store() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 0, - unique_id => 1, - is_date => 0, - category_code => undef + mandatory => 0, + repeatable => 0, + unique_id => 1, + is_date => 0, } } ); diff --git a/t/db_dependent/Koha/Patron/Attribute/Type.t b/t/db_dependent/Koha/Patron/Attribute/Type.t new file mode 100755 index 00000000000..d062cd32d81 --- /dev/null +++ b/t/db_dependent/Koha/Patron/Attribute/Type.t @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +use Modern::Perl; + +use Test::More; +use Koha::Database; +use t::lib::TestBuilder; + +plan tests => 2; + +my $schema = Koha::Database->new->schema; +my $builder = t::lib::TestBuilder->new; + +use_ok('Koha::Patron::Attribute::Type'); + +subtest 'categories' => sub { + plan tests => 1; + + $schema->storage->txn_begin; + + my $category1 = $builder->build_object( { class => 'Koha::Patron::Categories' } ); + my $category2 = $builder->build_object( { class => 'Koha::Patron::Categories' } ); + Koha::Patron::Attribute::Types->delete(); + my $attribute_type = Koha::Patron::Attribute::Type->new( + { + code => 'TEST', + description => 'Test attribute type', + } + ); + $attribute_type->store(); + $attribute_type->categories( [ $category1, $category2 ] ); + $attribute_type->store(); + my @categories = $attribute_type->categories->as_list; + is( scalar @categories, 2 ); + + $schema->storage->txn_rollback; +}; diff --git a/t/db_dependent/Koha/Patron/Attribute/Types.t b/t/db_dependent/Koha/Patron/Attribute/Types.t index 222251a6dee..59c7cd0f710 100755 --- a/t/db_dependent/Koha/Patron/Attribute/Types.t +++ b/t/db_dependent/Koha/Patron/Attribute/Types.t @@ -55,14 +55,11 @@ subtest 'new() tests' => sub { 1, 'Only one object created' ); - my $cateogory_code = $builder->build( { source => 'Category' } )->{categorycode}; - - my $attribute_type_with_category = Koha::Patron::Attribute::Type->new( + my $attribute_type_2 = Koha::Patron::Attribute::Type->new( { - code => 'code_2', - description => 'description', - category_code => $cateogory_code, - repeatable => 0 + code => 'code_2', + description => 'description', + repeatable => 0 } )->store(); @@ -464,4 +461,3 @@ subtest 'search_with_library_limits() tests' => sub { $schema->storage->txn_rollback; }; - diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t index 22b8cc5cc15..aab985fe111 100755 --- a/t/db_dependent/api/v1/patrons.t +++ b/t/db_dependent/api/v1/patrons.t @@ -626,10 +626,9 @@ subtest 'add() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 1, - unique_id => 0, - category_code => 'ST' + mandatory => 0, + repeatable => 1, + unique_id => 0, } } ); @@ -637,10 +636,9 @@ subtest 'add() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 1, - unique_id => 0, - category_code => 'ST' + mandatory => 0, + repeatable => 1, + unique_id => 0, } } ); diff --git a/t/db_dependent/api/v1/patrons_extended_attributes.t b/t/db_dependent/api/v1/patrons_extended_attributes.t index da7eeed122f..ef2ef0e3964 100755 --- a/t/db_dependent/api/v1/patrons_extended_attributes.t +++ b/t/db_dependent/api/v1/patrons_extended_attributes.t @@ -115,10 +115,9 @@ subtest 'add() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 1, - repeatable => 0, - unique_id => 0, - category_code => undef + mandatory => 1, + repeatable => 0, + unique_id => 0, } } ); @@ -126,10 +125,9 @@ subtest 'add() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 1, - unique_id => 0, - category_code => undef + mandatory => 0, + repeatable => 1, + unique_id => 0, } } ); @@ -137,10 +135,9 @@ subtest 'add() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 0, - unique_id => 1, - category_code => undef + mandatory => 0, + repeatable => 0, + unique_id => 1, } } ); @@ -238,10 +235,9 @@ subtest 'overwrite() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 1, - repeatable => 0, - unique_id => 0, - category_code => undef + mandatory => 1, + repeatable => 0, + unique_id => 0, } } ); @@ -249,10 +245,9 @@ subtest 'overwrite() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 1, - unique_id => 0, - category_code => undef + mandatory => 0, + repeatable => 1, + unique_id => 0, } } ); @@ -260,10 +255,9 @@ subtest 'overwrite() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 0, - unique_id => 1, - category_code => undef + mandatory => 0, + repeatable => 0, + unique_id => 1, } } ); @@ -380,10 +374,9 @@ subtest 'delete() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 1, - unique_id => 0, - category_code => undef + mandatory => 0, + repeatable => 1, + unique_id => 0, } } ); @@ -426,10 +419,9 @@ subtest 'update() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 1, - unique_id => 0, - category_code => undef + mandatory => 0, + repeatable => 1, + unique_id => 0, } } ); @@ -437,10 +429,9 @@ subtest 'update() tests' => sub { { class => 'Koha::Patron::Attribute::Types', value => { - mandatory => 0, - repeatable => 0, - unique_id => 1, - category_code => undef + mandatory => 0, + repeatable => 0, + unique_id => 1, } } ); diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl index 9e1830ddb2f..3994a0f7d70 100755 --- a/tools/modborrowers.pl +++ b/tools/modborrowers.pl @@ -38,7 +38,7 @@ use Koha::Libraries; use Koha::Patron::Categories; use Koha::Patron::Debarments qw( AddDebarment DelDebarment ); use Koha::Patrons; -use List::MoreUtils qw(uniq); +use List::MoreUtils qw(uniq none); use Koha::Patron::Messages; my $input = CGI->new; @@ -164,10 +164,8 @@ if ( $op eq 'cud-show' || $op eq 'show' ) { options => $options, }; - my $category_code = $attr_type->category_code; - my ($category_lib) = - map { ( defined $category_code and $attr_type->category_code eq $_->categorycode ) ? $_->description : () } - @patron_categories; + my @categories = $attr_type->categories->as_list; + my ($category_lib) = join( ', ', map { $_->description } @categories ); push @patron_attributes_codes, { attribute_code => $attr_type->code, @@ -433,8 +431,11 @@ if ( $op eq 'cud-do' ) { next unless $attr_type; - # If this borrower is not in the category of this attribute, we don't want to modify this attribute - next if $attr_type->category_code and $attr_type->category_code ne $patron->categorycode; + # If this borrower is not in one of the categories of this attribute, we don't want to modify this attribute + my @attr_type_categories = $attr_type->categories->as_list; + if (@attr_type_categories) { + next if none { $patron->categorycode eq $_->categorycode } @attr_type_categories; + } if ( $attributes->{$code}->{disabled} ) { -- 2.48.1