Bug 23805: Update 'C' to 'CREDIT' for consistency
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 14 Oct 2019 15:20:31 +0000 (16:20 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 24 Oct 2019 16:35:19 +0000 (17:35 +0100)
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/Account.pm
Koha/Account/Line.pm
api/v1/swagger/definitions/patron_account_credit.json
installer/data/mysql/account_credit_types.sql
installer/data/mysql/atomicupdate/bug_23805_credit.perl
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc
reports/cash_register_stats.pl

index 4d1947e..f9d8105 100644 (file)
@@ -322,7 +322,7 @@ my $credit_line = Koha::Account->new({ patron_id => $patron_id })->add_credit(
 );
 
 $credit_type can be any of:
-  - 'credit'
+  - 'CREDIT'
   - 'payment'
   - 'forgiven'
   - 'lost_item_return'
@@ -716,7 +716,7 @@ sub reconcile_balance {
 =cut
 
 our $offset_type = {
-    'credit'           => 'Manual Credit',
+    'CREDIT'           => 'Manual Credit',
     'forgiven'         => 'Writeoff',
     'lost_item_return' => 'Lost Item',
     'payment'          => 'Payment',
@@ -739,7 +739,7 @@ our $offset_type = {
 =cut
 
 our $account_type_credit = {
-    'credit'           => 'C',
+    'CREDIT'           => 'CREDIT',
     'forgiven'         => 'FOR',
     'lost_item_return' => 'LOST_RETURN',
     'payment'          => 'Pay',
index 922e7a8..8b7ff53 100644 (file)
@@ -338,7 +338,7 @@ sub adjust {
                     {
                         amount      => $new_outstanding * -1,
                         description => 'Overpayment refund',
-                        type        => 'credit',
+                        type        => 'CREDIT',
                         interface   => $interface,
                         ( $update_type eq 'overdue_update' ? ( item_id => $self->itemnumber ) : ()),
                     }
index 1bde9c3..a2eee7a 100644 (file)
@@ -3,7 +3,7 @@
   "properties": {
     "credit_type": {
       "type": "string",
-      "description": "Type of credit ('credit', 'forgiven', 'lost_item_return', 'payment', 'writeoff' )"
+      "description": "Type of credit ('CREDIT', 'forgiven', 'lost_item_return', 'payment', 'writeoff' )"
     },
     "amount": {
       "type": "number",
index 7828d09..021538e 100644 (file)
@@ -4,5 +4,5 @@ INSERT INTO account_debit_types ( code, description, can_be_added_manually, is_s
 ('W', 'Writeoff', 0, 1),
 ('WO', 'Writeoff', 0, 1),
 ('FOR', 'Forgiven', 1, 1),
-('C', 'Credit', 1, 1),
+('CREDIT', 'Credit', 1, 1),
 ('LOST_RETURN', 'Lost item fee refund', 0, 1);
index 46b0d55..0ce6c07 100644 (file)
@@ -41,7 +41,7 @@ if ( CheckVersion($DBversion) ) {
               ('W', 'Writeoff', 0, 1),
               ('WO', 'Writeoff', 0, 1),
               ('FOR', 'Forgiven', 1, 1),
-              ('C', 'Credit', 1, 1),
+              ('CREDIT', 'Credit', 1, 1),
               ('LOST_RETURN', 'Lost item fee refund', 0, 1)
         }
     );
@@ -75,6 +75,13 @@ if ( CheckVersion($DBversion) ) {
         }
     );
 
+    # Update accountype 'C' to 'CREDIT'
+    $dbh->do(
+        qq{
+          UPDATE accountlines SET accounttype = 'CREDIT' WHERE accounttype = 'C' OR accounttype = 'CR'
+        }
+    );
+
     # Populating credit_type_code
     $dbh->do(
         qq{
index 332b350..010a89c 100644 (file)
@@ -7,7 +7,7 @@
             [%- CASE 'FOR'              -%]Forgiven
             [%- CASE 'PAY'              -%]Payment
             [%- CASE 'WO'               -%]Writeoff
-            [%- CASE 'C'                -%]Credit
+            [%- CASE 'CREDIT'           -%]Credit
             [%- CASE 'LOST_RETURN'      -%]Lost item fee refund
             [%- CASE                    -%][% account.credit_type.description | html %]
         [%- END -%]
index 937eacd..ecd1510 100644 (file)
             [%- CASE 'FOR'              -%]Forgiven
             [%- CASE 'PAY'              -%]Payment
             [%- CASE 'WO'               -%]Writeoff
-            [%- CASE 'C'                -%]Credit
+            [%- CASE 'CREDIT'           -%]Credit
             [%- CASE 'LOST_RETURN'      -%]Lost item fee refund
             [%- CASE                    -%][% account.credit_type.description | html %]
         [%- END -%]
index d0889bf..9c9ae2e 100755 (executable)
@@ -72,7 +72,7 @@ if ($do_it) {
     if ($transaction_type eq 'ALL') { #All Transactons
         $whereTType = q{};
     } elsif ($transaction_type eq 'ACT') { #Active
-        $whereTType = q{ AND credit_type_code IN ('Pay','C') };
+        $whereTType = q{ AND credit_type_code IN ('Pay','CREDIT') };
     } elsif ($transaction_type eq 'FORW') {
         $whereTType = q{ AND credit_type_code IN ('FOR','W') };
     } else {