public function __construct($a_parent_obj, $a_parent_cmd = "") { $this->settings = ilPaymentSettings::_getInstance(); parent::__construct($a_parent_obj, $a_parent_cmd); $this->setFilterId('advanced_filter'); $this->setFilterCols(3); }
public static function _getInstance() { if (!isset(self::$_instance)) { self::$_instance = new ilPaymentSettings(); } return self::$_instance; }
/** * Constructor * * @access private */ private function ilBMFSettings() { global $ilDB; $this->db = $ilDB; $this->pSettings = ilPaymentSettings::_getInstance(); $this->getSettings(); }
function executeCommand() { global $ilUser; // Check for incomplete profile if ($ilUser->getProfileIncomplete()) { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } // check whether password of user have to be changed // due to first login or password of user is expired if ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired()) { ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI'); } $next_class = $this->ctrl->getNextClass($this); switch ($next_class) { case 'ilpageobjectgui': $this->prepareOutput(); $ret = $this->forwardToPageObject(); if ($ret != '') { $this->tpl->setContent($ret); } break; default: switch ($this->cmd) { case 'firstpage': $this->clearFilter(); if (!$this->genSet->get('show_general_filter') && !$this->genSet->get('show_topics_filter') && !$this->genSet->get('show_shop_explorer')) { $cmd = 'performSearch'; } else { if (ilPaymentSettings::useShopSpecials() == true) { $cmd = 'showSpecialContent'; } else { $cmd = 'performSearch'; } } break; case 'resetFilter': $cmd = 'resetFilter'; break; case 'setFilter': $cmd = 'setFilter'; break; default: $cmd = 'performSearch'; break; } if ($this->cmd != 'firstpage' && (isset($_GET['ref_id']) || $this->cmd == 'showTree')) { $obj_type = ilObject::_lookupType(ilObject::_lookupObjId($this->cur_ref_id)); $container = array("root", "cat", 'catr', "grp", "icrs", "crs", 'crsr', 'rcrs'); if (in_array($obj_type, $container)) { $cmd = 'showContainerContent'; } else { $cmd = 'performSearch'; } } $this->prepareOutput(); $this->{$cmd}(); break; } return true; }
public function __construct() { global $ilCtrl, $lng, $tpl, $ilMainMenu; $this->ctrl = $ilCtrl; $this->tpl = $tpl; $this->lng = $lng; $this->settings = ilPaymentSettings::_getInstance(); $this->lng->loadLanguageModule('search'); $this->lng->loadLanguageModule('payment'); $ilMainMenu->setActive('shop'); }
public function __construct($a_user_id = '', $a_admin_view = false) { global $ilDB; $this->admin_view = $a_admin_view; $this->user_id = $a_user_id; $this->db = $ilDB; include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $this->currency_unit = $genSet->get('currency_unit'); if ($a_user_id) { $this->__read(); } }
function executeCommand() { $next_class = $this->ctrl->getNextClass($this); switch ($next_class) { case 'ilshoppagegui': $this->prepareOutput(); $ret = $this->forwardToPageObject(); if ($ret != '') { $this->tpl->setContent($ret); } break; default: switch ($this->cmd) { case 'firstpage': $this->clearFilter(); if (!$this->genSet->get('show_general_filter') && !$this->genSet->get('show_topics_filter') && !$this->genSet->get('show_shop_explorer')) { $cmd = 'performSearch'; } else { if (ilPaymentSettings::useShopSpecials() == true) { $cmd = 'showSpecialContent'; } else { $cmd = 'performSearch'; } } break; case 'resetFilter': $cmd = 'resetFilter'; break; case 'setFilter': $cmd = 'setFilter'; break; default: $cmd = 'performSearch'; break; } if ($this->cmd != 'firstpage' && (isset($_GET['ref_id']) || $this->cmd == 'showTree')) { $obj_type = ilObject::_lookupType(ilObject::_lookupObjId($this->cur_ref_id)); $container = array("root", "cat", 'catr', "grp", "crs", 'crsr', 'rcrs'); if (in_array($obj_type, $container)) { $cmd = 'showContainerContent'; } else { $cmd = 'performSearch'; } } $this->prepareOutput(); $this->{$cmd}(); break; } return true; }
protected function buildSubTabs() { global $ilUser, $ilTabs, $ilCtrl; $settings = ilPaymentSettings::_getInstance(); if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasStatisticPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('bookings', $ilCtrl->getLinkTargetByClass('ilpaymentstatisticgui'), '', '', ''); } if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasObjectPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_object', $ilCtrl->getLinkTargetByClass('ilpaymentobjectgui'), '', '', ''); } if (ilPaymentVendors::_isVendor($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_trustees', $ilCtrl->getLinkTargetByClass('ilpaymenttrusteegui'), '', '', ''); } if (!(bool) $settings->get('hide_coupons')) { if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasCouponsPermission($ilUser->getId())) { $ilTabs->addSubTabTarget('paya_coupons_coupons', $ilCtrl->getLinkTargetByClass('ilpaymentcoupongui'), '', '', ''); } } }
public function __construct() { parent::__construct(); global $ilCtrl; if (isset($_POST['cmd']) && $_POST['cmd'] == 'setFilter') { $this->cmd = 'setFilter'; } else { $this->cmd = $ilCtrl->getCmd(); } $this->cur_ref_id = (int) $_GET['ref_id']; $this->settings = ilPaymentSettings::_getInstance(); $this->ilShopSearchResult = ilShopSearchResult::_getInstance(SHOP_CONTENT); // set filter settings $this->setType($_SESSION['shop_content']['type']); $this->setString($_SESSION['shop_content']['text']); $this->setTopicId($_POST['filter_topic_id']); // set sorting $this->setSortingTypeTopics($_SESSION['shop_content']['order_topics_sorting_type']); $this->setSortingDirectionTopics($_SESSION['shop_content']['shop_topics_sorting_direction']); $this->setSortField($_POST['order_field']); $this->setSortDirection($_SESSION['shop_content']['shop_order_direction']); }
/** * initialise $ilSettings object and define constants * * Used in Soap */ protected static function initSettings() { global $ilSetting; self::initGlobal("ilSetting", "ilSetting", "Services/Administration/classes/class.ilSetting.php"); // check correct setup if (!$ilSetting->get("setup_ok")) { self::abortAndDie("Setup is not completed. Please run setup routine again."); } // set anonymous user & role id and system role id define("ANONYMOUS_USER_ID", $ilSetting->get("anonymous_user_id")); define("ANONYMOUS_ROLE_ID", $ilSetting->get("anonymous_role_id")); define("SYSTEM_USER_ID", $ilSetting->get("system_user_id")); define("SYSTEM_ROLE_ID", $ilSetting->get("system_role_id")); define("USER_FOLDER_ID", 7); // recovery folder define("RECOVERY_FOLDER_ID", $ilSetting->get("recovery_folder_id")); // installation id define("IL_INST_ID", $ilSetting->get("inst_id", 0)); // define default suffix replacements define("SUFFIX_REPL_DEFAULT", "php,php3,php4,inc,lang,phtml,htaccess"); define("SUFFIX_REPL_ADDITIONAL", $ilSetting->get("suffix_repl_additional")); if (ilContext::usesHTTP()) { self::buildHTTPPath(); } // payment setting require_once 'Services/Payment/classes/class.ilPaymentSettings.php'; define('IS_PAYMENT_ENABLED', ilPaymentSettings::_isPaymentEnabled()); }
private function __checkItems($a_array) { $genSet = ilPaymentSettings::_getInstance(); // Wrong currency if ($a_array["mc_currency"] != $genSet->get("currency_unit")) { return false; } $sc = $this->psc_obj->getShoppingCart($this->pay_method); $this->psc_obj->clearCouponItemsSession(); if (is_array($sc) && count($sc) > 0) { for ($i = 0; $i < count($sc); $i++) { $items[$i] = array("name" => $a_array["item_name" . ($i + 1)], "amount" => $a_array["mc_gross_" . ($i + 1)]); if (!empty($_SESSION["coupons"]["paypal"])) { $sc[$i]["math_price"] = (double) $sc[$i]["price"]; $tmp_pobject = new ilPaymentObject($this->user_obj, $sc[$i]['pobject_id']); foreach ($_SESSION["coupons"]["paypal"] as $key => $coupon) { $this->coupon_obj->setId($coupon["pc_pk"]); $this->coupon_obj->setCurrentCoupon($coupon); if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) { $_SESSION["coupons"]["paypal"][$key]["total_objects_coupon_price"] += (double) $sc[$i]["price"]; $_SESSION["coupons"]["paypal"][$key]["items"][] = $sc[$i]; } } unset($tmp_pobject); } } $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["paypal"]); $found = 0; $total = 0; for ($i = 0; $i < count($sc); $i++) { if (array_key_exists($sc[$i]["pobject_id"], $coupon_discount_items)) { $sc[$i]["price"] = round($coupon_discount_items[$sc[$i]["pobject_id"]]["discount_price"], 2); if ($sc[$i]["price"] < 0) { $sc[$i]["price"] = 0.0; } } for ($j = 0; $j < count($items); $j++) { if (substr($items[$j]["name"], 0, strlen($sc[$i]["obj_id"]) + 2) == "[" . $sc[$i]["obj_id"] . "]" && $items[$j]["amount"] == $sc[$i]["price"]) { $total += $items[$j]["amount"]; $found++; } } } // The number of items, the items themselves and their amounts and the total amount correct if (number_format($total, 2, ".", "") == $a_array["mc_gross"] && $found == count($sc)) { return true; } } return false; }
public function editPriceObject() { $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id']; $price = ilPaymentPrices::_getPrice($price_id); $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']); $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']); include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false); if ($tmp_obj) { $form->setTitle($tmp_obj->getTitle()); } else { $form->setTitle($this->lng->txt('object_not_found')); } //price_type $radio_group = new ilRadioGroupInputGUI('', 'price_type'); $radio_group->setTitle($this->lng->txt('duration')); $radio_group->setRequired(true); $radio_group->setValue($price['price_type']); $radio_group->setPostVar('price_type'); $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH); // duration month $oDuration = new ilNumberInputGUI(); $oDuration->setTitle($this->lng->txt('paya_months')); $oDuration->setSize('20%'); $oDuration->setValue($price['duration']); $oDuration->setPostVar('duration_month'); $radio_option_1->addSubItem($oDuration); $radio_group->addOption($radio_option_1); $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE); // duration_date from $o_date_from = new ilDateTimeInputGUI(); $o_date_from->setTitle($this->lng->txt('cal_from')); $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE)); $o_date_from->setPostVar('duration_date_from'); $radio_option_3->addSubItem($o_date_from); // duration_date until $o_date_until = new ilDateTimeInputGUI(); $o_date_until->setTitle($this->lng->txt('cal_until')); $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE)); $o_date_until->setPostVar('duration_date_until'); $radio_option_3->addSubItem($o_date_until); $radio_group->addOption($radio_option_3); $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION); $radio_group->addOption($radio_option_2); $form->addItem($radio_group); // description $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $oDescription->setRows(4); $oDescription->setCols(35); $oDescription->setValue($price['description']); $form->addItem($oDescription); // price $oPrice = new ilNumberInputGUI(); $oPrice->setTitle($this->lng->txt('price_a')); $oPrice->setSize('20%'); $oPrice->setRequired(true); $oPrice->setValue($price['price']); include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $oPrice->setInfo($genSet->get('currency_unit')); $oPrice->setPostVar('price'); $oPrice->allowDecimals(true); $form->addItem($oPrice); //extension $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension'); $oExtension->setChecked($price['extension']); $form->addItem($oExtension); $o_hidden_1 = new ilHiddenInputGUI('pobject_id'); $o_hidden_1->setValue((int) $_GET['pobject_id']); $o_hidden_1->setPostVar('pobject_id'); $o_hidden_2 = new ilHiddenInputGUI('price_id'); $o_hidden_2->setValue((int) $_GET['price_id']); $o_hidden_2->setPostVar('price_id'); $form->addItem($o_hidden_1); $form->addItem($o_hidden_2); $form->addCommandButton('updatePrice', $this->lng->txt('save')); $form->addCommandButton('editPrices', $this->lng->txt('cancel')); $this->tpl->setVariable('FORM', $form->getHTML()); }
private function showItemsTable(&$a_tpl, $a_result_set, $a_pay_method = 0) { include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php'; $tbl = new ilShoppingCartTableGUI($this); $tbl->setId('tbl_id_' . $a_pay_method); $tbl->setTitle($this->lng->txt('paya_shopping_cart') . " (" . $this->lng->txt('payment_system') . ": " . ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) . ")"); $coupon_session = $a_pay_method['pm_title']; $tbl->setRowTemplate("tpl.shop_shoppingcart_row.html", "Services/Payment"); $tbl->addColumn('', 'item', '1%', true); $tbl->addColumn($this->lng->txt('title'), "table" . $a_pay_method['pm_title'] . "_title", '30%'); $tbl->addColumn($this->lng->txt('duration'), "table" . $a_pay_method['pm_title'] . "_duration", '30%'); $tbl->addColumn($this->lng->txt('vat_rate'), "table" . $a_pay_method['pm_title'] . "_vat_rate", '15%'); $tbl->addColumn($this->lng->txt('vat_unit'), "table" . $a_pay_method['pm_title'] . "_vat_unit", '15%'); $tbl->addColumn($this->lng->txt('price_a'), "table" . $a_pay_method['pm_title'] . "_price", '10%'); $tbl->setPrefix("table" . $a_pay_method['pm_title'] . "_"); $tbl->addMultiCommand('deleteItem', $this->lng->txt('delete')); // show total amount of costs $sc_obj = new ilPaymentShoppingCart($this->user_obj); $totalAmount = $sc_obj->getTotalAmount(); if (!empty($_SESSION['coupons'][$coupon_session])) { if (count($items = $sc_obj->getEntries($a_pay_method['pm_id']))) { $tbl->setTotalData('TXT_SUB_TOTAL', $this->lng->txt('pay_bmf_subtotal_amount') . ": "); $tbl->setTotalData('VAL_SUB_TOTAL', number_format($totalAmount[$a_pay_method['pm_id']], 2, ',', '.') . " " . $genSet->get('currency_unit')); foreach ($_SESSION['coupons'][$coupon_session] as $coupon) { $this->coupon_obj->setId($coupon['pc_pk']); $this->coupon_obj->setCurrentCoupon($coupon); $total_object_price = 0.0; $current_coupon_bonus = 0.0; foreach ($items as $item) { $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']); if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) { $price_data = ilPaymentPrices::_getPrice($item['price_id']); $price = (double) $price_data['price']; $total_object_price += $price; } unset($tmp_pobject); } $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price); $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * -1; } $tbl->setTotalData('TXT_COUPON_BONUS', $this->lng->txt('paya_coupons_coupon') . ": "); # . $coupon['pcc_code'] . ": "); #$tbl->setTotalData('VAL_COUPON_BONUS', number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get('currency_unit')); $tbl->setTotalData('VAL_COUPON_BONUS', number_format($totalAmount[$current_coupon_bonus], 2, ',', '.') . " " . $genSet->get('currency_unit')); if ($totalAmount[$a_pay_method['pm_id']] < 0) { $totalAmount[$a_pay_method['pm_id']] = 0; $this->totalVat = 0; } } } $this->totalAmount[$a_pay_method['pm_id']] = $totalAmount[$a_pay_method['pm_id']] - $totalAmount[$current_coupon_bonus] * -1; $tbl->setTotalData('TXT_TOTAL_AMOUNT', $this->lng->txt('pay_bmf_total_amount') . ": "); $tbl->setTotalData('VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$a_pay_method['pm_id']], 2, ',', '.') . " " . $genSet->get('currency_unit')); #.$item['currency']); if ($this->totalVat > 0) { $tbl->setTotalData('TXT_TOTAL_VAT', $this->lng->txt('pay_bmf_vat_included') . ": "); $tbl->setTotalData('VAL_TOTAL_VAT', number_format($this->totalVat, 2, ',', '.') . " " . $genSet->get('currency_unit')); } $tbl->setData($a_result_set); $a_tpl->setVariable('ITEMS_TABLE', $tbl->getCartHTML()); return true; }
public static function _getPriceStringFromAmount($a_price) { include_once './Services/Payment/classes/class.ilPaymentCurrency.php'; include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $currency_unit = $genSet->get("currency_unit"); $pr_str = ''; $pr_str .= number_format($a_price, 2, ",", "."); /* TODO: CURRENCY $pr_str = number_format($a_price * $this->getCurrencyConversionRate() , 2, ",", "."); * remove genset * */ return $pr_str . " " . $currency_unit; }
public static function _isUDInvoiceNumberActive() { $pSettings = ilPaymentSettings::_getInstance(); if (!IS_PAYMENT_ENABLED) { return false; } if ($pSettings->get('ud_invoice_number') == 1) { return true; } else { return false; } }
public static function _getPriceStringFromAmount($a_price) { include_once './Services/Payment/classes/class.ilPaymentCurrency.php'; include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $currency_unit = $genSet->get("currency_unit"); $pr_str = ''; $pr_str .= number_format($a_price, 2, ",", "."); return $pr_str . " " . $currency_unit; }
public function __initSearchSettingsObject() { include_once 'Services/Payment/classes/class.ilPaymentSettings.php'; $maxhits = ilPaymentSettings::_getInstance()->get('max_hits'); $this->setMaxHits($maxhits > 0 ? $maxhits : 20); }
public function saveTopicsSettings() { $genSet = ilPaymentSettings::_getInstance(); $genSet->set('enable_topics', $_POST['enable_topics'], 'gui'); $genSet->set('topics_allow_custom_sorting', $_POST['topics_allow_custom_sorting'], 'gui'); $genSet->set('topics_sorting_type', $_POST['topics_sorting_type'], 'gui'); $genSet->set('topics_sorting_direction', $_POST['topics_sorting_direction'], 'gui'); $genSet->set('show_topics_filter', $_POST['show_topics_filter'], 'gui'); ilUtil::sendSuccess($this->lng->txt('pays_updated_general_settings')); $this->showTopicsSettings(); return true; }
private function buildTabs() { global $ilTabs, $ilUser; // $shop_obj = new ilPaymentShoppingCart($ilUser); $obj = ilPaymentSettings::_getInstance(); $allSet = $obj->getAll(); $ilTabs->addTarget('content', $this->ctrl->getLinkTargetByClass('ilshopgui', 'firstpage'), '', '', ''); if (!(bool) $allSet['hide_advanced_search']) { $ilTabs->addTarget('advanced_search', $this->ctrl->getLinkTargetByClass('ilshopadvancedsearchgui'), '', '', ''); } if (!(bool) $allSet['hide_shop_info']) { $ilTabs->addTarget('shop_info', $this->ctrl->getLinkTargetByClass('ilshopinfogui'), '', '', ''); } if (!(bool) $allSet['hide_news']) { $ilTabs->addTarget('payment_news', $this->ctrl->getLinkTargetByClass('ilshopnewsgui'), '', '', ''); } if (ANONYMOUS_USER_ID != $ilUser->getId()) { if ((bool) ilPaymentSettings::_getInstance()->get('topics_allow_custom_sorting')) { $ilTabs->addTarget('pay_personal_settings', $this->ctrl->getLinkTargetByClass('ilshoppersonalsettingsgui'), '', '', ''); } // Only show if not empty $ilTabs->addTarget('paya_buyed_objects', $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui'), '', '', ''); // Only show if user is vendor if (ilPaymentVendors::_isVendor($ilUser->getId()) || ilPaymentTrustees::_hasAccess($ilUser->getId())) { $ilTabs->addTarget('paya_header', $this->ctrl->getLinkTargetByClass('ilpaymentadmingui'), '', '', ''); } } // Only show cart if not empty $ilTabs->addTarget('paya_shopping_cart', $this->ctrl->getLinkTargetByClass('ilshopshoppingcartgui'), '', '', ''); $ilTabs->addTarget('terms_conditions', $this->ctrl->getLinkTargetByClass(array('iltermsconditionsgui'), '')); }
function createBill() { global $tpl, $ilObjDataCache; $customer = $this->user_obj; $transaction = $_GET['transaction']; // $total_price = 0; // $total_vat = 0; $i = 0; include_once './Services/UICore/classes/class.ilTemplate.php'; include_once './Services/Utilities/classes/class.ilUtil.php'; include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $currency = $genSet->get('currency_unit'); $user_id = $this->user_obj->getId(); $bookings = ilPaymentBookings::__readBillByTransaction($user_id, $transaction); if ($bookings[$i]['street'] == NULL) { $bookings[$i]['street'] = nl2br(utf8_decode($customer->getStreet())); } if ($bookings[$i]['zipcode'] == NULL) { $bookings[$i]['zipcode'] = nl2br(utf8_decode($customer->getZipcode())); } if ($bookings[$i]['city'] == NULL) { $bookings[$i]['city'] = nl2br(utf8_decode($customer->getCity())); } if ($bookings[$i]['country'] == NULL) { $bookings[$i]['country'] = nl2br(utf8_decode($customer->getCountry())); } if (2 == strlen($bookings[$i]['country'])) { $this->lng->loadLanguageModule('meta'); $bookings[$i]['country'] = utf8_decode($this->lng->txt('meta_c_' . strtoupper($bookings[$i]['country']))); } $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.pay_bill.html', 'Services/Payment'); $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment'); if ($tpl->placeholderExists('HTTP_PATH')) { $http_path = ilUtil::_getHttpPath(); $tpl->setVariable('HTTP_PATH', $http_path); } ilDatePresentation::setUseRelativeDates(false); $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings[$i]['order_date'], IL_CAL_UNIX)))); $tpl->setVariable('TXT_CREDIT', utf8_decode($this->lng->txt('credit'))); $tpl->setVariable('TXT_DAY_OF_SERVICE_PROVISION', $this->lng->txt('day_of_service_provision')); include_once './Services/Payment/classes/class.ilPayMethods.php'; $str_paymethod = ilPayMethods::getStringByPaymethod($bookings[$i]['b_pay_method']); if (strlen(trim($bookings[$i]['transaction_extern']))) { $tpl->setVariable('TXT_EXTERNAL_BILL_NO', str_replace('%s', $str_paymethod, utf8_decode($this->lng->txt('external_bill_no')))); $tpl->setVariable('EXTERNAL_BILL_NO', $bookings[$i]['transaction_extern']); } $tpl->setVariable('TXT_POSITION', $this->lng->txt('position')); $tpl->setVariable('TXT_AMOUNT', $this->lng->txt('amount')); $tpl->setVariable('TXT_UNIT_PRICE', utf8_decode($this->lng->txt('unit_price'))); $tpl->setVariable('VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get('address')))); $tpl->setVariable('VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get('add_info')))); $tpl->setVariable('VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get('bank_data')))); $tpl->setVariable('TXT_BANK_DATA', utf8_decode($this->lng->txt('pay_bank_data'))); $tpl->setVariable('CUSTOMER_FIRSTNAME', utf8_decode($customer->getFirstName())); // $customer['vorname']); $tpl->setVariable('CUSTOMER_LASTNAME', utf8_decode($customer->getLastName())); //$customer['nachname']); if ($bookings['po_box'] == '') { $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings[$i]['street'])); } else { $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings[$i]['po_box'])); } $tpl->setVariable('CUSTOMER_ZIPCODE', utf8_decode($bookings[$i]['zipcode'])); $tpl->setVariable('CUSTOMER_CITY', utf8_decode($bookings[$i]['city'])); $tpl->setVariable('CUSTOMER_COUNTRY', utf8_decode($bookings[$i]['country'])); $tpl->setVariable('BILL_NO', $transaction); $tpl->setVariable('TXT_BILL', utf8_decode($this->lng->txt('pays_bill'))); $tpl->setVariable('TXT_BILL_NO', utf8_decode($this->lng->txt('pay_bill_no'))); $tpl->setVariable('TXT_DATE', utf8_decode($this->lng->txt('date'))); $tpl->setVariable('TXT_ARTICLE', utf8_decode($this->lng->txt('pay_article'))); $tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate'))); $tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit'))); $tpl->setVariable('TXT_PRICE', utf8_decode($this->lng->txt('price_a'))); for ($i = 0; $i < count($bookings[$i]); $i++) { $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings[$i]['pobject_id']); $obj_id = $ilObjDataCache->lookupObjId($bookings[$i]['ref_id']); $obj_type = $ilObjDataCache->lookupType($obj_id); $tpl->setCurrentBlock('loop'); $tpl->setVariable('LOOP_POSITION', $i + 1); $tpl->setVariable('LOOP_AMOUNT', '1'); $tpl->setVariable('LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt('period_of_service_provision'))); $tpl->setVariable('LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($obj_type))); $tpl->setVariable('LOOP_TITLE', utf8_decode($bookings[$i]['object_title']) . $assigned_coupons); $tpl->setVariable('LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt('pay_entitled_retrieve'))); if ($bookings[$i]['duration'] == 0 && $bookings[$i]['access_enddate'] == NULL) { $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration'))); } else { $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings[$i]['access_startdate'], IL_CAL_DATETIME))); $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings[$i]['access_enddate'], IL_CAL_DATETIME))); $tpl->setVariable('LOOP_DURATION', $access_startdate . ' - ' . $access_enddate . ' / ' . $bookings[$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months'))); } // old one $tpl->setVariable('LOOP_VAT_RATE', number_format($bookings[$i]['vat_rate'], 2, ',', '.') . ' %'); $tpl->setVariable('LOOP_VAT_UNIT', number_format($bookings[$i]['vat_unit'], 2, ',', '.') . ' ' . $currency); $tpl->setVariable('LOOP_UNIT_PRICE', number_format($bookings[$i]['price'], 2, ',', '.') . ' ' . $currency); $tpl->setVariable('LOOP_PRICE', number_format($bookings[$i]['price'], 2, ',', '.') . ' ' . $currency); $tpl->parseCurrentBlock('loop'); $bookings['total'] += (double) $bookings[$i]['price']; $bookings['total_vat'] += (double) $bookings[$i]['vat_unit']; $bookings['total_discount'] += (double) $bookings[$i]['discount']; unset($tmp_pobject); $sub_total_amount = $bookings['total']; } $bookings['total'] += $bookings['total_discount']; if ($bookings['total_discount'] < 0) { $tpl->setCurrentBlock('cloop'); $tpl->setVariable('TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_subtotal_amount'))); $tpl->setVariable('SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2, ',', '.') . ' ' . $currency); $tpl->setVariable('TXT_COUPON', utf8_decode($this->lng->txt('paya_coupons_coupon') . ' ' . $coupon['pcc_code'])); $tpl->setVariable('BONUS', number_format($bookings['total_discount'], 2, ',', '.') . ' ' . $currency); $tpl->parseCurrentBlock(); } if ($bookings['total'] < 0) { $bookings['total'] = 0.0; // $bookings['total_vat'] = 0.0; } $total_net_price = $sub_total_amount - $bookings['total_vat']; $tpl->setVariable('TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt('total_netprice'))); $tpl->setVariable('TOTAL_NETPRICE', number_format($total_net_price, 2, ',', '.') . ' ' . $currency); $tpl->setVariable('TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_total_amount'))); $tpl->setVariable('TOTAL_AMOUNT', number_format($bookings['total'], 2, ',', '.') . ' ' . $currency); if ($bookings['total_vat'] > 0) { $tpl->setVariable('TOTAL_VAT', number_format($bookings['total_vat'], 2, ',', '.') . ' ' . $currency); $tpl->setVariable('TXT_TOTAL_VAT', utf8_decode($this->lng->txt('plus_vat'))); } if (1 == $bookings[0]['b_pay_method']) { $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill'))); } else { $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill'))); } if (!@file_exists($genSet->get('pdf_path'))) { ilUtil::makeDir($genSet->get('pdf_path')); } $file_name = time(); if (@file_exists($genSet->get('pdf_path'))) { ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf'); } if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf')) { ilUtil::deliverFile($genSet->get('pdf_path') . '/' . $file_name . '.pdf', $transaction . '.pdf', $a_mime = 'application/pdf'); } @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html'); @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf'); }
/** * Constructor * */ private function __construct() { $this->pSettings = ilPaymentSettings::_getInstance(); $this->getSettings(); }
public function saveCustomer() { global $ilObjDataCache; if (!isset($_GET['sell_id'])) { ilUtil::sendInfo($this->lng->txt('paya_error_no_object_id_given')); $this->showObjectSelector(); return true; } if (!isset($_GET['user_id'])) { ilUtil::sendInfo($this->lng->txt('paya_error_no_user_id_given')); $this->searchUser(); return true; } if ($_POST["pay_method"] == "" || $_POST["duration"] == "") { ilUtil::sendInfo($this->lng->txt('paya_error_mandatory_fields')); $this->addCustomer(); return true; } $pObjectId = ilPaymentObject::_lookupPobjectId($_GET["sell_id"]); $obj = new ilPaymentObject($this->user_obj, $pObjectId); $this->__initBookingObject(); $transaction = ilInvoiceNumberPlaceholdersPropertyGUI::_generateInvoiceNumber($_GET["user_id"]); $this->booking_obj->setTransaction($transaction); $this->booking_obj->setTransactionExtern($_POST["transaction"]); $this->booking_obj->setPobjectId($pObjectId); $this->booking_obj->setCustomerId($_GET["user_id"]); $this->booking_obj->setVendorId($obj->getVendorId()); $this->booking_obj->setPayMethod((int) $_POST["pay_method"]); $this->booking_obj->setOrderDate(time()); $price = ilPaymentPrices::_getPrice($_POST["duration"]); $this->booking_obj->setDuration($price["duration"]); $this->booking_obj->setAccessExtension($price['extension']); switch ((int) $price['price_type']) { case ilPaymentPrices::TYPE_UNLIMITED_DURATION: $this->booking_obj->setDuration(0); break; case ilPaymentPrices::TYPE_DURATION_DATE: $this->booking_obj->setAccessStartdate($price['duration_from']); $this->booking_obj->setAccessEnddate($price['duration_until']); $this->booking_obj->setDuration(0); break; default: case ilPaymentPrices::TYPE_DURATION_MONTH: $this->booking_obj->setDuration($price["duration"]); break; } $this->booking_obj->setPriceType($price['price_type']); $this->booking_obj->setPrice(ilPaymentPrices::_getPriceString($_POST["duration"])); $this->booking_obj->setAccess((int) $_POST['access']); $this->booking_obj->setPayed((int) $_POST['payed']); $this->booking_obj->setVoucher(''); $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId()); $obj_type = $ilObjDataCache->lookupType($obj_id); $obj_title = $ilObjDataCache->lookupTitle($obj_id); include_once 'Services/Payment/classes/class.ilShopVatsList.php'; $oVAT = new ilShopVats((int) $obj->getVatId()); $obj_vat_rate = $oVAT->getRate(); $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice()); $this->booking_obj->setObjectTitle($obj_title); $this->booking_obj->setVatRate($obj_vat_rate); $this->booking_obj->setVatUnit($obj_vat_unit); include_once './Services/Payment/classes/class.ilPaymentSettings.php'; $genSet = ilPaymentSettings::_getInstance(); $this->booking_obj->setCurrencyUnit($genSet->get('currency_unit')); include_once './Services/Payment/classes/class.ilPayMethods.php'; if (ilPayMethods::_EnabledSaveUserAddress((int) $_POST["pay_method"]) == 1) { /** * @class $ilObjUser ilObjUser */ global $ilObjUser; $user_id[] = $_GET["user_id"]; $cust_obj = ilObjUser::_readUsersProfileData($user_id); $this->booking_obj->setStreet($cust_obj[$_GET["user_id"]]['street'], ''); $this->booking_obj->setZipcode($cust_obj[$_GET["user_id"]]['zipcode']); $this->booking_obj->setCity($cust_obj[$_GET["user_id"]]['city']); $this->booking_obj->setCountry($cust_obj[$_GET["user_id"]]['country']); } if ($this->booking_obj->add()) { // add purchased item to desktop ilShopUtils::_addPurchasedObjToDesktop($obj, $this->booking_obj->getCustomerId()); // autosubscribe user if purchased object is a course if ($obj_type == 'crs') { ilShopUtils::_assignPurchasedCourseMemberRole($obj, $this->booking_obj->getCustomerId()); } ilUtil::sendInfo($this->lng->txt('paya_customer_added_successfully')); $this->showStatistics(); } else { ilUtil::sendInfo($this->lng->txt('paya_error_adding_customer')); $this->addCustomer(); } return true; }