/** * Link the price set with the specified table and id * * @param string $entityTable * @param integer $entityId * @param integer $priceSetId * * @return bool */ public static function addTo($entityTable, $entityId, $priceSetId) { // verify that the price set exists $dao = new CRM_Price_DAO_Set(); $dao->id = $priceSetId; if (!$dao->find()) { return FALSE; } unset($dao); $dao = new CRM_Price_DAO_SetEntity(); // find if this already exists $dao->entity_id = $entityId; $dao->entity_table = $entityTable; $dao->find(TRUE); // add or update price_set_id $dao->price_set_id = $priceSetId; return $dao->save(); }
/** * Link the price set with the specified table and id * * @param string $entityTable * @param integer $entityId * @param integer $priceSetId * @return bool */ public static function addTo($entityTable, $entityId, $priceSetId) { // verify that the price set exists $dao = new CRM_Price_DAO_Set(); $dao->id = $priceSetId; if (!$dao->find()) { return false; } unset($dao); require_once 'CRM/Price/DAO/SetEntity.php'; $dao = new CRM_Price_DAO_SetEntity(); // find if this already exists $dao->entity_id = $entityId; $dao->entity_table = $entityTable; $dao->find(true); // add or update price_set_id $dao->price_set_id = $priceSetId; return $dao->save(); }