public static function _hasAccess($a_ref_id, $a_transaction = 0, $a_subtype = '')
    {
        include_once './Services/Payment/classes/class.ilPaymentBookings.php';
        include_once './Services/Payment/classes/class.ilPaymentTrustees.php';
        include_once './Services/Payment/classes/class.ilPaymentVendors.php';
        global $rbacsystem, $ilDB, $ilUser;
        // check write access
        if ($rbacsystem->checkAccess('write', $a_ref_id)) {
            return true;
        }
        // check if user is vendor/trustee
        $vendors_of_trustee = ilPaymentTrustees::_getVendorIdsByTrustee($ilUser->getId());
        if (!IS_PAYMENT_ENABLED) {
            return true;
        }
        if ($a_subtype) {
            $result = $ilDB->queryf('
				SELECT * FROM payment_objects
				WHERE ref_id = %s AND (status = %s or status = %s)
				AND subtype = %s', array('integer', 'integer', 'integer', 'text'), array($a_ref_id, '1', '2', $a_subtype));
        } else {
            $result = $ilDB->queryf('
				SELECT * FROM payment_objects
				WHERE ref_id = %s
				AND (status = %s OR status = %s)
				OR (vendor_id = %s)', array('integer', 'integer', 'integer', 'integer'), array($a_ref_id, '1', '2', $ilUser->getId()));
        }
        while ($row = $ilDB->fetchObject($result)) {
            if ($row->vendor_id == $ilUser->getId() || in_array($row->vendor_id, $vendors_of_trustee)) {
                return true;
            } else {
                if (!ilPaymentBookings::_hasAccess($row->pobject_id, '', $a_transaction)) {
                    return false;
                } else {
                    return true;
                }
            }
        }
        return false;
    }
 /**
  * insert payment information
  *
  * @access	private
  */
 function insertPayment()
 {
     global $ilAccess, $ilObjDataCache, $ilUser;
     if (IS_PAYMENT_ENABLED && $this->payment_enabled) {
         include_once './Services/Payment/classes/class.ilPaymentObject.php';
         include_once './Services/Payment/classes/class.ilPaymentBookings.php';
         if (ilPaymentobject::_requiresPurchaseToAccess($this->ref_id)) {
             if (ilPaymentBookings::_hasAccess(ilPaymentObject::_lookupPobjectId($a_ref_id), $ilUser->getId())) {
                 // get additional information about order_date and duration
                 $order_infos = array();
                 $order_infos = ilPaymentBookings::_lookupOrder(ilPaymentObject::_lookupPobjectId($this->ref_id));
                 if (count($order_infos) > 0) {
                     global $lng;
                     $pay_lang = $lng;
                     $pay_lang->loadLanguageModule('payment');
                     $alert = true;
                     $a_newline = true;
                     $a_property = $pay_lang->txt('object_purchased_date');
                     $a_value = ilDatePresentation::formatDate(new ilDateTime($order_infos["order_date"], IL_CAL_UNIX));
                     $this->addCustomProperty($a_property, $a_value, $alert, $a_newline);
                     $alert = true;
                     $a_newline = true;
                     $a_property = $this->lng->txt('object_duration');
                     if ($order_infos['duration'] == 0) {
                         $a_value = $pay_lang->txt('unlimited_duration');
                     } else {
                         $a_value = $order_infos['duration'] . ' ' . $this->lng->txt('months');
                     }
                     $this->addCustomProperty($a_property, $a_value, $alert, $a_newline);
                 }
                 // check for extension prices
                 if (ilPaymentObject::_hasExtensions($this->ref_id)) {
                     $has_extension_prices = true;
                     $this->insertPaymentCommand($has_extension_prices);
                 }
             } else {
                 // only relevant and needed for the shop content page
                 $this->ctpl = new ilTemplate("tpl.container_list_item_commands.html", true, true, "Services/Container", "DEFAULT", false, true);
                 $this->ctpl->setCurrentBlock('payment');
                 $this->ctpl->setVariable('PAYMENT_TYPE_IMG', ilUtil::getImagePath('icon_pays.svg'));
                 $this->ctpl->setVariable('PAYMENT_ALT_IMG', $this->lng->txt('payment_system') . ': ' . $this->lng->txt('payment_buyable'));
                 $this->ctpl->parseCurrentBlock();
                 $this->insertPaymentCommand();
             }
         }
     }
 }