From cbebf179c8ccff4b2c3b89a3951579038db78552 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 30 Sep 2024 15:56:54 +0000 Subject: [PATCH] Bug 24172: (follow-up) Split serial sequence upon editing and server This patch checks whether we find a season match in the numeration when editing/receiving a serial. If so, we split the input into three boxes, the before string, the season as a dropdown, and the after string. The dropdown visible values wil be transalated, however, the values will be in English. It's a bit ugly, but it works. To test: 1 - Apply patch, update translation 2 - Receive some issues of the serial 3 - Try receiving in English or your other lang 4 - Confirm values are saved in English in the DB either way 5 - Confirm issues show in the currently selected language either way 6 - Test with a non-seasonal serial, confirm no changes --- .../prog/en/includes/localizer.inc | 101 ++++++++++++++++-- .../prog/en/modules/serials/serials-edit.tt | 14 ++- 2 files changed, 103 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc index 864dbc276f3..3045f83dff1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc @@ -1,21 +1,104 @@ [%~ BLOCK localize_numbering_pattern_season ~%] [%~ IF ( matches = season.match('(.*)Spring(.*)') ) ~%] - [%~ matches.0 | html ~%]Spring[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Spring[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Summer(.*)') ) ~%] - [%~ matches.0 | html ~%]Summer[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Summer[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Fall(.*)') ) ~%] - [%~ matches.0 | html ~%]Fall[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Fall[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Winter(.*)') ) ~%] - [%~ matches.0 | html ~%]Winter[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Winter[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Spr(.*)') ) ~%] - [%~ matches.0 | html ~%]Spr[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Spr[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Sum(.*)') ) ~%] - [%~ matches.0 | html ~%]Sum[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Sum[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Fal(.*)') ) ~%] - [%~ matches.0 | html ~%]Fal[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Fal[%~ matches.1 | html ~%] [%~ ELSIF ( matches = season.match('(.*)Win(.*)') ) ~%] - [%~ matches.0 | html ~%]Win[%~ matches.1 | html ~%] + [%~ matches.0 | html ~%]Win[%~ matches.1 | html ~%] [%~ ELSE ~%] [%~ season | html ~%] [%~ END ~%] -[%~ END ~%] \ No newline at end of file +[%~ END ~%] +[%~ BLOCK localize_numbering_pattern_season_input ~%] + [%~ IF ( matches = season.match('(.*)Spring(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown cur_season => 'Spring' %] + + [%~ ELSIF ( matches = season.match('(.*)Summer(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown cur_season => 'Summer' %] + + [%~ ELSIF ( matches = season.match('(.*)Fall(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown cur_season => 'Fall' %] + + [%~ ELSIF ( matches = season.match('(.*)Winter(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown cur_season => 'Winter' %] + + [%~ ELSIF ( matches = season.match('(.*)Spr(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown_abrv cur_season => 'Spr' %] + + [%~ ELSIF ( matches = season.match('(.*)Sum(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown_abrv cur_season => 'Sum' %] + + [%~ ELSIF ( matches = season.match('(.*)Fal(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown_abrv cur_season => 'Fal' %] + + [%~ ELSIF ( matches = season.match('(.*)Win(.*)') ) ~%] + + [% PROCESS localize_numbering_pattern_season_dropdown_abrv cur_season => 'Win' %] + + [%~ ELSE ~%] + + [%~ END ~%] +[%~ END ~%] +[%~ BLOCK localize_numbering_pattern_season_dropdown ~%] + + [% IF ( cur_season == 'Spr' ) %] + + [% ELSE %] + + [% END %] + [% IF ( cur_season == 'Sum' ) %] + + [% ELSE %] + + [% END %] + [% IF ( cur_season == 'Fal' ) %] + + [% ELSE %] + + [% END %] + [% IF ( cur_season == 'Win' ) %] + + [% ELSE %] + + [% END %] +[%~ END ~%] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt index fcc19e40223..551fdb77299 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt @@ -73,6 +73,15 @@ $(document).ready(function() { return true; }); + $(".numbering_parts").change(function(){ + let num_parts = $(this).parent('td').children(".numbering_parts"); + let new_val = ""; + num_parts.each(function(){ + new_val += $(this).val(); + }); + let num_total = $(this).parent('td').children('.serialseq_hidden'); + num_total.val( new_val ); + }); $("#toggle_skip_issues").on("change", function() { if (this.checked) { $("#skip_issues").removeClass("collapse").prop("disabled", false); @@ -160,9 +169,8 @@ $(document).ready(function() { - Issue + + Issue [% PROCESS localize_numbering_pattern_season_input season => serialslis.serialseq serialid => serialslis.serialid %] -- 2.39.5