Bug 10617 - koha-common init script cleanup

Removed unused stuff, added a new config file /etc/default/koha-common
to control the init script behaviour. Currently is only a stub. The config
file could be put on /etc/sysconfig on RedHat and friends. The init script
should work them too. Added a TODO comment regarding the 'status' switch.

To test:
- Apply the patch on master, build your own packages and install.
- The init script should continue to work as expected.
(it can be tested replacing the /etc/init.d/koha-common file with
debian/koha-common.init on a packages install).
- The absence of the /etc/default/koha-common file should not prevent
the init script from working.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 213fbdc5b40dd7638d652a8fd60f7391d0b10bb1)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10622: add --sip and --nosip switches to koha-list

Just added those switches.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: Magnus Enger <magnus@enger.priv.no>

I applied the patch on my local dev install, and then copied the
patched koha-list script to a couple of servers with actual
instances running off the packages, to test the script.
- It seems that the -h switch did not work before this patch, now
  both -h and --help works nicely
- --sip and --nosip work as expected, also in combination with
  --email and --noemail

The patch does not add --sip and --nosip to the man page for
koha-list, but I will do a followup for that.

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 9f6e739ce0893fe7570adfa7cc2b7407351138ae)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10622 - [SIGNED OFF] Followup: Add --sip, --nosip and --help to man page

The original patch for bug 10622 added the --sip, --nosip and
--help switches to the koha-list command, but did not update the
manpage for the command. This patch does.

To test:

Run these commands and look at the formatted man page:
$ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/manpages/docbook.xsl \
  debian/docs/koha-list.xml
$ man -l koha-list.8

Make sure this test passes:
$ prove -v xt/verify-debian-docbook.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Forgot the docs this time, good catch Magnus

Signed-off-by: Robin Sheat <robin@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 46574c916090a3e7e9ae9157b4053b1d683ac0e3)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10622: (follow-up) uppercase "SIP" in documentation and help text

"SIP" is an acronym and should be capitalized.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 67ad9d28f5477124d2bf30c0dc48d693657461a7)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7813: Ability to delete local cover images

This patch adds the ability to delete local cover images from the
detail page. It adds an 'X' button to trigger the deletion. It occurs
using a new SVC script called cover_images that accepts the following
parameters:

 - action
 - biblionumber (used for checking imagenumber validity)
 - imagenumber (repeatable)

It then deletes all valid images passed and returns a JSON object
containing the imagenumbers and the deletion status (1/0). The operation
is triggered using jQuery.ajax, and with the response the corresponding
images get deleted.

Note: currently one image is deleted at a time, but the code is there to
be used.

To test:
- Open the detail page fr a biblionumber containing one or more cover
  images, go to its images tab.
- Apply the patch, reload the page, go to the images tab.
- Thumbnails should look better than before ;-)
- An 'X' button should show below each cover.
- Clicking the 'X' button should trigger an alert message asking for
  confirmation.
 a) Cancel: nothing happens, reload the page and check nothing got
    deleted.
 b) Accept: the deleted image should be gone, reload the page to check
    it doesn't exist anymore and is not a browser/DOM manipulation trick.
- Signoff

Note: check having more cover images than those that fit the width and
see it wraps fine.

P.S. I chose not to implement every possible action on the svc script, but
another bug could be filled for more improvements.

Sponsored-by: Universidad Nacional de Cordoba
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit ab362b93a710bddcd385a6a468af6ff682673367)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7813: (follow-up) improvements for deleting local cover images

This patch:
- displays a js alert if a problem occurred on deleting the
  image on the server.
- adds a class for the new span (in order to avoid future problem, if
  someone adds a new span).
- adds a title for the [X] link.
- deal with the upload_local_cover_images permission (don't display the
  delete link if the logged in user does not have it).
- changes the license version.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
I like the ehancements to the original patch and work as expected.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 1dc7d421bc87e3cf027161b08fbb44875c778f49)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 7813: (follow-up) use descriptive text for delete link

