Commit graph

206 commits

Author SHA1 Message Date
b64e6be1c4 Bug 16157: Move the selected flag from GetAuthorisedValues to the templates
From C4::Koha::GetAuthorisedValues

    # TODO: the "selected" feature should be replaced by a utility function
    # somewhere else, it doesn't belong in here. For starters it makes
    # caching much more complicated. Or just let the UI logic handle it, it's
    # what it's for.

Indeed, it's not a job for a subroutine, the template should take care of that.
Note that a perf gain could be won with this patch \o/

Test plan:
- Edit an itemtype and check the value of the "Search category" dropdown list
- Edit a patron attribute type and check the value of the "Class" dropdown list
- Detail for a catalogue record, the Status column should be correctly
  populated if items are damaged and/or lost
- Item details for a catalogue record, the lost, damaged and withdrawn
  value should be correctly displayed
- Edit a patron, the "street type" should be correctly selected
- Create a patron attribute type linked to an authorised value list.
- Edit a patron, set a value for this attribute, edit it again. The
  correct value should be selected.
- Search for subscriptions. The 'Location' dropdown list should behave
  correctly (select the entry you have choosen before, etc.)
- Edit a subscription, the location dropdown list should select the
  correct value.
- Edit and view a suggestion with a 'reason for suggestion' set (you
  should have at least 1 OPAC_SUG AV defined)

Followed test plan, works as expected
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-04-07 00:16:09 +00:00
017699c345 Bug 16011: $VERSION - Remove the $VERSION init
Mainly a
  perl -p -i -e 's/^.*3.07.00.049.*\n//' **/*.pm
Then some adjustements

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:28 +00:00
3830d78d46 Bug 16011: $VERSION - remove use vars $VERSION
perl -p -i -e 's/^(use vars .*)\$VERSION\s?(.*)/$1$2/' **/*.pm

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:26 +00:00
2237e0f871 Bug 5404: C4::Koha - remove subfield_is_koha_internal_p
The commit b5ecefd485
Date:   Mon Feb 3 18:46:00 2003 +0000

had a funny description:
Added function to check if a MARC subfield name is "koha-internal"
(instead of checking it for 'lib' and 'tag' everywhere); temporarily
added to Koha.pm

"Temporarily", since 2003, everything is relative, isn't it? :)

The thing is that GetMarcStructure returns hash like

field_200 => {
    subfield_a => {
        %attributes_of_subfield_a
    },
    %attributes_of_field_200
}

The attributes for field_200 can be 'repeatable', 'mandatory', 'tag', 'lib'.
We don't want to loop on these values when looping on subfields.
Since there are just { k => v } with v is a scalar (string), it's easier
to test if we are processing a subfield testing the reference.

At some places, we don't need to test that, we are looping on values
from MARC::Field->subfields which are always valid subfields.

Test plan:
1/ Edit items using the batch item mod tool
2/ display and edit items via the cataloguing module.

You should not see any changes between before and after the patch
applied.

Tech notes:
We need to check what we are processing when we loop on 'subfields' from
GetMarcStructure, not from MARC::Field->subfields.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-07 17:30:09 +00:00
0fdc1021d4 Bug 15800: Koha::AuthorisedValues - Remove C4::Koha::IsAuthorisedValueCategory
C4::Koha::IsAuthorisedValueCategory contains only 2 useful calls, from
C4::Reports::Guided and reports/guided_reports.pl
It can be replaced with
  Koha::AuthorisedValues->search({ category => $authorised_value})->count

Test plan:
1/ Create a sql report using an authorised value category, something
like:
  SELECT COUNT(*) FROM items where itemlost=<<lost|LOST>>
2/ Execute the report and confirm that everything works fine.
3/ Create a sql report using a nonexistent authorised value categor,
something like:
  SELECT COUNT(*) FROM items where itemlost=<<lost|NONEXIST>>
4/ When saving the report, you should get a warning message
  "lost: The authorized value category (NONEXIST) you selected does not exist."
5/ Save anyway and execute the report, you should get the same warning
message.

QA:
  git grep IsAuthorisedValueCategory
