Bugzilla – Attachment 169257 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.73 KB, created by
Kyle M Hall (khall)
on 2024-07-19 18:18:11 UTC
(
hide
)
Description:
Bug 35145: (follow-up) Rename number to display_order
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-07-19 18:18:11 UTC
Size:
6.73 KB
patch
obsolete
>From e4d8c2c35f759eda555fd245b7e764be47182af6 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 > >PA amended: Fix commit title > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > 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 d591383e489..fc3d391bf01 100755 >--- a/admin/patron-attr-types.pl >+++ b/admin/patron-attr-types.pl >@@ -125,6 +125,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' ) { >@@ -162,6 +163,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 00000000000..b1650cd3789 >--- /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 8a6a1c26170..9a157e2861f 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1251,6 +1251,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 1a6d2a74600..9fac4c1bed1 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 >@@ -105,6 +105,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"> >@@ -326,6 +334,7 @@ > <th>Authorized value category</th> > <th>Mandatory</th> > <th>Searching</th> >+ <th>Display order</th> > <th class="NoSort noExport">Actions</th> > </tr> > </thead> >@@ -376,6 +385,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 f6472346917..b62d8bbe645 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -856,7 +856,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 b671dde7c04..12364b864a0 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -651,7 +651,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.30.2
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