Commit Graph

3108 Commits

Author SHA1 Message Date
Koha Development Team d659526b5a
Bug 38664: Tidy the whole codebase
This commit is generated using:
  % perl misc/devel/tidy.pl
*within* ktd, to get the same version of perltidy than what will be used
by our CI (currently v20230309).

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:24 +01:00
Jonathan Druart a3c5620cc6
Bug 38664: The tidy script: remove blank line after SWITCH
The prettier plugin does not deal correctly with SWITCH
https://gitlab.com/koha-community/prettier-plugin-template-toolkit/-/issues/2

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:22 +01:00
Jonathan Druart 616102740a
Bug 38664: The tidy script - Implement --no-write and --silent
To ease comparisons, from the QA script

Bug 38664: Fix perltidyrc option

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:22 +01:00
Jonathan Druart 287cb328bc
Bug 38664: Move prettier options to .prettierrc.js
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:20 +01:00
Jonathan Druart c531081d86
Bug 38664: The auto-rebase script - use misc/devel/tidy.pl from the target branch
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:20 +01:00
Jonathan Druart 54cbdcc951
Bug 38664: Revert "Bug 38664: WIP trim msgid"
This reverts commit c54b476d80961f7d81f23c6be686309fed7ecbbc.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:18 +01:00
Jonathan Druart c00809a1c2
Bug 38664: WIP trim msgid
* Test the translation process
    * Confirm that the changes make sense
```
-                    <option value="r" selected="selected">Remote-sensing image</option>
+                    <option value="r" selected="selected">
+                        Remote-sensing image
+                    </option>
```
=> Generate
```
+#: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_007.tt:89
+#, fuzzy, c-format
+msgid "Remote-sensing image "
+msgstr "Image de télédétection"
```

Added a "trim" commit, and it actually fixes some problem with the current script:
```
+#. For the first occurrence,
 #. SCRIPT
-#: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_007.tt:114
+#: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_007.tt:139
 msgid "b- Large print"
 msgstr "b- Gros caractères"

-#. SCRIPT
-#: koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_007.tt:114
-msgid "b- Large print "
-msgstr "b- Gros caractères "
```
Is that enough?

OR we modify prettier's default behaviour: https://prettier.io/docs/en/options.html#html-whitespace-sensitivity

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:18 +01:00
Jonathan Druart ba83aa61b4
Bug 38664: The auto-rebase script - Remove the dependency IPC::System::Simple
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:16 +01:00
Jonathan Druart 675ff64ef7
Bug 38664: The tidy script - Remove the dependency IPC::System::Simple
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:15 +01:00
Jonathan Druart ba1aafe9e5
Bug 38664: The tidy script - Fix extra blank lines and spaces around script tags
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:14 +01:00
Jonathan Druart 955521be23
Bug 38664: The tidy script - Add exceptions
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:14 +01:00
Jonathan Druart 745da164ad
Bug 38664: The tidy script - fix race condition - replace edit_file
It seems that File::Slurp::edit_file is not thread safe?
Not sure what's happening here but I end up with corrupted file, or
getting the same error "write_file: No such file or directory"

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:13 +01:00
Jonathan Druart 4a7a8fbef1
Bug 38664: The tidy script - fix race condition
There was a race condition, edit_file trying to open it while it was not
fully written by prettier (?) This is a dirty fix but it seems to do the
trick.

The error was:
edit_file 'koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc' - write_file: No such file or directory at misc/devel/tidy.pl line 149.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:13 +01:00
Jonathan Druart 0cdaf9935f
Bug 38664: The tidy script - tidy tt twice
For an unknown reason the script is not idempotent (!)
Decided to run it twice for now, and have a look at this problem later.
It might be related to the length of the line

Version 0

