Commit graph

4 commits

Author SHA1 Message Date
b8a18702d2
Bug 30840: Add support for barcode filters to course reserves
This bug adds support for barcode filters on the inputs in the course reserves module.

To test:
1 - Set itemBarcodeInputFilter to 'Remove spaces from'
2 - Find a barcode in your system and add spaces between each characters
    e.g. 3 9 9 9 9 0 0 0 0 0 0 8 1 8
3 - Past that barcode into the checkin box, success
4 - Browse to course reserves, ensure you have a course or create on
5 - Test adding a reserve, batch adding a reserve, and batch removing reserves
6 - The pasted barcode does not in any
7 - Apply patch and restart
8 - Pasted barcode with spaces can now successfuly be added, batch added, and batch removed from courses

Signed-off-by: Jason Robb <jrobb@sekls.org>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-06-02 14:07:21 -03:00
9d6d641d1f Bug 17600: Standardize our EXPORT_OK
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:47 +02:00
f8b80abbd0 Bug 25898: Fix new occurrences
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-10-15 13:56:41 +02:00
Joseph Sikowitz
3bf7430d1c Bug 14648: Batch remove reserve items
Adds "Batch remove items" button to course-reserves.tt. Creates batch_rm_items.pl and batch_rm_items.tt. Allows user to enter a list of
barcode numbers so that they will be removed from all course reserves to which they are attached. A dialog box will provide a warning
before the final deletion is made.

This patch also now moves barcodes that are invalid or not attached to a course reserve to the invalid barcodes output. It also provides
a count of the courses that the deleted items were attached to.

Test Plan
1. Log in as a user with permissions to add and delete course reserves
2. Add the same items to multiple course reserves
3. Go to the main course reserves page (i.e. /cgi-bin/koha/course_reserves/course-reserves.pl)
4. Click the "- Batch remove items" button
5. Enter the barcodes that you added to multiple reserves in step 1
6. Click submit
7. Click Ok if you are ready to delete all of these items
8. Check each course reserve that you added the items to in step 1 to make sure the items you entered were deleted but nothing else
9. Repeat 2-5
10. Add an invalid barcode and a valid barcode that is not attached to a course reserve
11. Repeat 6-7
12. You should see that the items attached to course reserves were removed while the invalid and unattached barcodes were rejected
13. Log out
14. Log in as a user without permission to delete course reserves
15. Go to the main course reserves page (i.e. /cgi-bin/koha/course_reserves/course-reserves.pl)
16. You should not longer see the "- Batch remove items" button

Signed-off-by: David Nind <david@davidnind.com>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2020-10-01 10:33:10 +02:00