From 021ceccee9a991a1c94c443e69c6285854726612 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 14 Jan 2009 16:07:34 +0100 Subject: [PATCH] (bug #2914) delete all items of a notice This patch allow the librarian to delete all items attached to a notice in one click. Signed-off-by: Henri-Damien LAURENT --- cataloguing/additem.pl | 12 ++++++++++++ .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 9592bc79f4..376687c4ff 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -157,6 +157,18 @@ if ($op eq "additem") { } } #------------------------------------------------------------------------------- +} elsif ($op eq "delallitems") { +#------------------------------------------------------------------------------- + my @biblioitems = &GetBiblioItemByBiblioNumber($biblionumber); + foreach my $biblioitem (@biblioitems){ + my $items = &GetItemsByBiblioitemnumber($biblioitem->{biblioitemnumber}); + + foreach my $item (@$items){ + &DelItem($dbh,$biblionumber,$item->{itemnumber}); + } + } + print $input->redirect("/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=$biblionumber"); +#------------------------------------------------------------------------------- } elsif ($op eq "saveitem") { #------------------------------------------------------------------------------- # rebuild diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index dbc2fc6bb5..0b3fcbba77 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -27,6 +27,15 @@ function confirm_deletion() { } } +function confirm_items_deletion() { + var count = ; + if(confirm(_('Are you sure you want to delete the ' + count + ' attached items? '))){ + window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber="; + }else{ + return false; + } +} + // prepare DOM for YUI Toolbar $(document).ready(function() { @@ -55,7 +64,8 @@ function confirm_deletion() { { text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=&frameworkcode=&op=" }, { text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=" }, { text: _("Edit as New (Duplicate)"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=&frameworkcode=&op=duplicate" }, - { text: _("Delete Record"), onclick: {fn: confirm_deletion },id:'disabled' } + { text: _("Delete Record"), onclick: {fn: confirm_deletion },id:'disabled' }, + { text: _("Delete all Items"), onclick: {fn: confirm_items_deletion } } ]; var savemenu = [ -- 2.39.5