Bug 10115 - Hiding advanced search in Orders search tab removes plus button

The logic of the JavaScript for showing and hiding additional options in
the orders search form wasn't quite right, resulting in the +/- control
being hidden incorrectly.

This patch corrects and simplifies the JS in order to fix the problem.

To test:
 - Open any page in Acquisitions which shows the orders search
   form in the header search bar (for instance, Acquisitions home).
 - Open the orders search tab and click on the "+" to show more
   options.
 - Click the "-" to hide the additional options. The additional options
   should now be hidden and the "+" displayed.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Works as expected
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit f8130fb8486a3bb840d37006ddfbf046cb9b161a)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10107 - opacbookbag shouldn't prevent from adding items to a list in the OPAC

This bug is present in master and (at least 3.8.x, where we spotted it).
The patch makes adding items, to a list from the results page, not rely
only on opacbookbag syspref but also 'virtualshelves'.

Regards
To+

PS: Thanks Graciela Galli for reporting.

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template only patch, works nicely.
Test plan copied from bug report:

- Disable the opacbookbag syspref
- Login in the OPAC
- Create a list (I tested a private one)
- Search in your db for some biblios.
- Choose some and add them to the created list
- Go to your users's page, to the my lists tab
- Your list is empty.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 545573d33318a37e5f58f053acc3a5cf09a9260c)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9659 - Better handling of non-existent authorised value categories used in SQL reports

A user might create a SQL report that relies on non-existent authorised value categories.
Because of a typo, or just because they copy&pasted the report from the Wiki.

Use cases are:

- The user creates a report from SQL
  a) Uses bad authorised values
  b) Clicks 'Save Report'
  c) Koha lists the problematic authorised values
  d) The user decides to
  e-1) Save it anyway, it gets saved
  e-2) Edit the report, it gets back to where it chose 'Save Report'

- The user edits an already saved report (Update SQL)
  a) Uses bad authorised values
  b) Clicks 'Update SQL'
  c) Koha lists the problematic authorised values
  d) The user decides to
  e-1) Save it anyway, it gets saved
  e-2) Edit the report, it gets back to where it chose 'Update SQL'

- The user tries to run a saved report that contains bad authorised values, Koha advertises the problem and provides the user with a button 'Edit SQL' to fix things.

To test, just create a report from SQL using invalid authorised values like this (misspelled 'branch'):

SELECT *
FROM itemtypes
WHERE hola=<<Test branch1|branchee>> AND
      hola2=<<Test branch2|brancha>>

Regards
To+

Notes:
- I added several comments on the code.
- Fixed an annoying warning of uninitialised variable also (refactored some tiny bits to do it).
- Added the following methods
   -  C4::Reports::Guided::GetReservedAuthorisedValues
   -  C4::Reports::Guided::GetParametersFromSQL
   -  C4::Reports::Guided::IsAuthorisedValueValid
   -  C4::Reports::Guided::ValidateSQLParameters
   -  C4::Koha::IsAuthorisedValueCategory
- Those methods could have been used to refactor this guided reports code as its *a bit messy*. I chose to do it in a new bug of course :-D.
- Fixed some trivial perlcritic -5 errors
- Removed some debugging stuff left by mistake
- Fixed some POD problems
- Optimal SQL-driven IsAuthorisedValueCategory method
- Thanks to Owen and Jared for their patience heh.

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Work as described. No koha-qa errors.

Test:
Tried with examples (from help and test plan) reports, correctly
identifies invalid authorized values, and no problem with
authorized ones.

NOTE: Online help for this does not states that partial values
need to be between '%' in a SQLish way. Perhaps this could be
addressed inserting % in values or adding a checkbox (partial|exact).
Or changing help.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit cdc5e11159c6c3dba8ae371094633feb5e64b57d)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9659 - QA Follow up: Unit tests

Added some tests against the methods added by this patch.

To test, prove -v
- t/Koha.t
- t/ReportsGuided.t

Edit: fixed the amount of tests in the skip block. Tests fail for people having earlier versions of DBD::Mock.

Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works quite nicely!
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 6110375307845778f74d6e5a214d63ab69cc5330)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9659: Move new unit test to db-dependent directory

C4::Reports::Guided requires a koha-conf.xml file to be in place in
order to load. This means that any test which uses it has to go in
t/db_dependent

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 1f9145bbbdf020e18a4e0a49652a9cf55f6bed20)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9219 - Show damaged and lost statuses for issues on circulation.pl as they are on moremember.pl

This patch adds the lost and damaged status for an issued item to the
table of issued items on circulation.pl to make it align more closely to
the same table on moremember.pl

Test Plan:
1) Apply patch
2) Issue an item
3) Set the item's damaged status
4) Verify the status is showing near the date due on circulation.pl
5) Clear the damaged status and set the lost status again
6) Repeat step 4

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

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I could only test this with the DAMAGED value, because
currently lost items are removed from the patron account
when you set the status.
I know there is a patch somewhere
to make it optional and the change looks alright.
Passes all tests and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 6385cfd1dc6c0dbceed0064c35f6f86f86e22be2)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Revert "Merge branch 'bug_9812' into 3.12-master"

This reverts commit 761c6213f4d813e7eef00781867521dc1faabead, reversing
changes made to c007557f24d6deff086f4c024f4a5c3dc25d721a.

Reverted at request of author.
Bug 10103 UniqueItemFields is missing from sysprefs.sql

Bug 7892 introduced UniqueItemFields but did not add it to sysprefs.sql.
Also fixes an unrelated  missing semicolon in sysprefs.sql

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit faa93aff62a5bc381134720177918f09987ea61a)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10073: Show ccode or location also if not bound to Authorized Values in XSLT

