From 0007680d91d794aa6cce5ccd18f825a0d9320842 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 --- C4/Creators/Batch.pm | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt | 7 ++++++- koha-tmpl/intranet-tmpl/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 3f13917..9b9a0f2 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 72ad203..814954c 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 @@ -125,6 +125,11 @@ }; $(document).ready(function() { + [% IF table_loop %] + $("#description").show(); + [% ELSE %] + $("#description").hide(); + [% END %] $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, { "autoWidth": false, "aoColumnDefs": [ @@ -232,7 +237,7 @@
-
  1. +
    1. 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 bf494e7..f8780dc 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 @@ -112,6 +112,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 } @@ -220,7 +225,7 @@
      -
      1. +
        1. -- 2.1.4