/** * Recollect quote totals to update amounts based on newly received tax * data. This collect totals call is expected to happen recursively within * collect totals. The flags in eb2ccore/session are expected to prevent * going beyond a single recursive call to collect totals. As an additional * precaution, a lock is also used to prevent unexpected recursion. * * @param Mage_Sales_Model_Quote * @return Mage_Sales_Model_Quote */ protected function recollectTotals(Mage_Sales_Model_Quote $quote) { // Guard against unexpected recursion. Session flags should prevent // this but need to be sure this can't trigger infinite recursion. // If the lock is free (set to false), expect to not be within a recursive // collectTotals triggered by taxes. if (!self::$lockRecollectTotals) { // Acquire the lock prior to triggering the recursion. Prevents taxes // from being able to trigger further recursion. self::$lockRecollectTotals = true; $quote->collectTotals(); // Free the lock once we're clear of the recursive collectTotals. self::$lockRecollectTotals = false; } else { // Do not expect further recursive attempts to occur. Something // would be potentially wrong with the session flags if it does. $this->logger->warning('Attempted to recollect totals for taxes during a recursive collection. Additional collection averted to prevent further recursion.', $this->logContext->getMetaData(__CLASS__)); } return $quote; }