Bugzilla – Attachment 16111 Details for
Bug 9811
Patrons search improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9811: Take into account of Independent branches
Bug-9811-Take-into-account-of-Independent-branches.patch (text/plain), 6.19 KB, created by
Jonathan Druart
on 2013-03-14 09:31:39 UTC
(
hide
)
Description:
Bug 9811: Take into account of Independent branches
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-03-14 09:31:39 UTC
Size:
6.19 KB
patch
obsolete
>From 30a1ba86eb3867d1554a1cb872f6c576d8338282 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 14 Mar 2013 10:29:04 +0100 >Subject: [PATCH] Bug 9811: Take into account of Independent branches > >If the syspref IndependentBranches is ON, the user can only request on >it own branch. > >Try with IndependentBranches ON and OFF >--- > C4/Utils/DataTables/Members.pm | 9 +++++++ > .../prog/en/includes/patron-search.inc | 10 ++++--- > .../prog/en/modules/members/member.tt | 4 ++- > members/member.pl | 28 ++++++++++++++------ > members/members-home.pl | 21 +++++++++++---- > 5 files changed, 55 insertions(+), 17 deletions(-) > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index c51e3f8..93c19dd 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -1,5 +1,6 @@ > package C4::Utils::DataTables::Members; > >+use C4::Branch qw/onlymine/; > use C4::Context; > use C4::Members qw/GetMemberIssuesAndFines/; > use C4::Utils::DataTables; >@@ -17,6 +18,14 @@ sub search { > > my ($iTotalRecords, $iTotalDisplayRecords); > >+ # If branches are independant and user is not superlibrarian >+ # The search has to be only on the user branch >+ if ( C4::Branch::onlymine ) { >+ my $userenv = C4::Context->userenv; >+ $branchcode = $userenv->{'branch'}; >+ >+ } >+ > my $dbh = C4::Context->dbh; > my $select = "SELECT SQL_CALC_FOUND_ROWS > borrowers.borrowernumber, borrowers.surname, borrowers.firstname, borrowers.address, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index 15d622e..7ddc3a9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -46,9 +46,13 @@ > </select> > > <input value="Search" class="submit" type="submit" /> >- [% IF ( branchloop ) %] >- <p id="filters"> <label for="branchcode">Library: </label><select name="branchcode" id="branchcode"> >- <option value="">Any</option>[% FOREACH branchloo IN branchloop %] >+ [% IF ( branchloop ) %] >+ <p id="filters"> <label for="branchcode">Library: </label> >+ <select name="branchcode" id="branchcode"> >+ [% IF branchloop.size != 1 %] >+ <option value="">Any</option> >+ [% END %] >+ [% FOREACH branchloo IN branchloop %] > [% IF ( branchloo.selected ) %] > <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>[% ELSE %] > <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index ab3b3a1..a1caf23 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -294,7 +294,9 @@ > <li> > <label for="branchcode_filter">Branch:</label> > <select id="branchcode_filter"> >- <option value="">Any</option> >+ [% IF branchloop.size != 1 %] >+ <option value="">Any</option> >+ [% END %] > [% FOREACH b IN branchloop %] > [% IF b.selected %] > <option selected="selected" value="[% b.branchcode %]">[% b.branchname %]</option> >diff --git a/members/member.pl b/members/member.pl >index 60e4f44..407b3c0 100755 >--- a/members/member.pl >+++ b/members/member.pl >@@ -55,16 +55,28 @@ my $searchfieldstype = $input->param('searchfieldstype'); > > my $branches = GetBranches; > my @branches_loop; >-foreach ( sort { lc($branches->{$a}->{branchname}) cmp lc($branches->{$b}->{branchname}) } keys %$branches ) { >- my $selected = 0; >- $selected = 1 if($patron->{branchcode} and $patron->{branchcode} eq $_); >+if ( C4::Branch::onlymine ) { >+ my $userenv = C4::Context->userenv; >+ my $branch = C4::Branch::GetBranchDetail( $userenv->{'branch'} ); > push @branches_loop, { >- value => $_, >- branchcode => $_, >- branchname => $branches->{$_}->{branchname}, >- selected => $selected >- }; >+ value => $branch->{branchcode}, >+ branchcode => $branch->{branchcode}, >+ branchname => $branch->{branchname}, >+ selected => 1 >+ } >+} else { >+ foreach ( sort { lc($branches->{$a}->{branchname}) cmp lc($branches->{$b}->{branchname}) } keys %$branches ) { >+ my $selected = 0; >+ $selected = 1 if($patron->{branchcode} and $patron->{branchcode} eq $_); >+ push @branches_loop, { >+ value => $_, >+ branchcode => $_, >+ branchname => $branches->{$_}->{branchname}, >+ selected => $selected >+ }; >+ } > } >+ > my @categories = C4::Category->all; > if ( $patron->{categorycode} ) { > foreach my $category ( grep { $_->{categorycode} eq $patron->{categorycode} } @categories ) { >diff --git a/members/members-home.pl b/members/members-home.pl >index 74e5b17..5e816eb 100755 >--- a/members/members-home.pl >+++ b/members/members-home.pl >@@ -45,12 +45,23 @@ my ($template, $loggedinuser, $cookie) > > my $branches = GetBranches; > my @branchloop; >-foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) { >+if ( C4::Branch::onlymine ) { >+ my $userenv = C4::Context->userenv; >+ my $branch = C4::Branch::GetBranchDetail( $userenv->{'branch'} ); > push @branchloop, { >- value => $_, >- selected => ($branches->{$_}->{branchcode} eq $branch), >- branchname => $branches->{$_}->{branchname}, >- }; >+ value => $branch->{branchcode}, >+ branchcode => $branch->{branchcode}, >+ branchname => $branch->{branchname}, >+ selected => 1 >+ } >+} else { >+ foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) { >+ push @branchloop, { >+ value => $_, >+ selected => ($branches->{$_}->{branchcode} eq $branch), >+ branchname => $branches->{$_}->{branchname}, >+ }; >+ } > } > > my @categories; >-- >1.7.10.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 9811
:
16096
|
16111
|
16112
|
16320
|
16362
|
16403
|
16957
|
19056
|
19057
|
19307
|
19633
|
19642
|
20094
|
20095
|
20096
|
20174
|
20266
|
20290
|
20291
|
21169
|
21170
|
21171
|
21172
|
21173
|
21174
|
21175
|
22265
|
23261
|
24095
|
24111
|
26067
|
26068
|
26261
|
26336
|
26337
|
26342
|
26347
|
27642
|
27643
|
27644
|
27645
|
27646
|
27711
|
28738
|
28739
|
28740
|
28741
|
28742
|
28743
|
28744
|
28745
|
28746
|
28747
|
28781
|
28782
|
29019
|
29020
|
29021
|
29022
|
29023
|
29024
|
29025
|
29026
|
29027
|
29028
|
29029
|
29442