コード例 #1
0
 /**
  * Delete the price set field.
  *
  * @param   int   $id    Field Id
  *
  * @return  boolean
  *
  * @access public
  * @static
  *
  */
 public static function deleteField($id)
 {
     $field = new CRM_Price_DAO_PriceField();
     $field->id = $id;
     if ($field->find(TRUE)) {
         // delete the options for this field
         CRM_Price_BAO_PriceFieldValue::deleteValues($id);
         // reorder the weight before delete
         $fieldValues = array('price_set_id' => $field->price_set_id);
         CRM_Utils_Weight::delWeight('CRM_Price_DAO_PriceField', $field->id, $fieldValues);
         // now delete the field
         return $field->delete();
     }
     return NULL;
 }