From 5338cad98c61a0064cbfeacf7cdf2db6f3e5c0f4 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 14 Mar 2022 11:54:33 +0000 Subject: [PATCH] Bug 30290: Database revision for existing notices Content-Type: text/plain; charset=utf-8 Note: It will be hard to update translated notices. If we cannot find the part 'Pages:' then the replace does not do anything. Test plan: Run db rev. Check an existing AR notice (English). Signed-off-by: Marcel de Rooy --- installer/data/mysql/atomicupdate/bug_30290.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_30290.pl diff --git a/installer/data/mysql/atomicupdate/bug_30290.pl b/installer/data/mysql/atomicupdate/bug_30290.pl new file mode 100755 index 0000000000..c367b4fda2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30290.pl @@ -0,0 +1,16 @@ +use Modern::Perl; + +return { + bug_number => 30290, + description => "Modify AR notices, include TOC line", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + my $sql = q| +UPDATE letter +SET content=REPLACE(content, '\nPages:', '\nTOC: [% IF article_request.toc_request %]Include TOC[% ELSE %]No[% END %]\nPages:') +WHERE code RLIKE '^AR_' AND module='circulation' AND content NOT RLIKE '\nTOC:'; + |; + $dbh->do( $sql ); + }, +}; -- 2.20.1