should not return any results
  prove t/db_dependent/ReportsGuided.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as described

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-03-02 03:54:16 +00:00
8627ec5f6a Bug 4941: Remove the singleBranchMode system preference
The singleBranchMode system preference does not make sense.
Either the install has only 1 library defined or several. In both case,
we can easily guess the behavior to follow.

So the idea of this patch is to replace the fetch of this syspref with a
call to count the number of libraries defined in DB.

Test plan:
1/ From a fresh Koha install, execute the DB entry to remove the pref.
2/ Define only 1 library
3/ Confirm that Koha behaves the same as before (try to change your
library, look at the facets)
4/ Create another library (or more) and reinsert the pref and set it:
  insert into systempreferences (variable, value)
    values('singleBranchMode', 1);
5/ Execute the DB entry
You should get a warning message.
6/ Repeat 3.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Does what it says, but will change behaviour for any Koha install that
has 2 branches defined, One circulation, and this preference set.
If that is an acceptable change, we might need to make sure this is noted well in the
release notes.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-02-26 12:13:09 +00:00
a1bd7af5fb Bug 15798: Remove C4::Koha::displayServers
This subroutine is no longer is use and can be removed.

Test plan:
  git grep displayServers
should not return any results.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-02-24 17:09:39 +00:00
ad8d063ffa Bug 15769: Remove outdated C4::Koha::slashifyDate subroutine
This subroutine does not make sense anymore (Koha::DateUtils should be
used) and is no longer used.
It can be removed safely.

Test plan:
  git grep slashifyDate
should not return any results

  prove t/Koha.t
and
  prove t/db_dependent/Koha.t
should return green

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
slashifyDate removed, all test pass successfully

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-02-24 03:35:29 +00:00
2ea901c641 Bug 15783: AddAuthorisedValue - Remove the subroutine
Test plan:
  prove t/db_dependent/Koha.t
should return green

  git grep AddAuthorisedValue
should not return any results

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-02-24 03:34:14 +00:00
50c6991f49 Bug 15796: Remove C4::Koha::get_itemtypeinfos_of
This subroutine is no longer in use.

Test plan:
  git grep get_itemtypeinfos_of
should not return any results.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Trivial and needed removal.

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-02-24 03:33:05 +00:00
b1ea7d7068 Bug 15797: Remove C4::Koha::GetKohaImageurlFromAuthorisedValues
This subroutine is no longer in used and can be remove.

Test plan:
  git grep GetKohaImageurlFromAuthorisedValues
should not return any results.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-02-24 03:31:56 +00:00
372881ebfd Bug 15209: Check the parameter at the beginning of the subroutines
It seems better to check if parameters exist at the beginning of a
subroutine.
It makes the code easier to read and there is 1 indentation level less.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-01-27 02:07:21 +00:00
Colin Campbell
960458dee4 Bug 15209 Validate passed MARC::Record objs in C4::Koha
Ensure that a passed MARC::Record is defined before calling
its methods. Otherwise you are open to occurences of the
error 'Can't call method "field" on an undefined value'
In a CGI environment you can live with such sloppiness but
in a persistent environment the error can cause the instance
to abort.
Made all routines passed a MARC::Record validate it before calling
its methods. Changed the parameter name from the meaningless
record to marcrecord to indicate its content. Added an explicit return
for all cases where no valid data returned. Cleaned up some logic for
clarity. I think we can assume that GetNormalizedOCLCNumber meant to
look at all 035s till it found an OCLC number not just the first.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-01-27 02:07:20 +00:00
61ba35c2b3 Bug 15295: Koha::Libraries - Remove GetBranchesCount
This is replaced with Koha::Libraries->search->count.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

http://bugs.koha-community.org/show_bug.cgi?id=15294

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-01-14 15:45:31 +00:00
96ba9a0d6b Bug 15337: Make itemtypes retrieved with GetItemTypes ordered by descriptions
Prior to this patch, the itemtypes were displayed ordered by the code
(itemtypes.itemtype DB column).
This patch will make them displayed by the description displayed (the
translated description).

