/** * Set POST values method * * @param string|array $spec * @param null|mixed $value * @return Zend_Controller_Request_Http */ public function setPost($spec, $value = null) { if (!is_array($spec) && $value === null) { unset($_POST[$spec]); return $this; } elseif (is_array($spec) && empty($spec)) { $_POST = array(); return $this; } return parent::setPost($spec, $value); }
/** * Prepares and adds $_POST data to item's attribute * * @param array $itemPost * @param int $key * @return array */ public function prepareAttributes($itemPost, $key) { $httpRequest = new Zend_Controller_Request_Http(); $httpRequest->setPost($itemPost); /** @var $itemForm Enterprise_Rma_Model_Item_Form */ $itemForm = Mage::getModel('enterprise_rma/item_form'); $itemForm->setFormCode('default')->setEntity($this); $itemData = $itemForm->extractData($httpRequest); $files = array(); foreach ($itemData as $code => &$value) { if (is_array($value) && empty($value)) { if (array_key_exists($code . '_' . $key, $_FILES)) { $value = $_FILES[$code . '_' . $key]; $files[] = $code; } } } $itemErrors = $itemForm->validateData($itemData); if ($itemErrors !== true) { $this->_errors = array_merge($itemErrors, $this->_errors); } else { $itemForm->compactData($itemData); } if (!empty($files)) { foreach ($files as $code) { unset($_FILES[$code . '_' . $key]); } return $files; } }