public function ORg_updatePrice() { include_once './Services/Payment/classes/class.ilPaymentPrices.php'; if (!$_GET['pobject_id'] && !$_POST['pobject_id']) { ilUtil::sendInfo($this->lng->txt('paya_no_object_selected')); $this->showObjects(); return true; } if (isset($_GET['pobject_id'])) { $pobject_id = (int) $_GET['pobject_id']; } else { $pobject_id = (int) $_POST['pobject_id']; } $po = new ilPaymentPrices($pobject_id); $this->ctrl->setParameter($this, 'pobject_id', $pobject_id); $price_id = (int) $_POST['price_id']; // validate $old_price = $po->getPrice($price_id); $po->setDuration((int) $_POST['duration']); $po->setUnlimitedDuration($_POST['unlimited_duration']); $po->setPrice($_POST['price']); $po->setPriceType($_POST['price_type']); $po->setCurrency($old_price['currency']); $po->setExtension((int) $_POST['extension']); if (!$po->validate()) { $error = true; } if ($error) { ilUtil::sendInfo($this->lng->txt('paya_insert_only_numbers')); $this->editPrices(); return false; } foreach ($_POST['prices'] as $price_id => $price) { $old_price = $po->getPrice($price_id); if (isset($_POST['duration_ids'])) { // $search = in_array((string)$price_id, $_POST['duration_ids']); if ($_POST['duration_ids'] == NULL) { $po->setUnlimitedDuration(0); $po->setDuration($price['duration']); } else { if ($search = in_array((string) $price_id, $_POST['duration_ids'])) { $po->setUnlimitedDuration(1); $po->setDuration(0); } else { $po->setUnlimitedDuration(0); } } } if (isset($_POST['extension_ids'])) { // $search = in_array((string)$price_id, $_POST['extension_ids']); if ($search = in_array((string) $price_id, $_POST['extension_ids'])) { $po->setExtension(1); } else { $po->setExtension(0); } } $po->setDuration($price['duration']); $po->setPrice($price['price']); $po->setCurrency($old_price['currency']); $po->update($price_id); } ilUtil::sendInfo($this->lng->txt('paya_updated_prices')); $this->editPrices(); return true; }