Commit Graph

56825 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 6e79bc2dd4
Bug 38664: prettier-ignore country-list.inc
Or everything will be on a single line

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:23 +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 d8aae1ab89
Bug 38664: Ignore pre tag in merge-patrons.tt
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:21 +01:00
Jonathan Druart 693b4dc0eb
Bug 38664: Use our own prettier plugin - @koha-community/prettier-plugin-template-toolkit
https://www.npmjs.com/package/@koha-community/prettier-plugin-template-toolkit

https://gitlab.com/koha-community/prettier-plugin-template-toolkit
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:21 +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 9fe7434eaa
Bug 38664: Remove 'keep tidy' for JS files
We now want to check (almost) all JS files

On the tidy branch:
xt/js_tidy.t .. ok
All tests successful.
Files=1, Tests=175, 129 wallclock secs ( 0.07 usr  0.01 sys + 103.69 cusr 37.68 csys = 141.45 CPU)
Result: PASS

real    2m8.187s
user    1m43.806s
sys     0m37.730s

xt/vue_tidy.t .. ok
All tests successful.
Files=1, Tests=75, 60 wallclock secs ( 0.04 usr  0.01 sys + 53.80 cusr 17.22 csys = 71.07 CPU)
Result: PASS

real    1m0.137s
user    0m53.891s
sys     0m17.286s

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:19 +01:00
Jonathan Druart b9affd17cf
Bug 38664: htmlWhitespaceSensitivity: 'strict' - Whitespace (or the lack of it) around all tags is considered significant
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:19 +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 bb9d2284fb
Bug 38664: extend printWidth for template files
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:17 +01:00
Jonathan Druart a5fb573d99
Bug 38664: Adjust xt/perltidy.t
We want to test the files from the git index only

On my laptop:
real    3m54.692s
user    3m51.466s
sys     0m0.994s

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:17 +01:00
Jonathan Druart 7de1b14059
Bug 38664: Test::PerlTidy - new deps
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:16 +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
Jonathan Druart 26aa21d36a
Bug 38664: .prettierrc.js changes for template files
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:11 +01:00
Jonathan Druart 7c045e740c
Bug 38664: opac-facets.inc - Fix translation script
Finally got an error with the translation script:
$ gulp po:update --lang fr-FR --task opac-bootstrap
[13:05:23] Using gulpfile /kohadevbox/koha/gulpfile.js
[13:05:23] Starting 'po:update'...
[13:05:23] Starting 'po_update_opac'...
[13:05:24] 'po_update_opac' errored after 975 ms
[13:05:24] Error: Command failed: misc/translator/xgettext.pl --charset=UTF-8 -F -o /tmp/koha-6wJN1E/Koha-opac-bootstrap.pot -f /tmp/koha-6wJN1E/files
Can't use an undefined value as a HASH reference at misc/translator/xgettext.pl line 131, <$INPUT> line 122.

    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:05:24] 'po:update' errored after 980 ms

The problem is coming from the '>' within the TT condition.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:10 +01:00
Owen Leonard 597b5234ab
Bug 38718: (follow-up) Use container wrapper on tags page
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:10 +01:00
Owen Leonard f9277ec60c
Bug 38718: (follow-up) Correct aside parameter
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:09 +01:00
Owen Leonard 58397123a5
Bug 38718: (follow-up) Restore sidebar menu to point of sale page
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:09 +01:00
Owen Leonard 8bc6839254
Bug 38718: (follow-up) Use main-container.inc on ILL requests page
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:08 +01:00
Owen Leonard f747cb4639
Bug 38718: (follow-up) Wrap both search form and search results in wrapper
Also pass "wide_full" parameter to main-container.inc

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:08 +01:00
Owen Leonard 37c174ef69
Bug 38718: (follow-up) Fix a few minor errors
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:07 +01:00
Owen Leonard e3978a28f4
Bug 38718: Preferences pages should use prefs-menu.inc, not admin-menu.inc
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:07 +01:00
Jonathan Druart cf2710bd4f
Bug 38718: Main container - Virtual shelves
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:06 +01:00
Jonathan Druart 3d02751258
Bug 38718: Main container - Tools
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:06 +01:00
Jonathan Druart 548817a78b
Bug 38718: Main container - Serials
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:05 +01:00
Jonathan Druart 7c079939a9
Bug 38718: Main container - Rotating collections
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:04 +01:00
Jonathan Druart d50de25545
Bug 38718: Main container - Reviews
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:04 +01:00
Jonathan Druart 5396b1df64
Bug 38718: Main container - Reserves
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:03 +01:00
Jonathan Druart 6dafdf977a
Bug 38718: Main container - Reports
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:03 +01:00
Jonathan Druart 73b5e8cbbe
Bug 38718: Main container - POS
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:02 +01:00
Jonathan Druart 158dd6db42
Bug 38718: Main container - Patron lists
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:02 +01:00
Jonathan Druart e73ad325b2
Bug 38718: Main container - Recalls
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:01 +01:00
Jonathan Druart 1f9d0f0196
Bug 38718: Main container - Patron cards
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:01 +01:00
Jonathan Druart 607c70d294
Bug 38718: Main container - Offline circ
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:00 +01:00
Jonathan Druart 26e267e8f4
Bug 38718: Main container - Members
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:00 +01:00
Jonathan Druart 93dab2031c
Bug 38718: Main container - Labels
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:57:59 +01:00
Jonathan Druart b639648a76
Bug 38718: Main container - Errors
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:57:59 +01:00
Jonathan Druart 2d919e26ba
Bug 38718: Main container - Course reserves
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:57:58 +01:00
Jonathan Druart 5178877b6c
Bug 38718: Main container - Clubs
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:57:58 +01:00