Fixes + asserts
[mailer.git] / inc / libs / transaction_functions.php
index 6e47230b46325a25b17e9ec4809fa05e52a2b552..4422754cf3ca01f344bde3ba03f6b9965a264226 100644 (file)
@@ -86,7 +86,7 @@ function logTransaction ($sender, $receiver, $level, $valueAmount, $originalAmou
        );
 
        // Should work
-       assert(isValidId(getSqlInsertId()));
+       assert(isValidId(getSqlInsertId()), 'getSqlInsertId() is not valid id number.');
 }
 
 // Calculates transaction fee for sender amount
@@ -137,7 +137,7 @@ function generateHashFromTransactionData (array &$data, $oldHash = '') {
 // "Getter" for CAPTCHA code from given transaction id
 function getCaptchaCodeFromTransactionId ($transactionId) {
        // Must be valid
-       assert(isValidId($transactionId));
+       assert(isValidId($transactionId), 'transactionId=' . $transactionId . ' is not valid id number.');
 
        // Default is NULL
        $code = NULL;
@@ -319,7 +319,7 @@ LIMIT %s",
                        ), $allowed, '', FALSE);
 
                        // Should always work
-                       assert($updated === TRUE);
+                       assert($updated === TRUE, 'Nothing has been updated which is not expected.');
                } // END - if
        } // END - if
 
@@ -347,7 +347,7 @@ LIMIT %s",
                );
 
                // Should always work
-               assert(sqlAffectedRows() == count($failedIds));
+               assert(sqlAffectedRows() == count($failedIds), 'sqlAffectedRows()=' . sqlAffectedRows() . ',failedIds()=' . count($failedIds));
        } // END - if
 
        // Return status
@@ -357,7 +357,7 @@ LIMIT %s",
 // Checks whether the given user has a fee exempt
 function ifUserHasTransactionFeeExempt ($username) {
        // Accept only valid ids
-       assert(isValidId($username));
+       assert(isValidId($username), 'username=' . $username . ' which is not a valid id number.');
 
        // Is there "cache"?
        if (!isset($GLOBALS[__FUNCTION__][$username])) {
@@ -365,7 +365,7 @@ function ifUserHasTransactionFeeExempt ($username) {
                $GLOBALS[__FUNCTION__][$username] = FALSE;
 
                // "Determine" it
-               $GLOBALS[__FUNCTION__][$username] = (getTotalAmountByUserid($username) < getConfig('transaction_fee_exempt_amount'));
+               $GLOBALS[__FUNCTION__][$username] = (getTotalPoints($username) < getConfig('transaction_fee_exempt_amount'));
        } // END - if
 
        // Return cache