From ba8ec9bfe2c538f4b586f30426e2dffb10b814ae Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 18 Oct 2017 22:40:13 +0000 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- C4/Creators/Batch.pm | 2 +- .../prog/en/modules/labels/label-edit-batch.tt | 7 ++++++- .../prog/en/modules/patroncards/edit-batch.tt | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/C4/Creators/Batch.pm b/C4/Creators/Batch.pm index 3f13917ed5..9b9a0f24a0 100644 --- a/C4/Creators/Batch.pm +++ b/C4/Creators/Batch.pm @@ -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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt index 1b7275795e..6bbb1839df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt @@ -60,7 +60,7 @@
-
  1. +
    1. @@ -280,6 +280,11 @@ } $(document).ready(function() { + [% IF table_loop %] + $("#description").show(); + [% ELSE %] + $("#description").hide(); + [% END %] $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { "autoWidth": false, "aoColumnDefs": [ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt index c92c52c1b7..5b1780a18c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -44,7 +44,7 @@
      -
      1. +
        1. @@ -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 } -- 2.39.5