From 1937f1b1d10aa6ddf8bea8b6da05ae4361149fe0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 Apr 2021 14:15:05 +0000 Subject: [PATCH] Bug 26734: DBRev 20.12.00.041 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_26734.perl | 163 ------------------ installer/data/mysql/updatedatabase.pl | 160 +++++++++++++++++ 3 files changed, 161 insertions(+), 164 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_26734.perl diff --git a/Koha.pm b/Koha.pm index 2ff5826a69..413a5f2d43 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "20.12.00.040"; +$VERSION = "20.12.00.041"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_26734.perl b/installer/data/mysql/atomicupdate/bug_26734.perl deleted file mode 100644 index 975ec631d1..0000000000 --- a/installer/data/mysql/atomicupdate/bug_26734.perl +++ /dev/null @@ -1,163 +0,0 @@ -$DBversion = 'XXX'; -if ( CheckVersion($DBversion) ) { - - # ACCOUNT_CREDIT UPDATES - # backup existing notice to action_logs - my $credit_arr = $dbh->selectall_arrayref( - "SELECT lang FROM letter WHERE code = 'ACCOUNT_CREDIT'", { Slice => {} }); - my $c_sth = $dbh->prepare(q{ - INSERT INTO action_logs ( timestamp, module, action, object, info, interface ) - SELECT NOW(), 'NOTICES', 'UPGRADE', id, content, 'cli' - FROM letter - WHERE lang = ? AND code = 'ACCOUNT_CREDIT' - }); - - for my $c ( @{$credit_arr} ) { - $c_sth->execute( $c->{lang} ); - } - - # replace notice with default - my $c_notice = q{ -[% USE Price %] -[% PROCESS 'accounts.inc' %] - -[% IF ( LibraryName ) %] - - - -[% END %] - - - - - - - - - - - - - - - - - - - - - - - - - - - [% IF ( credit.patron.account.balance >= 0 ) %] - - -
-

[% LibraryName | html %]

-
-

Fee receipt

-
-

[% Branches.GetName( credit.patron.branchcode ) | html %]

-
- Received with thanks from [% credit.patron.firstname | html %] [% credit.patron.surname | html %]
- Card number: [% credit.patron.cardnumber | html %]
-
DateDescription of chargesNoteAmount
[% credit.date | $KohaDates %] - [% PROCESS account_type_description account=credit %] - [%- IF credit.description %], [% credit.description | html %][% END %] - [% credit.note | html %][% credit.amount | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% credit.patron.account.balance | $Price %]
- }; - - my $c_insert = $dbh->prepare("UPDATE letter SET content = ?, is_html = 1 WHERE code = 'ACCOUNT_CREDIT'"); - $c_insert->execute($c_notice); - - # ACCOUNT_DEBIT UPDATES - # backup existing notice to action_logs - my $debit_arr = $dbh->selectall_arrayref( - "SELECT lang FROM letter WHERE code = 'ACCOUNT_DEBIT'", { Slice => {} }); - my $d_sth = $dbh->prepare(q{ - INSERT INTO action_logs ( timestamp, module, action, object, info, interface ) - SELECT NOW(), 'NOTICES', 'UPGRADE', id, content, 'cli' - FROM letter - WHERE lang = ? AND code = 'ACCOUNT_DEBIT' - }); - - for my $d ( @{$debit_arr} ) { - $d_sth->execute( $d->{lang} ); - } - - # replace notice with default - my $d_notice = q{ -[% USE Price %] -[% PROCESS 'accounts.inc' %] - - [% IF ( LibraryName ) %] - - - - [% END %] - - - - - - - - - - - - - - - - - - - - - - - - - - - [% IF ( tendered ) %] - - - - - - - - - [% END %] - - - - - [% IF ( debit.patron.account.balance <= 0 ) %] - - -
-

[% LibraryName | html %]

-
-

INVOICE

-
-

[% Branches.GetName( debit.patron.branchcode ) | html %]

