Bug 34478: Add 'op' to admin/marc-overlay-rules
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
23ebad24b6
commit
025fcdc5ba
2 changed files with 14 additions and 14 deletions
|
@ -37,11 +37,11 @@ my $rule_from_cgi = sub {
|
|||
my %rule = map { $_ => scalar $cgi->param($_) } (
|
||||
'tag',
|
||||
'module',
|
||||
'cud-filter',
|
||||
'cud-add',
|
||||
'filter',
|
||||
'add',
|
||||
'append',
|
||||
'remove',
|
||||
'cud-delete'
|
||||
'delete'
|
||||
);
|
||||
|
||||
my $id = $cgi->param('id');
|
||||
|
@ -66,7 +66,7 @@ my $get_rules = sub {
|
|||
};
|
||||
my $rules = $get_rules->();
|
||||
|
||||
if ($op eq 'remove' || $op eq 'doremove') {
|
||||
if ($op eq 'remove' || $op eq 'cud-remove') {
|
||||
my @remove_ids = $input->multi_param('batchremove');
|
||||
push @remove_ids, scalar $input->param('id') if $input->param('id');
|
||||
if ($op eq 'remove') {
|
||||
|
@ -76,7 +76,7 @@ if ($op eq 'remove' || $op eq 'doremove') {
|
|||
$rule->{'removemarked'} = 1 if exists $remove_ids{$rule->{id}};
|
||||
}
|
||||
}
|
||||
elsif ($op eq 'doremove') {
|
||||
elsif ($op eq 'cud-remove') {
|
||||
my @remove_ids = $input->multi_param('batchremove');
|
||||
push @remove_ids, scalar $input->param('id') if $input->param('id');
|
||||
Koha::MarcOverlayRules->search({ id => { in => \@remove_ids } })->delete();
|
||||
|
@ -84,17 +84,17 @@ if ($op eq 'remove' || $op eq 'doremove') {
|
|||
$rules = $get_rules->();
|
||||
}
|
||||
}
|
||||
elsif ($op eq 'cud-edit') {
|
||||
elsif ($op eq 'edit') {
|
||||
$template->param( edit => 1 );
|
||||
my $id = $input->param('id');
|
||||
for my $rule(@{$rules}) {
|
||||
if ($rule->{id} == $id) {
|
||||
$rule->{'cud-edit'} = 1;
|
||||
$rule->{'edit'} = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($op eq 'doedit' || $op eq 'cud-add') {
|
||||
elsif ($op eq 'cud-edit' || $op eq 'cud-add') {
|
||||
my $rule_data = $rule_from_cgi->($input);
|
||||
if (!@{$errors}) {
|
||||
try {
|
||||
|
|
|
@ -142,8 +142,8 @@
|
|||
<option value="1">Delete</option>
|
||||
</select>
|
||||
</th>
|
||||
<th><button class="btn btn-default btn-xs" title="Add" id="add"><i class="fa fa-plus"></i> Add rule</button></th>
|
||||
<th><button id="btn_batchremove" disabled="disabled" class="btn btn-default btn-xs" title="Batch remove"><i class="fa fa-trash-can"></i> Delete selected</button></th>
|
||||
<th><button type="submit" class="btn btn-default btn-xs" title="Add" id="add" name="op" value="cud-add"><i class="fa fa-plus"></i> Add rule</button></th>
|
||||
<th><button type="submit" id="btn_batchremove" disabled="disabled" class="btn btn-default btn-xs" name="op" value="cud-remove" title="Batch remove"><i class="fa fa-trash-can"></i> Delete selected</button></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
[% END %]
|
||||
|
@ -349,17 +349,17 @@
|
|||
}
|
||||
|
||||
$('#doremove').on('click', function(){
|
||||
doSubmit('doremove');
|
||||
doSubmit('cud-remove');
|
||||
});
|
||||
$('#doedit').on('click', function(){
|
||||
doSubmit('doedit', $("#doedit").attr('value'));
|
||||
doSubmit('cud-edit', $("#doedit").attr('value'));
|
||||
});
|
||||
$('#add').on('click', function(){
|
||||
doSubmit('add');
|
||||
doSubmit('cud-add');
|
||||
return false;
|
||||
});
|
||||
$('#btn_batchremove').on('click', function(){
|
||||
doSubmit('remove');
|
||||
doSubmit('cud-remove');
|
||||
});
|
||||
|
||||
/* Disable batch remove unless one or more checkboxes are checked */
|
||||
|
|
Loading…
Reference in a new issue