Bugzilla – Attachment 184903 Details for
Bug 37054
Allow for custom library colors in the staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37054: USe try/catch when getting CSS rules or default to Koha green
Bug-37054-USe-trycatch-when-getting-CSS-rules-or-d.patch (text/plain), 5.09 KB, created by
Lucas Gass (lukeg)
on 2025-07-30 15:40:50 UTC
(
hide
)
Description:
Bug 37054: USe try/catch when getting CSS rules or default to Koha green
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-07-30 15:40:50 UTC
Size:
5.09 KB
patch
obsolete
>From 5c646c489d48fd2e29fc74716e227adbec604932 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Wed, 30 Jul 2025 15:40:16 +0000 >Subject: [PATCH] Bug 37054: USe try/catch when getting CSS rules or default to > Koha green > >--- > Koha/Library.pm | 45 +++++++++---------- > Koha/Template/Plugin/Branches.pm | 11 ++++- > api/v1/swagger/definitions/library.yaml | 2 +- > .../prog/en/includes/doc-head-open.inc | 4 ++ > .../opac-tmpl/bootstrap/css/src/_common.scss | 2 +- > 5 files changed, 37 insertions(+), 27 deletions(-) > >diff --git a/Koha/Library.pm b/Koha/Library.pm >index f5e68cdca7f..a04481ee376 100644 >--- a/Koha/Library.pm >+++ b/Koha/Library.pm >@@ -348,29 +348,28 @@ on the API. > > sub to_api_mapping { > return { >- branchcode => 'library_id', >- branchname => 'name', >- branchaddress1 => 'address1', >- branchaddress2 => 'address2', >- branchaddress3 => 'address3', >- branchzip => 'postal_code', >- branchcity => 'city', >- branchstate => 'state', >- branchcountry => 'country', >- branchphone => 'phone', >- branchfax => 'fax', >- branchemail => 'email', >- branchillemail => 'ill_email', >- branchreplyto => 'reply_to_email', >- branchreturnpath => 'return_path_email', >- branchurl => 'url', >- issuing => undef, >- branchip => 'ip', >- branchnotes => 'notes', >- marcorgcode => 'marc_org_code', >- opacusercss => undef, >- opacuserjs => undef, >- ui_staff_customization => undef >+ branchcode => 'library_id', >+ branchname => 'name', >+ branchaddress1 => 'address1', >+ branchaddress2 => 'address2', >+ branchaddress3 => 'address3', >+ branchzip => 'postal_code', >+ branchcity => 'city', >+ branchstate => 'state', >+ branchcountry => 'country', >+ branchphone => 'phone', >+ branchfax => 'fax', >+ branchemail => 'email', >+ branchillemail => 'ill_email', >+ branchreplyto => 'reply_to_email', >+ branchreturnpath => 'return_path_email', >+ branchurl => 'url', >+ issuing => undef, >+ branchip => 'ip', >+ branchnotes => 'notes', >+ marcorgcode => 'marc_org_code', >+ opacusercss => undef, >+ opacuserjs => undef, > }; > } > >diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm >index e91cb046e02..d320db3084b 100644 >--- a/Koha/Template/Plugin/Branches.pm >+++ b/Koha/Template/Plugin/Branches.pm >@@ -27,7 +27,8 @@ use C4::Koha; > use C4::Context; > use Koha::Cache::Memory::Lite; > use Koha::Libraries; >-use JSON qw( decode_json ); >+use JSON qw( decode_json ); >+use Try::Tiny qw( catch try ); > > sub GetName { > my ( $self, $branchcode ) = @_; >@@ -202,7 +203,13 @@ sub GetBranchCustomization { > > my $library = Koha::Libraries->find($branchcode); > my $customizations_json = $library ? $library->ui_staff_customization : q{}; >- my $customizations = decode_json($customizations_json); >+ >+ my $customizations; >+ try { >+ $customizations = decode_json($customizations_json); >+ } catch { >+ return q{}; >+ }; > > return q{} unless defined $key; > >diff --git a/api/v1/swagger/definitions/library.yaml b/api/v1/swagger/definitions/library.yaml >index d9889c0f615..e9531a9e456 100644 >--- a/api/v1/swagger/definitions/library.yaml >+++ b/api/v1/swagger/definitions/library.yaml >@@ -101,7 +101,7 @@ properties: > type: > - string > - "null" >- description: the primary color used by the library >+ description: a JSON object containing branch specific staff interface UI customization > marc_org_code: > type: > - string >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc >index 1082b191e7a..0431c5e77f5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-open.inc >@@ -41,5 +41,9 @@ > :root { > --library-color: [% ui_staff_color_background | html %] > } >+ [% ELSE %] >+ :root { >+ --library-color: #408540; >+ } > [% END %] > </style> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss >index 6f4193280b2..87fb0fa0b9b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss >+++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/_common.scss >@@ -1222,7 +1222,7 @@ table { > .nav-link { > background-color: #F0F3F3; > border: 1px solid $nav-tabs-border-color; >- color: var( --library-color ); >+ color: var( --bs-link-color ); > font-weight: normal; > margin-right: .4em; > >-- >2.39.5
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 37054
:
167577
|
167578
|
167579
|
167590
|
167595
|
167596
|
167597
|
167598
|
167609
|
167612
|
167613
|
167614
|
167615
|
167616
|
167618
|
167625
|
171221
|
171222
|
171223
|
171224
|
171225
|
171226
|
175991
|
175992
|
175993
|
175994
|
175995
|
175996
|
176014
|
176015
|
176016
|
176615
|
176616
|
180329
|
180330
|
180331
|
180332
|
180333
|
180334
|
184825
|
184826
|
184827
|
184828
|
184829
|
184830
|
184831
|
184838
| 184903