Ejemplo n.º 1
0
 /**
  * (non-PHPdoc)
  * @see CRUDPageAbstract::_getEndJs()
  */
 protected function _getEndJs()
 {
     $statusOptions = RMA::getAllStatuses();
     $js = parent::_getEndJs();
     $js .= "pageJs._statusOptions=" . json_encode($statusOptions) . ";";
     $js .= "pageJs._bindSearchKey()";
     $js .= ".setCallbackId('deactivateItems', '" . $this->deactivateItemBtn->getUniqueID() . "')";
     $js .= ".getResults(true, " . $this->pageSize . ");";
     return $js;
 }
Ejemplo n.º 2
0
 /**
  * get RMA Items by RMA
  *
  * @param RMA|string $rma
  * @return Ambigous <NULL, unknown>
  */
 public static function getByRMA($rma)
 {
     $rma = $rma instanceof RMA ? $rma : RMA::get(trim($rma));
     $rma = $rma instanceof RMA ? $rma : (count($rmas = RMA::getAllByCriteria('RMAId = ?', array(trim($rma)), true, 1, 1)) > 0 ? $rmas[0] : null);
     return $rma instanceof RMA ? count($items = self::getAllByCriteria('RMAId = ?', array($rma->getId()), true)) > 0 ? $items : null : null;
 }
Ejemplo n.º 3
0
 /**
  * Creating a RMA
  *
  * @param Customer $customer
  *
  * @return RMA
  */
 public static function create(Customer $customer, $description = '')
 {
     $ra = new RMA();
     return $ra->setCustomer($customer)->setDescription(trim($description))->save();
 }
Ejemplo n.º 4
0
 /**
  *
  * @param unknown $sender
  * @param unknown $params
  */
 public function addComments($sender, $params)
 {
     $results = $errors = array();
     try {
         Dao::beginTransaction();
         if (!isset($params->CallbackParameter->RMA) || !($RMA = RMA::get($params->CallbackParameter->RMA->id)) instanceof RMA) {
             throw new Exception('System Error: invalid CreditNote passed in!');
         }
         if (!isset($params->CallbackParameter->comments) || ($comments = trim($params->CallbackParameter->comments)) === '') {
             throw new Exception('System Error: invalid comments passed in!');
         }
         $comment = Comments::addComments($RMA, $comments, Comments::TYPE_NORMAL);
         $results = $comment->getJson();
         Dao::commitTransaction();
     } catch (Exception $ex) {
         Dao::rollbackTransaction();
         $errors[] = $ex->getMessage();
     }
     $params->ResponseData = StringUtilsAbstract::getJson($results, $errors);
 }