Commit graph

94 commits

Author SHA1 Message Date
23aa986612 Bug 20305: Remove warnings from tools scripts
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-05-07 11:55:23 -03:00
d32791b5db Bug 19974: Make MarkLostItemsAsReturned multiple
Given the confusion regarding this behaviour it sounds better to make it
configurable.
This pref will take 4 different values, 1 per place an item can be
marked as lost.

Test plan:
Mark items as lost and confirm the item is returned or not, depending on
the value of the system preference.

- from the longoverdue cronjob (--mark-returned takes precedence if set)
- from the batch item modification tool
- when cataloguing an item
- from the items tab of the catalog module

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-20 11:57:31 -03:00
83b364ec56 Bug 20462: Ensure batch item deletion will not delete the same item twice
This has been done on bug 9509 when barcodes are scaned, but not when using a text file.

Test plan (stolen from Barton on the bug report):
1) Create a text file containing duplicate barcodes

Here's a quick way to do that, substitute INSTANCE for the instance name of your test server:

sudo koha-mysql INSTANCE <<< "select barcode from items where barcode is not null limit 3" | sed '1d;p' > /tmp/dup_barcodes.txt

2) Go to Home › Tools › Batch item deletion
3) Click 'Choose File', select the file you created in step 1.
4) Click 'Continue'
5) Note that duplicate items appear in the list of items to batch delete
6) Check 'Delete records if no items remain'
7) This will trigger a software error

Note that entering the barcodes via the 'scan items one by one' text box removes duplicates in the list, so this only causes problems when uploading a file.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-04-02 18:07:44 -03:00
Jenny Way
cad2db6016 Bug 20017: use Modern::Perl in Tools perl scripts
Test plan:
Check that the following files don't contain use strict; use warnings;
and have use Modern::Perl instead.
background-job-progress.pl
batchMod.pl
copy-holidays.pl
exceptionHolidays.pl
holidays.pl
import_borrowers.pl
koha-news.pl
letter.pl
manage-marc-import.pl
newHolidays.pl
overduerules.pl
quotes-upload.pl
quotes.pl
quotes/quotes-upload_ajax.pl
quotes/quotes_ajax.pl
scheduler.pl
stage-marc-import.pl
upload-cover-image.pl

Also the credits have been added to newHolidays.pl

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-05 09:46:45 -03:00
58b6e95763 Bug 12363: Add a switch to mark|do not mark items as returned when lost
There are several ways to mark an item an lost:
- item list view (catalogue/moredetail.pl, "Items" tab)
- cataloguing (cataloguing/additem.pl)
- Batch item modification tools (tools/batchMod.pl)
- The long overdue cronjob (misc/cronjobs/longoverdue.pl)

So far only the cronjob is configurable, the others mark the item as
returned (does the checkin).

This behaviour should be controlable using a syspref, to let libraries
choose what fit best for them.

Test plan:
Use the 2 options of the pref, mark checked out items as lost using the
different possibilities, and confirm that the behaviours make sense to
you

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-10-27 13:57:14 -03:00
bd3b1c1a33 Bug 18262: Koha::Biblio - Remove GetBiblioData - part 1
Most of the time C4::Biblio::GetBiblioData is used to retrieve the title
and/or the author of a bibliographic record.

This patch replaces the easy occurrences of GetBiblioData, the ones
where the 2 joins are needed, but only data from biblio and biblioitems
table are.

Test plan:
It will be hard to test everything, I'd suggest a QAer to review this
patch and confirm that the difference occurrences of GetBiblioData have
been correctly replaced by calling Koha::Biblios->find or
$biblio->bibioitem

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-07-14 12:22:23 -03:00
2b90ea2cb0 Bug 17829: Move GetMember to Koha::Patron
GetMember returned a patron given a borrowernumber, cardnumber or
userid.
All of these 3 attributes are defined as a unique key at the DB level
and so we can use Koha::Patrons->find to replace this subroutine.
Additionaly GetMember set category_type and description.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-07-10 13:14:19 -03:00
0c14a76049 Bug 18277: [QA Follow-up] Additional polishing
Fix POD error in Biblio.pm, as reported by qa tools:
    Apparent command =cut not preceded by blank line

