13 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
14 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
15 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
16 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
17 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
18 include_once
'./Services/Payment/classes/class.ilInvoiceNumberPlaceholdersPropertyGUI.php';
29 $this->ctrl->saveParameter($this,
'baseClass');
31 $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;
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 %');
551 if(is_object($tmp_user))
553 $frm_user = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
557 $frm_user = $this->lng->txt(
'user_deleted');
559 $oForm->setTitle($frm_user);
566 $oTitleGUI->
setValue($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
567 $oForm->addItem($oTitleGUI);
571 $oTransactionGUI->
setValue($booking[
'transaction']);
572 $oForm->addItem($oTransactionGUI);
577 if(is_object($tmp_vendor))
579 $frm_vendor = $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']';
583 $frm_vendor = $this->lng->txt(
'user_deleted');
586 $oForm->addItem($oVendorGUI);
591 $oForm->addItem($oPaymethodGUI);
596 $oForm->addItem($oOrderdateGUI);
600 if(($booking[
'duration'] == 0) && ($booking[
'access_enddate'] == NULL))
602 $frm_duration = $this->lng->txt(
"unlimited_duration");
606 if($booking[
'duration'] > 0)
608 $frm_duration = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
613 $oDurationGUI->setValue($frm_duration);
614 $oForm->addItem($oDurationGUI);
618 $oPriceGUI->
setValue($booking[
'price'].
' '.$booking[
'currency_unit'] );
619 $oForm->addItem($oPriceGUI);
623 $payed_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
625 $oPayedGUI->setTitle($this->lng->txt(
'paya_payed'));
626 $oPayedGUI->setOptions($payed_option);
627 $oPayedGUI->setValue($booking[
'payed']);
628 $oPayedGUI->setPostVar(
'payed');
629 $oForm->addItem($oPayedGUI);
633 $access_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
635 $oAccessGUI->setTitle($this->lng->txt(
'paya_access'));
636 $oAccessGUI->setOptions($access_option);
637 $oAccessGUI->setValue($booking[
'access_granted']);
638 $oAccessGUI->setPostVar(
'access');
639 $oForm->addItem($oAccessGUI);
641 $oForm->addCommandButton(
'updateStatistic',$this->lng->txt(
'save'));
642 $oForm->addCommandButton(
'deleteStatistic',$this->lng->txt(
'delete'));
644 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
697 if(!isset(
$_GET[
'booking_id']))
706 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
707 $this->booking_obj->setAccess((
int)
$_POST[
'access']);
708 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
710 if($this->booking_obj->update())
728 if(!isset(
$_GET[
'booking_id']))
743 if(!isset(
$_GET[
'booking_id']))
752 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
753 if(!$this->booking_obj->delete())
755 die(
'Error deleting booking');
766 global $tree, $ilToolbar;
768 include_once
'./Services/Payment/classes/class.ilPaymentObjectSelector.php';
770 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_object_selector.html",
'Services/Payment');
771 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showStatistics'));
775 $exp =
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), (string)strtolower(get_class($this)));
776 $exp->setExpand(
$_GET[
"paya_link_expand"] ?
$_GET[
"paya_link_expand"] : $tree->readRootId());
777 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
781 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
790 if(!isset(
$_GET[
'sell_id']))
798 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
800 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
802 $this->lng->loadLanguageModule(
'search');
803 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
806 $form_gui->setFormAction($this->ctrl->getFormAction($this),
'performSearch');
807 $form_gui->setTitle($this->lng->txt(
'grp_search_members'));
808 $form_gui->setId(
'search_form');
810 $oTitle =
new ilTextInputGUI($this->lng->txt(
'search_search_term'),
'search_str');
812 $oTitle->setSize(40);
813 $oTitle->setValue(
$_POST[
'search_str']);
814 $form_gui->addItem($oTitle);
817 $form_gui->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
818 $form_gui->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));
820 $this->tpl->setVariable(
'FORM',$form_gui->getHTML());
831 if(!trim(
$_POST[
"search_str"]))
846 if(!isset(
$_GET[
'sell_id']))
854 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.main_view.html",
'Services/Payment');
855 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
857 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUser'));
868 $f_result[$counter][
'user_id'] = $user[
"id"];
869 $f_result[$counter][
'login'] = $tmp_obj->getLogin();
870 $f_result[$counter][
'firstname'] = $tmp_obj->getFirstname();
871 $f_result[$counter][
'lastname'] = $tmp_obj->getLastname();
883 isset(
$_POST[
'sell_id']) ? $sell_id =
$_POST[
'sell_id'] : $sell_id =
$_GET[
'sell_id'];
884 isset(
$_POST[
'user_id']) ? $user_id =
$_POST[
'user_id'] : $user_id =
$_GET[
'user_id'];
886 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.main_view.html",
'Services/Payment');
887 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUser'));
888 $ilCtrl->setParameter($this,
"sell_id", $sell_id);
889 $ilCtrl->setParameter($this,
"user_id", $user_id);
898 $tmp_object[
'title'] = $tmp_obj->getTitle();
902 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
911 $oForm->setFormAction($ilCtrl->getFormAction($this,
'saveCustomer'));
913 $oForm->setTitle($this->lng->txt($tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']'));
917 $oTransaction->setTitle($this->lng->txt(
'paya_transaction'));
919 $oTransaction->setPostVar(
'transaction');
920 $oForm->addItem($oTransaction);
924 $oObject->
setValue($tmp_obj->getTitle());
925 $oForm->addItem($oObject);
929 $oVendor->
setValue($tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
930 $oForm->addItem($oVendor);
933 $oPayMethods =
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'),
'pay_method');
936 $oPayMethods->setOptions($payOptions);
937 $oPayMethods->setValue(
$_POST[
'pay_method']);
938 $oPayMethods->setPostVar(
'pay_method');
939 $oForm->addItem($oPayMethods);
942 $duration_options = array();
945 $standard_prices = array();
946 $extension_prices = array();
947 $standard_prices = $price_obj->getPrices();
948 $extension_prices = $price_obj->getExtensionPrices();
950 $prices = array_merge($standard_prices, $extension_prices );
952 if (is_array($prices))
955 $currency_unit = $genSet->get(
'currency_unit');
957 foreach($prices as $price)
959 switch($price[
'price_type'])
963 $price[
'duration'].
' '.$this->lng->txt(
'paya_months').
' -> '.$price[
'price'].
' '. $currency_unit;
967 include_once
'./Services/Calendar/classes/class.ilDatepresentation.php';
975 $txt_duration = $this->lng->txt(
'unlimited_duration').
' -> '.$price[
'price'].
' '. $currency_unit;
979 if($price[
'extension'] == 1)
981 $txt_extension =
' ('.$this->lng->txt(
'extension_price').
') ';
983 $duration_options[$price[
'price_id']] = $txt_duration.
''.$txt_extension;
989 $oDuration->setValue(
$_POST[
'duration']);
990 $oForm->addItem($oDuration);
994 $payed_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
996 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
997 $o_payed->setOptions($payed_option);
998 $o_payed->setValue(
$_POST[
'payed']);
999 $o_payed->setPostVar(
'payed');
1000 $oForm->addItem($o_payed);
1003 $access_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
1005 $o_access->setTitle($this->lng->txt(
'paya_access'));
1006 $o_access->setOptions($access_option);
1007 $o_access->setValue(
$_POST[
'access']);
1008 $o_access->setPostVar(
'access');
1009 $oForm->addItem($o_access);
1011 $oForm->addCommandButton(
'saveCustomer',$this->lng->txt(
'save'));
1012 $oForm->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));
1014 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
1017 public function saveCustomer()
1019 global $ilObjDataCache;
1022 if(!isset(
$_GET[
'sell_id']))
1030 if(!isset(
$_GET[
'user_id']))
1038 if (
$_POST[
"pay_method"] ==
"" ||
1039 $_POST[
"duration"] ==
"")
1053 $this->booking_obj->setTransaction($transaction);
1054 $this->booking_obj->setTransactionExtern(
$_POST[
"transaction"]);
1055 $this->booking_obj->setPobjectId($pObjectId);
1056 $this->booking_obj->setCustomerId(
$_GET[
"user_id"]);
1057 $this->booking_obj->setVendorId($obj->getVendorId());
1058 $this->booking_obj->setPayMethod((
int)
$_POST[
"pay_method"]);
1059 $this->booking_obj->setOrderDate(time());
1063 $this->booking_obj->setDuration($price[
"duration"]);
1064 $this->booking_obj->setAccessExtension($price[
'extension']);
1066 switch((
int)$price[
'price_type'])
1069 $this->booking_obj->setDuration(0);
1073 $this->booking_obj->setAccessStartdate($price[
'duration_from']);
1074 $this->booking_obj->setAccessEnddate($price[
'duration_until']);
1075 $this->booking_obj->setDuration(0);
1080 $this->booking_obj->setDuration($price[
"duration"]);
1084 $this->booking_obj->setPriceType($price[
'price_type']);
1087 $this->booking_obj->setAccess((
int) $_POST[
'access']);
1088 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
1089 $this->booking_obj->setVoucher(
'');
1091 $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
1092 $obj_type = $ilObjDataCache->lookupType($obj_id);
1093 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
1095 include_once
'Services/Payment/classes/class.ilShopVatsList.php';
1096 $oVAT =
new ilShopVats((
int)$obj->getVatId());
1097 $obj_vat_rate = $oVAT->
getRate();
1098 $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
1100 $this->booking_obj->setObjectTitle($obj_title);
1101 $this->booking_obj->setVatRate($obj_vat_rate);
1102 $this->booking_obj->setVatUnit($obj_vat_unit);
1104 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
1106 $this->booking_obj->setCurrencyUnit( $genSet->get(
'currency_unit'));
1108 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
1116 $user_id[] =
$_GET[
"user_id"];
1120 $this->booking_obj->setStreet($cust_obj[
$_GET[
"user_id"]][
'street'],
'');
1122 $this->booking_obj->setZipcode($cust_obj[$_GET[
"user_id"]][
'zipcode']);
1123 $this->booking_obj->setCity($cust_obj[$_GET[
"user_id"]][
'city']);
1124 $this->booking_obj->setCountry($cust_obj[$_GET[
"user_id"]][
'country']);
1127 if($this->booking_obj->add())
1133 if($obj_type ==
'crs')
1154 $tbl->setTitle($this->lng->txt(
"bookings"));
1155 $tbl->setId(
'tbl_bookings');
1156 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
1158 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
1159 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
1160 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
1161 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
1162 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
1163 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
1164 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
1165 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
1166 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
1167 $tbl->addColumn($this->lng->txt(
'edit'),
'edit',
'5%');
1168 $tbl->setData($a_result_set);
1170 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1177 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
1184 include_once(
"./Services/Search/classes/class.ilSearch.php");
1186 $this->lng->loadLanguageModule(
"content");
1188 $search =
new ilSearch($this->user_obj->getId());
1191 $search->setCombination(
"and");
1192 $search->setSearchFor(array(0 =>
'usr'));
1193 $search->setSearchType(
'new');
1195 if($search->validate($message))
1197 $search->performSearch();
1202 $this->ctrl->redirect($this,
"searchUser");
1204 return $search->getResultByType(
'usr');
1208 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
1211 $tbl->setTitle($this->lng->txt(
"users"));
1212 $tbl->setId(
'tbl_users_search');
1213 $tbl->setRowTemplate(
"tpl.shop_users_row.html",
"Services/Payment");
1214 $tbl->addColumn(
'',
'user_id',
'1%',
true);
1215 $tbl->addColumn($this->lng->txt(
'login'),
'login',
'10%');
1216 $tbl->addColumn($this->lng->txt(
'firstname'),
'firstname',
'10%');
1217 $tbl->addColumn($this->lng->txt(
'lastname'),
'lastname',
'10%');
1219 $tbl->addMultiCommand(
'addCustomer', $this->lng->txt(
'add'));
1220 $tbl->setData($a_result_set);
1222 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1228 include_once
'./Services/Payment/classes/class.ilShopUtils.php';
1230 if(!isset(
$_GET[
'booking_id']))
1239 $bookings = $this->booking_obj->getBookings();
1240 $booking = $bookings[(int)
$_GET[
'booking_id']];
1245 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
1246 if(!$this->booking_obj->delete())
1248 die(
'Error deleting booking');