Bugzilla – Attachment 101865 Details for
Bug 24201
Attach desk to intranet session
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24201: (follow-up) Rework Desks Plugin
Bug-24201-follow-up-Rework-Desks-Plugin.patch (text/plain), 6.84 KB, created by
Martin Renvoize (ashimema)
on 2020-03-26 14:52:11 UTC
(
hide
)
Description:
Bug 24201: (follow-up) Rework Desks Plugin
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-03-26 14:52:11 UTC
Size:
6.84 KB
patch
obsolete
>From 829747fc8b2f3a0aa8b2e70b39bf32169b76ddd2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 26 Mar 2020 14:49:27 +0000 >Subject: [PATCH] Bug 24201: (follow-up) Rework Desks Plugin > >This patch removes unused plugin methods (they can be re-introduced in >subsequent bugs where they are used) and merges the 'all' and 'defined' >methods into a ListForBranch method that returns a list of desks >associated with the logged in branch. >--- > Koha/Template/Plugin/Desks.pm | 79 ++++--------------- > .../prog/en/includes/circ-nav.inc | 2 +- > .../intranet-tmpl/prog/en/includes/header.inc | 6 +- > .../prog/en/modules/circ/circulation-home.tt | 2 +- > 4 files changed, 20 insertions(+), 69 deletions(-) > >diff --git a/Koha/Template/Plugin/Desks.pm b/Koha/Template/Plugin/Desks.pm >index a3be8c365f..81f387893e 100644 >--- a/Koha/Template/Plugin/Desks.pm >+++ b/Koha/Template/Plugin/Desks.pm >@@ -37,20 +37,6 @@ got or the current one. > > =head2 Methods > >-=head3 GetName >- >-[% Desk.GetName(desk_id) %] >- >-return desk name or empty string >- >-=cut >- >-sub GetName { >- my ( $self, $desk_id ) = @_; >- my $d = Koha::Desks->search( { desk_id => $desk_id} )->unblessed; >- return @$d ? $d->{'desk_name'} : q{}; >-} >- > =head3 GetLoggedInDeskId > > [% Desks.GetLoggedInDeskId %] >@@ -62,9 +48,9 @@ return the desk name that is attached to the session or empty string > sub GetLoggedInDeskId { > my ($self) = @_; > >- return C4::Context->userenv ? >- C4::Context->userenv->{'desk_id'} : >- ''; >+ return C4::Context->userenv >+ ? C4::Context->userenv->{'desk_id'} >+ : ''; > } > > =head3 GetLoggedInDeskName >@@ -78,61 +64,26 @@ Return the desk name that is attached to the session or empty string > sub GetLoggedInDeskName { > my ($self) = @_; > >- return C4::Context->userenv ? >- C4::Context->userenv->{'desk_name'} : >- ''; >+ return C4::Context->userenv >+ ? C4::Context->userenv->{'desk_name'} >+ : ''; > } > >-=head3 all >+=head3 ListForBranch > >-[% Desks.all %] >+[% Desks.ListForBranch %] > > returns all desks existing at the library > > =cut > >-sub all { >- my ( $self, $params ) = @_; >- my $selected = $params->{selected}; >- my $unfiltered = $params->{unfiltered} || 0; >- my $search_params = $params->{search_params} || {}; >- >- if ( !$unfiltered ) { >- $search_params->{only_from_group} = $params->{only_from_group} || 0; >- } >- >- my $desks = $unfiltered >- ? Koha::Desks->search( $search_params, { order_by => ['desk_name'] } )->unblessed >- : Koha::Desks->search_filtered( $search_params, { order_by => ['desk_name'] } )->unblessed; >- >- for my $d ( @$desks ) { >- if ( defined $selected and $d->{desk_id} eq $selected >- or not defined $selected and C4::Context->userenv and $d->{branchcode} eq ( C4::Context->userenv->{desk_id} // q{} ) >- ) { >- $d->{selected} = 1; >- } >- } >- >- return $desks; >-} >- >-=head3 defined >- >-[% Desks.defined %] >- >-return 1 if there is at least a desk defined for the library. >- >-=cut >- >-sub defined { >- my ( $self ) = @_; >- my $desks = Koha::Desks->search()->unblessed; >- if (@$desks) { >- return 1 ; >- } >- else { >- return 0; >- } >+sub ListForBranch { >+ my ($self) = @_; >+ my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; >+ return Koha::Desks->search( >+ { branch => $branch_limit }, >+ { order_by => { '-asc' => 'name' } } >+ ); > } > > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >index 7360e1f288..3a8abaf483 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc >@@ -18,7 +18,7 @@ > [% IF ( AutoLocation ) %][% ELSE %][% IF ( IndependentBranches ) %][% ELSE %] > <li><a href="/cgi-bin/koha/circ/set-library.pl">Set library</a></li> > [% END %][% END %] >- [% IF ( Desks.defined ) %] >+ [% IF ( Desks.ListForBranch.count ) %] > <li><a href="/cgi-bin/koha/circ/selectdesk.pl">Set desk</a></li> > [% END %] > [% IF ( fast_cataloging ) %][% IF ( CAN_user_editcatalogue_fast_cataloging ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index 37b16132c8..d18f4d0113 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -86,7 +86,7 @@ > <span class="logged-in-branch-code content_hidden">[% Branches.GetLoggedInBranchcode | html %]</span> > </strong> > [% END %] >- [% IF (Desks.defined) %] >+ [% IF (Desks.ListForBranch.count) %] > <span class="separator">|</span> > <strong> > [% IF ( Desks.GetLoggedInDeskName == '' ) %] >@@ -119,7 +119,7 @@ > </li> > <li class="loggedin-menu-label"> > Desk: <br /> >- [% IF ( Desks.GetLoggedInDeskName == '' AND Desks.defined ) %] >+ [% IF ( Desks.GetLoggedInDeskName == '' AND Desks.ListForBranch.count ) %] > <span class="logged-in-desk-name">NO DESK SET</span> > [% ELSIF ( Desks.GetLoggedInDeskName != '' ) %] > <span class="logged-in-desk-name">[% Desks.GetLoggedInDeskName | html %]</span> >@@ -139,7 +139,7 @@ > <a class="toplinks" href="/cgi-bin/koha/circ/set-library.pl">Set library</a> > </li> > [% END %] >- [% IF Desks.defined %] >+ [% IF Desks.ListForBranch.count %] > <li> > <a class="toplinks" href="/cgi-bin/koha/circ/selectdesk.pl">Set desk</a> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >index 5c17f284f9..f6490a47c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt >@@ -34,7 +34,7 @@ > <a class="circ-button" href="/cgi-bin/koha/circ/set-library.pl"><i class="fa fa-home"></i> Set library</a> > </li> > [% END %] >- [% IF Desks.defined %] >+ [% IF Desks.ListForBranch.count %] > <li> > <a class="circ-button" href="/cgi-bin/koha/circ/selectdesk.pl"><i class="fa fa-location-arrow"></i> Set desk</a> > </li> >-- >2.20.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 24201
:
96158
|
96164
|
96165
|
96166
|
101452
|
101564
|
101684
|
101697
|
101704
|
101705
|
101848
|
101865
|
101866
|
101877
|
101878
|
101879
|
101880
|
101881
|
101882
|
101883
|
103839
|
103840
|
105795
|
105869
|
105873
|
105874
|
105875
|
106576
|
107089
|
107090
|
107091
|
107092
|
107093
|
107094
|
107095
|
107096
|
107097
|
107667
|
107668
|
107669
|
107670
|
107671
|
107672
|
107673
|
107674
|
107675
|
107676
|
107677
|
107678
|
107679
|
107680
|
107728
|
107729
|
107730
|
107731
|
107732
|
107750
|
107751
|
107752
|
107815
|
107816
|
107817
|
107818
|
107951
|
107952
|
107967
|
107968
|
107980
|
107981