This patch replaces the "times" symbol for the local cover image
deletion link with more descriptive text.  This was done because
the original "X" was small, is not necessarily going to be universally
understood to signify the deletion action, and because "&times;"
does not give much context to translators.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit fe3628070a7affddb691ee589ec0e63639d0a36a)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10888: Don't hide authorities module from users who lack permission to edit authorities

It should be possible for staff client users to search and view
authority records even if they don't have permission to edit them.

To test, apply the patch and view the staff client as a user with and
without "editauthorities" permission.

With "editauthorities" permission, authority search results should show
both an edit and delete link. Viewing the details of an authority
record, one should see a toolbar with edit/delete/new options.

The detail view has been altered to use the term "record" in place of
"biblio" ("Used in X record(s)).

Without "editauthorities" permission, authority search results should
show no edit or delete link. Viewing the details of an authority, the
only option shown in the toolbar should be "Save."

On the staff client home page and in the header's "More" menu the link
to the authorities module should now appear with and without permission
to edit authorities.

This patch also corrects the permissions in the authority export script
to allow saving of authority records by users who do not have permission
to edit.

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 9bd3a44944e6a0cb7920c3c53a88c11a8986b146)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10305 - _increment_barcode is called twice

For some reason, _increment_barcode is called twice in succession in
cataloguing/additem.pl

Test Plan:
1) Enable autobarcode = incremental
2) Catalog an item, not the barcode
3) Apply this patch
4) Catalog another item, the barcode should be the next in line
   as previously. No change should be noted.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 449fc4e168368cc3b1991152f32a2862b578a04c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10847: Open link to vendor's website in new window

To test:
- Create a new vendor or edit an existing one
- Make sure you have entered a valid URL for the website
- Click the link from the vendor summary page and verify it opens
  in a new window/tab (depending on your browser configuration)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit d67ef01814fb4ba1519d66d9ad749dfa64e62a76)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10465: remove useless reference to fields 780 and 785 in UNIMARC XSLT files

UNIMARCslim2OPACDetail.xsl and UNIMARCslim2intranetDetail.xsl contained
references to 780 and 785 fields, that exist in MARC21 but not in UNIMARC.

This patch remove the code related to 780 and 785 fields. No effect should
be visible.

To test : in a UNIMARC Koha
1. Be sure that OPACXSLTDetailsDisplay, OPACXSLTResultsDisplay,
   XSLTDetailsDisplay and XSLTResultsDisplay sysprefs are set to "default"
2. Apply the patch
3. Search some records in staff interface : the list view and the detail
   view must be exacty the same as before you apply the patch.
4. search some records in OPAC : the list view and the detail view must
   be exactly the same as before you apply the patch.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: No diplay change, no koha-qa errors.
Removes what can't be displayed.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Checked detail pages in OPAC and intranet still display correctly
and without errors.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 54befcf59ed85be0041d72760eb1771bcce0492e)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10911: fix invalid links when displaying records that have 880 fields

Koha intranet search results using XSLT for records with 880 fields have
the details link created by a code path that incorrectly links to some
opac pages.

Test Plan:
1) Enable XSLT for intranet search results
2) Upload or create a record with at least one 880 field
3) Search for the item ( must have multiple hits to avoid redirection )
4) Click the title link, note it is broken
5) Apply this patch
6) Click the title link, note it is correct

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work as described, no koha-qa errors.

Test
1) imported two times sample record
2) reindex
3) search, find example record, broken links
4) applied patch
5) refresh, good links

NOTE: A similar (invalid references) problem is present on
UNIMARC and NORMAC files
I'll file a new bug for those cases.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works nicely, tested with a different set of sample
records with Hebrew 880 fields.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 115a3e6b60cab0e5000483575ca69736bb40ee2c)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10924: fix updating contact note from OPAC

