Commit graph

51 commits

Author SHA1 Message Date
Jonathan Druart
ba0f84b46c Bug 9978: (followup) Replace license header with the correct license (GPLv3+)
There was another form of the v2.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:43 -03:00
Chris Cormack
8c8fb35864 Bug 9350: Making changes so that you can add the new fields to branches
To test

1/ Apply patch
2/ Add or Edit a branch, filling out the new fields
3/ Check that the changes saved

http://bugs.koha-community.org/show_bug.cgi?id=9530
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-27 10:38:16 -03:00
Robin Sheat
fb0e766104 Bug 11051: remove unneccessary SQL queries in GetBranches
The way GetBranches was written, it will issue one query to get all
branches, and then one query per branch for the branch relations.
This patch pre-fetches the relations table (as we need it all anyway)
and so makes the whole process happen in two queries, rather than take
1+N, where N is the number of branches.

This might not seem like much, but when you do a search, GetBranches is
called once for each result, so 25. And you might have 10 branches. This
causes 275 database requests when you could get away with 50.

From profiling, when you run a search, this is the thing that calls
DBI::st::execute the most. Refer:
http://debian.koha-community.org/~robin/opac-search/usr-share-koha-lib-C4-Branch-pm-146-line.html#125

Test Plan:
* Have a database with branches and relationships between the branches.
  (these are 'Library groups' in the UI.
* Make sure the relationships show up correctly after applying the
  patch.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-10 16:02:39 +00:00
fb4025b67b Bug 10277 - Add C4::Context->IsSuperLibrarian()
The method of checking the logged in user for superlibrarian privileges
is obtuse ( $userenv && $userenv->{flags} % 2 != 1 ) to say the least.
The codebase is littered with these lines, with no explanation given. It
would be much better if we had one subroutine that returned a boolean
value to tell us if the logged in user is a superlibrarian or not.

Test Plan:
1) Apply this patch
2) Verify superlibrarian behavior remains unchanged

Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comments on second patch.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:47:23 +00:00
Kenza Zaki
4287fd9d1c Bug 10629: remove inappropriate uses of $sth->finish() in C4::Branch
Test plan :
Check if the regression tests still works
prove t/db_dependent/Branch.t
t/db_dependent/Branch.t .. 1/36 Using a hash as a reference is deprecated at t/db_dependent/Branch.t line 207.
t/db_dependent/Branch.t .. ok
All tests successful.
Files=1, Tests=36,  0 wallclock secs ( 0.03 usr  0.01 sys +  0.12 cusr  0.00 csys =  0.16 CPU)
Result: PASS

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

From the man page

finsh()
Indicate that no more data will be fetched from this statement handle
before it is either executed again or destroyed.
You almost certainly do not need to call this method.

Adding calls to "finish" after loop that fetches all rows is a common
mistake, don't do it, it can mask genuine problems like uncaught fetch errors.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-28 14:25:52 +00:00
7ae3ea6857 Bug 8670 - Update POD of C4::Branch::GetBranches() to use TT syntax
This patch updates the example template syntax in the POD for
C4::Branch::GetBranches() to use Template Toolkit syntax.

To test, view the POD for C4::Branch::GetBranches() and confirm that it
looks correct.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Checked the POD with "perldoc C4/Branch.pm" before and after applying
the patch. The example now uses TT syntax, and looks sensible.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-08-20 14:32:31 +00:00
Jonathan Druart
ec3735433a Bug 10515: make behavior of library category fetchers consistent with other fetchers
The prototype is not consistent, GetBranchCategory should return only 1 result
and GetBranchCategories should not have a categorycode argument.
This patch fixes that.

Test plan:
1/ Try to add/remove/modify a library.
2/ Add some groups
3/ Add these groups to a library

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-17 17:27:24 +00:00
Jonathan Druart
7d93064906 Bug 10527: remove disused routine C4::Branch::get_branch_code_from_name
This routine is not in used and does not make sense. It should not be
used later.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, not references to get_branch_code_from_name found.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-12 20:20:20 +00:00
b00ec06968 Bug 10080 - Change system pref IndependantBranches to IndependentBranches
Test Plan:
1) Enable IndependantBranches
2) Apply this patch
3) Run updatedatabase.pl
4) Verify that the system preference still functions correctly

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-22 07:58:23 -07:00
719044f771 Bug 9257 - Add "groups" to normal search pulldown
This patch adds the ability to add groups to the library select
pulldown on the opac, if it is enabled.