<div>
    <div class="page-section clearfix">
        <div class="listgroup">
            <h4>
                <span>Statuses</span>
                [% IF foo %]
                    [% IF ( ITEM_DAT.withdrawn ) %]<span>Withdrawn</span>[% END %]
                    [% IF ITEM_DAT.bookable == 1 %] Yes [% ELSIF ITEM_DAT.bookable == 0 %] No [% ELSE %] Follow item type [% END %]

                    [% IF ITEM_DAT.bookable == 1 %] [% t('Yes') %] [% ELSIF ITEM_DAT.bookable == 0 %] [% t('No') %] [% ELSE %] [% t('Follow item type') %] [% END %]
                [% END %]
            </h4>
        </div>
    </div>
</div>

Version 1
<div>
    <div class="page-section clearfix">
        <div class="listgroup">
            <h4>
                <span>Statuses</span>
                [% IF foo %]
                    [% IF ( ITEM_DAT.withdrawn ) %]<span
                        >Withdrawn</span
                    >[% END %]
                    [% IF ITEM_DAT.bookable == 1 %]Yes[% ELSIF ITEM_DAT.bookable == 0 %]No[% ELSE %]Follow
                    item type[% END %]

                    [% IF ITEM_DAT.bookable == 1 %][% t('Yes') %][% ELSIF ITEM_DAT.bookable == 0 %][% t('No') %][% ELSE %][% t('Follow item type') %][% END %]
                [% END %]
            </h4>
        </div>
    </div>
</div>

Version 2
div>
    <div class="page-section clearfix">
        <div class="listgroup">
            <h4>
                <span>Statuses</span>
                [% IF foo %]
                    [% IF ( ITEM_DAT.withdrawn ) %]
                        <span>Withdrawn</span>
                    [% END %]
                    [% IF ITEM_DAT.bookable == 1 %]
                        Yes
                    [% ELSIF ITEM_DAT.bookable == 0 %]
                        No
                    [% ELSE %]
                        Follow item type
                    [% END %]

                    [% IF ITEM_DAT.bookable == 1 %][% t('Yes') %][% ELSIF ITEM_DAT.bookable == 0 %][% t('No') %][% ELSE %][% t('Follow item type') %][% END %]
                [% END %]
            </h4>
        </div>
    </div>
</div>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:12 +01:00
Jonathan Druart 2c6f9d31b6
Bug 38664: The tidy script
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:12 +01:00
Jonathan Druart a9c0a70f67
Bug 38664: The auto-rebase script
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:11 +01:00
Matt Blenkinsop 3d3ccd4624
Bug 30300: (QA follow-up) Move logic to queue_notice
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-03 14:26:54 +01:00
Matt Blenkinsop ae68d05b59
Bug 30300: Update the cronjob to respect patron messaging preferences
Test plan:
1) Apply patch and run updatedatabase
2) In system preferences set MembershipExpiryDaysNotice to 5
3) Choose a patron and edit their expiry date to today's date
4) Ensure that patron has a primary email address
5) Run perl misc/cronjobs/membership_expiry.pl -c -v -before 10 -after 10
6) Check the patron's messages, there should be no expiry notice queued
7) Edit the patron's messaging preferences and select the checkbox for email in the row for 'Patron expiry'
8) Repeat step 5
9) There should be a patron expiry message in the patron's message queue
10) Sign off!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-03 14:26:54 +01:00
Nicolas Hunstein d8c5e63ec7
Bug 31270: Terminology - use "self-registration"
Standardize on the use of "self-registration" (and variations)
for consistency in the OPAC and staff interface, instead of
"self registration".

Test plan:
1. Check the codebase for occurences of "self reg":
   . git grep "self reg"
   . git grep "selfreg"
   . git grep "Self reg"
   . git grep "Selfreg"
2. Note the occurences, excluding code comments, previous
   database updates, and previous release notes.
3. Search the system preferences for "self reg" and "selfreg".
4. Note the occurences in the results for the system preference
   descriptions (excluding system preference names) for:
   - PatronSelfRegistrationDefaultCategory
   - PatronSelfRegistrationEmailMustBeUnique
   - PatronSelfRegistrationLibraryList
   - PatronSelfRegistrationPrefillForm