Test plan:
0/ Do not apply this patch set
1/ Confirm that the itemtypes are displayed ordered by code (when adding
an item, cataloguing/additem.pl)
2/ Confirm that t/db_dependent/Koha.t does not pass
3/ Apply the test patch
4/ Confirm that t/db_dependent/Koha.t pass
5/ Confirm that the itemtypes are not displayed by description (on
additem.pl)

See comment #3
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2016-01-13 19:27:22 +00:00
7283069a9d Bug 15381: Remove getauthtypes and getauthtype
These 2 subroutines are now not necessary anymore, we can use
Koha::Authority::Types to retrieve the authority types.

This patch won't be easy to test. Indeed, a lot of file are updated.
To test it I would suggest to focus on the merge authority

You should also confirm that the authtypecode and the authtypetext
values are correctly displayed when navigating in the authority module.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
2015-12-31 18:59:02 +00:00
Bernardo Gonzalez Kriegel
b722fbfb5c Bug 15093: Load/show saved item type group and hideinopac
This patch adds loading of hideinopac and searchgroup
when showing/editing itemtypes

To test:
1) Put some values in ITEMTYPCAT auth value
2) Edit an item type, select a value for
search category & check 'Hide in OPAC'
Save
3) Results do no show on list of item types
4) Edit same item type, values are default/empty
5) Apply the patch
6) Edit again, change again, save
Now values shows in list
7) Edit again, values are now correct

Values were saved on db, but not loaded from it
How this happen?

Side note: searching for searchcategory I found

installer/data/mysql/kohastructure.sql:  searchcategory varchar(80) default NULL, -- Group this item type with others w
installer/data/mysql/updatedatabase.pl:            ADD searchcategory VARCHAR(20) DEFAULT NULL

Its varchar(80) in kohastructure and varchar(20) in updatedatabase

We need more eyes :)

Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-11-01 17:10:44 -03:00
93d6de4bf0 Bug 14100: Fix test xt/author/valid_templates complaining on opac-topissues.tt
undef error - Undefined subroutine &C4::Languages::getlanguage called at C4/Koha.pm line 250.

Test plan:
    prove xt/author/valid-templates.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-29 08:47:33 -03:00
30667f0555 Bug 14100: (follow-up) Language overlay for item types
Display the translated description for item types in the following pages:
> admin/smart-rules.pl
> catalogue/detail.pl
> catalogue/itemsearch.pl
> catalogue/moredetail.pl
> reports/acquisitions_stats.pl
> reports/bor_issues_top.pl
> reports/cat_issues_top.pl
> reports/catalogue_out.pl
> reports/catalogue_stats.pl
> reports/issues_avg_stats.pl
> reports/issues_stats.pl
> reports/itemslost.pl
> reports/manager.pl
> reports/reserves_stats.pl
> suggestion/suggestion.pl
> tools/export.pl

> Opac:
> opac-detail.pl
> opac-MARCdetail.pl
> opac-search.pl

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-27 12:34:06 -03:00
Jonathan Druart
0f63f89f66 Bug 14100: Generic solution for language overlay - Item types
Test plan:
1/ update the Schema (misc/devel/update_dbix_class_files.pl)
2/ Translate templates for some languages (es-DE, de-DE for instance)
3/ Enable them in the pref (search for 'lang') for the staff interface
4/ Go on the item type admin page (admin/itemtypes.pl)
5/ Edit one
6/ Click on the 'translate for other languages' link
7/ You are now on the interface to translate the item type's description
in the languages you want. So translate some :)
8/ Go back on the item type list view (admin/itemtypes.pl)
9/ You should see the original description (non translated)
10/ Switch the language
11/ You should see the translated description in the correct language.
If the description is non translated, the original description is
displayed.

12/ On the different page where the item type is displayed, confirm that
the translated description appears.

