From e7c049fea753232a51d78e07a9f15354cd71a469 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sun, 28 Oct 2018 09:36:32 -0300 Subject: [PATCH] Bug 21704: Edit framework subfield link is broken (TT filter) This patch removes URL building from the controller (admin/marctagstructure.pl) and does it on the templates, using the right 'uri' filter for the query parameters. It also removes: - No longer used attributes that are passed to the template - Duplicated code in the templates To test: - Go to Home > Administration > MARC bibliographic framework - On any of the listed frameworks, pick the 'MARC structure' action in the dropdown - On any subfield, hover on the actions dropdown => FAIL: The URLs are wrongly formed - Click on the links => FAIL: You get errors because of the bad URL - Apply this patch - Reload the 'MARC structure' page - On any subfield, hover on the actions dropdown => SUCCESS: LInks look correct - Click on any of them => SUCCESS: They work! - Use the 'Display only used tags/subfields' checkbox => SUCCESS: No behaviour change! - Sign off :-D Sponsored-by: Theke Solutions Signed-off-by: Michal Denar Signed-off-by: Michal Denar Signed-off-by: Nick Clemens --- admin/marctagstructure.pl | 6 --- .../prog/en/modules/admin/marctagstructure.tt | 40 ++++--------------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 43de4fb4ae..e42ce4fa48 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -248,9 +248,6 @@ if ($op eq 'add_form') { $row_data{authorised_value} = $results[$i]->{'mts_authorised_value'}; $row_data{ind1_defaultvalue} = $results[$i]->{'mts_ind1_defaultvalue'}; $row_data{ind2_defaultvalue} = $results[$i]->{'mts_ind2_defaultvalue'}; - $row_data{subfield_link} = "marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode; - $row_data{edit} = "$script_name?op=add_form&searchfield=" .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode; - $row_data{delete} = "$script_name?op=delete_confirm&searchfield=" .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode; $j=$i; my @internal_loop = (); while ( ( $j < $cnt ) and ( $results[$i]->{'tagfield'} == $results[$j]->{'tagfield'} ) ) { @@ -295,9 +292,6 @@ if ($op eq 'add_form') { $row_data{authorised_value} = $results->[$i]{'authorised_value'}; $row_data{ind1_defaultvalue} = $results->[$i]{'ind1_defaultvalue'}; $row_data{ind2_defaultvalue} = $results->[$i]{'ind2_defaultvalue'}; - $row_data{subfield_link} = "marc_subfields_structure.pl?tagfield=" .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; - $row_data{edit} = "$script_name?op=add_form&searchfield=" .$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; - $row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode; push(@loop_data, \%row_data); } $template->param(loop => \@loop_data); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt index 121480806e..1910451ff5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt @@ -41,7 +41,7 @@ [% IF ( else ) %] [% END %]

MARC Framework for [% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]default MARC framework[% END %]

@@ -184,18 +184,19 @@ - [% IF ( select_display ) %] - [% FOREACH loo IN loop %] + [% FOREACH loo IN loop %] [% loo.tagfield | html %] [% loo.liblibrarian | html %] + [% IF ( select_display ) %] [% FOREACH subfield IN loo.subfields %]

Tab:[% subfield.tab | html %] | $[% subfield.tagsubfield | html %] [% subfield.liblibrarian | html %] [% IF ( subfield.kohafield ) %][% subfield.kohafield | html %][% END %][% IF ( subfield.repeatable ) %], repeatable[% END %][% IF ( subfield.mandatory ) %], Mandatory[% END %][% IF ( subfield.seealso ) %], See [% subfield.seealso | html %][% END %][% IF ( subfield.authorised_value ) %], [% subfield.authorised_value | html %][% END %][% IF ( subfield.authtypecode ) %], [% subfield.authtypecode | html %][% END %][% IF ( subfield.value_builder ) %], [% subfield.value_builder | html %][% END %]

[% END %] + [% END %] [% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %] [% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %] @@ -207,43 +208,16 @@ Actions - [% END %] - [% ELSE %] - [% FOREACH loo IN loop %] - - [% loo.tagfield | html %] - [% loo.liblibrarian | html %] - [% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %] - [% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %] - [% loo.authorised_value | html %] - [% loo.ind1_defaultvalue | html %] - [% loo.ind2_defaultvalue | html %] - - - - - [% END %] [% END %] - - - [% END %] -- 2.39.5