Esempio n. 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_Field();
     $field->id = $id;
     if ($field->find(true)) {
         // delete the options for this field
         require_once 'CRM/Price/BAO/FieldValue.php';
         CRM_Price_BAO_FieldValue::deleteValues($id);
         // reorder the weight before delete
         $fieldValues = array('price_set_id' => $field->price_set_id);
         require_once 'CRM/Utils/Weight.php';
         CRM_Utils_Weight::delWeight('CRM_Price_DAO_Field', $field->id, $fieldValues);
         // now delete the field
         return $field->delete();
     }
     return null;
 }
 /**
  * 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_Field();
     $field->id = $id;
     if ($field->find(TRUE)) {
         // delete the options for this field
         CRM_Price_BAO_FieldValue::deleteValues($id);
         // reorder the weight before delete
         $fieldValues = array('price_set_id' => $field->price_set_id);
         CRM_Utils_Weight::delWeight('CRM_Price_DAO_Field', $field->id, $fieldValues);
         // now delete the field
         return $field->delete();
     }
     return NULL;
 }