Test Plan:
1) Apply patch
2) Run updatedatabase.pl
3) Go to Administration › Libraries and groups
4) Create a new group, or edit an existing one
5) Ensure the 'Show in search pulldown' checkbox is checked
6) Save the group
7) Enable OpacAddMastheadLibraryPulldown if it is not already enabled
8) Load the OPAC, try the group search from the libraries pulldown menu

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Yes! Now this works, and well.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-22 08:20:08 -04:00
Nadia Nicolaides
4d644c6930 Follow-up Bug 5634: Ordering branches should be case independent
This patch fix the order of branches in the log-in page,
on Branch.pm we added the variable branchcode to the
hash returned by GetBranchesLoop, and this function is used
on Auth.pm to get a list of branches ordered by branchname

To test
1) Use an installation with some branches
2) On login screen the branches are ordered by branchcode
3) apply the patch
4) On login screen the branches are now ordered by branchname

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This patch works as expected. Before applying the patch the branches
with lower case was at the end of the list. Now they are well ordered.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-12-21 07:42:18 -05:00
162d81d536 Bug 6679 - [SIGNED-OFF] fix 4 perlcritic violations in C4/Branch.pm
Subroutine prototypes used at line 157, column 1.  See page 194 of PBP.  (Severity: 5)
Subroutine prototypes used at line 375, column 1.  See page 194 of PBP.  (Severity: 5)
Subroutine prototypes used at line 385, column 1.  See page 194 of PBP.  (Severity: 5)
Subroutine prototypes used at line 418, column 1.  See page 194 of PBP.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-09-20 12:01:37 +02:00
881ee1b1a1 Bug 7401 - Shelving Location facet
This patch enables the shelving location facet as an
alternative to the branches fact in two situations:
A) SingleBranchMode is enabled
B) There is only one branch in the branches table

Test Plan:
1) Catalog multiple items with different shelving locations.
2) Test enable by enabling SingleBranchMode
3) Test enable by deleting all but one branch

Based on initial patch by Ian Walls.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Tested cases 2) and 3) successfully in OPAC and staff client

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-09-19 14:25:04 +02:00
Chris Cormack
509d673f10 Bug 7941 : Fix version numbers in modules
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-11 17:29:38 +02:00
Srdjan Jankovic
f4ab1e836f bug_7264: [SIGNED-OFF] Branch popup on OPAC detail.Added opac_info field to branches table.
Signed-off-by: Delaye stephane <stephane.delaye@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-03-22 11:50:00 +01:00
Paul Poulain
69732f5c62 Bug 7034: de-nesting C4/Branch.pm
use C4::Koha was loaded only to call C4::Koha::get_infos_of in get_branchinfos_of

the sub get_branchinfos_of was used nowhere
(checked with "grep -R get_branchinfos_of *")
only one reference was made to get_branchinfos_of, in reserve/request.pl, but the sub was not used in fact (maybe removed previously & silently)

This patch removes sub get_branchinfos_of and use C4::Koha in C4::Branch, as well as the reference in request.pl and the t test

The patch doesn't remove use C4::Branch in reserve/request.pl, as it's still used for other subroutines.

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-10-19 03:23:31 +13:00
Chris Cormack
ce1b47ce0b Bug 5431 : Follow up patch fixing ModBranch
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-12 08:55:20 +12:00
Katrin Fischer
ac2da44b69 Bug 5431: Separate state field for library addresses
Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-09 12:01:48 +12:00
Paul Poulain
129f05a5ec Bug 5634: BZ5634 order branch list alphabetically, without taking care of uc/lc
Perl separates uc & lc in cmp. So we just uc() to have list properly ordered

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-01-20 19:49:34 +13:00
Paul POULAIN
bea80d2948 mybranch not exported (merge pb) 2010-12-21 21:18:12 +13:00
7c0e441d50 replace references to defunct info email address
Now links to Koha project website.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-25 05:18:44 -04:00
Andrew Elwell
2856bb8295 POD Cleanups - Few minor ones this time
Signed-off-by: Andrew Elwell <Andrew.Elwell@gmail.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-06-09 08:38:57 -04:00
64daee5495 fix a common "developement" typo
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-05-25 14:38:38 -04:00
Donovan Jones
593a7d8e6a Bug 2505 - Add commented use warnings where missing in *.pm 2010-04-21 20:28:51 +12:00
4bade723ef Revert "(bug #3778) GetBranchesLoop and searchMyLibraryFirst"
Reverting this commit to resolve bug 4016.  This revert has the
same effect as a patch submitted by Garry Collum on 20 February 2010.

