/** * function to add or update either a Personal Campaign Page OR a PCP Block * * @param array $params reference array contains the values submitted by the form * @param bool $pcpBlock if true, create or update PCPBlock, else PCP * @access public * @static * * @return object */ static function add(&$params, $pcpBlock = TRUE) { if ($pcpBlock) { // action is taken depending upon the mode $dao = new CRM_PCP_DAO_PCPBlock(); $dao->copyValues($params); $dao->save(); return $dao; } else { $dao = new CRM_PCP_DAO_PCP(); $dao->copyValues($params); // ensure we set status_id since it is a not null field // we should change the schema and allow this to be null if (!$dao->id && !isset($dao->status_id)) { $dao->status_id = 0; } // set currency for CRM-1496 if (!isset($dao->currency)) { $config =& CRM_Core_Config::singleton(); $dao->currency = $config->defaultCurrency; } $dao->save(); return $dao; } }
/** * Add or update either a Personal Campaign Page OR a PCP Block. * * @param array $params * Values to create the pcp. * * @return object */ public static function create($params) { $dao = new CRM_PCP_DAO_PCP(); $dao->copyValues($params); // ensure we set status_id since it is a not null field // we should change the schema and allow this to be null if (!$dao->id && !isset($dao->status_id)) { $dao->status_id = 0; } // set currency for CRM-1496 if (!isset($dao->currency)) { $dao->currency = CRM_Core_Config::singleton()->defaultCurrency; } $dao->save(); return $dao; }