You are here

public function RedhenOrgEntityController::save in RedHen CRM 7

Saves an org.

Parameters

RedhenOrg $org: The full org object to save.

Return value

RedhenOrg The saved org object.

Overrides EntityAPIController::save

File

modules/redhen_org/lib/redhen_org.controller.inc, line 22
The controller for the org entity containing the CRUD operations.

Class

RedhenOrgEntityController
The controller class for orgs contains methods for the org CRUD operations. The load method is inherited from the default controller.

Code

public function save($org, DatabaseTransaction $transaction = NULL) {
  $org->updated = REQUEST_TIME;

  // New org, set created prop.
  if (isset($org->is_new) && $org->is_new) {
    $org->created = REQUEST_TIME;
  }
  else {
    if (!isset($org->is_new_revision)) {
      $org->is_new_revision = TRUE;
    }
    if (!isset($org->default_revision)) {
      $org->default_revision = TRUE;
    }
  }
  parent::save($org);
  return $org;
}