This reverts commit 2345dc7c27.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-02-21 18:04:15 -05:00
c097736084 Fix for bug 2885, now an error message is thrown instead of a silent fail
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-02-14 20:29:44 -05:00
Nahuel ANGELINETTI
2345dc7c27 (bug #3778) GetBranchesLoop and searchMyLibraryFirst
This fix GetBranchesLoop, if searchmylibraryfirst is disabled, getbranchesloop mustn't select any branch.
2009-11-18 19:12:45 +01:00
Chris Nighswonger
204e051dff [14/40] Work on batch management interface. 2009-09-01 15:50:05 -04:00
Sébastien Hinderer
7fa051d837 bug 3440: C4/Branch.pm: the branch{zip,city,country,url,notes} rows should be taken into account during Add and Mod operations.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-08-01 09:44:32 -04:00
Joe Atzberger
46b9ee7a93 Branch auto-selection in additem
Adding a new item should pre-select the library you are logged in at, where possible.
Use GetBranchesLoop.  This solves indy branches filtering, and sort order problems.
Set default off of ->{selected}, to establish pre-selected branch.
Fix flags check in onlymine sub, so superlibrarian + other flags still gets everything.
Removed defined(@array) check, since perl -wc warns it is deprecated.
Note new FIXME for botched date processing.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-07-14 21:39:00 -04:00
Joe Atzberger
b9be34a9d6 Correct POD and misleading variable names from copy/paste laziness
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-19 06:09:53 -05:00
Joe Atzberger
4677ae7390 Cleanup selectbranchprinter.pl and .tmpl
Use GetBranchesLoop and warnings.  Remove unused code.  Moved the Get's to after auth.
I begin to show how this script will use referer to redirect back to the sending
page upon successful change of branch or printer (see hidden div and recycle_loop).

Indicator for singleBranchMode added.
Also added another helper function for GetBranchesLoop, namely mybranch.  This
encapsulates the logic for finding an intelligent default selection, which is
almost always desirable.

This does not resolve bug 2426, but is work in that direction.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-06-05 17:30:52 -05:00
Paul Poulain
950f753f11 fix for #2884: Add error management to branches
While trying to add a new Branch with an existing Branch code, the UI says "Library saved" instead of something such as "Please select a unique branch code".

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-28 19:55:09 -05:00
Joe Atzberger
4f9d77ed32 Add onlymine helper function.
This should allow scripts to use GetBranchesLoop without having to reproduce
the check for:
(1) IndependantBranches,
(2) User logged in,
(3) User Not superlibrarian, and
(4) User branch set.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-05-21 08:01:39 -05:00
Joe Atzberger
6b3e5ce0dc Correct perldoc
Indentations misformatted for code blocks.  Also updated reference to
GetBranchesLoop.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-11 08:37:13 -05:00
Joe Atzberger
621c211d43 Allow all argument forms to GetBranchesLoops.
Allow arguments to be specified in the negative (i.e. 0).
Allow function to be called with no arguments.

This supercedes the patch titled:
Allow GetBranchesLoop to intuit IndependantBranches if not specified in argument.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-06 13:03:48 -06:00
Joe Atzberger
c188100bf3 Allow GetBranchesLoop to intuit IndependantBranches if not specified in argument.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-06 13:00:43 -06:00
Joe Atzberger
3d3628a1a6 Add GetBranchLoop since so many pages use exactly the same code.
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2009-03-06 12:59:27 -06:00
Andrew Moore
56b9f5b882 bug 1953: fixing potential SQL injection problems in C4::Branch::GetBranches
I moved C4::Branch::GetBranches to use bind parameters and wrote some tests to demonstrate functionality.

No functional or documentation changes here.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-12 15:07:17 -05:00
Chris Cormack
96e89fa4dc Removing replace statement from C4::Branch as per bug 1546
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 19:23:41 -06:00
Joe Atzberger
f59595d92f C4 - BEGIN blocks and 1; __END__ for modules
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-07 20:02:18 -06:00
Galen Charlton
80942a3031 fixed reference to branchrelations.categorycode
Previous patch had referred to column as category_id,
which is incorrect.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-17 12:58:39 -06:00
Chris Cormack
ea7cbfff43 Fix for bug 1648, specifying a due date resulted in a blank due date
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-12-17 08:19:55 -06:00
Ryan Higgins
3d04be488e adding branch groups search in intranet.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-21 19:18:39 -05:00
Ryan Higgins
70f46147a6 Extending branch categories : adding search domains. partial commit.
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-21 19:18:36 -05:00
Chris Cormack
b9c20fa9cf Patch from Galen Charlton, removing $Id$ $Log$ and $Revision$ from files
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2007-10-18 20:22:01 -05:00
Joshua Ferraro
6cdf0832e2 new virtual shelves changes, keyed by biblionumber
Signed-off-by: Chris Cormack <crc@liblime.com>
2007-08-09 09:17:49 -05:00
Joshua Ferraro
bf1fd83d08 set the branch at login 2007-08-07 15:45:03 -05:00
Joshua Ferraro
ab77322c08 adds the ability to set the branch at login,
Signed-off-by: Chris Cormack <crc@liblime.com>
2007-08-07 15:41:19 -05:00
tipaul
e1d907c688 various bugfixes on parameters modules + adding default NoZebraIndexes systempreference if it's empty 2007-05-04 16:24:08 +00:00