/** * 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); }
/** * Overrides CommerceLicenseBillingUsageBase::addUsage(). */ public function addUsage($revisionId, $quantity, $start = NULL, $end = NULL) { if (is_null($start)) { // Default $start to current time. $start = commerce_license_get_time(); } if (is_null($end)) { // Default $end to current time. $end = commerce_license_get_time(); } // Open the new usage. parent::addUsage($revisionId, $quantity, $start, $end); }