From 90dee1f3eef840b203409a25f56001b2d57b0888 Mon Sep 17 00:00:00 2001 From: btoumi Date: Fri, 25 May 2007 09:27:46 +0000 Subject: [PATCH] add security when u delete biblio : u must delete linked items before delete biblio --- catalogue/ISBDdetail.pl | 4 +++- .../prog/en/catalogue/ISBDdetail.tmpl | 23 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/catalogue/ISBDdetail.pl b/catalogue/ISBDdetail.pl index 8650df6492..1fef5dfa03 100755 --- a/catalogue/ISBDdetail.pl +++ b/catalogue/ISBDdetail.pl @@ -170,7 +170,9 @@ $res =~ s/\n//g; # remove empty () $res =~ s/\(\)//g; - +# count of item linked with biblio +my $itemcount = GetItemsCount($biblionumber); +$template->param( count => $itemcount); my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); if ($subscriptionsnumber) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/catalogue/ISBDdetail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/catalogue/ISBDdetail.tmpl index 29e49d1c9d..f63fc5b016 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/catalogue/ISBDdetail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/catalogue/ISBDdetail.tmpl @@ -19,10 +19,25 @@ function Dopop(link) { newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes'); } -function confirm_deletion() { - var is_confirmed = confirm('Are you sure you want to delete this biblio?'); - if (is_confirmed) { - window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber="; + +function confirm_deletion(count) { + var is_confirmed; + if (count>0){ + is_confirmed= alert('you have [ '+ count +' ] item(s) linked \n you must delete all items before delete this biblio'); + } + else{ + is_confirmed= confirm('Are you sure you want to delete this biblio? '); + } + + + if (is_confirmed) { + if (count>0){ +// window.location="/cgi-bin/koha/catalogue/detail.pl?biblionumber="; + } + else{ + window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber="; + } + } } -- 2.39.5