Bugzilla – Attachment 175786 Details for
Bug 38290
Add library group limits to vendors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38290: Use parameters to set/fetch values
Bug-38290-Use-parameters-to-setfetch-values.patch (text/plain), 2.61 KB, created by
Matt Blenkinsop
on 2024-12-19 16:30:42 UTC
(
hide
)
Description:
Bug 38290: Use parameters to set/fetch values
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-12-19 16:30:42 UTC
Size:
2.61 KB
patch
obsolete
>From 066bc53f92b2636e8ed61aecc20084abe3570ebc Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Thu, 19 Dec 2024 14:52:16 +0000 >Subject: [PATCH] Bug 38290: Use parameters to set/fetch values > >--- > Koha/Object/Limit/LibraryGroup.pm | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) > >diff --git a/Koha/Object/Limit/LibraryGroup.pm b/Koha/Object/Limit/LibraryGroup.pm >index 14502794427..ad3f15e67cf 100644 >--- a/Koha/Object/Limit/LibraryGroup.pm >+++ b/Koha/Object/Limit/LibraryGroup.pm >@@ -51,12 +51,15 @@ A method that can be used to embed or simply retrieve the library group limits f > =cut > > sub lib_group_limits { >- my ( $self ) = @_; >+ my ($self) = @_; > >- my $lib_group_visibility = $self->lib_group_visibility; >+ my $lib_group_visibility_parameters = $self->object_class()->_library_group_visibility_parameters; >+ my $visibility_column = $lib_group_visibility_parameters->{visibility_column}; >+ >+ my $lib_group_visibility = $self->$visibility_column; > return [] if !$lib_group_visibility; > >- my @ids = grep(/[0-9]/, split(/\|/, $lib_group_visibility)); >+ my @ids = grep( /[0-9]/, split( /\|/, $lib_group_visibility ) ); > > my @lib_groups = map { Koha::Library::Groups->find($_) } @ids; > >@@ -66,14 +69,27 @@ sub lib_group_limits { > =head3 set_lib_group_visibility > > A method that can be used to set the library group visibility for an object >+If passed an array, it will format it into a string of "|" separated ids >+If passed a string it will check it is formatted correctly and adjust it if needed > > =cut > > sub set_lib_group_visibility { >- my ( $self ) = @_; >- >- if ( $self->lib_group_visibility && $self->lib_group_visibility !~ /^\|.*\|$/ ) { >- $self->lib_group_visibility( "|" . $self->lib_group_visibility . "|" ); >+ my ( $self, $args ) = @_; >+ >+ my $new_visibility = $args->{new_visibility} || $self->lib_group_visibility; >+ my $lib_group_visibility_parameters = $self->object_class()->_library_group_visibility_parameters; >+ my $visibility_column = $lib_group_visibility_parameters->{visibility_column}; >+ >+ if ( ref $new_visibility eq 'ARRAY' ) { >+ if ( scalar( @{$new_visibility} ) == 0 ) { >+ $self->$visibility_column(undef); >+ return $self; >+ } >+ $self->$visibility_column( join( "|", grep( /[0-9]/, @{$new_visibility} ) ) ); >+ } >+ if ( $new_visibility && $new_visibility !~ /^\|.*\|$/ ) { >+ $self->$visibility_column( "|" . $self->$visibility_column . "|" ); > } > > return $self; >-- >2.39.5 (Apple Git-154)
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 38290
:
175155
|
175156
|
175157
|
175158
|
175159
|
175160
|
175161
|
175779
|
175780
|
175781
|
175782
|
175783
|
175784
|
175785
| 175786 |
175787