5. Note the system preferences category heading for the OPAC
   - "Self registration and modification".
6. Apply the patch.
7. Repeat steps 1 to 5. There should now be no occurences
   (excluding code comments, previous database updates, and
   previous release notes).

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-31 15:57:36 +01:00
Jonathan Druart 3a5d8d51ca
Bug 38900: Provide info about the problematic strings
The translation script explodes without meaningful error when
"incorrect" structure is found (edit)

Found when working on bug 38714, the translation script can break with
an error that does not directly point to the problematic string

[13:00:23] Error: Command failed: misc/translator/xgettext.pl --charset=UTF-8 -F -o /tmp/koha-2rwDEm/Koha-opac-bootstrap.pot -f /tmp/koha-2rwDEm/files
Can't use an undefined value as a HASH reference at misc/translator/xgettext.pl line 131.

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess.emit (node:domain:552:15)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)
    at Process.callbackTrampoline (node:internal/async_hooks:128:17)
[13:00:23] 'po:update' errored after 992 ms

Test plan:
0. Use main and confirm that `gulp po:update --lang LANG` returns
   successfully
1. Apply the first patch
=> The error is
Can't use an undefined value as a HASH reference at misc/translator/xgettext.pl line 131, <$INPUT> line 80.
2. Apply this patch
=> The error is now:
Incorrect structure found at ./koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt:230: '<option value="*" ' at misc/translator/xgettext.pl line 124, <$INPUT> line 100.

Which is way more interesting to fix the problem as we know exactly
where the problem comes from

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-30 18:55:20 +01:00
Jonathan Druart c26a989c64
Bug 38104: Always update when hea cronjob is run
If the cronjob is configured to run every month we don't need to add
another test on the delay in the script itself.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-24 16:14:31 +01:00
phette23 97c2437bb3
Bug 29238: Cataloging cron jobs are not logged
Testing plan:

1. set CronjobLog to "Log"
2. Run the three cron jobs
   `perl misc/link_bibs_to_authorities.pl; perl misc/cronjobs/merge_authorities.pl -b; perl misc/migration_tools/remove_unused_authorities.pl --confirm`
3. Visit the log viewer /cgi-bin/koha/tools/viewlog.pl, select the "Cron jobs" module, & note it's empty
4. apply the patch
5. Repeat steps 2 & 3 but note the cron logs aren't empty

squash

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

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-24 16:14:30 +01:00
Andrew Fuerste Henry 562dd9e2c9
Bug 38894: Use HomeOrHoldingBranch with longoverdue cronjob
To test:
1: Add 4 items, 2 with homebranch = Library A and 2 with homebranch = Library B
2: Logged into Library A, check out 1 Library A item and 1 Library B item, both with due dates in the past enough for the longoverdue cron
3: Set yourself to Library B, check out 1 Library A item and 1 Library B item, both with due dates in the past enough for the longoverdue cron
4: Run longoverdue cron with --verbose, without --confirm, and without --Library. see that it would act on all 4 items
5: Set CircControl to "the library the item is from"
6: Set HomeOrHoldingBranch to "the item's home library"
7: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
8: See the cron wants to act on the items with homebranch = A
9: Set HomeOrHoldingBranch to "the item's holding library"
10: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
11: See the cron is still trying to act on the two items with homebranch = A
12: Apply patch, restart all
13: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
14: See the cron is now trying to act on the two items with holdingbranch = A
15: Set HomeOrHoldingBranch to "the item's home library"
16: Run longoverdue cron with --verbose and --library="A" (where A is the code for your Library A), wihout --confirm
17: See the cron wants to act on the items with homebranch = A

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-24 12:02:14 +01:00
Kyle M Hall 576621a6df
Bug 37448: Add script to allow developers to quickly generate large amounts of data for development and testing
Test Plan:
1) Apply this patch
2) Run: misc/devel/create_test_data.pl -n 99 -s Borrower -d surname=Hall  -d zipcode=111111
3) Search patrons' for the name "Hall"
4) Note there are 99 Hall's in your results!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Bug 37448: Make use of build_sample_biblio and build_sample_item

