/** * @param CRM_Core_Form $form */ public static function buildQuickForm(&$form) { $form->removeElement('status_id'); $form->removeElement('priority_id'); $caseId = CRM_Utils_Array::first($form->_caseId); $form->_caseType = CRM_Case_PseudoConstant::caseType(); $form->_caseTypeId = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_Case', $caseId, 'case_type_id'); if (!in_array($form->_caseTypeId, $form->_caseType)) { $form->_caseType[$form->_caseTypeId] = CRM_Core_DAO::getFieldValue('CRM_Case_DAO_CaseType', $form->_caseTypeId, 'title'); } $form->add('select', 'case_type_id', ts('New Case Type'), $form->_caseType, TRUE); // timeline $form->addYesNo('is_reset_timeline', ts('Reset Case Timeline?'), NULL, TRUE, array('onclick' => "return showHideByValue('is_reset_timeline','','resetTimeline','table-row','radio',false);")); $form->addDateTime('reset_date_time', ts('Reset Start Date'), FALSE, array('formatType' => 'activityDateTime')); }
/** * Build form. * * @param CRM_Core_Form $form */ public static function buildQuickForm(&$form) { // FIXME: this is using the following as keys rather than the standard numeric keys returned by CRM_Utils_Date $dayOfTheWeek = array(); $dayKeys = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'); foreach (CRM_Utils_Date::getAbbrWeekdayNames() as $k => $label) { $dayOfTheWeek[$dayKeys[$k]] = $label; } $form->add('select', 'repetition_frequency_unit', ts('Repeats every'), CRM_Core_SelectValues::getRecurringFrequencyUnits(), FALSE, array('class' => 'required')); $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30); $form->add('select', 'repetition_frequency_interval', NULL, $numericOptions, FALSE, array('class' => 'required')); $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime')); foreach ($dayOfTheWeek as $key => $val) { $startActionCondition[] = $form->createElement('checkbox', $key, NULL, $val); } $form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on')); $roptionTypes = array('1' => ts('day of the month'), '2' => ts('day of the week')); $form->addRadio('repeats_by', ts("Repeats by"), $roptionTypes, array('required' => TRUE), NULL); $form->add('select', 'limit_to', '', CRM_Core_SelectValues::getNumericOptions(1, 31)); $dayOfTheWeekNo = array('first' => ts('First'), 'second' => ts('Second'), 'third' => ts('Third'), 'fourth' => ts('Fourth'), 'last' => ts('Last')); $form->add('select', 'entity_status_1', '', $dayOfTheWeekNo); $form->add('select', 'entity_status_2', '', $dayOfTheWeek); $eoptionTypes = array('1' => ts('After'), '2' => ts('On')); $form->addRadio('ends', ts("Ends"), $eoptionTypes, array('class' => 'required'), NULL); // Offset options gets key=>val pairs like 1=>2 because the BAO wants to know the number of // children while it makes more sense to the user to see the total number including the parent. $offsetOptions = range(1, 30); unset($offsetOptions[0]); $form->add('select', 'start_action_offset', NULL, $offsetOptions, FALSE); $form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule')); $form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing')); $form->add('text', 'exclude_date_list', ts('Exclude Dates'), array('class' => 'twenty')); $form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit')); $form->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); // For client-side pluralization $form->assign('recurringFrequencyOptions', array('single' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits()), 'plural' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits(2)))); }
/** * Build the form object for Additional Details. * * @param CRM_Core_Form $form */ public static function buildAdditionalDetail(&$form) { //Additional information section $form->add('hidden', 'hidden_AdditionalDetail', 1); $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution'); $form->addDateTime('thankyou_date', ts('Thank-you Sent'), FALSE, array('formatType' => 'activityDateTime')); // add various amounts $nonDeductAmount =& $form->add('text', 'non_deductible_amount', ts('Non-deductible Amount'), $attributes['non_deductible_amount']); $form->addRule('non_deductible_amount', ts('Please enter a valid monetary value for Non-deductible Amount.'), 'money'); if ($form->_online) { $nonDeductAmount->freeze(); } $feeAmount =& $form->add('text', 'fee_amount', ts('Fee Amount'), $attributes['fee_amount']); $form->addRule('fee_amount', ts('Please enter a valid monetary value for Fee Amount.'), 'money'); if ($form->_online) { $feeAmount->freeze(); } $netAmount =& $form->add('text', 'net_amount', ts('Net Amount'), $attributes['net_amount']); $form->addRule('net_amount', ts('Please enter a valid monetary value for Net Amount.'), 'money'); if ($form->_online) { $netAmount->freeze(); } $element =& $form->add('text', 'invoice_id', ts('Invoice ID'), $attributes['invoice_id']); if ($form->_online) { $element->freeze(); } else { $form->addRule('invoice_id', ts('This Invoice ID already exists in the database.'), 'objectExists', array('CRM_Contribute_DAO_Contribution', $form->_id, 'invoice_id')); } $element = $form->add('text', 'creditnote_id', ts('Credit Note ID'), $attributes['creditnote_id']); if ($form->_online) { $element->freeze(); } else { $form->addRule('creditnote_id', ts('This Credit Note ID already exists in the database.'), 'objectExists', array('CRM_Contribute_DAO_Contribution', $form->_id, 'creditnote_id')); } $form->add('select', 'contribution_page_id', ts('Online Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage()); $form->add('textarea', 'note', ts('Notes'), array("rows" => 4, "cols" => 60)); $statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); if ($form->_id && $form->_values['contribution_status_id'] == array_search('Cancelled', $statusName)) { $netAmount->freeze(); $feeAmount->freeze(); } }