Think further / Todo:
1/ Update all occurrences of the item type's description (DONE)
2/ Implement for authorised values
3/ Implement for syspref value (at least textarea)
4/ Implement for branch names
5/ Centralize all the translation on a single page in the admin area
...
N/ Implement a webservice to centralize all the translations and give
the ability to sync the item types/authorised values description with
the rest of the world (push and pull).

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-27 12:34:06 -03:00
cc73c53c6f Bug 14778: Install fixtures for t/Koha.t
Warning: This patch modifies a module!
What's the need of the binary function here?
The data are case insensitive, so no need to use this mysql function.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-23 12:01:18 -03:00
Blou
96b05f3535 Bug 10937: cleanup and rename DOCTYPECAT to ITEMTYPECAT
- "Item" and not "Document" is the word used throughout Koha.
- Moved the updates to an atomic update
- changed searchcategory from varchar(20) to (80)
- cleanup
2015-10-22 11:06:22 -03:00
ahmed
30edfbfa58 Bug 10937: Option to hide and group itemtypes from advanced search
This allows to group certain item types in a category, to be displayed (and searched) as such in OPAC's advanced search.  For example, you can group Reserve 2h and Reserve 12h into a Reserve category.  The 2 and 12h types won't appear anymore.
This also allows to simply prevent an item type from displaying as a search option.

TEST PLAN
------------------
0) Back up database, so you can reset and retest easily. ;)
1) Apply the patch
2) Run Koha QA tool.
3) prove -v t/db_dependent/Koha.t
  -- all tests should pass.
  4) run ./installer/data/mysql/updatedatabase.pl to add the
  two columns to itemtypes
  -- Does a meaningful message get printed?
  Are the columns added?
  "DESCRIBE itemtypes;" should list hideinopac and searchcategory.
  5) You need to add a category to group your item types:
  a) In Intranet/Koha Admin/Authorized values,
  select DOCTYPECAT in the 'Show category:' dropdown
  i) If you do not have a DOCTYPECAT category, create one.
  b) Click button "New authorized value for DOCTYPECAT"
  c) Enter
  Authorized value: HARDWARE
  Description : Hardware
  Description (OPAC): Hardware
  6) Group your items under that new category
  a) In Intranet/Koha Admin/Item types, choose (at least)
  two item types and for each:
  - Click action/Edit on the right column
  - Third row (below Description) is the Search category list box, select Hardware
  - click Save changes at the bottom
  7) Select at least one item to be hidden in the OPAC search
  a) In Intranet/Koha Admin/Item types (again), choose a different item type:
  -  Click action/Edit
  -  Click the checkbox "Hide in OPAC" below the list of icons.
  8) Go test your modifications
  a) Go to OPAC/Adv search.
  b) Validate that all items modified above (hidden or grouped) do not appear in Item type list
  c) Validate that new item type Hardware does appear instead.
  d) Select item Hardware, start Search.
  ) Validate returned items are the of the two types that were grouped into the Hardware category in step 4.

Sponsored-by: Vanier college

Signed-off-by: Nick <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-22 11:06:07 -03:00
Stefan Weil
64925f7522 Bug 14383: C4: Fix some typos (mostly in comments and documentation)
Most of them were found and fixed using codespell.
Fix also some related grammar issues.

In C4/Serials.pm a variable was renamed to make future codespelling
checks easier.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

http://bugs.koha-community.org/show_bug.cgi?id=14383
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-06-22 17:34:45 -03:00
7507145a6e Bug 14200: GetNormalizedISBN failing to normalize valid ISBNs in some cases
For some reason the regular expression used to split the multiple ISBN
fields can fail which keeps Business::ISBN from being able to parse out
and return a valid isbn. Using split() instead of the regex fixes the
issue.

Test Plan:
1) Apply the unit test patch first
2) prove t/Koha.t
3) Note the failures
4) Apply the second patch
5) prove t/Koha.t
6) Note all tests pass

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Karen Bryant <kbryant@ccpl-fl.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-19 09:45:38 -03:00
Mark Tompsett
4e0468e8c2 Bug 14057: Inventory is painfully slow
This patch is a rough start. I believe it runs exponentially
faster, but its equality to the previous version needs to be
tested before I clean it up to acceptable standards.

Nested hashes of hashes was being a debugging nightmare.

Moved the SQL select to C4::Koha.

Changed the GetItemsForInventory to have a hashref parameter.
Added interface, in case there is a need for 'opac' vs. 'staff'.