Resolve crash in t/db_dependent/Items/DelItem.t:
  Can't call method "biblio" on an undefined value at C4/Items.pm line 669.

Add find test in tools/batchMod.pl. Increase readability of map statement.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-07-10 13:03:38 -03:00
fa467223ea Bug 18277: Remove GetBiblionumberFromItemnumber - Easy ones
To retrieve a biblionumber from an itemnumber, we can use:
  Koha::Item->biblio->biblionumber

This is only what this patchset does.
Doing that we will be able to get rid of the
C4::Biblio::GetBiblionumberFromItemnumber subroutine.

Test plan:
- Acquisition module: cancel a receipt
- Export a record to CSV
- Modify items in a batch

Item's info should be correct

Other changes with be checked by QA team, by reading the code.

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

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2017-07-10 13:03:37 -03:00
8d5b4306e0 Bug 17835: Replace GetItemTypes with Koha::ItemTypes
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Lari Taskula <lari.taskula@jns.fi>

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2017-04-14 10:43:51 -04:00
3115ac641f Bug 18256: Koha::Items - Remove GetItemsCount
C4::Items::GetItemsCount can be replaced with Koha::Biblio->items->count

Test plan:
Create a bibliographic record with items attached
Try to delete the record from a basket (acquisition module), the detail
page and the batch item deletion tool.

=> You should not be able to delete it.

Remove the items and then try again to delete the record

=> Now you must be able to delete it.

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2017-03-22 19:18:15 +00:00
c840c93835 Bug 15758: Koha::Libraries - Ultimate duel for C4::Branch
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-09-08 14:36:04 +00:00
9b9803b69c Bug 15758: Koha::Libraries - Remove GetBranchesLoop
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-09-08 14:36:02 +00:00
Barton Chittenden
c02b33e425 bug 14504: (QA followup) fixing DelItemCheck arguments
Remove $dbh as argument to C4::Items::DelItemCheck
and C4::Items::ItemSafeToDelete, also change all
calls to these functions throughout the codebase.

Also remove remaining reference to 'do_not_commit' in
t/db_dependent/Items_DelItemCheck.t

Fixed doubled "$$" in C4/ImportBatch.pm

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-08-26 12:07:26 +00:00
6b2c55ecdd Bug 11490: Split MaxItemsForBatch into 2 prefs to clarify things
Prior to this patch, a single pref (MaxItemsForBatch) was used to
restrict the use of the batch item modification and deletion.

On the batch modification tool, the pref is used to limit the number of
items a librarian is allowed to modify in a batch, but on the batch
deletion tool the pref is used to limit the number of items to display.

To clarify things, this patch split the pref into 2 new prefs:
MaxItemsToDisplayForBatchDel and MaxItemsToProcessForBatchMod.

Later we could add a MaxItemsToProcessForBatchDel if needed.
Note that this patch should not introduce any changes in the current behaviors.

Test plan:
0/ Do not execute the update DB entry
1/ Set a value != 1000 for MaxItemsForBatch
2/ Execute the update DB entry and confirm that the 2 new prefs are
initially set with the value of MaxItemsForBatch and that
MaxItemsForBatch has been deleted
3/ Set different values for these 2 prefs (2 and 3 for instance to ease
the next steps)
4/ Try to delete less than MaxItemsToDisplayForBatchDel items
=> You must see the items details
5/ Try to delete more than MaxItemsToDisplayForBatchDel items
=> You must not see the items details but are allowed to delete them
6/ Try to modify less than MaxItemsToProcessForBatchMod items
=> You must see the items details
7/ Try to modify more than MaxItemsToProcessForBatchMod items
=> You must be restricted and not allowed to process

Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-06-24 11:50:27 +00:00
66aacace08 Bug 16154: CGI->multi_param - Declare a list
This patch replaces the occurrences of
  my @foo = $cgi->param('foo');
with
  my @foo = $cgi->multi_param('foo');