The script is brilliant, but for biblios and items we should make use of build_sample_biblio and build_sample_item or this data does not get indexed + linked tables rows get missed

To test, before this patch, run:
1) misc/devel/create_test_data.pl -n 5 -s Biblio -d title=Test
  Notice the 'Test' biblio is created on the database, but doesnt show on searches, and accessing it directly through URL throws a 500 error (because metadata does not exist for the biblio)
2) Apply this patch. Repeat the step above. Notice it now shows on searches and visiting the biblio directly shows no errors

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

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

Bug 37448: (QA follow-up) Tidy script

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-10 19:19:26 +01:00
Martin Renvoize 9e894ee790
Bug 38857: (QA follow-up) Fix perltidy errors
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-10 19:19:23 +01:00
Nick Clemens ed04d5b0fa
Bug 38857: Update cronjobs to log run before processing parameters
A few notes:
- I grabbed this list by looking for things in misc/ that had cronlogaction
- I didn't touch scripts that aren't in the cronjobs directory, except
  fix_invalid_dates where I follow import_patrons and only log if confirmed
  since they aren't crons, I figure this seems reasonable
- purge_suggestions I moved the logggin up and changed the addition of
  effective days to a verbose message - this seems more consistent

To test:
 1 - Enable CronjobLog
 2 - On command line:
     perl misc/cronjobs/cleanup_database.pl --old_reservers 550
 3 - Error on command line
 4 - In staff client, go to Tools->Log viewer, check 'Cronjobs' and submit
 5 - No entries
 6 - Apply patch
 7 - Repeat and see run is logged with wrong parameter
 8 - Fix parameter and confirm
 9 - Spot check other files until you are satisfied
10 - Sign it off!

Signed-off-by: William Lavoie <william.lavoie@inLibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-10 19:19:23 +01:00
Kyle M Hall 7fb78e4a5d
Bug 22415: (QA follow-up) Fix misc qa issues
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-10 19:19:14 +01:00
Martin Renvoize 7f6c186831
Bug 22415: Update EDI to use Koha::Logger
This patch updates the EDI code to use the Koha::Logger wrapper in
preference to the bare Log::Log4perl module.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-01-10 19:19:13 +01:00
Pedro Amorim 7834d25fb4
Bug 36039: (QA follow-up): Improve audit messages
Improve messages clarity.
Show success message if no schema diff was found from audit.
Code refactor to ensure the title+message shown in UI is the same as the one shown in CLI and are all translatable.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-27 15:19:05 +01:00
Martin Renvoize 534fba2691
Bug 36039: (follow-up) Move view logic to script/template
This patch updates the module as suggested by David to handle just the
diff code and leaves the display logic up to the templates and script.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: JesseM <jesse@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-27 15:19:04 +01:00
Pedro Amorim 09bb85409d
Bug 36039: Move audit_database script logic to a dedicated module
Test plan #1 ensure same script functionality (same as bug 34064):
0. Apply patch
1. vi ./installer/data/mysql/kohastructure.sql
2. Comment out some columns, change NULL status, or whatever you like
3. perl misc/maintenance/audit_database.pl \
    --filename /kohadevbox/koha/installer/data/mysql/kohastructure.sql
4. Note that the output includes SQL commands to change the database
to match the new kohastructure.sql

5a. Try using koha-foreach and note that the database name appears above
the database comparison
5b. koha-foreach "perl misc/maintenance/audit_database.pl \
    --filename /kohadevbox/koha/installer/data/mysql/kohastructure.sql"

