/**
  * Overrides CommerceLicenseBillingUsageBase::addUsage().
  */
 public function addUsage($revisionId, $quantity, $start = NULL, $end = 0)
 {
     if (is_null($start)) {
         // Default $start to current time.
         $start = commerce_license_get_time();
     }
     // Close the previous usage.
     $previous_end = $start - 1;
     db_update('cl_billing_usage')->fields(array('end' => $previous_end))->condition('license_id', $this->license->license_id)->condition('revision_id', $revisionId)->condition('usage_group', $this->groupName)->condition('end', 0)->execute();
     // Open the new usage.
     parent::addUsage($revisionId, $quantity, $start, $end);
 }
 /**
  * Implements CommerceLicenseBillingUsageGroupInterface::isComplete().
  */
 public function isComplete(CommerceLicenseBillingCycle $billingCycle)
 {
     // Usage is reported right away, so it can always be considered complete.
     if (!empty($this->groupInfo['immediate'])) {
         return TRUE;
     } else {
         return parent::isComplete($billingCycle);
     }
 }