Browse Source

Bug 22521: DBRev 18.12.00.055

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
19.05.x
Nick Clemens 4 years ago
parent
commit
75cdd63608
  1. 2
      Koha.pm
  2. 8
      Koha/Schema/Result/Accountline.pm
  3. 72
      installer/data/mysql/atomicupdate/bug_22521.perl
  4. 73
      installer/data/mysql/updatedatabase.pl

2
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 = "18.12.00.054";
$VERSION = "18.12.00.055";
sub version {
return $VERSION;

8
Koha/Schema/Result/Accountline.pm

@ -67,7 +67,7 @@ __PACKAGE__->table("accountlines");
data_type: 'varchar'
is_nullable: 1
size: 5
size: 16
=head2 status
@ -136,7 +136,7 @@ __PACKAGE__->add_columns(
"description",
{ data_type => "longtext", is_nullable => 1 },
"accounttype",
{ data_type => "varchar", is_nullable => 1, size => 5 },
{ data_type => "varchar", is_nullable => 1, size => 16 },
"status",
{ data_type => "varchar", is_nullable => 1, size => 16 },
"payment_type",
@ -285,8 +285,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OaHSR4SeurCr7h6nizbtBg
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-17 17:00:42
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2NOxgVuaRQ+6oTqgYDqzBg
sub koha_objects_class {
'Koha::Account::Lines';

72
installer/data/mysql/atomicupdate/bug_22521.perl

@ -1,72 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if ( CheckVersion($DBversion) ) {
$dbh->do(qq{
UPDATE
`account_offset_types`
SET
type = 'OVERDUE'
WHERE
type = 'Fine';
});
$dbh->do(qq{
UPDATE
`account_offset_types`
SET
type = 'OVERDUE_INCREASE'
WHERE
type = 'fine_increase';
});
$dbh->do(qq{
UPDATE
`account_offset_types`
SET
type = 'OVERDUE_DECREASE'
WHERE
type = 'fine_decrease';
});
if ( column_exists( 'accountlines', 'accounttype' ) ) {
$dbh->do(
qq{
ALTER TABLE `accountlines`
CHANGE COLUMN `accounttype`
`accounttype` varchar(16) DEFAULT NULL;
}
);
}
$dbh->do(qq{
UPDATE
accountlines
SET
accounttype = 'OVERDUE',
status = 'UNRETURNED'
WHERE
accounttype = 'FU';
});
$dbh->do(qq{
UPDATE
accountlines
SET
accounttype = 'OVERDUE',
status = 'FORGIVEN'
WHERE
accounttype = 'FFOR';
});
$dbh->do(qq{
UPDATE
accountlines
SET
accounttype = 'OVERDUE',
status = 'RETURNED'
WHERE
accounttype = 'F';
});
SetVersion($DBversion);
print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16), and map new statuses)\n";
}

73
installer/data/mysql/updatedatabase.pl

@ -18102,6 +18102,79 @@ if( CheckVersion( $DBversion ) ) {
print "Upgrade to $DBversion done (Bug 20128: Add permission for Advanced Cataloging Editor)\n";
}
$DBversion = '18.12.00.055';
if ( CheckVersion($DBversion) ) {
$dbh->do(qq{
UPDATE
`account_offset_types`
SET
type = 'OVERDUE'
WHERE
type = 'Fine';
});
$dbh->do(qq{
UPDATE
`account_offset_types`
SET
type = 'OVERDUE_INCREASE'
WHERE
type = 'fine_increase';
});
$dbh->do(qq{
UPDATE
`account_offset_types`
SET
type = 'OVERDUE_DECREASE'
WHERE
type = 'fine_decrease';
});
if ( column_exists( 'accountlines', 'accounttype' ) ) {
$dbh->do(
qq{
ALTER TABLE `accountlines`
CHANGE COLUMN `accounttype`
`accounttype` varchar(16) DEFAULT NULL;
}
);
}
$dbh->do(qq{
UPDATE
accountlines
SET
accounttype = 'OVERDUE',
status = 'UNRETURNED'
WHERE
accounttype = 'FU';
});
$dbh->do(qq{
UPDATE
accountlines
SET
accounttype = 'OVERDUE',
status = 'FORGIVEN'
WHERE
accounttype = 'FFOR';
});
$dbh->do(qq{
UPDATE
accountlines
SET
accounttype = 'OVERDUE',
status = 'RETURNED'
WHERE
accounttype = 'F';
});
SetVersion($DBversion);
print "Upgrade to $DBversion done (Bug 22521 - Update accountlines.accounttype to varchar(16), and map new statuses)\n";
}
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.

Loading…
Cancel
Save