Test plan #2:
1. After doing test plan #1, access the new 'database audit' tab, visit:
<staff_url>/cgi-bin/koha/about.pl?tab=database
2. Ensure the output is the same as test plan #1

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: JesseM <jesse@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-27 15:19:03 +01:00
Tomas Cohen Arazi 18c3e26db4
Bug 38386: Make compare_es_to_db.pl not retrieve the records from ES
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-23 12:20:39 +01:00
Tomas Cohen Arazi f50978c256
Bug 38726: (follow-up) Some more {Mm}arc ordering cases
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-23 12:20:36 +01:00
Nick Clemens e758492d99
Bug 38382: Fresh connection when connexion CSRF token expires
This patch simply generates a new user agent when reauthenticating when the CSRF token
for the session has expired.

To test:
1 - Edit Koha/Token.pm, line 275
from:    { MaxAge => $params->{MaxAge} // ( CSRF_EXPIRY_HOURS * 3600 ) },
to:      { MaxAge => $params->{MaxAge} // ( CSRF_EXPIRY_HOURS ) },
2 - This will make your CSRF tokens expire after 8 seconds
3 - vim /etc/koha/sites/kohadev/connexion.cnf
4 - Set content:
    host:
    port: 8888
    koha:http://localhost:8081
    log:/var/log/koha/kohadev/connexion.log
    match:ISBN
    user:kohauser
    password:kohapass
    overlay_action:replace
    nomatch_action:create_new
    item_action:always_add
    import_mode:direct
    framework:BKS
    overlay_framework:
    debug:1
5 - Save the sample file from this bug into your kohaclone (or copy and paste into a file your koha test site can reach)
6 - On the command line:
    perl misc/bin/connexion_import_daemon.pl -c /etc/koha/sites/kohadev/connexion.cnf
7 - In another terminal:
    cat bug_33418.test  | nc -v localhost 8888
8 - Successful request
9 - Wait 10 seconds (more than 8 anyways)
10 - Repeat 7
11 - Unsuccessful request - Invalid CSRF token
12 - Ctrl+C to stop the connexion daemon
13 - Apply patch
14 - repeat 6
15 - repeat 7, success
16 - Wait more than 8 seconds
17 - repeat 7, success!
18 - repeat again until you are satisfied
19 - Sign off!

WNC amended and tidied

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-20 18:33:25 +01:00
Katrin Fischer 66e186e3f8
24.11.00: Add missing manual contributors to release notes
This is a late addition due to problems with the release notes
script at time of release.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-12-03 14:36:23 +01:00
Katrin Fischer 7b617ebceb
24.11.00: Add release notes
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-25 20:38:56 +01:00
Alex Buckley 438c62e8f1
Bug 36766: (follow-up) Set ReplytoDefault as the preferred from_address of sftp_file.pl
Default to KohaAdminEmailAddress if ReplytoDefault is not set

Test plan:
1. Enter a valid email address into ReplytoDefault and
   KohaAdminEmailAddress sysprefs

2. Apply patch and restart services

3. Generate a file on your Koha server. Place it in /tmp/test.mrc

4. Manually connect to the SFTP remote host and accept the hostkey

5. Enter Koha shell

6. Run the sftp_file.pl command-line script
./sftp_file.pl --host <your remote hostname> --user <your user> --pass <your password> --upload_dir <your upload directory> --file /tmp/test.mrc --email <your email>

7. Confirm the SFTP was successful

8. Confirm that the email that you received has a from address matching the
   ReplytoDefault syspref

9. Empty out the ReplytoDefault syspref and repeat steps 5 and 6

10. Confirm that the new email you received has a from address matching
    the KohaAdminEmailAddress syspref

Sponsored-by: Catalyst IT
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-22 10:22:37 +01:00
Matthias Meusburger 4bfb4da587
Bug 35659: (QA follow-up) Fix DateTime and cronlogaction messages
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-19 16:59:55 +01:00
Nick Clemens 1ba5e028cb
Bug 37790: Add skip indexing and holds queue options and verbosity to update localuse script
This patch skips record indexing and real time holds queue updates when updating the localuse field
from statistics. A note is added to the script that the user should reindex if the localuse field is mapped.

Additionally a verbose option is added to the script, and doubled use of GetOptions is removed.

Lastly, a check is added to confirm the items value is being changed before the value is stored.

To test:
 1 - Enable the real time holds queue
 2 - Enable Elasticsearch
 3 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm
 4 - Note all items are touched and reported
 5 - Check the background jobs table - there are many jobs generated
 6 - Apply patch
 7 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm
 8 - Note 0 items are reported updated, no new background jobs
 9 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm --verbose
10 - No items reported
11 - Update some items in the DB
     UPDATE items SET localuse = 99 WHERE itemnumber LIKE '%9';
12 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm
13 - Only the number of items changed above reported
14 - UPDATE items SET localuse = 99 WHERE itemnumber LIKE '%9';
15 - perl misc/maintenance/update_localuse_from_statistics.pl --confirm --verbose
16 - Each item changed reported, and the amounts, and the total items updated.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-18 17:04:32 +01:00
Wainui Witika-Park 769b394292
Bug 31143: (follow-up) Add description to fix_invalid_dates.pl
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 16:47:04 +01:00
Kyle M Hall 6b96763992
Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files
The system is vulnerable to Formula Injection attacks as the data
stored within the database and exported as CSV/Excel is not being
sanitized or validated against implanted formula payloads

This patch modifies all uses of Text::CSV and derived classes to pass
the "formula" parameter with value of "empty" which replaces formulas
by empty string.

Test Plan:
1) Apply this patch
2) For guided_reports.pl, attempt to export CSV where you've set a column to a formula somehow
   ( such as "=1+3" )
