24 define (
'PAY_METHOD_NOT_SPECIFIED', 0);
25 define (
'PAY_METHOD_BILL', 1);
26 define (
'PAY_METHOD_BMF', 2);
27 define (
'PAY_METHOD_PAYPAL', 3);
28 define (
'PAY_METHOD_EPAY', 4);
59 $this->STATUS_NOT_BUYABLE = 0;
60 $this->STATUS_BUYABLE = 1;
61 $this->STATUS_EXPIRES = 2;
69 $this->pobject_id = $a_pobject_id;
81 $this->topic_id = $a_topic_id;
89 $this->ref_id = $a_ref_id;
97 $this->status = $a_status;
105 $this->pay_method = $a_method;
113 $this->vendor_id = $a_vendor_id;
125 $this->vat_id = $a_vat_id;
134 return (
float)($a_amount - (round(($a_amount / (1 + ($oVAT->getRate() / 100))) * 100) / 100));
138 $val = (float)($a_amount - (round(($a_amount / (1 + ($oVAT->getRate() / 100))) * 100) / 100));
146 $next_id = $this->db->nextId(
'payment_objects');
147 $statement = $this->db->manipulateF(
148 'INSERT INTO payment_objects
158 (%s, %s,%s,%s,%s,%s,%s)',
159 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
173 public function delete()
177 include_once
'Services/Payment/classes/class.ilFileDataShop.php';
179 $oFileData->deassignFileFromPaymentObject();
181 $statement = $this->db->manipulateF(
'DELETE FROM payment_objects WHERE pobject_id = %s',
195 $statement = $this->db->manipulateF(
196 'UPDATE payment_objects
204 WHERE pobject_id = %s',
205 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
225 $res = $ilDB->queryf(
'
226 SELECT * FROM payment_objects
233 return $row->pobject_id;
243 if(isset(
$cache[$a_ref_id]))
248 $result = $ilDB->queryf(
'SELECT pt_topic_fk FROM payment_objects WHERE ref_id = %s',
249 array(
'integer'),array($a_ref_id));
254 return (
int)
$cache[$a_ref_id];
287 $result = $ilDB->queryf(
'SELECT COUNT(pay_method) pm FROM payment_objects WHERE pay_method = %s',
288 array(
'integer'), array($pm));
292 return (
int)
$row->pm;
303 include_once
'./payment/classes/class.ilPaymentTrustees.php';
304 include_once
'./payment/classes/class.ilPaymentVendors.php';
310 $vendors[] = $a_user_id;
318 $data_types = array();
319 $data_values = array();
320 $cnt_vendors = count($vendors);
322 $query =
'SELECT * FROM payment_objects WHERE vendor_id IN';
324 if (is_array($vendors) &&
331 array_push($data_values, $vendor);
332 array_push($data_types,
'integer');
334 if($counter > 0)
$in .=
',';
342 $res= $ilDB->queryf(
$query, $data_types, $data_values);
347 $objects[
$row->pobject_id][
'pobject_id'] =
$row->pobject_id;
348 $objects[
$row->pobject_id][
'ref_id'] =
$row->ref_id;
349 $objects[
$row->pobject_id][
'status'] =
$row->status;
350 $objects[
$row->pobject_id][
'pay_method'] =
$row->pay_method;
351 $objects[
$row->pobject_id][
'vendor_id'] =
$row->vendor_id;
352 $objects[
$row->pobject_id][
'topic_id'] =
$row->pt_topic_fk;
353 $objects[
$row->pobject_id][
'vat_id'] =
$row->vat_id;
355 return $objects ? $objects : array();
362 $data_types = array();
363 $data_values = array();
365 $query =
'SELECT * FROM payment_objects ';
367 if (
$_SESSION[
"pay_objects"][
"title_value"] !=
"")
369 $query .=
', object_reference obr, object_data od ';
372 if (
$_SESSION[
'pay_objects'][
'vendor'] !=
"")
374 $query .=
', usr_data ud ';
377 $query .=
' WHERE 1 = 1 ';
379 if (
$_SESSION[
"pay_objects"][
"title_value"])
381 $query .=
' AND obr.ref_id = payment_objects.ref_id AND od.obj_id = obr.obj_id ';
385 $title_search = explode(
" ", trim(
$_SESSION[
"pay_objects"][
"title_value"]));
386 for ($i = 0; $i < count($title_search); $i++)
388 $title_search[$i] = trim($title_search[$i]);
390 if ($title_search[$i] !=
"")
393 $search_string .=
' od.title LIKE %s ';
394 array_push($data_types,
'text');
395 array_push($data_values,
'%'.$title_search[$i].
'%');
397 switch (
$_SESSION[
"pay_objects"][
"title_type"])
400 if ($i < count($title_search) - 1)
402 $search_string .=
' OR ';
406 if ($i < count($title_search) - 1)
408 $search_string .=
' AND ';
415 if ($search_string !=
'')
417 $query .=
' AND (' . $search_string .
') ';
421 if (
$_SESSION[
'pay_objects'][
'vendor'] !=
"")
423 $query .=
' AND ud.usr_id = payment_objects.vendor_id AND login = %s';
424 array_push($data_types,
'text');
425 array_push($data_values,
$_SESSION[
'pay_objects'][
'vendor']);
429 if (
$_SESSION[
'pay_objects'][
'pay_method'] ==
"1" ||
430 $_SESSION[
'pay_objects'][
'pay_method'] ==
"2" ||
431 $_SESSION[
'pay_objects'][
'pay_method'] ==
"3" ||
432 $_SESSION[
'pay_objects'][
'pay_method'] ==
"4")
434 $query .=
' AND pay_method = %s';
435 array_push($data_types,
'integer');
436 array_push($data_values,
$_SESSION[
'pay_objects'][
'pay_method']);
439 $res = $ilDB->queryf(
$query, $data_types, $data_values);
443 $objects[
$row->pobject_id][
'pobject_id'] =
$row->pobject_id;
444 $objects[
$row->pobject_id][
'ref_id'] =
$row->ref_id;
445 $objects[
$row->pobject_id][
'status'] =
$row->status;
446 $objects[
$row->pobject_id][
'pay_method'] =
$row->pay_method;
447 $objects[
$row->pobject_id][
'vendor_id'] =
$row->vendor_id;
448 $objects[
$row->pobject_id][
'topic_id'] =
$row->pt_topic_fk;
449 $objects[
$row->pobject_id][
'vat_id'] =
$row->vat_id;
451 return $objects ? $objects : array();
458 $res = $ilDB->queryf(
'
459 SELECT * FROM payment_objects
460 WHERE pobject_id = %s',
461 array(
'integer'), array($a_id));
478 $data_types = array();
480 $query =
'SELECT * FROM payment_objects WHERE ref_id = %s ';
481 array_push($data_types,
'integer');
482 array_push(
$data, $a_ref_id);
484 if ($a_vendor_id > 0)
486 $query .=
'AND vendor_id = %s';
487 array_push($data_types,
'integer');
488 array_push(
$data, $a_vendor_id);
492 include_once
'./payment/classes/class.ilPaymentTrustees.php';
493 include_once
'./payment/classes/class.ilPaymentVendors.php';
498 $vendors[] = $a_user_id;
501 if(is_array($vendors) && count($vendors))
503 $query .=
' OR '.$ilDB->in(
'vendor_id', $vendors,
false,
'integer');
510 return $res->numRows() ?
false :
true;
516 include_once
'./payment/classes/class.ilPaymentBookings.php';
518 global $rbacsystem,
$ilDB;
521 if($rbacsystem->checkAccess(
'write', $a_ref_id))
526 include_once
'payment/classes/class.ilGeneralSettings.php';
532 $res = $ilDB->queryf(
'
533 SELECT * FROM payment_objects
535 AND (status = %s OR status = %s)',
536 array(
'integer',
'integer',
'integer'),
537 array($a_ref_id,
'1',
'2'));
552 include_once
'./payment/classes/class.ilPaymentBookings.php';
554 global $rbacsystem,
$ilDB;
556 $res = $ilDB->queryf(
'
557 SELECT * FROM payment_objects
559 AND (status = %s OR status = %s)',
560 array(
'integer',
'integer',
'integer'),
561 array($a_ref_id,
'1',
'2'));
571 include_once
'payment/classes/class.ilGeneralSettings.php';
578 SELECT * FROM payment_objects
579 WHERE ref_id = %s AND (status = %s or status = %s)',
580 array(
'integer',
'integer',
'integer'),
581 array($a_ref_id,
'1',
'2'));
598 global
$ilDB, $ilUser;
601 SELECT psc_id FROM payment_objects po, payment_shopping_cart psc
604 AND po.pobject_id = psc.pobject_id',
605 array(
'integer',
'integer'),
606 array($a_ref_id, $ilUser->getId()));
620 $result = $this->db->queryf(
'SELECT * FROM payment_objects WHERE pobject_id = %s',