Bugzilla – Attachment 103839 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), 7.72 KB, created by
Nicolas Legrand
on 2020-04-28 10:12:16 UTC
(
hide
)
Description:
Bug 24201: (follow-up) Rework Desks Plugin
Filename:
MIME Type:
Creator:
Nicolas Legrand
Created:
2020-04-28 10:12:16 UTC
Size:
7.72 KB
patch
obsolete
>From dd079e34f6d66350ad97cff1677c646315079acb 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. > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > Koha/Template/Plugin/Desks.pm | 80 +++++----------------- > .../intranet-tmpl/prog/en/includes/circ-nav.inc | 2 +- > .../intranet-tmpl/prog/en/includes/header.inc | 6 +- > .../prog/en/modules/circ/circulation-home.tt | 2 +- > .../prog/en/modules/circ/set-library.tt | 1 + > 5 files changed, 22 insertions(+), 69 deletions(-) > >diff --git a/Koha/Template/Plugin/Desks.pm b/Koha/Template/Plugin/Desks.pm >index a3be8c3..27d0297 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,27 @@ 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 ListForLibrary > >-[% Desks.all %] >+[% Desks.ListForLibrary %] > > 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 ListForLibrary { >+ my ($self) = @_; >+ my $branch_limit = >+ C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; >+ return scalar Koha::Desks->search( >+ { branchcode => $branch_limit }, >+ { order_by => { '-asc' => 'desk_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 7360e1f..574224c 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.ListForLibrary.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 37b1613..1f7f03d 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.ListForLibrary.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.ListForLibrary.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.ListForLibrary.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 5c17f28..caf7f3d 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.ListForLibrary.count %] > <li> > <a class="circ-button" href="/cgi-bin/koha/circ/selectdesk.pl"><i class="fa fa-location-arrow"></i> Set desk</a> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >index 325b17e..127332e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt >@@ -63,6 +63,7 @@ Updated:<ul> > <li><label for="branch">Choose library:</label> > <select name="branch" id="branch"> > [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] >+ [% PROCESS options_for_yallah yallah => Branches.all( selected => branch ) %] > </select></li> > [% END %] > </ol> >-- >2.1.4
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