3) Export that CSV file
4) Note the formula has not been exported
5) Repeat this plan for the remaining scripts that export CSV files
   where users can define the outputted data

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Fixed two conflicts. I have tested that this works as advertised on:
- Reports (Download > Comma separated text (.csv)) [Text::CSV::Encoded]
- Circulation > Overdues > Download file of all overdues [Text::CSV_XS]
- misc/export_borrowers.pl [Text::CSV]
This covers all modules used, and both GUI and command line.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[EDIT] Change none to empty in the commit message ! None is the default,
doing nothing. Empty clears the formulas.
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-14 10:46:31 +01:00
Jan Kissig cfb841f9e6
Bug 23426: (follow-up) Enhance sip_cli_emulator.pl for test plan
This follow up enhances the sip_cli_emulator.pl to use start-item and/or end-item as params. With these new params the original test plan can be extended:

Test plan:
a) create several manual invoices for patron 23529000035676 : http://localhost:8081/cgi-bin/koha/members/maninvoice.pl?borrowernumber=19
b) run
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1   -l CPL --patron 23529000035676 -m patron_information -s "   Y      " --start-item=1 --end-item=2
   to get fine 1 and 2 or
     perl misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su term1 -sp term1   -l CPL --patron 23529000035676 -m patron_information -s "   Y      " --start-item=3 --end-item=3
   to retrieve fine 3

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-13 17:00:48 +01:00
Katrin Fischer 30bec5bb98
Bug 34355: (QA follow-up) Terminology and capitalization
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:22 +01:00
Nick Clemens fc97c91493
Bug 34355: (QA follow-up) Remove debugging comment from archiving command
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:20 +01:00
Matt Blenkinsop 3ee7c3ccbf
Bug 34355: (QA follow-up) Respect AcqCreateItem syspref
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:19 +01:00
Matt Blenkinsop 8c7418da95
Bug 34355: (QA follow-up) Add a delete flag to the cronjob
This patch adds a 'delete' flag to the cronjob to select whether a file should be deleted or archived once processed

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:16 +01:00
Matt Blenkinsop 6b85d06c19
Bug 34355: Add match_field and match_value to allow multiple accounts in the same file directory
Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:14 +01:00
Matt Blenkinsop 42ab7761f4
Bug 34355: Add cronjob and required methods
This patch adds a cronjob to take a marc file from the Koha file directory system and import it before creating order lines