-
- Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %]
- Card number: [% debit.patron.cardnumber | html %]
-
DateDescription of chargesNoteAmountAmount outstanding
[% debit.date | $KohaDates%] - [% PROCESS account_type_description account=debit %] - [%- IF debit.description %], [% debit.description | html %][% END %] - [% debit.note | html %][% debit.amount | $Price %][% debit.amountoutstanding | $Price %]
Amount tendered: [% tendered | $Price %]
Change given: [% change | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% debit.patron.account.balance | $Price %]
- }; - my $d_insert = $dbh->prepare("UPDATE letter SET content = ?, is_html = 1 WHERE code = 'ACCOUNT_DEBIT'"); - $d_insert->execute($d_notice); - - NewVersion( $DBversion, 26734, "Update notices to use defaults" ); - warn "Warning - ACCOUNT_DEBIT and ACCOUNT_CREDIT slip templates have been replaced. Backups have been made to the action logs for your reference."; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8c66f4f2f6..d4f2e904ca 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -23979,6 +23979,166 @@ if( CheckVersion( $DBversion ) ) { NewVersion( $DBversion, 27971, "Add VOID debit type code"); } +$DBversion = '20.12.00.041'; +if ( CheckVersion($DBversion) ) { + + # ACCOUNT_CREDIT UPDATES + # backup existing notice to action_logs + my $credit_arr = $dbh->selectall_arrayref(q{SELECT lang FROM letter WHERE code = 'ACCOUNT_CREDIT'}, { Slice => {} }); + my $c_sth = $dbh->prepare(q{ + INSERT INTO action_logs ( timestamp, module, action, object, info, interface ) + SELECT NOW(), 'NOTICES', 'UPGRADE', id, content, 'cli' + FROM letter + WHERE lang = ? AND code = 'ACCOUNT_CREDIT' + }); + + for my $c ( @{$credit_arr} ) { + $c_sth->execute( $c->{lang} ); + } + + # replace notice with default + my $c_notice = q{ +[% USE Price %] +[% PROCESS 'accounts.inc' %] + +[% IF ( LibraryName ) %] + + + +[% END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + [% IF ( credit.patron.account.balance >= 0 ) %] + + +
+

[% LibraryName | html %]

+
+

Fee receipt

+
+

[% Branches.GetName( credit.patron.branchcode ) | html %]

+
+ Received with thanks from [% credit.patron.firstname | html %] [% credit.patron.surname | html %]
+ Card number: [% credit.patron.cardnumber | html %]
+
DateDescription of chargesNoteAmount
[% credit.date | $KohaDates %] + [% PROCESS account_type_description account=credit %] + [%- IF credit.description %], [% credit.description | html %][% END %] + [% credit.note | html %][% credit.amount | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% credit.patron.account.balance | $Price %]
+ }; + + $dbh->do(q{UPDATE letter SET content = ?, is_html = 1 WHERE code = 'ACCOUNT_CREDIT'}, undef, $c_notice); + + # ACCOUNT_DEBIT UPDATES + # backup existing notice to action_logs + my $debit_arr = $dbh->selectall_arrayref( + "SELECT lang FROM letter WHERE code = 'ACCOUNT_DEBIT'", { Slice => {} }); + my $d_sth = $dbh->prepare(q{ + INSERT INTO action_logs ( timestamp, module, action, object, info, interface ) + SELECT NOW(), 'NOTICES', 'UPGRADE', id, content, 'cli' + FROM letter + WHERE lang = ? AND code = 'ACCOUNT_DEBIT' + }); + + for my $d ( @{$debit_arr} ) { + $d_sth->execute( $d->{lang} ); + } + + # replace notice with default + my $d_notice = q{ +[% USE Price %] +[% PROCESS 'accounts.inc' %] + + [% IF ( LibraryName ) %] + + + + [% END %] + + + + + + + + + + + + + + + + + + + + + + + + + + + [% IF ( tendered ) %] + + + + + + + + + [% END %] + + + + + [% IF ( debit.patron.account.balance <= 0 ) %] + + +
+

[% LibraryName | html %]

+
+

INVOICE

+
+

[% Branches.GetName( debit.patron.branchcode ) | html %]

+
+ Bill to: [% debit.patron.firstname | html %] [% debit.patron.surname | html %]
+ Card number: [% debit.patron.cardnumber | html %]
+
DateDescription of chargesNoteAmountAmount outstanding
[% debit.date | $KohaDates%] + [% PROCESS account_type_description account=debit %] + [%- IF debit.description %], [% debit.description | html %][% END %] + [% debit.note | html %][% debit.amount | $Price %][% debit.amountoutstanding | $Price %]
Amount tendered: [% tendered | $Price %]
Change given: [% change | $Price %]
Total outstanding dues as on date: [% ELSE %][% END %][% debit.patron.account.balance | $Price %]
+ }; + $dbh->do(q{UPDATE letter SET content = ?, is_html = 1 WHERE code = 'ACCOUNT_DEBIT'}, undef, $d_notice); + + NewVersion( $DBversion, 26734, ["Update notices to use defaults", "WARNING - ACCOUNT_DEBIT and ACCOUNT_CREDIT slip templates have been replaced. Backups have been made to the action logs for your reference."] ); +} + # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; -- 2.39.5