Bugzilla – Attachment 165288 Details for
Bug 35570
Add a generic master form in ILL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35570: Atomicupdate
Bug-35570-Atomicupdate.patch (text/plain), 4.11 KB, created by
Pedro Amorim
on 2024-04-22 13:52:14 UTC
(
hide
)
Description:
Bug 35570: Atomicupdate
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-04-22 13:52:14 UTC
Size:
4.11 KB
patch
obsolete
>From c559c2f5e4dc5377343a2d93c82240cc464cc191 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Fri, 15 Dec 2023 13:12:27 +0000 >Subject: [PATCH] Bug 35570: Atomicupdate > >Move stuff out of 'FreeForm' into 'Standard' > >This atomicupdate will printout the changes it made, if any. >It will also print out the report IDs of reports that may contain occurrences of 'FreeForm'. >This is to give the sys admin the chance to fix those reports before users. > >To test, empty k-t-d: >1) Run updatedatabase, notice nothing happens >2) Install FreeForm, run: >bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) >3) Create a new 'FreeForm' ILL batch (requires a metadata enrichment plugin like https://github.com/PTFS-Europe/koha-plugin-api-pubmed) >4) Add '123' to the pubmedid list of identifiers and finish creating the batch >5) Upon creating the batch, you will now have 1 request, 1 batch and a few illrequestattributes in the 'FreeForm' backend >6) Run the updatedatabase again, notice the print outs. >7) Create a saved sql report like: >'Select * from illrequests where backend="FreeForm";' >8) Run the updatedatabase again, notice you get a warning for the above report > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../data/mysql/atomicupdate/bug_35570.pl | 71 +++++++++++++++++++ > 1 file changed, 71 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_35570.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_35570.pl b/installer/data/mysql/atomicupdate/bug_35570.pl >new file mode 100644 >index 00000000000..07101efa0e6 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35570.pl >@@ -0,0 +1,71 @@ >+use Modern::Perl; >+ >+use C4::Context; >+use Koha::Reports; >+use Term::ANSIColor; >+ >+return { >+ bug_number => "35570", >+ description => "Update 'FreeForm' ILL backend to 'Standard'", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ my ($illbatches) = $dbh->selectrow_array( >+ q| >+ SELECT count(*) from illbatches where backend = 'FreeForm'; >+ | >+ ); >+ >+ if ($illbatches) { >+ $dbh->do("UPDATE illbatches SET backend = 'Standard' where backend = 'FreeForm'"); >+ say $out colored( "Bug 35570: Updated ILL batches from 'FreeForm' to 'Standard'", 'green' ); >+ } >+ >+ my ($illrequestattributes) = $dbh->selectrow_array( >+ q| >+ SELECT count(*) from illrequestattributes where backend = 'FreeForm'; >+ | >+ ); >+ >+ if ($illrequestattributes) { >+ $dbh->do("UPDATE illrequestattributes SET backend = 'Standard' where backend = 'FreeForm'"); >+ say $out colored( "Bug 35570: Updated ILL request attributes from 'FreeForm' to 'Standard'", 'green' ); >+ } >+ >+ my ($illrequests) = $dbh->selectrow_array( >+ q| >+ SELECT count(*) from illrequests where backend = 'FreeForm'; >+ | >+ ); >+ >+ if ($illrequests) { >+ $dbh->do("UPDATE illrequests SET backend = 'Standard' where backend = 'FreeForm'"); >+ say $out colored( "Bug 35570: Updated ILL requests from 'FreeForm' to 'Standard'", 'green' ); >+ } >+ >+ my $reports = join( >+ "\n", >+ map( "\tReport ID: " >+ . $_->id >+ . ' | Edit link: ' >+ . C4::Context->preference('staffClientBaseURL') >+ . '/cgi-bin/koha/reports/guided_reports.pl?reports=' >+ . $_->id >+ . "&phase=Edit%20SQL", >+ Koha::Reports->search( { savedsql => { -like => "%FreeForm%" } } )->as_list ) >+ ); >+ >+ if ($reports) { >+ say $out colored( >+ "Bug 35570: **ACTION REQUIRED**: Saved SQL reports containing occurrences of 'FreeForm' were found. The following reports MUST be updated accordingly ('FreeForm' -> 'Standard'):", >+ 'yellow' >+ ); >+ say $out colored( $reports, 'blue'); >+ } else { >+ say $out "Bug 35570: Finished database update."; >+ } >+ >+ >+ }, >+}; >-- >2.39.2
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 35570
:
159942
|
159943
|
159944
|
159946
|
159947
|
160452
|
160457
|
160654
|
160655
|
160656
|
160657
|
160658
|
160659
|
160660
|
160686
|
161519
|
161520
|
161521
|
161522
|
161523
|
161524
|
162894
|
162897
|
162898
|
162899
|
162900
|
162901
|
162902
|
162903
|
162904
|
162905
|
164277
|
164278
|
164279
|
164280
|
164281
|
164282
|
164283
|
164284
|
165204
|
165205
|
165206
|
165207
|
165208
|
165209
|
165210
|
165211
|
165286
|
165287
|
165288
|
165289
|
165290
|
165291
|
165292
|
165293
|
167050
|
167051
|
171312
|
171313
|
171314
|
171315
|
171316
|
171317
|
171318
|
171319
|
171320
|
171321
|
171322
|
171323
|
172218
|
172219
|
172722
|
172723
|
172724
|
172725
|
172726
|
172727
|
172728
|
172729
|
172730
|
172731
|
172732
|
172733
|
172734
|
172735
|
172740
|
172741
|
172742
|
172743
|
172744
|
172745
|
172746
|
172747
|
172748
|
172749
|
172750
|
172751
|
172752
|
172753
|
172780
|
172809
|
172811
|
173916
|
173917
|
173918