perl -p -i -e
's/^(\s*my\s*@\w+\s*=\s*)\$(cgi|input|query)\->param\(/$1\$$2\->multi_param\(/xms'
**/*.pl

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
2016-04-26 23:16:42 +00:00
1307f26bd1 Bug 5404: Move the test to a new IsMarcStructureInternal sub
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
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
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
dc6bc14fc9 Bug 15021: Fix scoping variable in tools/batchMod.pl
$tagslib is used in subroutines and should be declare as global.

Test plan:
On the Batch item modification page, all item fields should be listed, not only the title.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-23 10:10:15 -03:00
02492bd6ea Bug 15005: Replace $ENV{SCRIPT_NAME} with the hardcoded script paths
Since I don't manage to make SCRIPT_NAME works directly with RequestHeader and/or
ReverseProxyPath, the easier way it to fix all the different occurrences.

Test plan:
On the import patrons page, confirm that the "Import" button does not redirect to a 'Not found' page.
You should stay on the import patrons page.

Note that if this change works, all others should work too.
Have a look at the diff of this patch and confirm there is no typo.

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

Tested in patron import and item batch modification

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-19 09:36:43 -03:00
d1cd0bff64 Bug 14950: Remove unused variable $today_iso
This variable is not used anymore in the template (and has never been
used...).

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-06 10:27:56 -03:00
Marc Véron
d17cb79309 Bug 14950: Assign default value for YYYY, MM and DD
[was Remove C4::Dates from tools/batchMod.pl]

This patch replace the YYYY, MM and DD if defined in the default values.

This patch also removes C4::Dates from tools/batchMod.pl

To test:

- In MARC bibliographic Default framework, define a default value
  for one of the in Tag 952 Subfield struture, e.g. for
  subfield x Non-public note. You can define it under
  'Advancde constraints'. Define the value similar to the following:
  Year:YYYY Month:MM Day:DD
- Got to Home > Tools > Batch item modification
- Enter one ore more barcodes you want to modify
- Check checkbox 'Populate fields with defautl values from defautl framework
- Click 'Continue'
- Verify on the follwing screen that the field in Edit form is populated
  as appropriate (in our example 'x - Non public note')
- Click 'Save'
- Verify that the items are updated as appropriate

Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended commit message: This is a bug fix and can be backported. The
YYYY, MM and DD were not replaced correctly before this patch.
I got Year:2015-10-06 Month: Day:
now I correctly get Year: 2015 Month: 10 Day: 06
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-10-06 10:27:39 -03:00
ca268ad877 Bug 12311: Do not return a lost item if modified in a batch
If a item is lost and issued, and you modify it in a batch, the item
will be marked as returned. It should only be returned if the item is
marked as lost.

Test plan:
1/ Check an item out and mark it as lost
2/ Edit it in a batch (tools/batchMod.pl) and edit a field (notes for
instance)
3/ The item should still be issued to the patron
4/ Edit it in a batch and edit the lost value, marked it as not lost
5/ The item should still be issued to the patron
6/ Edit it in a batch and edit the lost value, marked it as lost
7/ The item should have been returned.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Just one comment, lost status can be changed only if you change default framework to another framework then edit the item. If you change it in Item menu at left side of screen this will remove the item from patron’s checkouts and patron charged for lost item.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
For testing purposes the lost item field can be set to visible
in the framework used. That will allow changing it without
returning it at the same time.
The other option is using the longoverdues.pl script.
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
2015-10-02 11:04:59 -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
ff5996d65e Bug 10480: Use the framework plugin object in cataloguing
This patch implements the use of Koha::FrameworkPlugin in Cataloguing,
Authorities, Acquisition, Serials and Tools.

The main change is architectural: see the commit message of the previous
patch. No changes in behavior are expected, but the support of new events
may provide additional functionality in the future. Some small bugs are
resolved along the way.

The change primarily focuses on the MARC and items editor in Cataloguing.
But the MARC editor for Authorities and the item editor in Acquisition,
Serials and Tools are touched too. This commit message gives some comments
per module.

NOTE FOR CATALOGUING:
A new plugin without popup (or other click event code) now shows the title
No popup when hovering over the tag editor image. The image alerts the
user on a plugin, the title tells about its status. The noclick property
allows for further style modifications in the template. Note that a
follow-up patch will clean up the old style plugins too with the same
effect.

Some additional code in cataloging.js makes it possible to clone subfields
with plugins (although only theoretically useful). The clones use the
same javascript functions but event.data contains an updated id.
This effectively resolves bug 13306. Note that if old plugins do not use
the javascript parameter for the id but the perl variable, cloning does
still operate on the wrong field (with and without this patch set).

In the absence of report 12176 in master, it is not yet necessary to modify
additem.tt. When it gets pushed, it should be an easy rebase.
New style item plugins will no longer need an extra parameter. (The code in
the FrameworkPlugin object actually takes care of that.)

NOTE FOR AUTHORITIES:
This patch also adds class name tag_editor to the buttonDot anchors. This
effectively makes the same tag editor image appear as in Cataloguing.
Futhermore it removes the button from the tab sequence if there is no click
event (really effective after conversion to the new style, since the old
style plugins contain empty onclicks and launchers).
Both small adjustments increase consistency between auth and bib edits.

NOTE FOR ACQUISITION:
In Acquisition two scripts use an item editor, but in a different way.
The scripts addorderiso2709 and neworderempty both rely on the routine
PrepareItemrecordDisplay in C4::Items, but neworderempty creates item
blocks dynamically via an ajax call to services/itemrecorddisplay.pl.

In order to make the dynamic item blocks work with plugins, some code
changes were needed in additem.js. (Normally the event binding is done
at document ready time; now it must be done later.)

At this moment the routine in Items.pm contains the html tags, and this
makes changes to the following templates not necessary for now:
* acqui/addorderiso2709.tt
* services/itemrecorddisplay.tt
Report 13397 has been opened to address moving the html to the templates.

NOTE FOR SERIALS:
Script serial-edit relies also on C4::Items (just as in Acquisition).
This makes changes to serials/serials-edit.tt not necessary for now.

NOTE FOR TOOLS:
The current code in tools/batchMod.pl allows the use of plugins for batch
modification of items. This patch just converts that code to use the new
object. Most item plugins however may not be very useful for operating on
multiple items at once.

PERFORMANCE:
I have benchmarked build_tabs in addbiblio to see how especially the
additional processing of the javascript in the FrameworkPlugin object
would impact performance. Testing default MARC21 framework with 8 plugins
gave the following figures:
- Old situation: 851 ms
- New situation: 942 ms (+10,7%)
- New situation after plugin cleanup: 881 ms (+3,4%)
Note also that adding lines for event binding is compensated by removing
lines for unused events. Page load should essentially be the same.

TEST PLAN:
Suggestion: If you also apply the next patch with the EXAMPLE plugin, you
can test with a rather harmless plugin (with popup) on various places :)
But your test should also include old style plugins, with[out] popups.

If you want to test a new plugin without popup, rename/remove Click$id
in the javascript code of the $builder definition (temporarily).

[1] Test Cataloguing:
    - Add/Edit biblio. Try plugins with and without popup.
    - Add/Edit items. (EXAMPLE can be used as an item plugin with popup.)
    - Clone a subfield with plugin (use EXAMPLE): Verify that the plugin
      works on both original and clone with the respective field values.
      Is the value put back in the right field too?
[2] Test Authorities:
    Edit an authority record. Try plugins with an without popup.
[3] Test Acquisition:
    Set system preference AcqCreateItem to "placing an order".
    Check the item editor in the following two places:
    a- addorderiso2709: Open a basket, add an order from a staged file.
       Select a file, click Add orders, and go to tab Item information.
    b- neworderempty: Open a basket, add an order from a new empty record.
[4] Test Serials:
    Check the item editor on serials-edit. Go to subscription detail.
    Click Receive. Choose "Click to add item". (Note that this subscription
    should create an item record when receiving this serial.)
[5] Test Tools:
    Check the item editor for batch item modification. Enter a few valid
    barcodes and press Continue to reach the item editor.

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-16 14:48:36 -03:00
Jonathan Druart
e20270fec4 Bug 11944: use CGI( -utf8 ) everywhere
Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-01-13 13:07:21 -03:00
Jonathan Druart
86a5b39911 Bug 7673: Assume that all fields can be edited if the pref is empty
If the sysprefs are empty, we assume that the librarian can edit all
subfields, even if s/he has the restricted permission.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 12:27:23 -03:00
Jonathan Druart
107e2a0dfb Bug 7673: Change the superlibrarian check
To know if the user is a superlibrarian, we have to call
C4::Context->IsSuperLibrarian

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 12:27:20 -03:00
Jonathan Druart
186ef8b858 Bug 7673: Update permission names in script
Two permission names have been changed since the first patch.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 12:27:17 -03:00
Jonathan Druart
cecdb3f27e Bug 7673: Update syspref names in script
The both syspref names have been changed since the first patch.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 12:27:16 -03:00
Jonathan Druart
4d96568427 Bug 7673: QA Followup: trailing whitespace and perlcritic issues
This patch fixes the following qa issues:

 FAIL   cataloguing/additem.pl
   FAIL   forbidden patterns
        forbidden pattern: trailing space char (line 833)
   FAIL   critic
        # Variables::ProhibitConditionalDeclarations: Got 2 violation(s).

 FAIL   tools/batchMod.pl
   FAIL   critic
        # Variables::ProhibitConditionalDeclarations: Got 2 violation(s).

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 12:27:09 -03:00
Matthias Meusburger
cd0b2e33b3 Bug 7673: New patron permissions
This patch adds the following permissions:

     - editcatalogue.limited_item_edition: Limit item modification to barcode, status and note
     - editcatalogue.delete_all_items: Delete all items at once
     - tools.items_limited_batchmod: Limit batch item modification to item status

    The SubfieldsToAllowForLimitedEdition syspref is used to define which subfields can be edited
    when the editcatalogue.limited_item_edition permission is enabled.

    In the same way, the SubfieldsToAllowForLimitedBatchmod is used to define which subfields
    can be edited when the tools.items_limited_batchmod permission is enabled.

Signed-off-by: Koha Team AMU <koha.aixmarseille@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 12:27:00 -03:00
Bernardo Gonzalez Kriegel
6f10c7bbbc Bug 12180 - Remove HTML from batchMod.pl
This patch removes HTML code from batchMod.pl

To test:
1. Check no regressions on batchMod editor,
Go to Tools > Batch item modification,
put a know barcode on barcode list, press continue

2. Check new line on translation files, update
a language, look for 'Tag editor'

Fixed capitalisation

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>

Amended patch, a stupid mistake on line 198 of batchMod-edit.tt

-                    [% javascript %]
+                    [% mv.javascript %]

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-08-19 09:28:07 -03:00
afd2418d73 Bug 11349: Change .tmpl -> .tt in scripts using templates
Since we switched to Template Toolkit we don't need to stick with the
sufix we used for HTML::Template::Pro.

This patch changes the occurences of '.tmpl' in favour of '.tt'.

To test:
- Apply the patch
- Install koha, and verify that every page can be accesed

Regards
To+

P.S. a followup will remove the glue code.

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-17 11:05:49 -03:00
5cfb693a82 Bug 12151: Remove use of smartmatch operator in tools/batchMod.pl
The '~~' smartmatch operator is used to compare MARC::Field->subfield(code)
(i.e. a string) and the text element of each MARC::Field->subfields() which
is also plain text.

Substituting '~~' for 'eq' should be harmless then.

Regards
To+

Sponsored-by: Universidad Nacional de Cordoba

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes QA script and tests.
Tested batch modification of items, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-07 10:16:54 -03:00
Jonathan Druart
e55d89be20 Bug 11493: Revert "Bug 6869 Batch item modification fails whit accented characters"
This reverts commit c9905750e5.

Test plan:
1/ Open a bib record with more than 1 item ,
2/ Select all items
3/ Chose Modify selected items
4/ put you "ق ك و" in notes
5/ Verify the items have been updated correctly
6/ put you "éàç" in notes
7/ Verify the items have been updated correctly
8/ put you "ق ك و éàç" in notes
9/ Verify the items have been updated correctly

Patch behaves as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Confirmed bug on master and that the patch fixes it.
Passes all tests and the QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-03-12 17:31:28 +00:00
Jonathan Druart
0e8f85a3b3 Bug 11343: The max number of items to process in a batch is hardcoded
Until now, the maximum number of item records to process in a batch was
hardcoded to 1000.
This patch adds a syspref MaxItemsForBatch in order to allow to adapt
this value.

Test plan:
- set the pref to 2
- try to delete a batch of 3 items: they are not displayed
- try to modify a batch of 3 items: you are not allowed to do that
- set the pref to 1000 and try again. Now items are displayed and you
  are allow to modify them.

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2014-03-10 19:10:27 +00:00
Galen Charlton
bb75025364 Bug 7002: fix some invalid superlibrarian permission checks
This patch fixes a problem where if a staff user has superlibrarian
permissions, but also has module-specific permissions, they are
prevent from editing item records that they should be allowed to.

To test:

[1] Turn on IndependentBranches.
[2] Register a superlibrarian staff user at branch A.
[3] Give that new account at least one other module-level
    permission.  This cannot be done through the user interface,
    however, but can be done via SQL:

    UPDATE borrowers SET flags = 3 WHERE userid = 'XXX';

[4] Log in as that new superlibrarian.
[5] Bring up the item details (catalogue/moredetail.pl) page for
    an item at branch B.  Note that there is no 'Edit Item' link.
[6] Similarly, try editing that item (cataloging/additem.pl).  Note
    that the edit form forbids you from touching the item.
[7] Finally, try editing that item using the Tools | Batch item
    modification utility.  Note that it doesn't allow you to do so.
[8] Apply the patch.
[9] Repeat steps 5 through 7.  This time, the item actions should
    be allowed.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, passes QA script and test suite.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-06 05:32:22 +00:00
dcaa3ff704 Bug 10661: format mandatory item fields the same on all forms
Mandatory item fields are not indicated the same way in all places. This
patch corrects two places where required fields were shown in bold
rather than using the standard "required" class: When adding an order
from a staged file and when adding an item for a new issue of a serial.

This patch also normalizes the text input size on item entry forms: In
some places it was 50, others 67. I have changed the latter to 50.

Unrelated changes: Added $KohaDates formatting of date and time and
corrected capitalization on a heading on the add order from staged file
page.

It would be nice to be able to use the same method for displaying the
item form as we use on neworderentry.tt -- pulling in the form from a
separate include. However that system is designed for handling multiple
items and would need to be adapted for these cases.

To test, you must have a staged file from which to add an order. Open an
existing basket or create a new one and choose to add an order "From a
staged file." Choose a staged file from which to order. The item entry
form under the "Import all" heading should show required fields in red.

To test in serials: Begin the process for receiving an item from an
existing subscription. On the serials-edit page, find the "Click to add
item" links and click to open the item edit forms. There should be one
under the numbered issue and the supplemental issue forms. In both cases
the item edit screen should show the mandatory item fields in red.

Confirm that the cataloging add item form looks correct and works
correctly.

Revision: Left out the "required" note which should appear after each
required field.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-10 04:17:48 +00:00
Jonathan Druart
3086788b26 Bug 10601: Add a counter on batch items modifications
After executing a batch items modifications, a dialog is displayed above
the result table. It contains the number of items (and total fields)
which has been modified.

Note that items that are selected for modification but which do not
end up actually be changed are not reported in the final counts.

This patch adds two methiods to C4::BackgroundJob, ->set() and ->get(),
that allow background jobs to pass arbitrary data back to the client.

Test plan:
1/ Go to tools/batchMod.pl
2/ Enter a barcodes list
3/ Check/uncheck items and fill some values to apply
4/ Save
5/ The table summary will be displayed with a dialog box on top:
 XX item(s) modified (with YY fields modified)
Check that XX and YY correspond with what you expected.

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
batch modification still seems to work correctly, with the helpful addition of the counter. Thanks!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-18 17:10:00 +00:00
Jonathan Druart
5ed940b18e Bug 10599: add option to unselect on loan items on the batch item modification tool
Sometimes when using the batch item modification tool, we would like to
automatically uncheck on loan items.

This patch also adds a new routine in C4::Circulation, IsItemIssued(),
which, when passed an itemnumber, returns whether the item is
currently on loan.

Test plan:
1/ Go to tools/batchMod.pl.
2/ Enter some barcode (at least 1 should be on loan).
3/ Click on the Continue button.
4/ Click on the "Clear on loan" link.
5/ Check that on loan items are unchecked.

Launch the unit test file:
prove t/db_dependent/Circulation/IsItemIssued.t

http://bugs.koha-community.org/show_bug.cgi?id=10572
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Works as expected, only modifies items that are checked (still). No regression noted.

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-09-18 16:45:24 +00:00
Meenakshi.R
0005f6bad3 Bug 7639: add option to forgive overdue fines when declaring items lost
This patch adds functionality to forgive overdue fine when an item is
set to lost status.  Fines are forgiven only when the syspref
WhenLostForgiveFine is set to yes. Item can be set to lost status from:

- catalogue/moredetail.pl
- cataloguing/additem.pl
- tools/batchMod.pl
- misc/cronjobs/longoverdue.pl

Changed subroutine C4::Circulation::LostItem to forgive fines on the
item depending on the value of syspref WhenLostForgiveFine. This
routine is currently used to return an item and charge a replacement
cost.

Also added a new syspref in C4::Circulation::LostItem -
WhenLostChargeReplacementFee.  The replacement fee will now be charged
only if this syspref is set to yes.  The default value of the
WhenLostChargeReplacementFee is yes, meaning that current behavior
will not change during upgrade.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Alex Hatley <alexh@cctexas.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Testing notes on last patch in series.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-09-17 15:10:46 +00:00
2d32ab3814 Bug 9533: batch item modification form now shows default field values only by request
This patch makes the pre-population of the fields for the batch
item editor with the default values from the default framework
optional and off by default.

Test Plan:
1) Apply patch
2) Add default values for cost and replacement cost to the
   default framework.
3) Browse to Tools / Batch item modification
4) Choose a file, or entire some barcodes in the text area
5) Ensure that the 'Populate fields with default values from default
   framework' is *not* checked
6) Click 'Continue'
7) Observe that the fields for cost and replacement cost are blank
8) Click the 'back' button on your browser
9) Check the checkbox to enable the default value
10) Click 'Continue'
11) Observe that the fields for cost and replacement cost now contain
    the default values you assigned them in the default MARC framework

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Switch works correctly, all tests and QA script pass.

Note: there is a bug with default values for all non text input
fields. Default values won't be applied for those fields as the
pull downs are not preselected correctly with the default values
defined in the framework.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-07-05 15:52:26 +00:00
Colin Campbell
6c3a28b640 Bug 10291: Clarify misleading variable name
Remove the unrequired extra processing and pass
the array of itemnumbers as itemnumbers_array

Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-06-17 08:55:54 -07: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
11feabf09b Bug 9509 - batchMod.pl does not ensure each barcode is unique
Test plan:
1) Browse to Tools › Batch item deletion
2) Enter a list of barcodes, make sure you have at
   least one barcode listed more than once
3) Click continue
4) Verify the duplicated barcode shows up multiple times in the table
5) Apply patch
6) Refresh the page
7) Verify each barcode now displays only once

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
verified bug and fix - both good.

Nice test plan, thanks!

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-02-05 07:36:13 -05:00
Jonathan Druart
acbfe26c9e Bug 7919 : Display of values depending on the connexion library
In a librairies network, we would like to declare specific values just
for one (or more) library.
Here we implement the ability to associate categories, patron attributes
types and/or authorised_values with librairies (branches).

This patch adds 3 new association tables:
- categories_branches ( association table between categories and branches )
- authorised_values_branches ( association table between
  authorised_values and branches )
- borrower_attribute_types_branches (association table between
  borrower_attribute_types and branches )

Plan test:
  - Create (or modify) categories, patron attributes and
    authorised_values and link it with one (or more) library.
  - Set one of these librairies
  - Go to one of the multiple pages where this specific value must be displayed
    and check that it does appear.
  - Set a library not concerned.
  - Check on the same pages this value is doest not appear.

A page list:
cataloguing/addbiblio.pl
cataloguing/additems.pl
members/members-home.pl
members/memberentry.pl
acqui/neworderempty.pl
tools/modborrowers.pl
and others :)

Please say me if filters don't work on some pages.

Signed-off-by: Delaye Stephane <stephane.delaye@biblibre.com>
Signed-off-by: Koha Team Lyon 3 <koha@univ-lyon3.fr>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Melia Meggs <melia@bywatersolutions.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-12-05 10:10:57 -05:00
Fridolyn SOMERS
2f860e36f6 Bug 7455: Authority subfields are cloned in the wrong field
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Passed-QA-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-11-01 09:50:32 -04:00
Mark Tompsett
2317b233e1 Bug 8861 - Undefined variables in batchMod.pl trigger error logs
Initialized $op, and changed lines like "$op => 1" and
"$error => 1" into separate, conditional template param calls.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-10-19 17:48:32 +02:00