Bugzilla – Attachment 162676 Details for
Bug 35145
Add ability to order patron attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35145 : (follow-up) Rename number to display_order
Bug-35145--follow-up-Rename-number-to-displayorder.patch (text/plain), 6.58 KB, created by
Phan Tung Bui
on 2024-03-01 15:51:38 UTC
(
hide
)
Description:
Bug 35145 : (follow-up) Rename number to display_order
Filename:
MIME Type:
Creator:
Phan Tung Bui
Created:
2024-03-01 15:51:38 UTC
Size:
6.58 KB
patch
obsolete
>From a380bed825f38b8df42417c6a97ea3cfc48a1878 Mon Sep 17 00:00:00 2001 >From: Phan Tung Bui <phan-tung.bui@inlibro.com> >Date: Thu, 29 Feb 2024 15:05:55 -0500 >Subject: [PATCH] Bug 35145 : (follow-up) Rename number to display_order > >--- > admin/patron-attr-types.pl | 2 ++ > .../bug_35145_order_patron_attributes.pl | 22 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 1 + > .../en/modules/admin/patron-attr-types.tt | 10 +++++++++ > members/memberentry.pl | 2 +- > opac/opac-memberentry.pl | 2 +- > 6 files changed, 37 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl > >diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl >index ca5d2fca47..dff581876a 100755 >--- a/admin/patron-attr-types.pl >+++ b/admin/patron-attr-types.pl >@@ -124,6 +124,7 @@ sub add_update_attribute_type { > my $display_checkout = $input->param('display_checkout') ? 1 : 0; > my $category_code = $input->param('category_code') || undef; > my $class = $input->param('class'); >+ my $display_order = $input->param('display_order') || undef; > > my $attr_type = Koha::Patron::Attribute::Types->find($code); > if ( $op eq 'edit' ) { >@@ -160,6 +161,7 @@ sub add_update_attribute_type { > display_checkout => $display_checkout, > category_code => $category_code, > class => $class, >+ display_order => $display_order, > } > )->store; > >diff --git a/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl b/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl >new file mode 100755 >index 0000000000..b1650cd378 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35145_order_patron_attributes.pl >@@ -0,0 +1,22 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35145", >+ description => "Add display_order column to borrower_attribute_types table", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Do you stuffs here >+ $dbh->do( >+ q{ >+ ALTER TABLE borrower_attribute_types >+ ADD display_order int(11); >+ } >+ ); >+ >+ # Print useful stuff here >+ # tables >+ say $out "Added column 'borrower_attribute_types.number'"; >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 16310f0f44..65c3a45ed3 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1242,6 +1242,7 @@ CREATE TABLE `borrower_attribute_types` ( > `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', >+ `display_order` int(11) DEFAULT NULL COMMENT 'the order in which this attribute type appears in patron form', > PRIMARY KEY (`code`), > KEY `auth_val_cat_idx` (`authorised_value_category`), > KEY `category_code` (`category_code`), >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 bad4257539..2600e9ec1c 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 >@@ -104,6 +104,14 @@ > <input type="text" id="description" name="description" required="required" class="required" size="50" maxlength="250" value="[% attribute_type.description |html %]" /> > <span class="required">Required</span> > </li> >+ <li> >+ <label for="display_order">Appear in position: </label> >+ [% IF ( attribute_type.display_order ) %] >+ <input id="display_order" size="3" name="display_order" type="text" value="[% attribute_type.display_order | html %]" /> >+ [% ELSE %] >+ <input id="display_order" size="3" name="display_order" type="text" /> >+ [% END %] >+ </li> > > [% IF attribute_type AND attribute_type.repeatable AND NOT can_be_set_to_nonrepeatable %] > <li aria-disabled="true"> >@@ -317,6 +325,7 @@ > <th>Authorized value category</th> > <th>Mandatory</th> > <th>Searching</th> >+ <th>Display order</th> > <th class="NoSort noExport">Actions</th> > </tr> > </thead> >@@ -367,6 +376,7 @@ > <span>Not searchable</span> > [% END %] > </td> >+ <td>[% item.display_order | html %]</td> > <td class="actions"> > <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&code=[% item.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> > <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=delete_attribute_type&code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 57e780cfec..1eff46b46d 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -866,7 +866,7 @@ sub patron_attributes_form { > my $op = shift; > > my $library_id = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >- my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, {}, $library_id); >+ my $attribute_types = Koha::Patron::Attribute::Types->search_with_library_limits({}, { order_by => 'display_order' }, $library_id); > if ( $attribute_types->count == 0 ) { > $template->param(no_patron_attribute_types => 1); > return; >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index 51f03fca19..53964222bc 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -672,7 +672,7 @@ sub GeneratePatronAttributesForm { > > # Get all attribute types and the values for this patron (if applicable) > my @types = grep { $_->opac_editable() or $_->opac_display } # FIXME filter using DBIC >- Koha::Patron::Attribute::Types->search()->as_list(); >+ Koha::Patron::Attribute::Types->search( {}, { order_by => 'display_order' } )->as_list(); > if ( scalar(@types) == 0 ) { > return []; > } >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35145
:
159182
|
159193
|
159344
|
159345
|
162347
|
162348
|
162619
|
162620
|
162621
|
162622
|
162676
|
166473
|
166519
|
166520
|
166521
|
169256
|
169257
|
169258
|
170330
|
170331
|
170332
|
170627
|
170628
|
170629
|
176756
|
176757
|
176758
|
176760
|
176761
|
176762
|
176763
|
176764
|
176765
|
177119