Bug 16208 - Can't delete a library EAN if the EAN value is empty

Test Plan:
1) Create an empty EAN
2) Attempt to delete it, you should get an error
3) Apply this patch
4) Attempt to delete the EAN, you should now be able to

Signed-off-by: Chris Cormack <chrisc@catalyst.net.z>

This depends on bug 16206 being pushed, or you need to apply that patch
first

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

https://bugs.koha-community.org/show_bug.cgi?id=16256

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
This commit is contained in:
Kyle M Hall 2016-04-18 16:10:34 +00:00 committed by Brendan Gallagher
parent 3156950e0a
commit e1cdef939a
2 changed files with 8 additions and 22 deletions

View File

@ -103,13 +103,9 @@ $template->param(
output_html_with_http_headers( $input, $cookie, $template->output );
sub delsubmit {
my $ean = $schema->resultset('EdifactEan')->find(
{
branchcode => $input->param('branchcode'),
ean => $input->param('ean')
}
);
$ean->delete;
my $id = $input->param('id');
my $e = $schema->resultset('EdifactEan')->find( $id );
$e->delete if $e;
return;
}
@ -128,7 +124,6 @@ sub addsubmit {
}
sub editsubmit {
warn "DESC: " . $input->param('description');
$schema->resultset('EdifactEan')->search(
{
branchcode => $input->param('oldbranchcode'),
@ -146,16 +141,8 @@ sub editsubmit {
}
sub show_ean {
my $branchcode = $input->param('branchcode');
my $ean = $input->param('ean');
if ( $branchcode && $ean ) {
my $e = $schema->resultset('EdifactEan')->find(
{
ean => $ean,
branchcode => $branchcode,
}
);
$template->param( ean => $e );
}
my $id = $input->param('id');
my $e = $schema->resultset('EdifactEan')->find( $id );
$template->param( ean => $e );
return;
}

View File

@ -116,8 +116,7 @@
<h3>Delete EAN [% ean.ean %] for [% ean.branch.branchname %]?</h3>
<form action="/cgi-bin/koha/admin/edi_ean_accounts.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="branchcode" value="[% ean.branch.branchcode %]" />
<input type="hidden" name="ean" value="[% ean.ean %]" />
<input type="hidden" name="ean" value="[% ean.id %]" />
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
</form>
<form action="/cgi-bin/koha/admin/edi_ean_accounts.pl" method="get">
@ -151,7 +150,7 @@
</td>
<td class="actions">
<a class="btn btn-mini" href="/cgi-bin/koha/admin/edi_ean_accounts.pl?op=ean_form&branchcode=[% ean.branch.branchcode %]&ean=[% ean.ean %]"><i class="fa fa-pencil"></i> Edit</a>
<a class="btn btn-mini" href="/cgi-bin/koha/admin/edi_ean_accounts.pl?op=delete_confirm&branchcode=[% ean.branch.branchcode %]&ean=[% ean.ean %]"><i class="fa fa-trash"></i> Delete</a>
<a class="btn btn-mini" href="/cgi-bin/koha/admin/edi_ean_accounts.pl?op=delete_confirm&ean=[% ean.id %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]