Bugzilla – Attachment 59391 Details for
Bug 17944
Remove the sql code from itemtypes.pl administrative perl script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17944 - Moved the sql code from itemtypes.pl into Koha/ItemTypes.pm
Bug-17944---Moved-the-sql-code-from-itemtypespl-in.patch (text/plain), 1.79 KB, created by
Alex Buckley
on 2017-01-22 02:05:39 UTC
(
hide
)
Description:
Bug 17944 - Moved the sql code from itemtypes.pl into Koha/ItemTypes.pm
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-01-22 02:05:39 UTC
Size:
1.79 KB
patch
obsolete
>From 7d8bb20d704de31718c27e3bdfbc844f061747b8 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Sun, 22 Jan 2017 01:52:50 +0000 >Subject: [PATCH] Bug 17944 - Moved the sql code from itemtypes.pl into > Koha/ItemTypes.pm > >--- > Koha/ItemTypes.pm | 17 +++++++++++++++++ > admin/itemtypes.pl | 10 +--------- > 2 files changed, 18 insertions(+), 9 deletions(-) > >diff --git a/Koha/ItemTypes.pm b/Koha/ItemTypes.pm >index 92fea9c..9eb26df 100644 >--- a/Koha/ItemTypes.pm >+++ b/Koha/ItemTypes.pm >@@ -39,6 +39,23 @@ Koha::ItemTypes - Koha ItemType Object set class > > =cut > >+sub check_items_and_biblioitems { >+ my ($itemtype_code) = @_; >+ >+ my $dbh = C4::Context->dbh; >+ >+ # Check both items and biblioitems >+ my ($total) = $dbh->selectrow_array( ' >+ SELECT COUNT(*) AS total FROM ( >+ SELECT itemtype AS t FROM biblioitems >+ UNION ALL >+ SELECT itype AS t FROM items >+ ) AS tmp >+ WHERE tmp.t=? >+ ', {}, $itemtype_code ); >+ return $total; >+} >+ > sub _type { > return 'Itemtype'; > } >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index c8c224e..81bb391 100755 >--- a/admin/itemtypes.pl >+++ b/admin/itemtypes.pl >@@ -139,15 +139,7 @@ if ( $op eq 'add_form' ) { > $op = 'list'; > } elsif ( $op eq 'delete_confirm' ) { > >- # Check both items and biblioitems >- my ($total) = $dbh->selectrow_array( ' >- SELECT COUNT(*) AS total FROM ( >- SELECT itemtype AS t FROM biblioitems >- UNION ALL >- SELECT itype AS t FROM items >- ) AS tmp >- WHERE tmp.t=? >- ', {}, $itemtype_code ); >+ my $total = Koha::ItemTypes->check_items_and_biblioitems($itemtype_code); > > if ($total) { > push @messages, { type => 'error', code => 'cannot_be_deleted', total => $total }; >-- >2.1.4
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 17944
:
59391
|
59564
|
59565
|
59655
|
59656
|
59657
|
59715
|
59716
|
59717
|
59718
|
59953
|
59954
|
62499
|
62500
|
62501
|
62502
|
62503
|
62504
|
62505
|
63045
|
63152
|
63220
|
63259
|
63307
|
63308
|
63309
|
63310
|
63924
|
63925