Commit Graph

59291 Commits

Author SHA1 Message Date
Jonathan Druart 6836c428f4
Bug 38664: Fix xt/author/valid-templates.t
There was a missing END in basket/basket.tt (it should have been raised
by the tidy that something wrong happened, to investigate later)

The branch-selector change is a trick to make the test pass, or it fails
with:
  # undef error - WHILE loop terminated (> 1000 iterations)
2025-02-11 22:31:28 +01:00
Jonathan Druart bd3e07c756
Bug 38664: Revert changse made to t/db_dependent/misc/translator/sample.tt
We don't want to comment the whole block or it won't be parsed by the
translator tool.

This has been done initially to make the prettier plugin happy but it
didn't handle TT comments correctly. Now with version 2.0.2 it should be
better.

This patch fixes t/db_dependent/misc/translator/xgettext-tt2.t
2025-02-11 22:31:27 +01:00
Jonathan Druart cfec07a55b
Bug 38664: Update yarn.lock 2025-02-11 22:31:26 +01:00
Jonathan Druart 70cbed2da9
Bug 38664: Bump the version of the prettier plugin
It improves the parsing of TT comments, as well as correctly supporting
prettier-ignore within TT comments
2025-02-11 22:31:25 +01:00
Jonathan Druart 2b6598f01a
Bug 38664: prettier-ignore virtualshelves/tables/shelves_results.tt
You must have the version 2.0.2 of the prettier plugin!
2025-02-11 22:31:25 +01:00
Jonathan Druart 58548ad0e6
Bug 38664: Revert changes for virtualshelves/tables/shelves_results.tt 2025-02-11 22:31:24 +01:00
Jonathan Druart aea905f704
Bug 38664: Fix the auto_rebase script
I had the tidy.pl script with correct +x permission during my testing
session. Now we retrieve it from main, write its content into a
temporary file. It does not have the +x bit.
2025-02-11 22:31:23 +01:00
Katrin Fischer 93eda45a9e
Update debian/control
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:29 +01:00
Katrin Fischer e1615b250c
Bug 38664: Update yarn.lock
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:28 +01:00
Jonathan Druart a731f3c279
Bug 38664: Add Test::PerlTidy to the dependency list
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:28 +01:00
Jonathan Druart 0c1d5faf3f
Bug 38664: Add @babel/core back to package.json
It's a dependency for prettier-plugin-template-toolkit

warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax@1.1.0" has unmet peer dependency "@babel/core@^7.0.0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-jest@29.7.0" has unmet peer dependency "@babel/core@^7.8.0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-jest@29.6.3" has unmet peer dependency "@babel/core@^7.0.0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-bigint@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-async-generators@7.8.4" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-class-properties@7.12.13" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-class-static-block@7.14.5" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-import-attributes@7.26.0" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-import-meta@7.10.4" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-logical-assignment-operators@7.10.4" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-json-strings@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-nullish-coalescing-operator@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-numeric-separator@7.10.4" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-optional-chaining@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-object-rest-spread@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-optional-catch-binding@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-private-property-in-object@7.14.5" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@koha-community/prettier-plugin-template-toolkit > babel-preset-current-node-syntax > @babel/plugin-syntax-top-level-await@7.14.5" has unmet peer dependency "@babel/core@^7.0.0-0".

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:27 +01:00
Jonathan Druart 9a631e77a8
Bug 38664: Add Git::Wrapper to the dependency list
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:27 +01:00
Jonathan Druart fa10e13691
Bug 38664: Manual revert
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:26 +01:00
Jonathan Druart 23370390b0
Bug 38664: Fix some tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:26 +01:00
Jonathan Druart 8fb8590600
Bug 38664: (re)Tidy the .vue files - 'semi: true'
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:25 +01:00
Jonathan Druart aa24f1e6d1
Bug 38664: Treat .vue files like other JS files
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-02-11 14:58:25 +01:00
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