public function delete()
 {
     if ($this->getPobjectId()) {
         include_once 'Services/Payment/classes/class.ilFileDataShop.php';
         $oFileData = new ilFileDataShop($this->getPobjectId());
         $oFileData->deassignFileFromPaymentObject();
         $statement = $this->db->manipulateF('DELETE FROM payment_objects WHERE pobject_id = %s', array('integer'), array($this->getPobjectId()));
         return true;
     }
     return false;
 }
 public function updateDetails()
 {
     if (!$_GET['pobject_id']) {
         ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
         $this->showObjects();
         return true;
     }
     $this->__initPaymentObject((int) $_GET['pobject_id']);
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     // read old settings
     $old_status = $this->pobject->getStatus();
     // check status changed from not_buyable
     if ($old_status == $this->pobject->STATUS_NOT_BUYABLE and (int) $_POST['status'] != $old_status) {
         // check pay_method edited
         switch ((int) $_POST['pay_method']) {
             case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
                 ilUtil::sendInfo($this->lng->txt('paya_select_pay_method_first'));
                 $this->editDetails();
                 return false;
             default:
         }
         // check minimum one price
         include_once './Services/Payment/classes/class.ilPaymentPrices.php';
         $prices_obj = new ilPaymentPrices((int) $_GET['pobject_id']);
         if (!count($prices_obj->getPrices())) {
             ilUtil::sendInfo($this->lng->txt('paya_edit_prices_first'));
             $this->editDetails();
             return false;
         }
     }
     if ((int) $_POST['status'] == 0) {
         // Status: not buyable -> delete depending shoppingcart entries
         include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
         ilPaymentShoppingCart::_deleteShoppingCartEntries($this->pobject->getPobjectId());
     }
     $this->pobject->setStatus((int) $_POST['status']);
     $this->pobject->setVendorId((int) $_POST['vendor']);
     $this->pobject->setPayMethod((int) $_POST['pay_method']);
     $this->pobject->setTopicId((int) $_POST['topic_id']);
     $this->pobject->setVatId((int) $_POST['vat_id']);
     $this->pobject->setSubtype((string) $_POST['exc_subtype']);
     $this->pobject->setSpecial((int) $_POST['is_special']);
     if ((int) $_POST['thumbnail_delete']) {
         $oFile = new ilFileDataShop($this->pobject->getPobjectId());
         $oFile->deassignFileFromPaymentObject();
     } else {
         if ($_FILES['thumbnail']['tmp_name'] != '') {
             $this->lng->loadLanguageModule('form');
             include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
             $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail');
             if ($oThumbnail->checkInput()) {
                 $oFile = new ilFileDataShop($this->pobject->getPobjectId());
                 if ($oFile->storeUploadedFile($_FILES['thumbnail']) !== false) {
                     $oFile->assignFileToPaymentObject();
                 }
             } else {
                 ilUtil::sendInfo($oThumbnail->getAlert());
                 return $this->editDetails();
             }
         }
     }
     $this->pobject->update();
     ilUtil::sendInfo($this->lng->txt('paya_details_updated'));
     $this->showObjects();
     return true;
 }