/**
     * @service coupon read
     * @param $fields
     * @return Gpf_Rpc_Form
     */
    public function load(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);
        $form->addField(Pap_Db_Table_Coupons::CODE, null);

        $coupon = new Pap_Db_Coupon();
        $coupon->setId($form->getFieldValue(Gpf_View_FormService::ID));
        $coupon->setCode($form->getFieldValue(Gpf_View_FormService::ID));
        $banner = new Pap_Features_Coupon_Coupon();
        $affiliate = new Pap_Affiliates_User();

        try {
            $this->loadCoupon($coupon);
            if (!$coupon->isValid()) {
                return $form;
            }
            $banner->setPrimaryKeyValue($coupon->getBannerID());
            $banner->load();
            $affiliate->setPrimaryKeyValue($coupon->getUserID());
            $affiliate->load();
            $form->addField('couponid', $coupon->getId());
            $form->addField('couponcode', $coupon->getCode());
            $form->addField('name', $banner->getName());
            $form->addField('description', $banner->getData1());
            $this->fillFromUser($form, $affiliate);
            
            Gpf_Plugins_Engine::extensionPoint('PostAffiliate.OfflineSaleForm.load', $form);
            
        } catch (Gpf_Exception $e) {
        }

        return $form;
    }
 protected function createResultSelect() {
     parent::createResultSelect();
     $this->banner = new Pap_Features_Coupon_Coupon();
     $this->banner->setPrimaryKeyValue($this->getBannerID());
     try {
         $this->banner->load();
     } catch (Gpf_DbEngine_NoRowException $e) {
         throw new Gpf_Exception($this->_('Coupon banner with id %s not exist', $this->getBannerID()));
     }
 }