예제 #1
0
파일: Batch.php 프로젝트: kidaa30/yes
 /**
  * Set default values for the form.
  */
 public function setDefaultValues()
 {
     $defaults = array();
     if ($this->_action & CRM_Core_Action::ADD) {
         // Set batch name default.
         $defaults['title'] = CRM_Batch_BAO_Batch::generateBatchName();
     } else {
         $defaults = $this->_values;
     }
     return $defaults;
 }
 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch');
     $this->add('text', 'title', ts('Batch Title'), $attributes['title'], TRUE);
     $this->addRule('title', ts('Label already exists in Database.'), 'objectExists', array('CRM_Batch_DAO_Batch', $this->_id, 'title'));
     $this->add('textarea', 'description', ts('Description:') . ' ', $attributes['description']);
     require_once 'CRM/Batch/BAO/Batch.php';
     $batchName = CRM_Batch_BAO_Batch::generateBatchName();
     $defaults = array('title' => ts('GiftAid ' . $batchName));
     $this->setDefaults($defaults);
     $this->addDefaultButtons(ts('Add to batch'));
 }
예제 #3
0
 /**
  * Set default values for the form. Note that in edit/view mode
  * the default values are retrieved from the database
  *
  *
  * @return void
  */
 public function setDefaultValues()
 {
     $defaults = parent::setDefaultValues();
     if ($this->_id) {
         $this->assign('modified_date', $defaults['modified_date']);
         $this->assign('created_date', $defaults['created_date']);
     } else {
         // set batch name default
         $defaults['title'] = CRM_Batch_BAO_Batch::generateBatchName();
     }
     return $defaults;
 }