The template checks for a "count" variable (item count) to see
whether it should allow deletion of the biblio record. For some
reason labeledMARCdetail.pl hard-coded this as 1, which meant
the template always thought was 1 item.
This patch also adds an item count check on the display of
"Delete all items," disabling it if there are no items.
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
use C4::Context;
use C4::Output;
use C4::Biblio;
+use C4::Items;
use C4::Search; # enabled_staff_search_views
my $query = new CGI;
}
);
-$template->param( count => 1, bibliotitle => $biblio->{title} );
+#count of item linked
+my $itemcount = GetItemsCount($biblionumber);
+$template->param( count => $itemcount,
+ bibliotitle => $biblio->{title}, );
#Getting the list of all frameworks
my $queryfwk =
{ text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->" },
{ text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&frameworkcode=&op=duplicate" },
{ text: _("Delete Record"), onclick: {fn: confirm_deletion }<!-- TMPL_IF NAME="count" -->,id:'disabled'<!-- /TMPL_IF --> },
- { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } }
+ { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion }<!-- TMPL_UNLESS NAME="count" -->,id:'disabled'<!-- /TMPL_UNLESS --> }
];
var savemenu = [