Bug 34478: Classification config - Convert delete links to form POSTS
This patch converts the delete links on the classification configuration page for sources, filing rules, and splitting rules to POST forms. A couple of op checks in the script are corrected to match. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
2cfd7c4bfe
commit
bf22d52098
2 changed files with 22 additions and 6 deletions
|
@ -109,7 +109,7 @@ elsif ( $op eq "cud-add_source_validate" ) {
|
||||||
|
|
||||||
$op = 'list';
|
$op = 'list';
|
||||||
}
|
}
|
||||||
elsif ( $op eq "delete_source_confirmed" ) {
|
elsif ( $op eq "cud-delete_source_confirmed" ) {
|
||||||
my $class_source = Koha::ClassSources->find($cn_source);
|
my $class_source = Koha::ClassSources->find($cn_source);
|
||||||
my $deleted = eval { $class_source->delete };
|
my $deleted = eval { $class_source->delete };
|
||||||
if ( $@ or not $deleted ) {
|
if ( $@ or not $deleted ) {
|
||||||
|
@ -166,7 +166,7 @@ elsif ( $op eq "cud-add_sort_rule_validate" ) {
|
||||||
}
|
}
|
||||||
$op = 'list';
|
$op = 'list';
|
||||||
}
|
}
|
||||||
elsif ( $op eq "delete_sort_rule" ) {
|
elsif ( $op eq "cud-delete_sort_rule" ) {
|
||||||
my $sort_rule = Koha::ClassSortRules->find($class_sort_rule);
|
my $sort_rule = Koha::ClassSortRules->find($class_sort_rule);
|
||||||
my $deleted = eval { $sort_rule->delete };
|
my $deleted = eval { $sort_rule->delete };
|
||||||
if ( $@ or not $deleted ) {
|
if ( $@ or not $deleted ) {
|
||||||
|
@ -237,7 +237,7 @@ elsif ( $op eq "cud-add_split_rule_validate" ) {
|
||||||
}
|
}
|
||||||
$op = 'list';
|
$op = 'list';
|
||||||
}
|
}
|
||||||
elsif ( $op eq "delete_split_rule" ) {
|
elsif ( $op eq "cud-delete_split_rule" ) {
|
||||||
my $split_rule = Koha::ClassSplitRules->find($class_split_rule);
|
my $split_rule = Koha::ClassSplitRules->find($class_split_rule);
|
||||||
my $deleted = eval { $split_rule->delete };
|
my $deleted = eval { $split_rule->delete };
|
||||||
if ( $@ or not $deleted ) {
|
if ( $@ or not $deleted ) {
|
||||||
|
|
|
@ -357,7 +357,12 @@
|
||||||
<td>[% class_source.class_split_rule | html %]</td>
|
<td>[% class_source.class_split_rule | html %]</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a class="btn btn-default btn-xs" href="[% script_name | url %]?op=add_source&cn_source=[% class_source.cn_source | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
<a class="btn btn-default btn-xs" href="[% script_name | url %]?op=add_source&cn_source=[% class_source.cn_source | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
||||||
<a class="btn btn-default btn-xs delete_class_source" href="[% script_name | url %]?op=delete_source_confirmed&cn_source=[% class_source.cn_source | uri%]"><i class="fa fa-trash-can"></i> Delete</a>
|
<form action="[% script_name | url %]" method="post">
|
||||||
|
[% INCLUDE 'csrf-token.inc' %]
|
||||||
|
<input type="hidden" name="op" value="cud-delete_source_confirmed" />
|
||||||
|
<input type="hidden" name="cn_source" value="[% class_source.cn_source | uri%]" />
|
||||||
|
<button class="btn btn-default btn-xs delete_class_source"><i class="fa fa-trash-can"></i> Delete</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
@ -380,7 +385,12 @@
|
||||||
<td>[% rule.sort_routine | html %]</td>
|
<td>[% rule.sort_routine | html %]</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a class="btn btn-default btn-xs" href="[% script_name | html %]?op=add_sort_rule&class_sort_rule=[% rule.class_sort_rule |url %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
<a class="btn btn-default btn-xs" href="[% script_name | html %]?op=add_sort_rule&class_sort_rule=[% rule.class_sort_rule |url %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
||||||
<a class="btn btn-default btn-xs delete_sort_rule" href="[% script_name | html %]?op=delete_sort_rule&class_sort_rule=[% rule.class_sort_rule |url %]"><i class="fa fa-trash-can"></i> Delete</a>
|
<form action="[% script_name | url %]" method="post">
|
||||||
|
[% INCLUDE 'csrf-token.inc' %]
|
||||||
|
<input type="hidden" name="op" value="cud-delete_sort_rule" />
|
||||||
|
<input type="hidden" name="class_sort_rule" value="[% rule.class_sort_rule |url %]" />
|
||||||
|
<button class="btn btn-default btn-xs delete_class_source"><i class="fa fa-trash-can"></i> Delete</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
@ -403,7 +413,13 @@
|
||||||
<td>[% rule.split_routine | html %]</td>
|
<td>[% rule.split_routine | html %]</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a class="btn btn-default btn-xs" href="[% script_name | url %]?op=add_split_rule&class_split_rule=[% rule.class_split_rule | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
<a class="btn btn-default btn-xs" href="[% script_name | url %]?op=add_split_rule&class_split_rule=[% rule.class_split_rule | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
||||||
<a class="btn btn-default btn-xs delete_split_rule" href="[% script_name | url %]?op=delete_split_rule&class_split_rule=[% rule.class_split_rule | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
|
<form action="[% script_name | url %]" method="post">
|
||||||
|
[% INCLUDE 'csrf-token.inc' %]
|
||||||
|
<input type="hidden" name="op" value="cud-delete_split_rule" />
|
||||||
|
<input type="hidden" name="class_split_rule" value="[% rule.class_split_rule | html %]" />
|
||||||
|
<input type="hidden" name="op" value="cud-delete_split_rule" />
|
||||||
|
<button class="btn btn-default btn-xs delete_split_rule"><i class="fa fa-trash-can"></i> Delete</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in a new issue