If you update your "Contact note" via the OPAC that change doesn't
appear in the staff client's "Update patron records" interface. The
field is missing from members-update.tt

To test, log in to the OPAC and update your details
(opac-memberentry.pl), modifying the "Contact note" in the "Alternate
address" section.

In the staff client, view "Patrons requesting modifications"
(members/memgers-update.pl). The changed contact note field should
appear in the list of field awaiting approval for that patron.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work as described. No koha-qa errors

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
One line change - contact note now updates perfectly.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4713a27280b9ee0956c4f2d9ee0e63b12260db01)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10803: make "Make payment" in circ easier to translate

To test:
- Choose a patron account
- Add a fine to it
- Switch to the checkout tab of the patron account
- Check for the "Make payment" link. Make is not a link, but payment is.
- Apply patch
- Check again, now both words are linked.

In translation this string is divided into:
. %s Make
payment

Because of this it's difficult to translate it grammatically.
The patch moves 'Make' into the link text, so that both words
will show up together in translation.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Works as described. No koha-qa errors.
Not only improves translatability,
also corrects capitalization.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 39c435e36fec65dbba795214bdde79932bb4edcf)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10687: Delete erroneous tags 68a and 68b on default MARC21 auth framework

This patch deletes information for default
MARC21 auth framework on tags 68a and 68b.
Also added update for current installs.

RM note: The 68a and 68b fields were defined in an attempt to include
both MARC21 classification and MARC21 authority records in the same
default framework, but I don't think this has turned out to be useful,
as to my knowledge nobody tries to use MARC21 classification records
in Koha, and if one were to want to, a distinct record type (or at
least auth_type) would be a better way to do it.

To test with current authorities_normal_marc21.sql loaded

1) apply the patch
2) run updatedatabase
3) check on database that there are no more
references to tags 68a and 68b

To test for new installs
1) remove auth frameworks
2) load authorities_normal_marc21.sql
3) check that load without problem
4) check on database that there are no more
references to tags 68a and 68b

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 15f28461e09cffe2917f424b8b7e84cd722b1246)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10687: (follow-up) remove authority 68a/68b tags from translated MARC21 framework scripts

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit a1c5d280f67a632ab9e1fdd32cf4967c3de6fdd6)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10687: DBRev 3.12.06.001

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10663: (3.12.x followup) Rewrite some calls as unit tests rely on newer API

Some tests fail in t/db_dependent/Circulation.t because of API difference.
This patch is a followup for 3.12.x.

Regards
To+

Sponsored-by: Universidad Nacional de Córdoba
Bug 9299: fix LDAP login breakage when ExtendedPatronAttributes is on

To test:
- Configure an LDAP server and $KOHA_CONF, etc.
- Make sure ExtendedPatronAttributes is defined and that
  there is no attribute defined that is specified to be
  a unique ID.
- Try to log in using an account originating from the
  LDAP directory.
- You will got a software error:
  Can't use an undefined value as an ARRAY reference at
  /home/koha/src/C4/Auth_with_ldap.pm line 183.
- Apply the patch.
- Try to log in again; this time it should work.

Signed-off-by: Nuño López Ansótegui <nunyo@masmedios.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 4d75243e27cab93cd84ee6bbfd71362326569c21)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Bug 10925: fix LDAP auth failing if DEBUG is enabled

To reproduce:
1/ Edit your apache virtual host and set the DEBUG environment variable
(SetEnv DEBUG 1).
2/ Try to login with an ldap user
3/ You will be redirected to the 500 error page.
The Koha logs contains:
malformed header from script. Bad header=------------------------------: mainpage.pl

The hashdump routine directly prints to STDOUT (!) and breaks the
headers.
It appears Net::LDAP::?->dump does the same thing.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Maybe we can kill C4::Utils after getting rid of this

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 561107bb5b348eaa14054e3470f39ff9cf080d22)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>