Added t/db_dependent/Items/GetItemsForInventory.t
Added t/db_dependent/Koha/GetKohaAuthorisedValuesMapping.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-06 10:40:23 -03:00
Jonathan Druart
a6c9bd0eb5 Bug 9978: Replace license header with the correct license (GPLv3+)
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

http://bugs.koha-community.org/show_bug.cgi?id=9987

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:38 -03:00
352d9cd2fd Bug 13167 Stage MARC for Import hangs for biblio containing invalid ISBN-13
If the ISBN of a UNIMARC record begins with 979 then the 'Stage MARC for
import' hangs.  If I use the same UNIMARC record and change 979 to 978 in the
ISBN, 'Stage MARC for import' works perfectly.

The patch deals with the fact that converting an ISBN-13 to ISBN-10 with
Business::ISBN as_isbn10() method fails if the ISBN doesn't begin with 978.

TEST PLAN:

(1) Download, and decompress the ZIP file attached to BZ.
(2) On a UNIMARC Koha instance, go in Tools > Stage MARC for import.
(3) Choose the MARC file containing the record with an ISBN begining with 979.
    Click on Upload file, then Stage to import.
(4) The Job progress bar stay at 0%.
(5) Apply the patch. Repeat steps 2-3. The upload works.

Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Tested in a UNIMARC installation, confirmed that the patch fixes the
problem.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-04 11:15:24 -03:00
532b41934c Bug 13157: (QA followup) homebranch is 995$b on UNIMARC frameworks
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2014-11-25 15:27:12 -03:00
9ebb6ba5d1 Bug 13157: UNIMARC holdingbranch facet is 995$c not 995$b
Fix a typo. Not test plan required, just a look at default UNIMARC framework.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
2014-11-25 15:27:05 -03:00
Jonathan Druart
d85f29661b Bug 12874: A DB field without a default mapping is set to a default value on editing
If an item is edited and a field is not mapped to Koha, it is to 0 or
NULL (depending on the default value defined).

This patch adds a check on the mapping before editing the item. It there
is no mapping, the DB value is not erased.

Test plan:
1/ Edit an item and fill a value for a field
2/ Unmap this field
3/ Edit the item
4/ Verify that the value is not erased (using the MySQL CLI)

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-11 12:57:11 -03:00
Robin Sheat
56844b81d7 Bug 9967 - include $branch_limit in the cache key
Make the caching more correct. Also removes a warn that got left behind.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-09 11:05:07 -03:00
Robin Sheat
1878cb0bdf Bug 9967 - Cache authorised value requests properly
Authorised values are now cached using the proper Koha::Cache mechanism,
rather than a simple internal cache. Memoize has been removed because it
didn't really work like we needed it to.

Test plan:
 * running a persistent environment:
 * load the edit item screen
 * refresh several times to ensure any process-based caches are filled
 * add a new LOC authorised value as fast as possible (prepare it on
   another tab.)
 * refresh the edit item page
 * note that the new LOC value may or may not be showing in the
   "shelving location"
 * if more than 5 seconds have passed since saving it, it must now show
   up.
 * refresh a few times to ensure that it's showing on all processes.

Note:
 * This patch depends on the caching changes of 9967.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-09 11:05:00 -03:00
Bernardo Gonzalez Kriegel
c7ca45d046 Bug 12675: Remove CGI::scrolling_list from labeledMARCdetail.pl
This patch removes only instance in this file.

Also updates getframework POD on C4/Koha.pm,
adds new GetFrameworksLoop() func on same file from
suggested code, but with ordered result.

To test:
1. Apply the patch
2. Enable viewLabeledMARC syspref
3. On staff, search for a record, goto detail view
4. Clic on Labeled MARC
5. Framework pulldown was replaced, check changing
framework.

A bug was fixed, because selecting any fw and then Default
tries to load values from 'Default' fw code, which does not
exists.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-03 16:53:00 -03:00
Galen Charlton
9d9c413c42 Bug 12288: (follow-up) test for defined values
This patch adjusts the test so that if an "ISBN" is not
defined (because the source string did not specify a valid
ISBN), it doesn't result in a warning once the warnings
stricture is enabled in C4::Koha.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 20:03:30 +00:00
833eef4e08 Bug 12288: fix search errors with AggressiveMatchOnISBN turned on
This patch fixes a problem where search errors like this in the logs when
running a stage import with the AggressiveMatchOnISBN syspref turned on:

search failed (isbn,phr=978-0-7517-9745-9 or isbn,phr=0-7517-9745-6 or
isbn,phr=978-0-7517-9745-9 or isbn,phr=0751797456 or
isbn,phr=9780751797459 or isbn,phr=978-0-7517-9759-6 or
isbn,phr=0-7517-9759-6 or isbn,phr=978-0-7517-9759-6 or
isbn,phr=0751797596 or isbn,phr=9780751797596 or isbn,phr= or
isbn,phr= or isbn,phr= or isbn,phr= or isbn,phr=) CCL parsing
error (10014) Search word expected ZOOM at
/usr/share/koha/lib/C4/Matcher.pm line 688.

This is most easily seen when running the script from command line
/misc/stage_file.pl.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 20:02:38 +00:00
a18ce86e83 Bug 12243: ensure that records with invalid ISBNs do not cause searches to fail
Some types of invalid ISBNs, when run through C4::Koha::NormalizeISBN
can produce ISBN objects that contain invalid ISBNs. This can be
reproduced with an ISBN that has an invalid prefix, group code or
publisher code. An example ISBN would be "0788893777 (2 DVD 45th ed)".

When attempting to look up a record with such an ISBN, you will get an
error along the lines of: Can't call method "as_string" on an undefined
value

Instead of checking for the BAD_ISBN state, we should be checking for
the GOOD_ISBN state via the method is_valid.

Test Plan:
1) Edit a record, add the following ISBN to your record:
   0788893777 (2 DVD 45th ed)
2) When Koha redirects to the record, you should see the error message
   described
3) Apply this patch
4) Reload the page, you should now see your record

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 15:42:56 +00:00
8d5d319f62 Bug 10500: (follow-up) add checks for empty isbn
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 18:06:08 +00:00
ed4b60fa1d Bug 10500: Improve ISBN matching when importing records
Test Plan:
1) Catalog a record with the ISBN "0394502884 (Random House)"
2) Export the record, edit it so the ISBN is now
   "0394502884 (UnRandomHouse)"
3) Using the record import tool, import this record with matching
   on ISBN.
4) You should not find a match
5) Apply this patch
6) Run updatedatabase.pl
7) Enable the new system preference AggressiveMatchOnISBN
8) Repeat step 3
9) The tool should now find a match

Signed-off-by: Tom McMurdo <thomas.mcmurdo@state.vp.us>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 18:04:55 +00:00
Olli-Antti Kivilahti
24dd5ea3d2 Bug 11466: improve selection of item types for purchase order desired format list
This patch ensures that the list of desired formats for a purchase
suggestion includes the list of item types so long as the
AdvancedSearchTypes system preference includes 'itemtypes'.

--------------
-- Synopsis --
--------------

When system preference AdvancedSearchTypes has other values than 'itemtypes',
for ex 'itemtypes|loc', itemtypes selection in opac-suggestions.pl
is not populated with available itemtypes.

This patch fixes the issue by broadening the strict comparison of
($advanced_search_types eg 'itemtypes') #fails 'itemtypes|loc'
to
($advanced_search_types =~ 'itemtypes') #succeeds 'itemtypes|loc'

Unit tests included

---------------
-- Test plan --
---------------

REPLICATING THE ISSUE
1. Set system preference  AdvancedSearchTypes to itemtypes|loc
2. Go to opac-suggestions.pl and observe Item type <select> dropdown list
2.1. List should have only the default value

AFTER APPLYING THIS PATCH
1. Set system preference  AdvancedSearchTypes to itemtypes|loc
2. Go to opac-suggestions.pl and observe Item type <select> dropdown list
2.1. List should have itemtypes available for selection

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Tests worked as expected. Placed a suggestion and saw the whole
list of item types, chose one, saved, checked staff and it loaded
as expected. Changed item type in staff and it applied in both
views.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes all tests including new regression tests.
Restores old functionality.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 23:20:33 +00:00
Jonathan Druart
0514a7483c Bug 766: Move GetAuthvalueDropbox to C4::Koha
GetAuthvalueDropbox is in C4::Budgets, this does not make sense.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-04 23:01:44 +00:00
3d7e685081 Bug 11334: add ability to control which library fields are used for facets
The current "Library" facet is somewhat ambiguous for Koha installations
with multiple libraries. It refers to the holdingbranch, but does not
explicitly state this. It would be beneficial to allow the administrator
to choose to show facets for the holding library, home library, or both.
In addition, the facets should be more explicitly labeled.  This patch
adds this flexibility.