If you do not have ccode or location governed by authorized value
(you can release this default connection in the marc structure),
these item values are not passed through in the items section,
created by buildKohaItemsNamespace for XSLTParse4Display.

This simple patch checks if the authorized value hash on ccode or
location returns something and passes the original value in otherwise.

Test plan:
Temporarily disconnect ccode and location from authorized values
in MARC structure.
Edit an item, put some values in location and ccode.
Look at this record via opac search (XSLT enabled). Toggle the value of
OPACItemLocation to show ccode or location before call number.
Restore authorized values-connection when applicable.

Note: Since bug 9995 adjusts OPAC XSLT Results, it may be helpful
to apply these
patches when testing this.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
This works as described for the XSLT result list.
The text is shown when OpacItemLocation is set to show collection
or location.

Note: Displaying location and collection without using authorised
values doesn't work in other places like the detail page item table.
So this will need more work to be fully functional.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit ab5c3eccf4a7e874f8b654c199caeeae9a98128f)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10040: Capitalization wrong when deleting subfields from authority

Confirmation message for deleting subfields from an authority framework
has wrong capitalization.

To reproduce:
1) Go to Administration > Authority types
2) Click on MARC structure for one of the authority types
3) Click on the subfields link for one of the fields
4) Delete one of the subfields

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Passed-QA-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 0f2945d768753b92c7014830efc31345d3ce7e87)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9671: Make fines.pl help text more accurate

To test:

run kohaclone/misc/cronjobs/fines.pl --help and note the help text. It should match the settings in System Preferences.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Documentation change, passes all tests.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 109f316efb49287e92f56164f819d2ced03536c1)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9886: ParseLetter removes too often punctuation characters from fields

This patch makes ParseLetter somewhat more restrictive in removing
punctuation characters from the end of a table field.
Based on the assumption that we want to remove punctuation from fields in
biblio and biblioitems (like ISBD).
ParseLetter should not remove e.g. a parenthesis in itemcallnumber, but still
removes e.g. a colon (:) at the end of a title.
Removed an unneeded global and lookahead from the regex.

Test plan:
1) Add a colon (:) to the end of a title.
2) Add a colon to the end of item copynumber.
3) Place a hold on that item. Check it in. Confirm hold.
4) Check the email or print notice generated. There should be no colon at the
end of the title, but the colon in the copynumber should still be there.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I compared checkout notices with lots of different fields before
and after applying the patch. For example the ) at the end of a
field in branches is now longer removed. Other fields looked ok
before and after.
Passes all tests and QA script.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 4b1c71e91a19fcf37e302bba66019807b18cb307)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9659 follow-up: correct syntax for older Perl

A construction that was a syntax error in older versions of Perl was
causing problems for jenkins. This patch fixes it.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 906bf789febd3e97bd23ed2cc1fcf3233bdfba9c)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 9684 : Correct path to compact.xsl

When try to display card view of retrieved record
error occurred as compact.xsl could not be found
script was constructing path as though it was opac

Also added fallback to en version if no xsl file
found under current lang as done in opac-showmarc.pl

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

* Set sys pref to use CCSR
* Do a Z39.50 Search
* Click 'card' on one of the results
* confirm that there is no error.

All test pass

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
I am astonished that opacthemes affects Z39.50 search in
staff so this might be fixing a bigger problem.

Checked that clicking on Card works for both themes now
correctly after I confirmed the bug.
Also all views in OPAC were checked for both themes.

All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 5b6f89714d58d4a7c33b621b2cefbc02523dafa3)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10110: Problems with diacritics in saved SQL reports

Adds decoding for cgi params (for completeness).
Apparently, the NAME attribute of DBI statement handle has a UTF8 bug.
Fixing this by decoding the returned column names.
Did this in a shared routine.

http://bugs.koha-community.org/show_bug.cgi?id=10110
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Copying test plan from bug report:

Example SQL:
select
branchname as "Bibliothek (üöä)",
branchname "Bibiothek (üäa)",
branchname
from branches where branchcode = <<Bibliothekskürzel|branches>>

1) Create report with given example SQL or your own including
   some diacritics in the columnnames
2) Save the report and run it
3) Verify column names are broken before patch, but fixed after..

All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit d050e557f4ac3d7a8b1a0fa573a8ca00aa0862a9)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10110 Followup for Acquisition.pm

Adding a FIXE at a line that uses $sth->{NAME} for possible utf8 problems.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Adds a comment, no danger from that.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 8084a70a3b13a87a516844ee7b7f3665aa8c1e95)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 10093 - Typo in marc21_leader.tt

fixed a typo in marc 21 leader builder about the value 'b', Serial component part

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Good catch.
Template change only.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 9a449ce16ce00d667ff12ec262dc02e973a21cc2)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Add Stefano Bargioni to the history

Welcome, Stefano, you are the 209th developer with a patch in Koha!

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 97596d94982ce8c7ea4f2e8a29f724cb97cc1613)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 2046 - Suggestions: Title Field too small

Increase both on staff and OPAC interface
from 80 to 255 characters to be saved in
the database. Shown will be 80 characters.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Clean patch, workes as described.

To test:
- Apply patch and run database update
- Check that the column in the database is now varchar(255)
- Enter a new suggestion in the OPAC
- Edit this suggestion in staff
- Confirm form has the new max value set
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit 7a5dc6eef546bfa4f9465e9f864bacdefe168cd5)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Bug 2046: Increment version number

Database update for bug 2046 has been given version 3.11.00.203
(cherry picked from commit e1ecd7aa3fa5bbd6423255a4fc6585b946633eb1)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>