[Koha-cvs] koha C4/Biblio.pm catalogue/MARCdetail.pl koha-...

Bruno Toumi btoumi at ouestprovence.fr
Mon May 21 10:44:18 CEST 2007


CVSROOT:	/cvsroot/koha
Module name:	koha
Changes by:	Bruno Toumi <btoumi>	07/05/21 08:44:18

Modified files:
	C4             : Biblio.pm 
	catalogue      : MARCdetail.pl 
	koha-tmpl/intranet-tmpl/prog/en/catalogue: MARCdetail.tmpl 

Log message:
	add security when u delete biblio :
	u must delete linked items before delete biblio

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&r1=1.205&r2=1.206
http://cvs.savannah.gnu.org/viewcvs/koha/catalogue/MARCdetail.pl?cvsroot=koha&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl?cvsroot=koha&r1=1.6&r2=1.7

Patches:
Index: C4/Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -b -r1.205 -r1.206
--- C4/Biblio.pm	11 May 2007 16:04:03 -0000	1.205
+++ C4/Biblio.pm	21 May 2007 08:44:17 -0000	1.206
@@ -33,7 +33,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.205 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.206 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
 
 @ISA = qw( Exporter );
 
@@ -58,6 +58,7 @@
   &GetItemLocation
   &GetLostItems
   &GetItemsForInventory
+  &GetItemsCount
 
   &GetMarcNotes
   &GetMarcSubjects
@@ -3879,6 +3880,28 @@
     return $serviceOptions;
 }
 
+=head2 GetItemsCount
+
+$count = &GetItemsCount( $biblionumber);
+this function return count of item with $biblionumber
+=cut
+
+sub GetItemsCount {
+    my ( $biblionumber ) = @_;
+    my $dbh = C4::Context->dbh;
+    my $query = qq|SELECT count(*)
+ 		  FROM  items 
+ 		  WHERE biblionumber=?|;
+    my $sth = $dbh->prepare($query);
+    $sth->execute($biblionumber);
+    my $count = $sth->fetchrow;  
+    $sth->finish;
+    return ($count);
+}
+
+
+
+
 END { }    # module clean-up code here (global destructor)
 
 1;
@@ -3895,8 +3918,12 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.205 2007/05/11 16:04:03 btoumi Exp $
+# $Id: Biblio.pm,v 1.206 2007/05/21 08:44:17 btoumi Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.206  2007/05/21 08:44:17  btoumi
+# add security when u delete biblio :
+# u must delete linked items before delete biblio
+#
 # Revision 1.205  2007/05/11 16:04:03  btoumi
 # bug fix:
 # problem in  displayed label link  with subject in detail.tmpl

Index: catalogue/MARCdetail.pl
===================================================================
RCS file: /cvsroot/koha/koha/catalogue/MARCdetail.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- catalogue/MARCdetail.pl	24 Apr 2007 13:54:29 -0000	1.11
+++ catalogue/MARCdetail.pl	21 May 2007 08:44:18 -0000	1.12
@@ -116,6 +116,10 @@
     }
 );
 
+#count of item linked
+my $itemcount = GetItemsCount($biblionumber);
+$template->param( count => $itemcount);
+
 #Getting the list of all frameworks
 my $queryfwk =
   $dbh->prepare("select frameworktext, frameworkcode from biblio_framework");

Index: koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl	11 Mar 2007 21:08:12 -0000	1.6
+++ koha-tmpl/intranet-tmpl/prog/en/catalogue/MARCdetail.tmpl	21 May 2007 08:44:18 -0000	1.7
@@ -370,12 +370,29 @@
     }
 }
 
-function confirm_deletion() {
-    var is_confirmed = confirm('Are you sure you want to delete this biblio?');
+function confirm_deletion(count) {
+    //     var is_confirmed = confirm('Are you sure you want to delete this biblio?');
+//     if (is_confirmed) {
+//         window.location="../cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
+//     }
+ 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) {
-        window.location="../cataloguing/addbiblio.pl?op=delete&biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
+        if (count=0){
+// 	window.location="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
+	window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&amp;biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->";
     }
-}
+		
+    }
+    }
+
 function Dopop(link) {
     newin=window.open(link,'popup','width=500,height=400,toolbar=false,scrollbars=yes');
 }





More information about the Koha-cvs mailing list