Bugzilla – Attachment 180550 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.42 KB, created by
Matt Blenkinsop
on 2025-04-03 13:55:28 UTC
(
hide
)
Description:
Bug 38290: Use parameters to set/fetch values
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-04-03 13:55:28 UTC
Size:
2.42 KB
patch
obsolete
>From 03aa1067345886e9d9bc468fa50c29bb9a86fd73 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 | 26 +++++++++++++++++++++----- > 1 file changed, 21 insertions(+), 5 deletions(-) > >diff --git a/Koha/Object/Limit/LibraryGroup.pm b/Koha/Object/Limit/LibraryGroup.pm >index 82a8badaa14..ad3f15e67cf 100644 >--- a/Koha/Object/Limit/LibraryGroup.pm >+++ b/Koha/Object/Limit/LibraryGroup.pm >@@ -53,7 +53,10 @@ A method that can be used to embed or simply retrieve the library group limits f > sub lib_group_limits { > 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 ) ); >@@ -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.48.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 38290
:
175155
|
175156
|
175157
|
175158
|
175159
|
175160
|
175161
|
175779
|
175780
|
175781
|
175782
|
175783
|
175784
|
175785
|
175786
|
175787
|
180543
|
180544
|
180545
|
180546
|
180547
|
180548
|
180549
|
180550
|
180551
|
182656
|
182657
|
182658
|
182659
|
182660
|
182661
|
182662
|
182663
|
182664