Esempio n. 1
0
 /**
  * @return array
  */
 public function getStatusOptionHash()
 {
     if (null === $this->_statusHash) {
         $storeId = Mage::app()->getRequest()->getParam('store', 0);
         $this->_statusHash = AW_Helpdesk3_Model_Source_Ticket_Status::toOptionHash($storeId);
     }
     return $this->_statusHash;
 }
Esempio n. 2
0
 /**
  * @return array
  */
 public function getStatusOptionArray()
 {
     $statusList = AW_Helpdesk3_Model_Source_Ticket_Status::toOptionArray(Mage::app()->getStore()->getId());
     foreach ($statusList as $key => $status) {
         if ($status['value'] == AW_Helpdesk3_Model_Source_Ticket_Status::NEW_VALUE) {
             unset($statusList[$key]);
             break;
         }
     }
     return $statusList;
 }
Esempio n. 3
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/saveNewPost'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     $fieldset = $form->addFieldset('aw_hdu3_ticket_new_form', array('legend' => $this->__('Ticket Information')));
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => $this->__('Subject'), 'required' => true));
     $fieldset->addField('store_ids', 'select', array('name' => 'store_id', 'label' => $this->__('Store ID'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false), 'required' => true));
     $fieldset->addField('department_id', 'select', array('name' => 'department_id', 'label' => $this->__('Department'), 'values' => AW_Helpdesk3_Model_Source_Department::toOptionArray(), 'required' => true));
     $fieldset->addField('status_id', 'select', array('name' => 'status_id', 'label' => $this->__('Status'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Status::toOptionArray(), 'required' => true));
     $fieldset->addField('priority_id', 'select', array('name' => 'priority_id', 'label' => $this->__('Priority'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Priority::toOptionArray(), 'required' => true, 'value' => AW_Helpdesk3_Model_Source_Ticket_Priority::TODO_VALUE));
     $departmentCollection = Mage::getModel('aw_hdu3/department')->getCollection()->addNotDeletedFilter();
     $_dependBlock = $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence');
     $_dependBlock->addFieldMap($form->getHtmlIdPrefix() . 'department_id', 'department_id');
     foreach ($departmentCollection as $department) {
         $fieldset->addField('department_agent_id' . $department->getId(), 'select', array('name' => 'department_agent_id' . $department->getId(), 'label' => $this->__('Agent'), 'values' => $department->getAgentCollection()->addActiveFilter()->toOptionArray()));
         $_dependBlock->addFieldMap($form->getHtmlIdPrefix() . 'department_agent_id' . $department->getId(), 'department_agent_id' . $department->getId())->addFieldDependence('department_agent_id' . $department->getId(), 'department_id', $department->getId());
     }
     $fieldset->addType('customer', 'AW_Helpdesk3_Block_Adminhtml_Ticket_New_Form_Customer');
     $fieldset->addField('customer_email', 'customer', array('label' => $this->__('Customer Email'), 'name' => 'customer_email', 'class' => 'validate-email', 'required' => true));
     $fieldset->addField('customer_name', 'text', array('label' => $this->__('Customer Name'), 'name' => 'customer_name', 'required' => true, 'value' => $this->getRequest()->getParam('customer_name')));
     $fieldset->addField('order_increment_id', 'hidden', array('name' => 'order_increment_id', 'value' => $this->getRequest()->getParam('order_increment_id')));
     $fieldset->addField('return_customer_id', 'hidden', array('name' => 'return_customer_id', 'value' => $this->getRequest()->getParam('return_customer_id')));
     $templateCollection = Mage::getModel('aw_hdu3/template')->getCollection()->addActiveFilter()->toOptionHash();
     $fieldset->addField('quick_response', 'select', array('label' => $this->__('Use Quick Response'), 'name' => 'quick_response', 'values' => $templateCollection, 'after_element_html' => $this->_prepareObserver() . $this->_getApplyQuickResponseButton()->toHtml()));
     $fieldset->addField('awhdu3_content_state', 'hidden', array('name' => 'awhdu3_content_state', 'value' => Mage::getSingleton('adminhtml/session')->getEditorState() ? Mage::getSingleton('adminhtml/session')->getEditorState() : 'show'));
     $fieldset->addField('awhdu3_content', 'editor', array('label' => $this->__('Message'), 'name' => 'content', 'style' => 'width:500px; height:400px;', 'config' => $this->_getWysiwygConfig(), 'required' => true, 'after_element_html' => $this->_showHideObserver()));
     $fieldset->addType('multiattach', 'AW_Helpdesk3_Block_Adminhtml_Ticket_Edit_Form_Reply_Multiattach');
     $fieldset->addField('attach', 'multiattach', array('label' => $this->__('Attach File(s)'), 'name' => 'attach[]', 'multiple' => true));
     $departmentId = Mage::helper('aw_hdu3/config')->getDefaultDepartmentId();
     $departmentModel = Mage::getModel('aw_hdu3/department');
     $departmentModel->load($departmentId);
     if ($departmentModel->getId() && $departmentModel->isEnabled()) {
         $form->addValues(array('department_id' => $departmentId));
     }
     $this->setChild('form_after', $_dependBlock);
     return parent::_prepareForm();
 }
Esempio n. 4
0
 /**
  * @return array
  */
 public function getStatusList()
 {
     $storeId = Mage::registry('current_store');
     return AW_Helpdesk3_Model_Source_Ticket_Status::toOptionHash($storeId);
 }
Esempio n. 5
0
 protected function _prepareMassaction()
 {
     if (!$this->_userMode) {
         $this->setMassactionIdField('main_table.id');
         $this->getMassactionBlock()->setFormFieldName('ticketIds');
         $this->getMassactionBlock()->addItem('assign_to_department', array('label' => $this->__('Assign to Department'), 'url' => $this->getUrl('*/*/massAssignToDepartment'), 'additional' => array('visibility' => array('name' => 'department_list', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Department'), 'values' => Mage::getModel('aw_hdu3/department')->getCollection()->addActiveFilter()->toOptionHash()))));
         $this->getMassactionBlock()->addItem('assign_to_agent', array('label' => $this->__('Assign to Agent'), 'url' => $this->getUrl('*/*/massAssignToAgent'), 'additional' => array('visibility' => array('name' => 'agent_list', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Agent'), 'values' => Mage::getModel('aw_hdu3/department_agent')->getCollection()->addActiveFilter()->toOptionHash()))));
         $this->getMassactionBlock()->addItem('change_status', array('label' => $this->__('Change Status'), 'url' => $this->getUrl('*/*/massChangeStatus'), 'additional' => array('visibility' => array('name' => 'status_list', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Status'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Status::toOptionHash()))));
         $this->getMassactionBlock()->addItem('change_priority', array('label' => $this->__('Change Priority'), 'url' => $this->getUrl('*/*/massChangePriority'), 'additional' => array('visibility' => array('name' => 'priority_list', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Priority'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Priority::toOptionHash()))));
         $this->getMassactionBlock()->addItem('change_lock_status', array('label' => $this->__('Change Lock Status'), 'url' => $this->getUrl('*/*/massChangeLockStatus'), 'additional' => array('visibility' => array('name' => 'lock_list', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Status'), 'values' => AW_Helpdesk3_Model_Source_Ticket_Lock::toOptionHash()))));
         $this->getMassactionBlock()->addItem('change_lock_status', array('label' => $this->__('Delete'), 'url' => $this->getUrl('*/*/massDelete'), 'additional' => array('visibility' => array('name' => 'answer', 'type' => 'select', 'class' => 'required-entry', 'label' => $this->__('Delete?'), 'values' => Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray()))));
     }
     return $this;
 }
Esempio n. 6
0
 /**
  * @return string
  */
 protected function _getNewStatusSelectHtml()
 {
     $selectHtml = "<select name='status' style='width:auto;font-size:16px;'>";
     $statusOptionHash = AW_Helpdesk3_Model_Source_Ticket_Status::toOptionHash(Mage::app()->getStore()->getId());
     foreach ($statusOptionHash as $statusId => $statusLabel) {
         if ($statusId === AW_Helpdesk3_Model_Source_Ticket_Status::NEW_VALUE) {
             continue;
         }
         switch (intval($this->getTicket()->getStatus())) {
             case AW_Helpdesk3_Model_Source_Ticket_Status::NEW_VALUE:
             case AW_Helpdesk3_Model_Source_Ticket_Status::OPEN_VALUE:
                 $isSelected = $statusId == AW_Helpdesk3_Model_Source_Ticket_Status::WAITING_VALUE;
                 break;
             default:
                 $isSelected = $statusId == $this->getTicket()->getStatus();
         }
         $selectHtml .= "<option value='{$statusId}' " . ($isSelected ? "selected" : "") . ">{$statusLabel}</option>";
     }
     $selectHtml .= "</select>";
     $label = $this->__('New Status:');
     return $label . '&nbsp' . $selectHtml;
 }