Bugzilla – Attachment 69537 Details for
Bug 16735
Replace existing library search groups functionality with the new hierarchical groups system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16735 - Don't use objects for database update
Bug-16735---Dont-use-objects-for-database-update.patch (text/plain), 3.25 KB, created by
Jonathan Druart
on 2017-12-05 17:14:09 UTC
(
hide
)
Description:
Bug 16735 - Don't use objects for database update
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-12-05 17:14:09 UTC
Size:
3.25 KB
patch
obsolete
>From 12f57fcd5408c727c572635ce86dcd49c19c032d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 21 Feb 2017 12:07:18 +0000 >Subject: [PATCH] Bug 16735 - Don't use objects for database update > >--- > installer/data/mysql/updatedatabase.pl | 40 ++++++++++++++++++++++------------ > 1 file changed, 26 insertions(+), 14 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index c264b850ac..5245740047 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -15054,29 +15054,41 @@ $DBversion = "XXX"; > if ( CheckVersion($DBversion) ) { > require Koha::Library::Group; > >- my $search_groups_staff_root = Koha::Library::Group->new( { title => '__SEARCH_GROUPS__', description => "Library search groups - Staff only" } )->store(); >- my $search_groups_opac_root = Koha::Library::Group->new( { title => '__SEARCH_GROUPS_OPAC__', description => "Library search groups - OPAC & Staff" } )->store(); >+ $dbh->do(q{ >+ INSERT INTO library_groups ( title, description, created_on ) VALUES ( '__SEARCH_GROUPS__', 'Library search groups - Staff only', NOW() ) >+ }); >+ my $search_groups_staff_root_id = $dbh->last_insert_id(undef, undef, 'library_groups', undef); >+ >+ $dbh->do(q{ >+ INSERT INTO library_groups ( title, description, created_on ) VALUE ( '__SEARCH_GROUPS_OPAC__', 'Library search groups - Staff only', NOW() ) >+ }); >+ my $search_groups_opac_root_id = $dbh->last_insert_id(undef, undef, 'library_groups', undef); > > my $sth = $dbh->prepare("SELECT * FROM branchcategories"); >- $sth->execute(); > >+ my $sth2 = $dbh->prepare("INSERT INTO library_groups ( parent_id, title, description, created_on ) VALUES ( ?, ?, ?, NOW() )"); >+ >+ my $sth3 = $dbh->prepare("SELECT * FROM branchrelations WHERE categorycode = ?"); >+ >+ my $sth4 = $dbh->prepare("INSERT INTO library_groups ( parent_id, branchcode, created_on ) VALUES ( ?, ?, NOW() )"); >+ >+ $sth->execute(); > while ( my $lc = $sth->fetchrow_hashref ) { > my $description = $lc->{categorycode}; > $description .= " - " . $lc->{codedescription} if $lc->{codedescription}; > >- my $subgroup = Koha::Library::Group->new( >- { >- parent_id => $lc->{show_in_pulldown} ? $search_groups_opac_root->id : $search_groups_staff_root->id, >- title => $lc->{categoryname}, >- description => $description, >- } >- )->store(); >+ $sth2->execute( >+ $lc->{show_in_pulldown} ? $search_groups_opac_root_id : $search_groups_staff_root_id, >+ $lc->{categoryname}, >+ $description, >+ ); >+ >+ my $subgroup_id = $dbh->last_insert_id(undef, undef, 'library_groups', undef); > >- my $sth2 = $dbh->prepare("SELECT * FROM branchrelations WHERE categorycode = ?"); >- $sth2->execute( $lc->{categorycode} ); >+ $sth3->execute( $lc->{categorycode} ); > >- while ( my $l = $sth2->fetchrow_hashref ) { >- Koha::Library::Group->new( { parent_id => $subgroup->id, branchcode => $l->{branchcode} } )->store(); >+ while ( my $l = $sth3->fetchrow_hashref ) { >+ $sth4->execute( $subgroup_id, $l->{branchcode} ); > } > } > >-- >2.11.0
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 16735
:
52732
|
52733
|
52734
|
52735
|
57098
|
57099
|
57100
|
57101
|
58087
|
58088
|
58089
|
58090
|
60497
|
60498
|
60499
|
60500
|
60501
|
60502
|
60503
|
60772
|
60773
|
60774
|
60775
|
60776
|
60777
|
60778
|
60779
|
65658
|
65659
|
65660
|
65661
|
65662
|
65663
|
65664
|
65665
|
69533
|
69534
|
69535
|
69536
|
69537
|
69538
|
69539
|
69540
|
69541
|
69684
|
69685
|
69686
|
69687
|
69688
|
69689
|
69690
|
69691
|
69692
|
69693
|
69694
|
71386
|
71393