You are here

public function PricingEvent::applyOperation in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7

Applies an operation against a Price event.

Parameters

int $amount: The operation amount.

string $operation: The operation type.

int $days: The number of days the event lasts.

Overrides PricingEventInterface::applyOperation

File

modules/rooms_pricing/includes/rooms_pricing.pricing_event.inc, line 56
contains PricingEvent.

Class

PricingEvent
@file contains PricingEvent.

Code

public function applyOperation($amount, $operation) {
  switch ($operation) {
    case ROOMS_REPLACE:
      $this->amount = $amount;
      break;
    case ROOMS_ADD:
      $this->amount = $this->amount + $amount;
      break;
    case ROOMS_SUB:
      $this->amount = $this->amount - $amount;
      break;
    case ROOMS_INCREASE:
      $this->amount = $this->amount + $this->amount * ($amount / 100);
      break;
    case ROOMS_DECREASE:
      $this->amount = $this->amount - $this->amount * ($amount / 100);
      break;
    default:
      break;
  }
}