Bug 15766: (follow-up) Hide description field if the batch is empty

Because if it's empty, it hasn't actually been created yet. Hiding the
field prevents a lot of errors

Sponsored-by: Catalyst IT

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

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Aleisha Amohia 2017-10-18 22:40:13 +00:00 committed by Nick Clemens
parent 39772eca51
commit ba8ec9bfe2
3 changed files with 13 additions and 3 deletions

View File

@ -68,7 +68,7 @@ sub add_item {
my $query = "INSERT INTO creator_batches (batch_id, description, $number_type, branch_code, creator) VALUES (?,?,?,?,?);";
my $sth = C4::Context->dbh->prepare($query);
# $sth->{'TraceLevel'} = 3;
$sth->execute($self->{'batch_id'}, $number, $self->{'branch_code'}, $1);
$sth->execute($self->{'batch_id'}, $self->{'description'}, $number, $self->{'branch_code'}, $1);
if ($sth->err) {
warn sprintf('Database returned the following error on attempted INSERT: %s', $sth->errstr);
return -1;

View File

@ -60,7 +60,7 @@
<form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
<div>
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
<ol><li>
<ol><li id="description">
<input type="hidden" name="op" value="add" />
<input type="hidden" name="batch_id" value="[% batch_id | html %]" />
<label for="description">Batch description: </label>
@ -280,6 +280,11 @@
}
$(document).ready(function() {
[% IF table_loop %]
$("#description").show();
[% ELSE %]
$("#description").hide();
[% END %]
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
"autoWidth": false,
"aoColumnDefs": [

View File

@ -44,7 +44,7 @@
<form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
<div>
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
<ol><li>
<ol><li id="description">
<input type="hidden" name="op" value="add" />
<input type="hidden" name="batch_id" value="[% batch_id | html %]" />
<label for="description">Batch description: </label>
@ -230,6 +230,11 @@
};
$(document).ready(function() {
[% IF table_loop %]
$("#description").show();
[% ELSE %]
$("#description").hide();
[% END %]
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }