public function updatePriceObject() { if (!$_GET['pobject_id'] && !$_POST['pobject_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); $this->objectsObject(); return true; } if (isset($_GET['pobject_id'])) { $pobject_id = (int) $_GET['pobject_id']; } else { $pobject_id = (int) $_POST['pobject_id']; } if (!(int) $_GET['price_id'] && !$_POST['price_id']) { ilUtil::sendInfo($this->lng->txt('payment_no_price_selected')); return $this->editPricesObject(); } if (isset($_GET['price_id'])) { $price_id = (int) $_GET['price_id']; } else { $price_id = (int) $_POST['price_id']; } $po = new ilPaymentPrices((int) $pobject_id); switch ($_POST['price_type']) { case ilPaymentPrices::TYPE_UNLIMITED_DURATION: $po->setType(ilPaymentPrices::TYPE_UNLIMITED_DURATION); $po->setDuration(NULL); $po->setDurationFrom(NULL); $po->setDurationUntil(NULL); $po->setUnlimitedDuration(1); break; case ilPaymentPrices::TYPE_DURATION_DATE: $po->setType(ilPaymentPrices::TYPE_DURATION_DATE); $po->setDuration(NULL); $po->setDurationFrom(ilUtil::stripSlashes($_POST['duration_date_from']['date']['y'] . '-' . $_POST['duration_date_from']['date']['m'] . '-' . $_POST['duration_date_from']['date']['d'])); $po->setDurationUntil(ilUtil::stripSlashes($_POST['duration_date_until']['date']['y'] . '-' . $_POST['duration_date_until']['date']['m'] . '-' . $_POST['duration_date_until']['date']['d'])); break; default: case ilPaymentPrices::TYPE_DURATION_MONTH: $po->setType(ilPaymentPrices::TYPE_DURATION_MONTH); $po->setDuration($_POST['duration_month']); $po->setDurationFrom(NULL); $po->setDurationUntil(NULL); break; } $po->setDescription($_POST['description'] ? ilUtil::stripSlashes($_POST['description']) : NULL); $po->setPrice(ilUtil::stripSlashes($_POST['price'])); $po->setCurrency(ilUtil::stripSlashes($_POST['currency'])); if ($_POST['extension_price']) { $po->setExtension(1); } else { $po->setExtension(0); } try { $po->validate(); $po->update($price_id); ilUtil::sendInfo($this->lng->txt('paya_updated_price')); return $this->editPricesObject(); } catch (ilShopException $e) { ilUtil::sendInfo($e->getMessage()); $this->editPriceObject(); return true; } }