Test plan:
1) Apply this patch
2) Check that the facets label "Libraries" now reads "Holding libraries"
3) Update the system preference DisplayLibraryFacets to "home library"
4) Check that the facet now reads "Home libraries"
5) Update the preference again to "both home and holding library"
6) Check that both the facets for home and holding library are now
   displayed.

Signed-off-by: Jen DeMuth <jdemuth@roseville.ca.us>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Changes apply to both prog and bootstrap OPAC and staff client.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-29 15:57:53 +00:00
Mathieu Saby
81cc05cbd6 Bug 10893: fix location facet in UNIMARC
Location facet in UNIMARC is void. In the code, it is build
on 995$c, while location is store in 995$e (see record.abs).
This patch replace 995$c with 995$e in Koha.pm

To test :
1. Use a UNIMARC Koha instance with ONE branch, and SEVERAL
    locations
2. Make a search in opac and staff interface : no location
    facet on the left side of the screen
3. apply the patch
4. Make the same search : location facets will be displayed

NOTE: I, Mark Tompsett, rebased this. I confirmed that 995$c
      should be 995$e (wiki, Holdings_data_fields_(9xx) page)
      Also note that the code relocated based on bug 10078,
      causing the patch to not apply.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: The location facet did not appear in master, but after
      applying the patch, it did appear.
      Because of the code being moved, it is no longer affected
      by the branch count or singleBranchMode.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixes wrong subfield code for UNIMARC.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-29 15:49:08 +00:00
Jonathan Druart
8ee6e4290e Bug 11279: (follow-up) remove unnecessary check on number of quotes
It is not necessary to process the case where the number of quotes
is just one, as int(rand(1)) will always produce 0, which is a valid
offset.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-19 15:06:39 +00:00
Katrin Fischer
5a3db23362 Bug 11279: Improve how a new quote of the day is selected
If there is a gap in the id sequence for the quotes table, it
is possible that no new quote will be selected. This will happen
particularly when a lot of the older quotes with low ids have been
deleted.

This patch improves the selection of a new quote.

To test:
- Load sample quotes
- Delete the first half of the quotes.
  Note: With 34 quotes, delete the quotes with ids from 1-17
- Activate the QuoteOfTheDay system preference
- Check if a quote is displayed in OPAC
- Reload the page a few times, no quote should be displayed
  Note: make sure you don't have a quote with the current
  date in your quotes table before running those tests
- Run 'perl t/db_dependent/Koha.t'
  Note: requires sample quotes!
- Apply patch
- Reload the OPAC start page
- Verify a quote was now picked
- Run 'perl t/db/dependent/Koha.t' again - all tests should still pass

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

Patch modified to use "LIMIT 1 OFFSET ?" rather than "LIMIT ?, 1"; the
latter construction does not work in PostgreSQL.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-19 15:06:31 +00:00
083f90cc44 Bug 8015: (follow-up) remove references to C4::Koha::Log
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 22:50:29 +00:00
Jonathan Druart
5d170aa268 Bug 8015: Add unit tests for SimpleMARC and MarcModificationTemplates routines
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Bug 8015: Fix complains from qa tools

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 8015: Get rid of the eval in ModifyRecordWithTemplate

This patch removes the use of eval in the
C4::MarcModificationTemplates::ModifyRecordWithTemplate routine.

Now this routine call the wanted modification routine with the list of
parameters.
This call is done only if the condition is respected.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 8015: Get rid of eval for evaluating =~ m//

Koha::SimpleMarc::field_equals uses eval in order to check if a string
matches a pattern.
Now this eval is removed and the "regex" variable does not contain the
regex separated character (/ or |).

