Bugzilla – Attachment 4319 Details for
Bug 6436
Don't allow deletion of an itemtype used in items.itype
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
0001-BUG6436-Don-t-allow-deletion-of-an-itemtype-used-in-.patch (text/plain), 1.35 KB, created by
Fridolin Somers
on 2011-05-31 13:33:02 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2011-05-31 13:33:02 UTC
Size:
1.35 KB
patch
obsolete
>From a674a6ef3a4e31c22b9984f0220f2717fe4bd890 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@progilone.fr> >Date: Tue, 31 May 2011 15:16:15 +0200 >Subject: [PATCH] BUG6436 Don't allow deletion of an itemtype used in items.itype > >--- > admin/itemtypes.pl | 20 +++++++++++--------- > 1 files changed, 11 insertions(+), 9 deletions(-) > >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index 1a33a21..3219da3 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -188,15 +188,17 @@ elsif ( $op eq 'add_validate' ) { > # called by default form, used to confirm deletion of data in DB > } > elsif ( $op eq 'delete_confirm' ) { >- # Check both categoryitem and biblioitems, see Bug 199 >- my $total = 0; >- for my $table ('biblioitems') { >- my $sth = >- $dbh->prepare( >- "select count(*) as total from $table where itemtype=?"); >- $sth->execute($itemtype); >- $total += $sth->fetchrow_hashref->{total}; >- } >+ # Check both items and biblioitems >+ my $sth = $dbh->prepare(' >+ SELECT COUNT(*) AS total FROM ( >+ SELECT itemtype AS t FROM biblioitems >+ UNION >+ SELECT itype AS t FROM items >+ ) AS tmp >+ WHERE tmp.t=? >+ '); >+ $sth->execute($itemtype); >+ my $total = $sth->fetchrow_hashref->{'total'}; > > my $sth = > $dbh->prepare( >-- >1.7.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6436
:
4319
|
4321