Bugzilla – Attachment 20122 Details for
Bug 5904
ysearch.pl members improvements (Independant branches behaviour)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 5904: ysearch.pl members improvements (Independent branches behaviour)
Bug-5904-ysearchpl-members-improvements-Independen.patch (text/plain), 4.77 KB, created by
Srdjan Jankovic
on 2013-08-06 04:24:14 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 5904: ysearch.pl members improvements (Independent branches behaviour)
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2013-08-06 04:24:14 UTC
Size:
4.77 KB
patch
obsolete
>From ab039bccf8e209bed6096c05539a1b441e745e0d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 27 Jun 2013 15:33:46 +0200 >Subject: [PATCH] Bug 5904: ysearch.pl members improvements (Independent > branches behaviour) > >Test plan: >- Add a staff user foo in a library A >- Add a staff user bar in a library B >- log in as foo and try to search 'bar' >- Switch on (Prevent) the new pref IndependentBranchPatron >- the search returns no result >- log in as a superlibrarian >- Check that you are allow to search all patrons. > >Signed-off-by: Srdjan <srdjan@catalyst.net.nz> >--- > circ/ysearch.pl | 26 +++++++++++++++------- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 7 ++++++ > .../prog/en/modules/admin/preferences/patrons.pref | 7 ++++++ > 4 files changed, 33 insertions(+), 8 deletions(-) > >diff --git a/circ/ysearch.pl b/circ/ysearch.pl >index 8a48c51..99acf80 100755 >--- a/circ/ysearch.pl >+++ b/circ/ysearch.pl >@@ -44,13 +44,23 @@ if ($auth_status ne "ok") { > } > > my $dbh = C4::Context->dbh; >-my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country >- FROM borrowers >- WHERE surname LIKE ? >- OR firstname LIKE ? >- OR cardnumber LIKE ? >- ORDER BY surname, firstname >- LIMIT 10); >+my $sql = q( >+ SELECT surname, firstname, cardnumber, address, city, zipcode, country >+ FROM borrowers >+ WHERE ( surname LIKE ? >+ OR firstname LIKE ? >+ OR cardnumber LIKE ? ) >+); >+if (C4::Context->preference("IndependentBranchPatron")){ >+ if ( C4::Context->userenv >+ && (C4::Context->userenv->{flags} % 2) !=1 >+ && C4::Context->userenv->{'branch'} >+ ){ >+ $sql .= " AND borrowers.branchcode =" . $dbh->quote(C4::Context->userenv->{'branch'}); >+ } >+} >+ >+$sql .= q( ORDER BY surname, firstname LIMIT 10); > my $sth = $dbh->prepare( $sql ); > $sth->execute("$query%", "$query%", "$query%"); > >@@ -68,4 +78,4 @@ while ( my $rec = $sth->fetchrow_hashref ) { > "}"; > $i++; > } >-print "]"; >\ No newline at end of file >+print "]"; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index c8caee7..9e8db83 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -430,3 +430,4 @@ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) V > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo'); > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('AllowTooManyOverride', '1', 'If on, allow staff to override and check out items when the patron has reached the maximum number of allowed checkouts', '', 'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('IndependentBranchPatron','0','Allow/Don\'t allow limit to the librarian branch in circ member auto completion', '', 'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 74aeb3e..cf2b8b5 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7067,6 +7067,13 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.13.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('IndependentBranchPatron','0','Allow/Don\'t allow limit to the librarian branch in circ member auto completion', '', 'YesNo')"); >+ print "Upgrade to $DBversion done (Bug 5904: Add syspref IndependentBranchPatron)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 74d14af..520a9aa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -139,3 +139,10 @@ Patrons: > yes: Do > no: "Don't" > - enable the ability to upload and attach arbitrary files to a borrower record. >+ - >+ - pref: IndependentBranchPatron >+ choices: >+ yes: Prevent >+ no: "Don't prevent" >+ - staff (but not superlibrarians) from searching patrons belonging to other libraries. >+ >-- >1.8.1.2
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 5904
:
3364
|
3365
|
3809
|
19259
|
20122
|
20742
|
20750
|
20766