From a1f30804a704bfdf6187c4e581d681e6e7eaa53f Mon Sep 17 00:00:00 2001 From: abijah Date: Thu, 30 Jul 2009 21:40:38 +0000 Subject: [PATCH] Changed the StatementEntry type enum from CREDIT to SURPLUS. I never liked using the term CREDIT, since its use is confusing along side DEBIT/CREDIT. I couldn't think of another name earlier, which is why I used CREDIT, but I decided anything other than CREDIT is good, so I chose SURPLUS. git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@435 97e9348a-65ac-dc4b-aefc-98561f571b83 --- db/schema.sql | 2 +- site/models/statement_entry.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/schema.sql b/db/schema.sql index 0b51ef9..a6b8200 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -1062,7 +1062,7 @@ CREATE TABLE `pmgr_statement_entries` ( `type` ENUM('CHARGE', 'PAYMENT', - 'CREDIT') + 'SURPLUS') NOT NULL, `transaction_id` INT(10) UNSIGNED NOT NULL, diff --git a/site/models/statement_entry.php b/site/models/statement_entry.php index 8e72a7d..3da2455 100644 --- a/site/models/statement_entry.php +++ b/site/models/statement_entry.php @@ -39,7 +39,7 @@ class StatementEntry extends AppModel { ($sum ? ')' : '') . ' AS charge' . ($sum ? 's' : ''), ($sum ? 'SUM(' : '') . - "IF({$entry_name}.type = 'PAYMENT' OR {$entry_name}.type = 'CREDIT'," . + "IF({$entry_name}.type = 'PAYMENT' OR {$entry_name}.type = 'SURPLUS'," . " {$entry_name}.amount, NULL)" . ($sum ? ')' : '') . ' AS payment' . ($sum ? 's' : ''), @@ -346,7 +346,7 @@ OPTION 2 // First, find all known credits $lquery = $query; - $lquery['conditions'][] = array('StatementEntry.type' => 'CREDIT'); + $lquery['conditions'][] = array('StatementEntry.type' => 'SURPLUS'); $lquery['order'][] = 'StatementEntry.effective_date ASC'; $credits = $this->find('all', $lquery); /* pr(array('StatementEntry::assignCredits' => */ @@ -435,7 +435,7 @@ OPTION 2 $payment_account_id = $credit['LedgerEntry']['account_id']; } else { - die("HOW DID WE GET HERE WITH NO CREDITS?"); + die("HOW DID WE GET HERE WITH NO SURPLUS?"); } // Set the payment amount to the maximum amount @@ -454,7 +454,7 @@ OPTION 2 /* + compact('credit'))); */ if ($credit['balance'] < 0) - die("HOW DID WE END UP WITH NEGATIVE CREDIT BALANCE?"); + die("HOW DID WE END UP WITH NEGATIVE SURPLUS BALANCE?"); // If we've exhaused the credit, get it out of the // available credit pool (but keep track of it for later). @@ -534,7 +534,7 @@ OPTION 2 /* + compact('credit'))); */ $result = $this->addStatementEntry - (array('type' => 'CREDIT', + (array('type' => 'SURPLUS', 'account_id' => $credit['LedgerEntry']['account_id'], 'amount' => $credit['balance'], 'effective_date' => $credit['Transaction']['stamp'],