public function addCustomerObject()
 {
     global $ilToolbar;
     if ($_POST['sell_id'] != '') {
         $_GET['sell_id'] = $_POST['sell_id'];
     }
     if ($_GET['user_id'] != '') {
         $_POST['user_id'] = $_GET['user_id'];
     }
     if (!isset($_GET['sell_id'])) {
         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
         $this->showObjectSelectorObject();
         return true;
     }
     if (!isset($_POST['user_id'])) {
         ilUtil::sendInfo($this->lng->txt('paya_no_user_id_given'));
         $this->searchUserSPObject();
         return true;
     }
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $this->ctrl->setParameter($this, 'sell_id', $_GET['sell_id']);
     $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'searchUserSP'));
     $this->ctrl->setParameter($this, 'user_id', $_POST['user_id']);
     $pObjectId = ilPaymentObject::_lookupPobjectId($_GET['sell_id']);
     $obj = new ilPaymentObject($this->user_obj, $pObjectId);
     // get obj
     $tmp_obj = ilObjectFactory::getInstanceByRefId($_GET['sell_id'], false);
     if ($tmp_obj) {
         $tmp_object['title'] = $tmp_obj->getTitle();
     } else {
         $tmp_object['title'] = $this->lng->txt('object_not_found');
     }
     // get customer_obj
     $tmp_user = ilObjectFactory::getInstanceByObjId($_POST['user_id']);
     // get vendor_obj
     $tmp_vendor = ilObjectFactory::getInstanceByObjId($obj->getVendorId());
     /**/
     $oForm = new ilPropertyFormGUI();
     $oForm->setFormAction($this->ctrl->getFormAction($this, 'saveCustomer'));
     $oForm->setTitle($this->lng->txt($tmp_user->getFullname() . ' [' . $tmp_user->getLogin() . ']'));
     //transaction
     $oTransaction = new ilTextInputGUI();
     $oTransaction->setTitle($this->lng->txt('paya_transaction'));
     //$oTransaction->setValue(ilUtil::prepareFormOutut($_POST['transaction'], true));
     $oTransaction->setValue($_POST['transaction']);
     $oTransaction->setPostVar('transaction');
     $oForm->addItem($oTransaction);
     //object
     $oObject = new ilNonEditableValueGUI($this->lng->txt('title'));
     $oObject->setValue($tmp_obj->getTitle());
     $oForm->addItem($oObject);
     //vendor
     $oVendor = new ilNonEditableValueGUI($this->lng->txt('paya_vendor'));
     $oVendor->setValue($tmp_vendor->getFullname() . ' [' . $tmp_vendor->getLogin() . ']');
     $oForm->addItem($oVendor);
     // pay methods
     $oPayMethods = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
     $payOptions = ilPaymethods::getPayMethodsOptions(false);
     $oPayMethods->setOptions($payOptions);
     $oPayMethods->setValue($_POST['pay_method']);
     $oPayMethods->setPostVar('pay_method');
     $oForm->addItem($oPayMethods);
     //duration
     $duration_options = array();
     $price_obj = new ilPaymentPrices($pObjectId);
     $standard_prices = array();
     $extension_prices = array();
     $standard_prices = $price_obj->getPrices();
     $extension_prices = $price_obj->getExtensionPrices();
     $prices = array_merge($standard_prices, $extension_prices);
     if (is_array($prices)) {
         $genSet = ilPaymentSettings::_getInstance();
         $currency_unit = $genSet->get('currency_unit');
         foreach ($prices as $price) {
             switch ($price['price_type']) {
                 case ilPaymentPrices::TYPE_DURATION_MONTH:
                     $txt_duration = $price['duration'] . ' ' . $this->lng->txt('paya_months') . ' -> ' . $price['price'] . ' ' . $currency_unit;
                     break;
                 case ilPaymentPrices::TYPE_DURATION_DATE:
                     include_once './Services/Calendar/classes/class.ilDatePresentation.php';
                     $txt_duration = ilDatePresentation::formatDate(new ilDate($price['duration_from'], IL_CAL_DATE)) . ' - ' . ilDatePresentation::formatDate(new ilDate($price['duration_until'], IL_CAL_DATE)) . " -> " . ilPaymentPrices::_getPriceString($price["price_id"]) . ' ' . $currency_unit;
                     break;
                 case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                     $txt_duration = $this->lng->txt('unlimited_duration') . ' -> ' . $price['price'] . ' ' . $currency_unit;
                     break;
             }
             $txt_extension = '';
             if ($price['extension'] == 1) {
                 $txt_extension = ' (' . $this->lng->txt('extension_price') . ') ';
             }
             $duration_options[$price['price_id']] .= $txt_duration . '' . $txt_extension;
         }
     }
     $oDuration = new ilSelectInputGUI($this->lng->txt('duration'), 'price_id');
     $oDuration->setOptions($duration_options);
     $oDuration->setValue($_POST['price_id']);
     $oForm->addItem($oDuration);
     //payed
     $o_payed = new ilSelectInputGUI();
     $payed_option = array('1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_payed->setTitle($this->lng->txt('paya_payed'));
     $o_payed->setOptions($payed_option);
     $o_payed->setValue($_POST['payed']);
     $o_payed->setPostVar('payed');
     $oForm->addItem($o_payed);
     $o_access = new ilSelectInputGUI();
     $access_option = array('1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_access->setTitle($this->lng->txt('paya_access'));
     $o_access->setOptions($access_option);
     $o_access->setValue($_POST['access']);
     $o_access->setPostVar('access');
     $oForm->addItem($o_access);
     $oForm->addCommandButton('saveCustomer', $this->lng->txt('save'));
     $oForm->addCommandButton('bookings', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
     return true;
 }
 private function addBookings($pay_method, $coupon_session)
 {
     global $ilUser, $ilObjDataCache;
     include_once './Services/Payment/classes/class.ilPaymentBookings.php';
     include_once './Services/Payment/classes/class.ilPaymentObject.php';
     include_once './Services/Payment/classes/class.ilPaymentPrices.php';
     $booking_obj = new ilPaymentBookings();
     $sc_obj = new ilPaymentShoppingCart($this->user_obj);
     $items = $sc_obj->getEntries($pay_method);
     $sc_obj->clearCouponItemsSession();
     foreach ($items as $entry) {
         $pobject = new ilPaymentObject($this->user_obj, $entry['pobject_id']);
         $price = ilPaymentPrices::_getPrice($entry['price_id']);
         if (!empty($_SESSION['coupons'][$coupon_session])) {
             $entry['math_price'] = $entry['price'];
             // (float) ilPaymentPrices::_getPriceFromArray($price);
             foreach ($_SESSION['coupons'][$coupon_session] as $key => $coupon) {
                 $this->coupon_obj->setId($coupon['pc_pk']);
                 $this->coupon_obj->setCurrentCoupon($coupon);
                 if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId())) {
                     $_SESSION['coupons'][$coupon_session][$key]['total_objects_coupon_price'] += $entry['price'];
                     //(float) ilPaymentPrices::_getPriceFromArray($price);
                     $_SESSION['coupons'][$coupon_session][$key]['items'][] = $entry;
                 }
             }
         }
         unset($pobject);
     }
     $coupon_discount_items = $sc_obj->calcDiscountPrices($_SESSION['coupons'][$coupon_session]);
     foreach ($items as $entry) {
         $pobject = new ilPaymentObject($this->user_obj, $entry['pobject_id']);
         $price = ilPaymentPrices::_getPrice($entry['price_id']);
         if (array_key_exists($entry['pobject_id'], $coupon_discount_items)) {
             $bonus = $coupon_discount_items[$entry['pobject_id']]['math_price'] - $coupon_discount_items[$entry['pobject_id']]['discount_price'];
         }
         $booking_obj->setPobjectId($entry['pobject_id']);
         $booking_obj->setCustomerId($this->user_obj->getId());
         $booking_obj->setVendorId($pobject->getVendorId());
         $booking_obj->setPayMethod($pobject->getPayMethod());
         $booking_obj->setOrderDate(time());
         $booking_obj->setDuration($price['duration']);
         $booking_obj->setPrice(ilPaymentPrices::_getPriceString($entry['price_id']));
         $booking_obj->setDiscount($bonus > 0 ? -1 * $bonus : 0);
         $booking_obj->setPayed(1);
         $booking_obj->setAccess(1);
         switch ($price['price_type']) {
             case ilPaymentPrices::TYPE_UNLIMITED_DURATION:
                 $booking_obj->setDuration(0);
                 break;
             case ilPaymentPrices::TYPE_DURATION_MONTH:
                 $booking_obj->setDuration($price['duration']);
                 break;
             case ilPaymentPrices::TYPE_DURATION_DATE:
                 $booking_obj->setAccessStartdate($price['duration_from']);
                 $booking_obj->setAccessEnddate($price['duration_until']);
                 break;
         }
         $booking_obj->setAccessExtension($price['extension']);
         $obj_id = $ilObjDataCache->lookupObjId($pobject->getRefId());
         $obj_title = $ilObjDataCache->lookupTitle($obj_id);
         $oVAT = new ilShopVats((int) $pobject->getVatId());
         $obj_vat_rate = $oVAT->getRate();
         if ($bonus > 0) {
             $tmp_price = $booking_obj->getPrice() - $bonus;
             $obj_vat_unit = $pobject->getVat($tmp_price);
         } else {
             $obj_vat_unit = $pobject->getVat($booking_obj->getPrice());
         }
         $booking_obj->setObjectTitle($obj_title);
         $booking_obj->setVatRate($obj_vat_rate);
         $booking_obj->setVatUnit($obj_vat_unit);
         if (ilPaymethods::_EnabledSaveUserAddress($booking_obj->getPayMethod())) {
             $booking_obj->setStreet($this->user_obj->getStreet(), $this->user_obj->getHouseNumber);
             $booking_obj->setZipcode($this->user_obj->getZipcode());
             $booking_obj->setCity($this->user_obj->getCity());
             $booking_obj->setCountry($this->user_obj->getCountry());
         }
         $current_booking_id = $booking_obj->add();
         if ($current_booking_id) {
             $sc_obj->delete($entry['psc_id']);
             if (!empty($_SESSION['coupons'][$coupon_session])) {
                 foreach ($_SESSION['coupons'][$coupon_session] as $coupon) {
                     $this->coupon_obj->setId($coupon['pc_pk']);
                     $this->coupon_obj->setCurrentCoupon($coupon);
                     if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId())) {
                         $this->coupon_obj->addCouponForBookingId($current_booking_id);
                     }
                 }
             }
         }
         unset($current_booking_id);
         unset($pobject);
     }
     if (!empty($_SESSION['coupons'][$coupon_session])) {
         foreach ($_SESSION['coupons'][$coupon_session] as $coupon) {
             $this->coupon_obj->setId($coupon['pc_pk']);
             $this->coupon_obj->setCurrentCoupon($coupon);
             $this->coupon_obj->addTracking();
         }
     }
 }
 public function editDetails($a_show_confirm = false)
 {
     /** 
      * @var $ilToolbar ilToolbarGUI 
      */
     global $ilToolbar;
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     /** @var $genSet ilPaymentSettings */
     $genSet = ilPaymentSettings::_getInstance();
     if (!(int) $_GET['pobject_id']) {
         ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
         return $this->showObjects();
     }
     $this->__initPaymentObject((int) $_GET['pobject_id']);
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     /** @var $tmp_obj ilObject */
     $tmp_obj = ilObjectFactory::getInstanceByRefId($this->pobject->getRefId(), false);
     if (is_object($tmp_obj)) {
         $trash = '';
         if (ilObject::_isInTrash($this->pobject->getRefId())) {
             $trash = ' (' . $this->lng->txt('object_deleted') . ')';
         }
         $tmp_object['title'] = $tmp_obj->getTitle() . '' . $trash;
         $tmp_object['type'] = $tmp_obj->getType();
     } else {
         $tmp_object['title'] = $this->lng->txt('object_not_found');
         $tmp_object['type'] = false;
     }
     if ($a_show_confirm) {
         include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
         $oConfirmationGUI = new ilConfirmationGUI();
         // set confirm/cancel commands
         $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, "performDelete"));
         $oConfirmationGUI->setHeaderText($this->lng->txt("paya_sure_delete_object"));
         $oConfirmationGUI->setCancel($this->lng->txt("cancel"), "editDetails");
         $oConfirmationGUI->setConfirm($this->lng->txt("confirm"), "performDelete");
         $oConfirmationGUI->addItem('', $tmp_object['title'], $tmp_object['title']);
         $this->tpl->setVariable('CONFIRMATION', $oConfirmationGUI->getHTML());
         return true;
     }
     $ilToolbar->addButton($this->lng->txt('paya_edit_details'), $this->ctrl->getLinkTarget($this, 'editDetails'));
     $ilToolbar->addButton($this->lng->txt('paya_edit_prices'), $this->ctrl->getLinkTarget($this, 'editPrices'));
     $ilToolbar->addButton($this->lng->txt('pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $oForm = new ilPropertyFormGUI();
     $oForm->setFormAction($this->ctrl->getFormAction($this, 'updateDetails'));
     $oForm->setTitle($tmp_object['title']);
     if ($tmp_object['type']) {
         $oForm->setTitleIcon(ilUtil::getImagePath('icon_' . $tmp_object['type'] . '_b.png'));
     }
     // repository path
     $oPathGUI = new ilNonEditableValueGUI($this->lng->txt('path'));
     $oPathGUI->setValue($this->__getHTMLPath($this->pobject->getRefId()));
     $oForm->addItem($oPathGUI);
     switch ($tmp_object['type']) {
         case 'exc':
             $exc_subtype_option = array();
             $check_subtypes = ilPaymentObject::_checkExcSubtype($this->pobject->getRefId());
             if (!in_array('download', $check_subtypes) || $this->pobject->getSubtype() == 'download') {
                 $exc_subtype_option['download'] = $this->lng->txt('download');
             }
             if (!in_array('upload', $check_subtypes) || $this->pobject->getSubtype() == 'upload') {
                 $exc_subtype_option['upload'] = $this->lng->txt('upload');
             }
             $oExcSubtype = new ilSelectInputGUI($this->lng->txt('select_subtype'), 'exc_subtype');
             $oExcSubtype->setOptions($exc_subtype_option);
             $oExcSubtype->setValue($this->pobject->getSubtype());
             $oForm->addItem($oExcSubtype);
             break;
         default:
             break;
     }
     // number of purchasers
     $oPurchasersGUI = new ilNonEditableValueGUI($this->lng->txt('paya_count_purchaser'));
     $oPurchasersGUI->setValue(ilPaymentBookings::_getCountBookingsByObject((int) $_GET['pobject_id']));
     $oForm->addItem($oPurchasersGUI);
     // vendors
     $oVendorsGUI = new ilSelectInputGUI($this->lng->txt('paya_vendor'), 'vendor');
     $oVendorsGUI->setOptions($this->__getVendors());
     $oVendorsGUI->setValue($this->pobject->getVendorId());
     $oForm->addItem($oVendorsGUI);
     // status
     $oStatusGUI = new ilSelectInputGUI($this->lng->txt('status'), 'status');
     $oStatusGUI->setOptions($this->__getStatus());
     $oStatusGUI->setValue($this->pobject->getStatus());
     $oForm->addItem($oStatusGUI);
     // pay methods
     $oPayMethodsGUI = new ilSelectInputGUI($this->lng->txt('paya_pay_method'), 'pay_method');
     $PMoptions = ilPaymethods::getPayMethodsOptions('not_specified');
     $oPayMethodsGUI->setOptions($PMoptions);
     $oPayMethodsGUI->setValue($this->pobject->getPayMethod());
     $oForm->addItem($oPayMethodsGUI);
     // topics
     /** @var $shopTopicsObj ilShopTopics */
     $shopTopicsObj = ilShopTopics::_getInstance();
     $shopTopicsObj->read();
     if (is_array($topics = $shopTopicsObj->getTopics()) && count($topics)) {
         $oTopicsGUI = new ilSelectInputGUI($this->lng->txt('topic'), 'topic_id');
         include_once 'Services/Payment/classes/class.ilShopTopics.php';
         /** @var $shopTopicsObj ilShopTopics */
         $shopTopicsObj = ilShopTopics::_getInstance();
         $shopTopicsObj->read();
         $topic_options = array();
         $topic_options[''] = $this->lng->txt('please_choose');
         /** @var $oTopic ilShopTopic */
         foreach ($topics as $oTopic) {
             $topic_options[$oTopic->getId()] = $oTopic->getTitle();
         }
         $oTopicsGUI->setOptions($topic_options);
         $oTopicsGUI->setValue($this->pobject->getTopicId());
         $oForm->addItem($oTopicsGUI);
     }
     // vats
     $oShopVatsList = new ilShopVatsList();
     $oShopVatsList->read();
     if ($oShopVatsList->hasItems()) {
         $oVatsGUI = new ilSelectInputGUI($this->lng->txt('vat_rate'), 'vat_id');
         $vats_options = array();
         /** @var $oVAT ilShopVats */
         foreach ($oShopVatsList as $oVAT) {
             $vats_options[$oVAT->getId()] = ilShopUtils::_formatVAT($oVAT->getRate()) . ' -> ' . $oVAT->getTitle();
         }
         $oVatsGUI->setOptions($vats_options);
         $oVatsGUI->setValue($this->pobject->getVatId());
         $oForm->addItem($oVatsGUI);
     } else {
         $oVatsGUI = new ilNonEditableValueGUI($this->lng->txt('vat_rate'));
         $oVatsGUI->setValue($this->lng->txt('paya_no_vats_assigned'));
         $oForm->addItem($oVatsGUI);
     }
     $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail');
     $oFile = new ilFileDataShop($this->pobject->getPobjectId());
     if (($webpath_file = $oFile->getCurrentImageWebPath()) !== false) {
         $oThumbnail->setImage($webpath_file);
     }
     $oForm->addItem($oThumbnail);
     if ($genSet->get('use_shop_specials')) {
         // special object
         $oSpecial = new ilCheckboxInputGUI($this->lng->txt('special'), 'is_special');
         $oSpecial->setChecked((int) $this->pobject->getSpecial());
         $oSpecial->setInfo($this->lng->txt('special_info'));
         $oForm->addItem($oSpecial);
     }
     // buttons
     $oForm->addCommandButton('updateDetails', $this->lng->txt('save'));
     $oForm->addCommandButton('deleteObject', $this->lng->txt('delete'));
     $this->tpl->setVariable('FORM', $oForm->getHTML());
     return true;
 }
 public function purchase($tid)
 {
     global $lng;
     $this->getDebtor();
     $this->deb->createInvoice();
     $products = array();
     foreach ($this->sc as $i) {
         $pod = ilPaymentObject::_getObjectData($i['pobject_id']);
         $bo = new ilPaymentBookings($this->ilUser->getId());
         $ilias_tid = $this->ilUser->getId() . "_" . $tid;
         // psc_id, pobject_id, obj_id, typ, betrag_string
         $bo->setTransaction($ilias_tid);
         $bo->setPobjectId(isset($i['pobject_id']) ? $i['pobject_id'] : 0);
         $bo->setCustomerId($this->ilUser->getId());
         $bo->setVendorId($pod['vendor_id']);
         $bo->setPayMethod($this->paytype);
         $bo->setOrderDate(time());
         // $bo->setDuration($i['dauer']); // duration
         // $bo->setPrice(  $i['betrag'] ); // amount
         //$bo->setPrice( ilPaymentPrices::_getPriceString( $i['price_id'] ));
         $bo->setDuration($i['duration']);
         $bo->setPrice($i['price_string']);
         $bo->setDiscount(0);
         $bo->setVoucher('');
         $bo->setVatRate($i['vat_rate']);
         $bo->setVatUnit($i['vat_unit']);
         $bo->setTransactionExtern($tid);
         // $product_name = $i['buchungstext'];
         //$duration = $i['dauer'];
         //$amount = $i['betrag'];
         $product_name = $i['object_title'];
         $duration = $i['duration'];
         $amount = $i['price'];
         // -> ? $i['price_string']
         include_once './Services/Payment/classes/class.ilPayMethods.php';
         $save_adr = (int) ilPaymethods::_EnabledSaveUserAddress($this->paytype) ? 1 : 0;
         //if($save_adr == 1)
         //{
         $bo->setStreet($this->ilUser->getStreet(), '');
         $bo->setPoBox('');
         //$this->ilUser->);
         $bo->setZipcode($this->ilUser->getZipcode());
         $bo->setCity($this->ilUser->getCity());
         $bo->setCountry($this->ilUser->getCountry());
         //}
         $bo->setPayed(1);
         $bo->setAccess(1);
         $bo->setAccessExtension($this->sc['extension']);
         $boid = $bo->add();
         //$bo->update();
         if ($i['typ'] == 'crs') {
             include_once './Modules/Course/classes/class.ilCourseParticipants.php';
             $this->deb->createInvoiceLine(0, $product_name . " (" . $duration . ")", 1, $amount);
             $products[] = $product_name;
             $obj_id = ilObject::_lookupObjId($pod["ref_id"]);
             $cp = ilCourseParticipants::_getInstanceByObjId($obj_id);
             $cp->add($this->ilUser->getId(), IL_CRS_MEMBER);
             $cp->sendNotification($cp->NOTIFY_ACCEPT_SUBSCRIBER, $this->ilUser->getId());
         }
     }
     $inv = $this->deb->bookInvoice();
     $invoice_number = $this->deb->getInvoiceNumber();
     $attach = $this->deb->getInvoicePDF($inv);
     $this->deb->saveInvoice($attach, false);
     $lng->loadLanguageModule('payment');
     $this->deb->sendInvoice($lng->txt('pay_order_paid_subject'), $this->ilUser->getFullName() . ",\n" . str_replace('%products%', implode(", ", $products), $lng->txt('pay_order_paid_body')), $this->ilUser->getEmail(), $attach, $lng->txt('pays_invoice') . "-" . $invoice_number);
     $this->cart->emptyShoppingCart();
 }
 public function showObjects()
 {
     $this->coupon_obj->setId($_GET['coupon_id']);
     $this->__initPaymentObject();
     $this->ctrl->setParameter($this, 'coupon_id', $_GET['coupon_id']);
     $this->__showButtons();
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $objects = $this->pobject->_getObjectsData($this->user_obj->getId());
     $this->coupon_obj->getCouponById(ilUtil::stripSlashes($_GET['coupon_id']));
     $counter_assigned = 0;
     $counter_unassigned = 0;
     $f_result_assigned = array();
     $f_result_unassigned = array();
     foreach ($objects as $data) {
         if ($this->coupon_obj->isObjectAssignedToCoupon($data['ref_id'])) {
             $p_counter =& $counter_assigned;
             $p_result =& $f_result_assigned;
         } else {
             $p_counter =& $counter_unassigned;
             $p_result =& $f_result_unassigned;
         }
         $tmp_obj = ilObjectFactory::getInstanceByRefId($data['ref_id'], false);
         if ($tmp_obj) {
             $p_result[$p_counter]['object_id'] = ilUtil::formCheckbox(0, 'object_id[]', $data['ref_id']);
             $p_result[$p_counter]['title'] = $tmp_obj->getTitle();
             switch ($data['status']) {
                 case $this->pobject->STATUS_BUYABLE:
                     $p_result[$p_counter]['status'] = $this->lng->txt('paya_buyable');
                     break;
                 case $this->pobject->STATUS_NOT_BUYABLE:
                     $p_result[$p_counter]['status'] = $this->lng->txt('paya_not_buyable');
                     break;
                 case $this->pobject->STATUS_EXPIRES:
                     $p_result[$p_counter]['status'] = $this->lng->txt('paya_expires');
                     break;
             }
             include_once './Services/Payment/classes/class.ilPayMethods.php';
             $p_result[$p_counter]['pay_method'] = ilPaymethods::getStringByPaymethod($data['pay_method']);
         } else {
             $p_result[$p_counter]['object_id'] = '';
             $p_result[$p_counter]['title'] = $this->lng->txt('object_not_found');
             $p_result[$p_counter]['status'] = '';
             $p_result[$p_counter]['pay_method'] = '';
         }
         ++$p_counter;
         unset($tmp_obj);
     }
     $this->ctrl->setParameter($this, "cmd", "showObjects");
     if (count($f_result_assigned) > 0) {
         $tbl = new ilShopTableGUI($this);
         $tbl->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt("paya_coupons_assigned_objects"));
         $tbl->setId('tbl_show_assigned');
         $tbl->setPrefix('assigned');
         $tbl->setRowTemplate("tpl.shop_objects_row.html", "Services/Payment");
         $tbl->addColumn('', 'object_id', '1%');
         $tbl->addColumn($this->lng->txt('title'), 'title', '10%');
         $tbl->addColumn($this->lng->txt('status'), 'status', '30%');
         $tbl->addColumn($this->lng->txt('paya_pay_method'), 'paya_pay_method', '60%');
         $tbl->setSelectAllCheckbox('object_id');
         $tbl->addMultiCommand('unassignObjects', $this->lng->txt('remove'));
         $tbl->setData($f_result_assigned);
         $this->tpl->setVariable('TABLE', $tbl->getHTML());
     }
     if (count($f_result_unassigned) > 0) {
         $tbl_2 = new ilShopTableGUI($this);
         $tbl_2->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt("paya_coupons_unassigned_objects"));
         $tbl_2->setId('tbl_show_unassigned');
         $tbl_2->setPrefix('unassigned');
         $tbl_2->setRowTemplate("tpl.shop_objects_row.html", "Services/Payment");
         $tbl_2->addColumn('', 'object_id', '1%');
         $tbl_2->addColumn($this->lng->txt('title'), 'title', '10%');
         $tbl_2->addColumn($this->lng->txt('status'), 'status', '30%');
         $tbl_2->addColumn($this->lng->txt('paya_pay_method'), 'pay_method', '60%');
         $tbl_2->setSelectAllCheckbox('object_id');
         $tbl_2->addMultiCommand('assignObjects', $this->lng->txt('add'));
         $tbl_2->setData($f_result_unassigned);
         $this->tpl->setVariable('TABLE_2', $tbl_2->getHTML());
     }
     return true;
 }