Test plan:

This test plan involves running a cronjob, not sure how easy this is in the sandboxes

1) In system preferences, click Search and then select the Acquisitions option from the left hand menu
2) Enable MarcOrderingAutomation
3) Paste the following into MarcFieldsToOrder
price: 975$p
quantity: 975$q
budget_code: 975$h
4) Paste the following into MarcItemFieldsToOrder
homebranch: 949$a
holdingbranch: 949$b
itype: 949$y
nonpublic_note: 949$x
public_note: 949$z
loc: 949$c
ccode: 949$8
notforloan: 949$7
uri: 949$u
copyno: 949$t
price: 949$g
replacementprice: 949$v
itemcallnumber: 949$o
quantity: 949$k
budget_code: 949$l
Now save the sysprefs
5) In the administration homepage, under Acquisition parameters there should now be a link called "MARC order accounts"
6) Click on this and click the New account button
7) Choose a vendor and a budget
8) Enter a description
9) Enter the following in download directory - "/var/lib/koha/kohadev/tmp/koha_kohadev_upload"
10) Select any record matching settings you want (not important for the test plan, this uses the same code as the marc file staging that already exists in Koha)
11) Check Yes under Check for embedded item record data
12) Click submit
13) We now need to upload a MARC file into the directory that we put in the account. The easiest way to do this is through the marc staging tool
14) Navigate to Cataloging > Stage MARC records for import
15) Upload the file attached to this bug using the Choose file button
16) Click Upload file.
17) Leave the page without completing the new form that appears, we don't want to stage this file. The file we uploaded is now in the directory ready for the cronjob to process as if it had been transferred via SFTP.
18) In the CLI run, perl misc/cronjobs/marc_ordering_process.pl -v -c
19) The logging should show that the file has been processed for that account
20) Navigate to Acquisitions
21) Search for the Vendor that you put in the MARC ordering account
22) There should be a basket created on the vendor with the name of the file you uploaded (there will also be a reference at the start e.g. ea2323966faef2c59a6056dbd1f7d658_filename.marcxml. This is because we used the marc staging tool to upload the file and that adds a reference to filenames. This will not appear when using files from an SFTP location).
23) Click in the basket
24) There should be three orderlines, complete with accounting details that have been mapped from the file.
One line should have a fund of Fund 1_2, quantity of 4 and a replacement price of 6.75, one should have Secondary fund, 2, 6.40 and one should have Main fund,2, 6.30

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-11 17:43:12 +01:00
Nick Clemens cfb72ca7fa
Bug 37478: Rename strict to skip_bad_records and add POD
Option name changed, POD updated.
The reason not to do this by default is that it is an extra record conversion
to check the validity, so may slow down the import.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-08 11:23:46 +01:00
Nick Clemens 0306281e41
Bug 37478: Add strict mode to bulkmarcimport
This patch adds a conversion from MARC -> XML -> MARC to catch any parsing errors.
If errors are found, we then lint the record to catch any problems, output the
warnings, and skip the record.

To test:
1 - Download the sample records from this bug report
2 - perl misc/migration_tools/bulkmarcimport.pl -b --file=520_nosubfield.mrc -v
    fails!
3 - perl misc/migration_tools/bulkmarcimport.pl -b --file=003_subfielda.mrc -v
    fails!
4 - Apply patch
5 - Repeat 2 & 3 - no change
6 - Add -st switch to the commands:
    perl misc/migration_tools/bulkmarcimport.pl -b --file=520_nosubfield.mrc -v -st
    perl misc/migration_tools/bulkmarcimport.pl -b --file=003_subfielda.mrc -v -st
7 - The records are now skipped, and the script completes
8 - Confirm the warnings generated are useful
9 - Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2024-11-08 11:23:45 +01:00