Regression: Before this patch, the user was able to user a modifier. Now
it is not possible.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 8015: Get rid of the eval for substitution

Before this patch, the regex substitution was contain into only one
variable (e.g. my $regex = "/foo/bar/i").
Now each member of the regex is stored into a field in the
marc_modification_template_actions sql table.

In order to avoid a complex code, only modifiers i and g are take into
account.

Note: If you already add the mmta table, you have to drop it.
This patch also adds a foreign key from mmta to mmt tables.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 8015: FIX ui issue

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Bug 8015: The template name is a required field

Test plan:
Try to add a template with an empty string as name.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 22:50:11 +00:00
7362776897 Bug 8015: (follow-up) fix various issues (squashed patch)
Bug 8015: Fix template capitalization amd other template issues

Signed-off-by: Leila <koha.aixmarseille@gmail.com>

Bug 8015: Fix error where field object is returned instead of field value for fields without subfields

Signed-off-by: Leila <koha.aixmarseille@gmail.com>

Bug 8015: Fix bad ordering on function parameters

Signed-off-by: Leila <koha.aixmarseille@gmail.com>

Bug 8015: Escape escape characters for strings

Signed-off-by: Leila <koha.aixmarseille@gmail.com>

Bug 8015: Fix bad parameter list for direct external call to update_field

Signed-off-by: Leila <koha.aixmarseille@gmail.com>

Bug 8015: Fix problem with moving existing subfield value to nonexistent field/subfield

Signed-off-by: Leila <koha.aixmarseille@gmail.com>

Bug 8015: FIX QA issues

This patch fixes some stuffs failing qa tests: POD, indentation (tabs),
perlcritic

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 22:49:45 +00:00
622430cfb5 Bug 8015: Add MARC Modifications Templates
The MARC Modification Templates system gives Koha users
the power to make alterations to MARC records automatically
while staging MARC records for import.

This tool is useful for altering MARC records from
various venders work with your MARC framework.

The system essentially allows one to create a basic script
using actions to Copy, Move, Add, Update and Delete fields.

Each action can also have an optional condition to check
the value or existance of another field.

The Copy & Move actions also support Regular Expressions,
which can be used to automatically modify field values during the
copy/move. An example would be to strip out the '$' character
in field 020$c.

Furthermore, the value for an update can include variables
that change each time the template is used. Currently,
the system supports two variables, __BRANCHCODE__ which
is replaced with the branchcode of the library currently
using the template, and __CURRENTDATE__ which is replaced
with the current date in ISO format ( YYYY-MM-DD ).

At its simplist, it can perform functions such as:
Copy field 092$a to 952$c
At its most complex it can run actions like:
Copy field 020$c to 020$c using RegEx s/\$// if 020$c equals RegEx m/^\$/

Signed-off-by: Leila <koha.aixmarseille@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-31 22:47:08 +00:00
c767545119 Bug 10078: show location facet regardless of singleBranchMode setting
Currently, the location facet only shows if you have singlebranch
mode enabled. In other words, you can either see the library branch
or the shelving location.

This patch simply changes the location facet so that it will always
show the shelving location (if one is available), regardless of the
singlebranch system preference.

Test Plan:

BEFORE APPLYING:

0) Disable singlebranch mode if it is on
1) Do an OPAC or Staff Client search for a record that has items with
shelving locations.
2) Note that you can see the library branch facet under Libraries
but no shelving locations.
3) Enable singlebranch mode
4) Repeat your search
5) Note that you can no longer see the library branch facet under
Libraries. However, you can see the shelving location under Location

N.B. If you don't have more than one branch or the search results
are all from one branch, you might not get a library branch facet.

If this is the case, create additional branches and/or change the
branch for items in your search results so that you have multiple
branches to prompt the appearance of a library branch facet.

AFTER APPLYING

1) Do an OPAC or Staff Client search for a record that has items with
shelving locations.
2) Note that you see a facet under Location on the left sidebar,
regardless of there being a singlebranch mode or the number of branches
there are being represented in the search results.

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passes koha-qa.pl, works as advertised.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-30 05:00:20 +00:00