14 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
15 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
16 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
17 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
18 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
19 include_once
'./Services/Payment/classes/class.ilInvoiceNumberPlaceholdersPropertyGUI.php';
20 include_once(
"./Services/Payment/classes/class.ilPaymentObjectSelector.php");
31 $this->ctrl->saveParameter($this,
'baseClass');
33 $this->user_obj = $user_obj;
44 $ilTabs->setTabActive(
'paya_header');
45 $ilTabs->setSubTabActive(
'bookings');
50 $cmd = $this->ctrl->getCmd();
52 switch ($this->ctrl->getNextClass($this))
55 if(!
$cmd = $this->ctrl->getCmd())
57 $cmd =
'showStatistics';
68 unset(
$_POST[
"transaction_type"]);
69 unset(
$_POST[
"transaction_value"]);
70 unset(
$_POST[
"from"][
"day"]);
71 unset(
$_POST[
"from"][
"month"]);
72 unset(
$_POST[
"from"][
"year"]);
73 unset(
$_POST[
"til"][
"day"]);
74 unset(
$_POST[
"til"][
"month"]);
75 unset(
$_POST[
"til"][
"year"]);
79 unset(
$_POST[
"pay_method"]);
80 unset(
$_POST[
"updateView"]);
81 unset(
$_POST[
"filter_title_id"]);
88 global $rbacsystem, $ilToolbar, $ilObjDataCache;
98 $ilToolbar->addButton($this->lng->txt(
'paya_add_customer'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
99 if(!
$_POST[
'show_filter'] &&
$_POST[
'updateView'] ==
'1')
104 if (
$_POST[
'updateView'] == 1)
107 $_SESSION[
'pay_statistics'][
'updateView'] =
true;
110 $_SESSION[
'pay_statistics'][
'transaction_type'] = isset(
$_POST[
'transaction_type']) ?
$_POST[
'transaction_type'] :
'' ;
111 $_SESSION[
'pay_statistics'][
'transaction_value'] = isset(
$_POST[
'transaction_value']) ?
$_POST[
'transaction_value'] :
'';
112 $_SESSION[
'pay_statistics'][
'filter_title_id'] = (int)
$_POST[
'filter_title_id'];
114 if(
$_SESSION[
'pay_statistics'][
'from_check'] ==
'1')
116 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] =
$_POST[
'from'][
'date'][
'd'];
117 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] =
$_POST[
'from'][
'date'][
'm'];
118 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] =
$_POST[
'from'][
'date'][
'y'];
122 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] =
'';
123 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] =
'';
124 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] =
'';
127 if(
$_SESSION[
'pay_statistics'][
'until_check']==
'1')
129 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] =
$_POST[
'til'][
'date'][
'd'];
130 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] =
$_POST[
'til'][
'date'][
'm'];
131 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] =
$_POST[
'til'][
'date'][
'y'];
135 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] =
'';
136 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] =
'';
137 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] =
'';
147 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
149 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
152 $filter_form->setFormAction($this->ctrl->getFormAction($this));
153 $filter_form->setTitle($this->lng->txt(
'pay_filter'));
154 $filter_form->setId(
'formular');
155 $filter_form->setTableWidth(
'100 %');
158 $o_hide_check =
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'),
'show_filter');
159 $o_hide_check->setValue(1);
160 $o_hide_check->setChecked(
$_SESSION[
'pay_statistics'][
'show_filter'] ? 1 : 0);
163 $o_hidden->setValue(1);
164 $o_hidden->setPostVar(
'updateView');
165 $o_hide_check->addSubItem($o_hidden);
168 $trans_option = array($this->lng->txt(
'pay_starting'),$this->lng->txt(
'pay_ending'));
169 $trans_value = array(
'0',
'1');
170 $o_transaction_type->setTitle($this->lng->txt(
'paya_transaction'));
171 $o_transaction_type->setOptions($trans_option);
172 $o_transaction_type->setValue(
$_SESSION[
'pay_statistics'][
'transaction_type']);
173 $o_transaction_type->setPostVar(
'transaction_type');
174 $o_hide_check->addSubItem($o_transaction_type);
177 $o_transaction_val->setValue(
$_SESSION[
'pay_statistics'][
'transaction_value']);
178 $o_transaction_val->setPostVar(
'transaction_value');
179 $o_hide_check->addSubItem($o_transaction_val);
182 $o_customer->setTitle($this->lng->txt(
'paya_customer'));
183 $o_customer->setValue(
$_SESSION[
'pay_statistics'][
'customer']);
184 $o_customer->setPostVar(
'customer');
185 $o_hide_check->addSubItem($o_customer);
188 $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
189 $o_vendor->setValue(
$_SESSION[
'pay_statistics'][
'vendor']);
190 $o_vendor->setPostVar(
'vendor');
191 $o_hide_check->addSubItem($o_vendor);
193 $o_from_check =
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_from'),
'from_check');
194 $o_from_check->setValue(1);
195 $o_from_check->setChecked(
$_SESSION[
'pay_statistics'][
'from_check'] ? 1 : 0);
198 $o_date_from->setPostVar(
'from');
201 if(
$_SESSION[
'pay_statistics'][
'from_check'] ==
'1')
203 $o_date_from->checkInput();
206 $o_from_check->addSubItem($o_date_from);
207 $o_hide_check->addSubItem($o_from_check);
209 $o_until_check =
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_til'),
'until_check');
210 $o_until_check->setValue(1);
211 $o_until_check->setChecked(
$_SESSION[
'pay_statistics'][
'until_check'] ? 1 : 0);
214 $o_date_until->setPostVar(
'til');
217 if(
$_SESSION[
'pay_statistics'][
'until_check'] ==
'1')
219 $o_date_until->checkInput();
222 $o_until_check->addSubItem($o_date_until);
223 $o_hide_check->addSubItem($o_until_check);
228 $title_options[
'all']=$this->lng->txt(
'pay_all');
229 $unique_titles = $this->booking_obj->getUniqueTitles();
231 if(is_array($unique_titles) && count($unique_titles))
233 foreach($unique_titles as
$ref_id)
235 $title_options[
$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
240 $o_object_title->setTitle($this->lng->txt(
'title'));
241 $o_object_title->setOptions($title_options);
242 $o_object_title->setValue(
$_SESSION[
"pay_statistics"][
"filter_title_id"]);
243 $o_object_title->setPostVar(
'filter_title_id');
244 $o_hide_check->addSubItem($o_object_title);
247 $payed_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
249 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
250 $o_payed->setOptions($payed_option);
251 $o_payed->setValue(
$_SESSION[
'pay_statistics'][
'payed']);
252 $o_payed->setPostVar(
'payed');
254 $o_hide_check->addSubItem($o_payed);
257 $access_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
259 $o_access->setTitle($this->lng->txt(
'paya_access'));
260 $o_access->setOptions($access_option);
261 $o_access->setValue(
$_SESSION[
'pay_statistics'][
'access']);
262 $o_access->setPostVar(
'access');
263 $o_hide_check->addSubItem($o_access);
266 $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
268 $o_paymethod->setValue(
$_SESSION[
'pay_statistics'][
'pay_method']);
269 $o_paymethod->setPostVar(
'pay_method');
270 $o_hide_check->addSubItem($o_paymethod);
272 $filter_form->addCommandButton(
'showStatistics', $this->lng->txt(
'pay_update_view'));
273 $filter_form->addCommandButton(
'resetFilter', $this->lng->txt(
'pay_reset_filter'));
275 $filter_form->addItem($o_hide_check);
277 $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
283 if(!count($bookings = $this->booking_obj->getBookings()))
289 # $this->__showButton('excelExport',$this->lng->txt('excel_export'));
291 include_once
'Services/User/classes/class.ilObjUser.php';
292 $object_title_cache = array();
293 $user_title_cache = array();
296 foreach($bookings as $booking)
298 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
300 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
305 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
307 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
309 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
314 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
316 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
318 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
323 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
326 $transaction = $booking[
'transaction_extern'];
328 $transaction .=
" (" . $str_paymethod .
")";
330 $f_result[$counter][
'transaction'] = $transaction;
331 $f_result[$counter][
'object_title'] = ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
332 $f_result[$counter][
'vendor'] = ($tmp_vendor !=
'' ?
'['.$tmp_vendor.
']' : $this->lng->txt(
'user_deleted'));
333 $f_result[$counter][
'customer'] = ($tmp_purchaser !=
'' ?
'['.$tmp_purchaser.
']' : $this->lng->txt(
'user_deleted'));
336 if($booking[
'duration'] == 0)
338 $booking[
'duration'] = $this->lng->txt(
'unlimited_duration');
341 $f_result[$counter][
'duration'] = $booking[
'duration'];
343 $f_result[$counter][
'discount'] = $booking[
'discount'].
' '.$booking[
'currency_unit'];
345 $payed_access = $booking[
'payed'] ?
346 $this->lng->txt(
'yes') :
347 $this->lng->txt(
'no');
349 $payed_access .=
'/';
350 $payed_access .= $booking[
'access_granted'] ?
351 $this->lng->txt(
'yes') :
352 $this->lng->txt(
'no');
354 $f_result[$counter][
'payed_access'] = $payed_access;
356 $this->ctrl->setParameter($this,
"booking_id",$booking[
'booking_id']);
357 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editStatistic").
"\">".$this->lng->txt(
"edit").
"</a></div>";
359 $f_result[$counter][
'edit'] = $link_change;
363 unset($tmp_purchaser);
372 include_once
'./Services/Payment/classes/class.ilPaymentExcelWriterAdapter.php';
381 $workbook = $pewa->getWorkbook();
387 include_once
'./Services/Payment/classes/class.ilPaymentVendors.php';
391 $workbook = $pewa->getWorkbook();
392 $worksheet = $workbook->addWorksheet($this->lng->txt(
'bookings'));
394 $worksheet->mergeCells(0,0,0,8);
395 $worksheet->setColumn(0,0,16);
396 $worksheet->setColumn(0,1,32);
397 $worksheet->setColumn(0,2,32);
398 $worksheet->setColumn(0,3,16);
399 $worksheet->setColumn(0,4,16);
400 $worksheet->setColumn(0,5,16);
401 $worksheet->setColumn(0,6,24);
402 $worksheet->setColumn(0,7,8);
403 $worksheet->setColumn(0,8,12);
404 $worksheet->setColumn(0,9,16);
406 $title = $this->lng->txt(
'bookings');
407 $title .=
' '.$this->lng->txt(
'as_of');
408 $title .= strftime(
'%Y-%m-%d %R',time());
410 $worksheet->writeString(0,0,$title,$pewa->getFormatTitle());
412 $worksheet->writeString(1,0,$this->lng->txt(
'payment_system'),$pewa->getFormatHeader());
413 $worksheet->writeString(1,1,$this->lng->txt(
'paya_transaction'),$pewa->getFormatHeader());
414 $worksheet->writeString(1,2,$this->lng->txt(
'title'),$pewa->getFormatHeader());
415 $worksheet->writeString(1,3,$this->lng->txt(
'paya_vendor'),$pewa->getFormatHeader());
416 $worksheet->writeString(1,4,$this->lng->txt(
'pays_cost_center'),$pewa->getFormatHeader());
417 $worksheet->writeString(1,5,$this->lng->txt(
'paya_customer'),$pewa->getFormatHeader());
418 $worksheet->writeString(1,6,$this->lng->txt(
'paya_order_date'),$pewa->getFormatHeader());
419 $worksheet->writeString(1,7,$this->lng->txt(
'duration'),$pewa->getFormatHeader());
420 $worksheet->writeString(1,8,$this->lng->txt(
'price_a'),$pewa->getFormatHeader());
421 $worksheet->writeString(1,9,$this->lng->txt(
'paya_payed_access'),$pewa->getFormatHeader());
423 if(!count($bookings = $this->booking_obj->getBookings()))
428 include_once
'Services/User/classes/class.ilObjUser.php';
429 $object_title_cache = array();
430 $user_title_cache = array();
433 foreach($bookings as $booking)
435 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
437 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
442 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
444 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
446 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
451 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
453 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
455 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
460 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
465 $worksheet->writeString($counter,0,$pay_method);
466 $worksheet->writeString($counter,1,$booking[
'transaction_extern']);
467 $worksheet->writeString($counter,2,($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted')));
468 $worksheet->writeString($counter,3,($tmp_vendor !=
'' ? $tmp_vendor : $this->lng->txt(
'user_deleted')));
469 $worksheet->writeString($counter,4,ilPaymentVendors::_getCostCenter($booking[
'b_vendor_id']));
470 $worksheet->writeString($counter,5,($tmp_purchaser !=
'' ? $tmp_purchaser : $this->lng->txt(
'user_deleted')));
471 $worksheet->writeString($counter,6,strftime(
'%Y-%m-%d %R',$booking[
'order_date']));
472 $worksheet->writeString($counter,7,$booking[
'duration']);
473 $worksheet->writeString($counter,8,$booking[
'price']);
475 $payed_access = $booking[
'payed'] ?
476 $this->lng->txt(
'yes') :
477 $this->lng->txt(
'no');
479 $payed_access .=
'/';
480 $payed_access .= $booking[
'access_granted'] ?
481 $this->lng->txt(
'yes') :
482 $this->lng->txt(
'no');
484 $worksheet->writeString($counter,9,$payed_access);
488 unset($tmp_purchaser);
498 if(!isset(
$_GET[
'booking_id']))
506 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
507 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showStatistics'));
509 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
511 $this->ctrl->setParameter($this,
'booking_id',(
int)
$_GET[
'booking_id']);
513 $bookings = $this->booking_obj->getBookings();
514 $booking = $bookings[(int) $_GET[
'booking_id']];
517 if($a_show_confirm_delete)
526 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDelete"));
527 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_stat"));
528 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"editStatistic");
532 $oConfirmationGUI->addButton($this->lng->txt(
"confirm"),
"performDeleteDeassignCrs");
535 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDelete");
537 $oConfirmationGUI->addItem(
'booking_id', $_GET[
'booking_id'], $tmp_obj);
539 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
547 $oForm->setFormAction($this->ctrl->getFormAction($this));
548 $oForm->setId(
'stat_form');
549 $oForm->setTableWidth(
'50 %');
550 if(is_object($tmp_user))
552 $frm_user = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
556 $frm_user = $this->lng->txt(
'user_deleted');
558 $oForm->setTitle($frm_user);
565 $oTitleGUI->
setValue($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
566 $oForm->addItem($oTitleGUI);
570 $oTransactionGUI->
setValue($booking[
'transaction']);
571 $oForm->addItem($oTransactionGUI);
576 if(is_object($tmp_vendor))
578 $frm_vendor = $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']';
582 $frm_vendor = $this->lng->txt(
'user_deleted');
585 $oForm->addItem($oVendorGUI);
590 $oForm->addItem($oPaymethodGUI);
595 $oForm->addItem($oOrderdateGUI);
599 if(($booking[
'duration'] == 0) && ($booking[
'access_enddate'] == NULL))
601 $frm_duration = $this->lng->txt(
"unlimited_duration");
605 if($booking[
'duration'] > 0)
607 $frm_duration = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
612 $oDurationGUI->setValue($frm_duration);
613 $oForm->addItem($oDurationGUI);
617 $oPriceGUI->
setValue($booking[
'price'].
' '.$booking[
'currency_unit'] );
618 $oForm->addItem($oPriceGUI);
622 $payed_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
624 $oPayedGUI->setTitle($this->lng->txt(
'paya_payed'));
625 $oPayedGUI->setOptions($payed_option);
626 $oPayedGUI->setValue($booking[
'payed']);
627 $oPayedGUI->setPostVar(
'payed');
628 $oForm->addItem($oPayedGUI);
632 $access_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
634 $oAccessGUI->setTitle($this->lng->txt(
'paya_access'));
635 $oAccessGUI->setOptions($access_option);
636 $oAccessGUI->setValue($booking[
'access_granted']);
637 $oAccessGUI->setPostVar(
'access');
638 $oForm->addItem($oAccessGUI);
640 $oForm->addCommandButton(
'updateStatistic',$this->lng->txt(
'save'));
641 $oForm->addCommandButton(
'deleteStatistic',$this->lng->txt(
'delete'));
643 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
696 if(!isset(
$_GET[
'booking_id']))
705 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
706 $this->booking_obj->setAccess((
int)
$_POST[
'access']);
707 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
709 if($this->booking_obj->update())
727 if(!isset(
$_GET[
'booking_id']))
742 if(!isset(
$_GET[
'booking_id']))
751 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
752 if(!$this->booking_obj->delete())
754 die(
'Error deleting booking');
767 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_object_selector.html",
'Services/Payment');
768 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showStatistics'));
773 if (!$exp->handleCommand())
775 $this->tpl->setVariable(
"EXPLORER",$exp->getHTML());
786 if(!isset(
$_GET[
'sell_id']))
794 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
796 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
798 $this->lng->loadLanguageModule(
'search');
799 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
802 $form_gui->setFormAction($this->ctrl->getFormAction($this),
'performSearch');
803 $form_gui->setTitle($this->lng->txt(
'grp_search_members'));
804 $form_gui->setId(
'search_form');
806 $oTitle =
new ilTextInputGUI($this->lng->txt(
'search_search_term'),
'search_str');
808 $oTitle->setSize(40);
809 $oTitle->setValue(
$_POST[
'search_str']);
810 $form_gui->addItem($oTitle);
813 $form_gui->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
814 $form_gui->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));
816 $this->tpl->setVariable(
'FORM',$form_gui->getHTML());
827 if(!trim(
$_POST[
"search_str"]))
842 if(!isset(
$_GET[
'sell_id']))
850 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.main_view.html",
'Services/Payment');
851 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
853 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUser'));
864 $f_result[$counter][
'user_id'] = $user[
"id"];
865 $f_result[$counter][
'login'] = $tmp_obj->getLogin();
866 $f_result[$counter][
'firstname'] = $tmp_obj->getFirstname();
867 $f_result[$counter][
'lastname'] = $tmp_obj->getLastname();
879 isset(
$_POST[
'sell_id']) ? $sell_id =
$_POST[
'sell_id'] : $sell_id =
$_GET[
'sell_id'];
880 isset(
$_POST[
'user_id']) ? $user_id =
$_POST[
'user_id'] : $user_id =
$_GET[
'user_id'];
882 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.main_view.html",
'Services/Payment');
883 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUser'));
884 $ilCtrl->setParameter($this,
"sell_id", $sell_id);
885 $ilCtrl->setParameter($this,
"user_id", $user_id);
894 $tmp_object[
'title'] = $tmp_obj->getTitle();
898 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
907 $oForm->setFormAction($ilCtrl->getFormAction($this,
'saveCustomer'));
909 $oForm->setTitle($this->lng->txt($tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']'));
913 $oTransaction->setTitle($this->lng->txt(
'paya_transaction'));
915 $oTransaction->setPostVar(
'transaction');
916 $oForm->addItem($oTransaction);
920 $oObject->
setValue($tmp_obj->getTitle());
921 $oForm->addItem($oObject);
925 $oVendor->
setValue($tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
926 $oForm->addItem($oVendor);
929 $oPayMethods =
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'),
'pay_method');
932 $oPayMethods->setOptions($payOptions);
933 $oPayMethods->setValue(
$_POST[
'pay_method']);
934 $oPayMethods->setPostVar(
'pay_method');
935 $oForm->addItem($oPayMethods);
938 $duration_options = array();
941 $standard_prices = array();
942 $extension_prices = array();
943 $standard_prices = $price_obj->getPrices();
944 $extension_prices = $price_obj->getExtensionPrices();
946 $prices = array_merge($standard_prices, $extension_prices );
948 if (is_array($prices))
951 $currency_unit = $genSet->get(
'currency_unit');
953 foreach($prices as $price)
955 switch($price[
'price_type'])
959 $price[
'duration'].
' '.$this->lng->txt(
'paya_months').
' -> '.$price[
'price'].
' '. $currency_unit;
963 include_once
'./Services/Calendar/classes/class.ilDatePresentation.php';
971 $txt_duration = $this->lng->txt(
'unlimited_duration').
' -> '.$price[
'price'].
' '. $currency_unit;
975 if($price[
'extension'] == 1)
977 $txt_extension =
' ('.$this->lng->txt(
'extension_price').
') ';
979 $duration_options[$price[
'price_id']] = $txt_duration.
''.$txt_extension;
985 $oDuration->setValue(
$_POST[
'duration']);
986 $oForm->addItem($oDuration);
990 $payed_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
992 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
993 $o_payed->setOptions($payed_option);
994 $o_payed->setValue(
$_POST[
'payed']);
995 $o_payed->setPostVar(
'payed');
996 $oForm->addItem($o_payed);
999 $access_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
1001 $o_access->setTitle($this->lng->txt(
'paya_access'));
1002 $o_access->setOptions($access_option);
1003 $o_access->setValue(
$_POST[
'access']);
1004 $o_access->setPostVar(
'access');
1005 $oForm->addItem($o_access);
1007 $oForm->addCommandButton(
'saveCustomer',$this->lng->txt(
'save'));
1008 $oForm->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));
1010 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
1013 public function saveCustomer()
1015 global $ilObjDataCache;
1018 if(!isset(
$_GET[
'sell_id']))
1026 if(!isset(
$_GET[
'user_id']))
1034 if (
$_POST[
"pay_method"] ==
"" ||
1035 $_POST[
"duration"] ==
"")
1049 $this->booking_obj->setTransaction($transaction);
1050 $this->booking_obj->setTransactionExtern(
$_POST[
"transaction"]);
1051 $this->booking_obj->setPobjectId($pObjectId);
1052 $this->booking_obj->setCustomerId(
$_GET[
"user_id"]);
1053 $this->booking_obj->setVendorId($obj->getVendorId());
1054 $this->booking_obj->setPayMethod((
int)
$_POST[
"pay_method"]);
1055 $this->booking_obj->setOrderDate(time());
1059 $this->booking_obj->setDuration($price[
"duration"]);
1060 $this->booking_obj->setAccessExtension($price[
'extension']);
1062 switch((
int)$price[
'price_type'])
1065 $this->booking_obj->setDuration(0);
1069 $this->booking_obj->setAccessStartdate($price[
'duration_from']);
1070 $this->booking_obj->setAccessEnddate($price[
'duration_until']);
1071 $this->booking_obj->setDuration(0);
1076 $this->booking_obj->setDuration($price[
"duration"]);
1080 $this->booking_obj->setPriceType($price[
'price_type']);
1083 $this->booking_obj->setAccess((
int) $_POST[
'access']);
1084 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
1085 $this->booking_obj->setVoucher(
'');
1087 $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
1088 $obj_type = $ilObjDataCache->lookupType($obj_id);
1089 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
1091 include_once
'Services/Payment/classes/class.ilShopVatsList.php';
1092 $oVAT =
new ilShopVats((
int)$obj->getVatId());
1093 $obj_vat_rate = $oVAT->
getRate();
1094 $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
1096 $this->booking_obj->setObjectTitle($obj_title);
1097 $this->booking_obj->setVatRate($obj_vat_rate);
1098 $this->booking_obj->setVatUnit($obj_vat_unit);
1100 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
1102 $this->booking_obj->setCurrencyUnit( $genSet->get(
'currency_unit'));
1104 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
1112 $user_id[] =
$_GET[
"user_id"];
1116 $this->booking_obj->setStreet($cust_obj[
$_GET[
"user_id"]][
'street'],
'');
1118 $this->booking_obj->setZipcode($cust_obj[$_GET[
"user_id"]][
'zipcode']);
1119 $this->booking_obj->setCity($cust_obj[$_GET[
"user_id"]][
'city']);
1120 $this->booking_obj->setCountry($cust_obj[$_GET[
"user_id"]][
'country']);
1123 if($this->booking_obj->add())
1129 if($obj_type ==
'crs')
1150 $tbl->setTitle($this->lng->txt(
"bookings"));
1151 $tbl->setId(
'tbl_bookings');
1152 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
1154 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
1155 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
1156 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
1157 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
1158 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
1159 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
1160 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
1161 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
1162 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
1163 $tbl->addColumn($this->lng->txt(
'edit'),
'edit',
'5%');
1164 $tbl->setData($a_result_set);
1166 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1173 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
1180 include_once(
"./Services/Search/classes/class.ilSearch.php");
1182 $this->lng->loadLanguageModule(
"content");
1184 $search =
new ilSearch($this->user_obj->getId());
1187 $search->setCombination(
"and");
1188 $search->setSearchFor(array(0 =>
'usr'));
1189 $search->setSearchType(
'new');
1191 if($search->validate($message))
1193 $search->performSearch();
1198 $this->ctrl->redirect($this,
"searchUser");
1200 return $search->getResultByType(
'usr');
1204 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
1207 $tbl->setTitle($this->lng->txt(
"users"));
1208 $tbl->setId(
'tbl_users_search');
1209 $tbl->setRowTemplate(
"tpl.shop_users_row.html",
"Services/Payment");
1210 $tbl->addColumn(
'',
'user_id',
'1%',
true);
1211 $tbl->addColumn($this->lng->txt(
'login'),
'login',
'10%');
1212 $tbl->addColumn($this->lng->txt(
'firstname'),
'firstname',
'10%');
1213 $tbl->addColumn($this->lng->txt(
'lastname'),
'lastname',
'10%');
1215 $tbl->addMultiCommand(
'addCustomer', $this->lng->txt(
'add'));
1216 $tbl->setData($a_result_set);
1218 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1224 include_once
'./Services/Payment/classes/class.ilShopUtils.php';
1226 if(!isset(
$_GET[
'booking_id']))
1235 $bookings = $this->booking_obj->getBookings();
1236 $booking = $bookings[(int)
$_GET[
'booking_id']];
1241 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
1242 if(!$this->booking_obj->delete())
1244 die(
'Error deleting booking');