private function __read() { global $ilUser; include_once './Services/Payment/classes/class.ilPaymentPrices.php'; $this->sc_entries = array(); if (ANONYMOUS_USER_ID == $ilUser->getId()) { $res = $this->db->queryf(' SELECT * FROM payment_shopping_cart WHERE session_id = %s', array('text'), array($this->getSessionId())); } else { $res = $this->db->queryf(' SELECT * FROM payment_shopping_cart WHERE customer_id = %s', array('integer'), array($this->user_obj->getId())); } while ($row = $this->db->fetchObject($res)) { $this->sc_entries[$row->psc_id]["psc_id"] = $row->psc_id; $this->sc_entries[$row->psc_id]["customer_id"] = $row->customer_id; $this->sc_entries[$row->psc_id]["pobject_id"] = $row->pobject_id; $this->sc_entries[$row->psc_id]["price_id"] = $row->price_id; $this->sc_entries[$row->psc_id]['session_id'] = $row->session_id; } // Delete all entries with not valid prices or pay_method unset($prices); $prices = array(); foreach ($this->sc_entries as $entry) { // check if price_id exists for pobject if (!ilPaymentPrices::_priceExists($entry['price_id'], $entry['pobject_id'])) { $this->delete($entry['psc_id']); return false; } // check pay method $tmp_pobj = new ilPaymentObject($this->user_obj, $entry['pobject_id']); $pay_method = $tmp_pobj->getPayMethod(); if ($pay_method == $tmp_pobj->PAY_METHOD_NOT_SPECIFIED) { $this->delete($entry['psc_id']); return false; } // if payment is expired if ($tmp_pobj->getStatus() == $tmp_pobj->STATUS_EXPIRES) { $this->delete($entry['psc_id']); return false; } $this->sc_entries[$entry['psc_id']]['pay_method'] = $pay_method; $prices[] = array('id' => $entry['price_id'], 'pay_method' => $pay_method); unset($tmp_pobj); } // set total amount $this->setTotalAmount(ilPaymentPrices::_getTotalAmount($prices ? $prices : array())); $this->setPobjectId($entry['pobject_id']); return true; }