public function addObject() { if (!$_GET['sell_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); return $this->showObjectSelector(); } if (!(int) $_POST['vendor']) { ilUtil::sendInfo($this->lng->txt('paya_no_vendor_selected')); return $this->showSelectedObject(); } include_once 'Services/Payment/classes/class.ilPaymentObject.php'; $p_obj = new ilPaymentObject($this->user_obj); if ($check_subtypes = ilPaymentObject::_checkExcSubtype($_GET['sell_id'])) { if (!in_array('download', $check_subtypes)) { $p_obj->setSubtype('download'); } else { if (!in_array('upload', $check_subtypes)) { $p_obj->setSubtype('upload'); } } } else { if (ilPaymentObject::_isPurchasable($_GET['sell_id'])) { // means that current object already exits in payment_objects _table ... ilUtil::sendInfo($this->lng->txt('paya_object_not_purchasable')); return $this->showObjectSelector(); } } $p_obj->setRefId((int) $_GET['sell_id']); $p_obj->setStatus($p_obj->STATUS_NOT_BUYABLE); $p_obj->setPayMethod($p_obj->PAY_METHOD_NOT_SPECIFIED); $p_obj->setVendorId((int) $_POST['vendor']); $p_obj->setTopicId((int) $_POST['topic_id']); $p_obj->setVatId((int) $_POST['vat_id']); $new_id = $p_obj->add(); if ($new_id) { ilUtil::sendInfo($this->lng->txt('paya_added_new_object')); $_GET['pobject_id'] = $new_id; $this->editPrices(); return true; } else { ilUtil::sendInfo($this->lng->txt('paya_err_adding_object')); return $this->showObjects(); } }