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()); } } } }
/** * @deprecated */ public static function replaceConstantsInInvoice($params) { if(isset($params['applyVat']) && $params['applyVat'] == Gpf::YES) { $text = $params['payoutInvoiceWithVat']; } else { $text = $params['payoutInvoice']; } $userFields = Pap_Common_UserFields::getInstance(); $userFields->setUser($params['user']); $text = $userFields->replaceUserConstantsInText($text); $text = Pap_Common_UserFields::replaceCustomConstantInText('vat_number', $params['vat_number'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('reg_number', $params['reg_number'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText(Pap_Settings::VAT_PERCENTAGE_SETTING_NAME, $params['vatPercentage'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('payoutcurrency', $params['payout_currency'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('affiliate_note', $params['affiliateNote'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('payment', $params['payout_clear'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('payoutmethod', $params['payout_method'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('payment_vat_part', $params['payment_vat_part'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('payment_incl_vat', $params['payment_incl_vat'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('payment_excl_vat', $params['payment_excl_vat'], $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('date', Gpf_Common_DateUtils::getDateInLocaleFormat(), $text); $text = Pap_Common_UserFields::replaceCustomConstantInText('time', Gpf_Common_DateUtils::getTimeInLocaleFormat(), $text); return $text; }
protected function setTimeVariableValues($timeOffset = 0) { //TODO: Use date and time format as defined by customer in settings ' $time = time() + $timeOffset; $this->setVariable('date', Gpf_Common_DateUtils::getDateInLocaleFormat($time)); $this->setVariable('time', Gpf_Common_DateUtils::getTimeInLocaleFormat($time)); }