protected function init() {
     $this->setTable(Pap_Db_Table_UserPayoutOptions::getInstance());
     parent::init();
 }
Exemplo n.º 2
0
    private function assignPayoutVariablesToTemplate(Gpf_Templates_Template $template) {
        $template->assignAttributes($this->user);
        $template->assign('vat_number', $this->vatNumber);
        $template->assign('reg_number', $this->regNumber);
        $template->assign('amount_of_reg_capital', $this->amountOfRegCapital);
        $template->assign('vat_percentage', $this->vatPercentage);
        $template->assign('payoutcurrency', $this->currency->getName());
        $template->assign('affiliate_note', $this->getAffiliateNote());
        $template->assign('payment', $this->getAmount());
        $template->assign('amount', str_replace('.', ',', $this->getAmount()));
        $template->assign('currency', $this->currency->getName());

        if ($this->payoutOption != null) {
            $template->assign('payoutmethod', $this->_localize($this->payoutOption->getName()));
        }
        $template->assign('payment_vat_part', $this->amountVatPart);
        $template->assign('payment_incl_vat', $this->amountWithVat);
        $template->assign('payment_excl_vat', $this->amountWithoutWat);

        $historyItem = $this->getPayoutHistoryItem();
        if ($historyItem === null) {
            
            $template->assign('date', Gpf_Common_DateUtils::getDateInLocaleFormat());
            $template->assign('time', Gpf_Common_DateUtils::getTimeInLocaleFormat());
        } else {
            $time = new Gpf_DateTime($historyItem->getDateInserted());
            $template->assign('date', Gpf_Common_DateUtils::getDateInLocaleFormat($time->toTimestamp()));
            $template->assign('time', Gpf_Common_DateUtils::getTimeInLocaleFormat($time->toTimestamp()));
        }
        $template->assign('invoicenumber',$this->getInvoiceNumber());

        if ($this->payoutOptionFields != null) {
            $userPayoutOptions = Pap_Db_Table_UserPayoutOptions::getInstance()->getValues(
            $this->payoutOption->getFormId(), $this->user->getId());
            foreach ($this->payoutOptionFields as $payoutOptionField) {
                $code = $payoutOptionField->get('code');
                if (array_key_exists($code, $userPayoutOptions)) {
                    $template->assign($code, $userPayoutOptions[$code]->getValue());
                }
            }
        }
    }
Exemplo n.º 3
0
    /**
     * @anonym
     * @service affiliate read
     * @param Gpf_Rpc_Params $params
     */
    public function loadPayoutFields(Gpf_Rpc_Params $params) {
        $form = new Gpf_Rpc_Form($params);

        if (!Gpf_Session::getAuthUser()->isLogged()) {
            return $form;
        }

        $this->user = $this->createDbRowObject();
        $this->user->setPrimaryKeyValue($this->getId($form));
        try {
            $this->user->load();
        } catch (Gpf_DbEngine_NoRow $e) {
            throw new Exception($this->getDbRowObjectName().$this->_(" does not exist"));
        }

        $this->attribute->loadAttributes($this->user->getAccountUserId());

        $payoutOptionId = $form->getFieldValue("payoutOptionId");
        if ($payoutOptionId == null) {
            return $form;
        }
        $formFields = Gpf_Db_Table_FormFields::getInstance();
        $formName = "payout_option_" . $payoutOptionId;
        $payoutOptionFields = $formFields->getFieldsNoRpc($formName);

        $payoutOptionValues = Pap_Db_Table_UserPayoutOptions::getInstance()->getValues($formName, $this->user->getId());
        foreach ($payoutOptionFields as $field) {
            $code = $field->get("code");
            if (array_key_exists($code, $payoutOptionValues)) {
                $value = $payoutOptionValues[$code]->getValue();
            } else {
                $value = '';
            }
            $form->setField($code, $value);
        }

        return $form;
    }