19 require_once
'./classes/class.ilObjectGUI.php';
20 include_once
'./Services/Payment/classes/class.ilShopVatsList.php';
21 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
22 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
23 include_once
'./Services/Payment/classes/class.ilFileDataShop.php';
24 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
25 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
26 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
27 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
28 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
29 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
45 $this->user_obj = $ilias->account;
50 $this->genSetData = $genSet->getAll();
53 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
55 $this->lng->loadLanguageModule(
'payment');
60 $next_class = $this->ctrl->getNextClass($this);
61 $cmd = $this->ctrl->getCmd();
64 $this->
getTabs($this->tabs_gui);
68 case 'ilpermissiongui':
69 include_once(
'Services/AccessControl/classes/class.ilPermissionGUI.php');
71 $ret = $this->ctrl->forwardCommand($perm_gui);
74 case 'ilpageobjectgui':
79 $this->tpl->setContent(
$ret);
83 case 'ilshoptopicsgui':
84 include_once
'./Services/Payment/classes/class.ilShopTopicsGUI.php';
86 $ret = $this->ctrl->forwardCommand($topics_gui);
92 $cmd =
'generalSettings';
98 case 'saveGeneralSettings' :
99 case 'generalSettings' :
100 $this->tabs_gui->setTabActive(
'settings');
101 $this->
getSubTabs(
'settings',
'generalSettings');
103 case 'saveBmfSettings' :
104 case 'bmfSettings' : $this->tabs_gui->setTabActive(
'settings');
107 case 'savePaypalSettings' :
108 case 'paypalSettings' :
109 $this->tabs_gui->setTabActive(
'settings');
110 $this->
getSubTabs(
'settings',
'paypalSettings');
112 case 'saveEPaySettings' :
113 case 'epaySettings' :
114 $this->tabs_gui->setTabActive(
'settings');
115 $this->
getSubTabs(
'settings',
'epaySettings');
117 case 'saveERPsettings' :
118 case 'delERPpreview':
119 case 'testERPsettings' :
121 $this->tabs_gui->setTabActive(
'settings');
129 case 'performDeleteVat':
130 case 'confirmDeleteVat':
134 case 'vats' : $this->tabs_gui->setTabActive(
'vats');
138 #TODO: CURRENCY not finished yet
141 # case 'performDeleteCurrency':
142 case 'updateCurrency':
143 # if($_POST['action'] == 'editCurrency' || $_POST['action'] == 'deleteCurrency')
144 # $cmd = $_POST['action'];
145 $this->tabs_gui->setTabActive(
'currencies');
162 if(!(
int)
$_GET[
'pobject_id'])
165 return $this->showObjects();
167 $this->ctrl->setParameter($this,
'pobject_id', (
int)$_GET[
'pobject_id']);
170 $this->lng->loadLanguageModule(
'content');
172 $ilTabs->clearTargets();
173 $ilTabs->clearSubTabs();
174 $ilTabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'editDetails'));
177 include_once
'Services/COPage/classes/class.ilPageObject.php';
178 include_once
'Services/COPage/classes/class.ilPageObjectGUI.php';
179 include_once(
'./Services/Style/classes/class.ilObjStyleSheet.php');
187 $new_page_object->setParentId(0);
188 $new_page_object->setId($this->pobject->getPobjectId());
189 $new_page_object->createFromXML();
192 $this->ctrl->setReturnByClass(
'ilpageobjectgui',
'edit');
194 $page_gui =
new ilPageObjectGUI(
'shop', $this->pobject->getPobjectId());
195 $this->ctrl->setParameter($page_gui,
'pobject_id', (
int)$_GET[
'pobject_id']);
197 $page_gui->setTemplateTargetVar(
'ADM_CONTENT');
198 $page_gui->setLinkXML(
'');
199 $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'downloadFile'));
200 $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'displayMediaFullscreen'));
201 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'download_paragraph'));
202 $page_gui->setPresentationTitle(
'');
203 $page_gui->setTemplateOutput(
false);
204 $page_gui->setHeader(
'');
205 $page_gui->setEnabledRepositoryObjects(
false);
206 $page_gui->setEnabledFileLists(
true);
207 $page_gui->setEnabledMaps(
true);
208 $page_gui->setEnabledPCTabs(
true);
210 return $this->ctrl->forwardCommand($page_gui);
218 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
220 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
223 include_once
'./Services/Payment/classes/class.ilBMFSettings.php';
240 if (
$_POST[
'mandantNr'] ==
'' ||
241 $_POST[
'bewirtschafterNr'] ==
'' ||
242 $_POST[
'haushaltsstelle'] ==
'' ||
243 $_POST[
'objektNr'] ==
'' ||
244 $_POST[
'kennzeichenMahnverfahren'] ==
'' ||
245 $_POST[
'waehrungskennzeichen'] ==
'' ||
246 $_POST[
'ePaymentServer'] ==
'' ||
247 $_POST[
'clientCertificate'] ==
'' ||
248 $_POST[
'caCertificate'] ==
'' ||
251 $this->error = $this->lng->txt(
'pays_bmf_settings_not_valid');
271 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
273 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
275 include_once
'./Services/Payment/classes/class.ilBMFSettings.php';
278 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
283 $form->setFormAction($this->ctrl->getFormAction($this,
'saveBmfSettings'));
284 $form->setTitle($this->lng->txt(
'pays_bmf_settings'));
286 $form->addCommandButton(
'saveBmfSettings',$this->lng->txt(
'save'));
288 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_client_id'),
'mandantNr');
289 $formItem->
setValue($bmfSetObj->getClientId());
290 $form->addItem($formItem);
292 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_bewirtschafter_nr'),
'bewirtschafterNr');
293 $formItem->
setValue($bmfSetObj->getBewirtschafterNr());
294 $form->addItem($formItem);
296 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_haushaltsstelle'),
'haushaltsstelle');
297 $formItem->
setValue($bmfSetObj->getHaushaltsstelle());
298 $form->addItem($formItem);
300 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_object_id'),
'objektNr');
301 $formItem->
setValue($bmfSetObj->getObjectId());
302 $form->addItem($formItem);
304 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_kennzeichen_mahnverfahren'),
'kennzeichenMahnverfahren');
305 $formItem->
setValue($bmfSetObj->getKennzeichenMahnverfahren());
306 $form->addItem($formItem);
308 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_waehrungskennzeichen'),
'waehrungskennzeichen');
309 $formItem->
setValue($bmfSetObj->getWaehrungsKennzeichen());
310 $form->addItem($formItem);
312 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_epayment_server'),
'ePaymentServer');
313 $formItem->
setValue($bmfSetObj->getEpaymentServer());
314 $form->addItem($formItem);
316 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_client_certificate'),
'clientCertificate');
317 $formItem->
setValue($bmfSetObj->getClientCertificate());
318 $form->addItem($formItem);
320 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_ca_certificate'),
'caCertificate');
321 $formItem->
setValue($bmfSetObj->getCaCertificate());
322 $form->addItem($formItem);
324 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_bmf_timeout'),
'timeOut');
325 $formItem->
setValue($bmfSetObj->getTimeOut());
326 $form->addItem($formItem);
328 $this->tpl->setVariable(
'FORM',$form->getHTML());
334 if(!
$_GET[
'pobject_id'])
338 $this->objectObjects();
343 $this->ctrl->setParameter($this,
'pobject_id',(
int) $_GET[
'pobject_id']);
346 $old_pay_method = $this->pobject->getPayMethod();
347 $old_status = $this->pobject->getStatus();
348 $old_vat_id = $this->pobject->getVatId();
351 if($old_status == $this->pobject->STATUS_NOT_BUYABLE and
352 (
int)
$_POST[
'status'] != $old_status)
355 switch((
int)
$_POST[
'pay_method'])
357 case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
367 if(!count($prices_obj->getPrices()))
377 $this->pobject->setStatus((
int)
$_POST[
'status']);
378 $this->pobject->setVendorId((
int) $_POST[
'vendor']);
379 $this->pobject->setPayMethod((
int) $_POST[
'pay_method']);
380 $this->pobject->setTopicId((
int) $_POST[
'topic_id']);
381 $this->pobject->setVatId((
int) $_POST[
'vat_id']);
383 $this->pobject->update();
395 if($a_show_delete ==
false) unset(
$_SESSION[
'price_ids']);
399 if(!
$_GET[
'pobject_id'])
406 $this->ctrl->setParameter($this,
'pobject_id',(
int)
$_GET[
'pobject_id']);
408 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'objects'));
409 $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this,
'editDetails'));
410 $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this,
'editPrices'));
414 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
417 $prices = $price_obj->getPrices();
423 $ilToolbar->addButton($this->lng->txt(
'paya_add_price'), $this->ctrl->getLinkTarget($this,
'addPrice'));
433 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDeletePrice"));
434 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_selected_prices"));
435 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"editPrices");
436 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDeletePrice");
438 foreach($prices as $price)
443 if(in_array($price[
'price_id'],
$_SESSION[
'price_ids']))
445 if ($price[
'unlimited_duration'] ==
'1')
447 $tmp_price = $this->lng->txt(
'unlimited_duration');
451 $tmp_price = $price[
'duration'].
' '.$this->lng->txt(
'paya_months');
453 $delete_row =
''.$tmp_price.
' '.
455 $this->genSetData[
'currency_unit'];
458 $oConfirmationGUI->addItem(
'',$delete_row, $delete_row);
462 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
471 $tpl->setCurrentBlock(
'tbl_form_header');
473 $tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this));
474 $tpl->parseCurrentBlock();
477 foreach($prices as $price)
480 if($a_show_delete ==
true )
482 $this->ctrl->setParameter($this,
'show_delete',
'true');
484 if(in_array($price[
'price_id'],
$_SESSION[
'price_ids']))
487 $data[$counter][
'price_id'] =
'';
488 $data[$counter][
'duration'] =$price[
'duration'] ;
489 $data[$counter][
'month'] = $this->lng->txt(
'paya_months');
491 $data[$counter][
'unlimited_duration'] = ilUtil::formCheckBox($price[
'unlimited_duration'] ? 1 : 0,
492 'duration_ids[]', (
int)$price[
'price_id']);
496 $data[$counter][
'currency_unit'] = $this->genSetData[
'currency_unit'];
501 $data[$counter][
'price_id'] = ilUtil::formCheckBox(in_array($price[
'price_id'],
$_SESSION[
'price_ids']) ? 1 : 0,
502 'price_ids[]', $price[
'price_id']);
504 $data[$counter][
'duration'] =
ilUtil::formInput(
'prices['.$price[
'price_id'].
'][duration]',$price[
'duration']);
505 $data[$counter][
'month'] = $this->lng->txt(
'paya_months');
507 $data[$counter][
'unlimited_duration'] = ilUtil::formCheckBox($price[
'unlimited_duration'] ? 1 : 0,
508 'duration_ids[]', (
int)$price[
'price_id']);
511 # $data[$counter]['currency_unit'] = $currency['unit']; #
512 $data[$counter][
'currency_unit'] = $this->genSetData[
'currency_unit'];
523 $this->ctrl->setParameter($this,
'cmd',
'editprices');
529 $tbl->setTitle($tmp_obj->getTitle());
533 $tbl->setTitle($this->lng->txt($object_not_found));
536 $tbl->setId(
'tbl_bookings');
537 $tbl->setRowTemplate(
"tpl.shop_prices_row.html",
"Services/Payment");
539 $tbl->addColumn(
' ',
'price_id',
'5%');
540 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
541 $tbl->addColumn(
'',
'month',
'10%');
542 $tbl->addColumn($this->lng->txt(
'unlimited_duration'),
'unlimitied_duration',
'15%');
543 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'10%');
544 $tbl->addColumn($this->lng->txt(
'currency'),
'currency_unit',
'50%');
545 $tbl->setSelectAllCheckbox(
'price_id');
546 $tbl->addCommandButton(
'updatePrice',$this->lng->txt(
'paya_update_price'));
547 $tbl->addCommandButton(
'addPrice',$this->lng->txt(
'paya_add_price'));
549 $tbl->addMultiCommand(
"deletePrice", $this->lng->txt(
"paya_delete_price"));
552 $tbl->setData($a_result_set);
554 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
563 if(!
$_GET[
'pobject_id'])
567 $this->showObjects();
571 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
575 $this->ctrl->setParameter($this,
'pobject_id',(
int)
$_GET[
'pobject_id']);
579 $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this,
'editDetails'));
580 $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this,
'editPrices'));
583 if(is_object($tmp_obj))
585 $tmp_object[
'title'] = $tmp_obj->getTitle();
589 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
591 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
594 $form->setFormAction($this->ctrl->getFormAction($this));
595 $form->setTitle($this->lng->txt(
'paya_add_price_title'));
600 $oTitle->
setValue($tmp_object[
'title']);
601 $form->addItem($oTitle);
605 $oDuration->setTitle($this->lng->txt(
'duration'));
606 $oDuration->setValue(
$_POST[
'duration']);
607 $oDuration->setInfo($this->lng->txt(
'paya_months'));
608 $oDuration->setPostVar(
'duration');
609 $form->addItem($oDuration);
612 $oUnlimitedDuration =
new ilCheckboxInputGUI($this->lng->txt(
'unlimited_duration'),
'unlimited_duration');
614 $form->addItem($oUnlimitedDuration);
618 $oPrice->setTitle($this->lng->txt(
'price_a'));
619 $oPrice->setValue(
$_POST[
'price']);
620 $oPrice->setPostVar(
'price');
621 $oPrice->setRequired(
true);
622 $form->addItem($oPrice);
627 #TODO: CURRENCY not finished yet
643 $currency_options = $this->genSetData[
'currency_unit'];
645 $oCurrency->
setValue($currency_options);
646 $form->addItem($oCurrency);
648 $form->addCommandButton(
'performAddPrice',$this->lng->txt(
'paya_add_price'));
649 $form->addCommandButton(
'editPrices', $this->lng->txt(
'cancel'));
650 $this->tpl->setVariable(
'FORM',$form->getHTML());
657 if(!
$_GET[
'pobject_id'])
669 $prices->setUnlimitedDuration((
int)
$_POST[
'unlimited_duration']);
671 if($_POST[
'unlimited_duration'] ==
'1')
673 $prices->setUnlimitedDuration(1);
676 $prices->setDuration($_POST[
'duration']);
677 $prices->setPrice($_POST[
'price']);
678 $prices->setCurrency($currency[
'currency_id']);
680 if(!$prices->validate())
697 if(!
$_GET[
'pobject_id'])
715 foreach(
$_SESSION[
'price_ids'] as $price_id)
717 if($prices->delete($price_id))
723 if(!count($prices->getPrices()))
727 $this->pobject->setStatus($this->pobject->STATUS_NOT_BUYABLE);
728 $this->pobject->update();
740 if(!
$_GET[
'pobject_id'])
748 if(!count(
$_POST[
'price_ids']))
763 if(!
$_GET[
'pobject_id'])
772 $this->ctrl->setParameter($this,
'pobject_id',(
int) $_GET[
'pobject_id']);
775 foreach(
$_POST[
'prices'] as $price_id => $price)
777 $old_price = $po->getPrice($price_id);
779 $po->setDuration($price[
'duration']);
780 $po->setPrice($price[
'price']);
781 $po->setCurrency($old_price[
'currency']);
797 foreach(
$_POST[
'prices'] as $price_id => $price)
799 $old_price = $po->getPrice($price_id);
801 if(isset(
$_POST[
'duration_ids']))
803 $search = in_array((
string)$price_id,
$_POST[
'duration_ids']);
805 if(
$_POST[
'duration_ids'] == NULL)
807 $po->setUnlimitedDuration(0);
808 $po->setDuration($price[
'duration']);
811 else if( $search = in_array((
string)$price_id,
$_POST[
'duration_ids']))
813 $po->setUnlimitedDuration(1);
818 $po->setUnlimitedDuration(0);
822 $po->setDuration($price[
'duration']);
823 $po->setPrice($price[
'price']);
824 $po->setCurrency($old_price[
'currency']);
826 $po->update($price_id);
838 if(!(
int)
$_GET[
'pobject_id'])
841 return $this->showObjects();
846 $this->ctrl->setParameter($this,
'pobject_id', (
int)$_GET[
'pobject_id']);
848 $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this,
'editDetails'));
849 $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this,
'editPrices'));
850 $ilToolbar->addButton($this->lng->txt(
'pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'edit'));
852 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
855 $this->tpl->setCurrentBlock(
'confirm_delete');
856 $this->tpl->setVariable(
'CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
857 $this->tpl->setVariable(
'TXT_CANCEL',$this->lng->txt(
'cancel'));
858 $this->tpl->setVariable(
'CONFIRM_CMD',
'performDelete');
859 $this->tpl->setVariable(
'TXT_CONFIRM',$this->lng->txt(
'confirm'));
860 $this->tpl->parseCurrentBlock();
866 $tmp_object[
'title'] = $tmp_obj->getTitle();
867 $tmp_object[
'type'] = $tmp_obj->getType();
871 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
872 $tmp_object[
'type'] =
'';
877 $oForm->setFormAction($this->ctrl->getFormAction($this,
'updateDetails'));
878 $oForm->setTitle($tmp_object[
'title']);
884 $oForm->addItem($oPathGUI);
889 $oForm->addItem($oPurchasersGUI);
892 $oVendorsGUI =
new ilSelectInputGUI($this->lng->txt(
'paya_vendor'),
'vendor');
894 $oVendorsGUI->setValue($this->pobject->getVendorId());
895 $oForm->addItem($oVendorsGUI);
900 $oStatusGUI->setValue($this->pobject->getStatus());
901 $oForm->addItem($oStatusGUI);
904 $oPayMethodsGUI =
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'),
'pay_method');
907 $oPayMethodsGUI->setValue($this->pobject->getPayMethod());
908 $oForm->addItem($oPayMethodsGUI);
911 include_once
'./Services/Payment/classes/class.ilShopTopics.php';
918 $topic_options = array();
919 $topic_options[
''] = $this->lng->txt(
'please_choose');
921 foreach($topics as $oTopic)
923 $topic_options[$oTopic->getId()] = $oTopic->getTitle();
926 $oTopicsGUI->setOptions($topic_options);
927 $oTopicsGUI->setValue($this->pobject->getTopicId());
928 $oForm->addItem($oTopicsGUI);
933 $oShopVatsList->read();
934 if($oShopVatsList->hasItems())
938 $vats_options = array();
939 foreach($oShopVatsList as $oVAT)
944 $oVatsGUI->setOptions($vats_options);
945 $oVatsGUI->setValue($this->pobject->getVatId());
946 $oForm->addItem($oVatsGUI);
951 $oVatsGUI->
setValue($this->lng->txt(
'paya_no_vats_assigned'));
952 $oForm->addItem($oVatsGUI);
957 if(($webpath_file = $oFile->getCurrentImageWebPath()) !==
false)
959 $oThumbnail->setImage($webpath_file);
961 $oForm->addItem($oThumbnail);
964 $oForm->addCommandButton(
'updateDetails', $this->lng->txt(
'save'));
965 $oForm->addCommandButton(
'deleteObject', $this->lng->txt(
'delete'));
967 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
975 if(!
$_GET[
'pobject_id'])
1001 if(!
$_GET[
'pobject_id'])
1011 $this->pobject->delete();
1015 $price_obj->deleteAllPrices();
1029 $path = $tree->getPathFull($a_ref_id);
1035 $html .= $data[
'title'].
' > ';
1037 return substr($html,0,-2);
1042 include_once
'Services/Payment/classes/class.ilPaymentVendors.php';
1048 $all_vendors = $vendor_obj->getVendors();
1049 if (is_array($all_vendors))
1051 foreach ($all_vendors as
$vendor)
1053 $vendors[] = $vendor[
'vendor_id'];
1060 $options[
$vendor] = $tmp_obj->getFullname().
' ['.$tmp_obj->getLogin().
']';
1068 $option[$this->pobject->STATUS_NOT_BUYABLE] = $this->lng->txt(
'paya_not_buyable');
1069 $option[$this->pobject->STATUS_BUYABLE] = $this->lng->txt(
'paya_buyable');
1070 $option[$this->pobject->STATUS_EXPIRES] = $this->lng->txt(
'paya_expires');
1078 unset(
$_POST[
'title_type']);
1079 unset(
$_POST[
'title_value']);
1081 unset(
$_POST[
'pay_method']);
1093 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
1095 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
1098 if (
$_POST[
'updateView'] == 1)
1106 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
1109 $this->lng->loadLanguageModule(
'search');
1112 $filter_form->setFormAction($this->ctrl->getFormAction($this));
1113 $filter_form->setTitle($this->lng->txt(
'pay_filter'));
1114 $filter_form->setId(
'filter_form');
1115 $filter_form->setTableWidth(
'100 %');
1118 $o_hide_check =
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'),
'show_filter');
1119 $o_hide_check->setValue(1);
1120 $o_hide_check->setChecked(
$_POST[
'show_filter'] ? 1 : 0);
1123 $o_hidden->setValue(1);
1124 $o_hidden->setPostVar(
'updateView');
1125 $o_hide_check->addSubItem($o_hidden);
1129 $radio_option =
new ilRadioOption($this->lng->txt(
'search_any_word'),
'or');
1130 $radio_group->addOption($radio_option);
1131 $radio_option =
new ilRadioOption($this->lng->txt(
'search_all_words'),
'and');
1132 $radio_group->addOption($radio_option);
1134 $radio_group->setRequired(
false);
1136 $radio_group->setPostVar(
'title_type');
1139 $o_title->setValue(
$_SESSION[
'pay_objects'][
'title_value']);
1140 $o_title->setPostVar(
'title_value');
1141 $o_title->setTitle($this->lng->txt(
'title'));
1143 $o_hide_check->addSubItem($radio_group);
1144 $o_hide_check->addSubItem($o_title);
1148 $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
1149 $o_vendor->setValue(
$_SESSION[
'pay_objects'][
'vendor']);
1150 $o_vendor->setPostVar(
'vendor');
1151 $o_hide_check->addSubItem($o_vendor);
1155 $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
1156 $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions(
'all'));
1157 $o_paymethod->setValue(
$_SESSION[
'pay_objects'][
'pay_method']);
1158 $o_paymethod->setPostVar(
'pay_method');
1159 $o_hide_check->addSubItem($o_paymethod);
1161 $filter_form->addCommandButton(
'objects', $this->lng->txt(
'pay_update_view'));
1162 $filter_form->addCommandButton(
'resetObjectFilter', $this->lng->txt(
'pay_reset_filter'));
1164 $filter_form->addItem($o_hide_check);
1171 $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
1174 foreach($objects as
$data)
1179 $f_result[$counter][
'title'] = $tmp_obj->getTitle();
1183 $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
1186 switch($data[
'status'])
1188 case $this->pobject->STATUS_BUYABLE:
1189 $f_result[$counter][
'status'] = $this->lng->txt(
'paya_buyable');
1192 case $this->pobject->STATUS_NOT_BUYABLE:
1193 $f_result[$counter][
'status'] = $this->lng->txt(
'paya_not_buyable');
1196 case $this->pobject->STATUS_EXPIRES:
1197 $f_result[$counter][
'status'] = $this->lng->txt(
'paya_expires');
1201 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
1203 $f_result[$counter][
'pay_method'] = $str_paymethod;
1205 if($data[
'vat_id'] <= 0)
1207 $vat_rate = $this->lng->txt(
'payment_vat_has_to_be_defined_by_administration_short');
1213 $oVAT =
new ilShopVats((
int)$data[
'vat_id']);
1218 $vat_rate = $this->lng->txt(
'payment_vat_has_to_be_defined_by_administration_short');
1222 $f_result[$counter][
'vat_rate'] = $vat_rate;
1227 $f_result[$counter][
'vendor'] = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
1231 $f_result[$counter][
'vendor'] = $this->lng->txt(
'user_not_found');
1238 $this->ctrl->setParameter($this,
'pobject_id',$data[
'pobject_id']);
1239 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editDetails").
"\">".$this->lng->txt(
"edit").
"</a></div>";
1241 $f_result[$counter][
'options'] = $link_change;
1255 $this->ctrl->setParameter($this,
'cmd',
'objects');
1258 $tbl->setTitle($this->lng->txt(
'objects'));
1260 $tbl->setId(
'tbl_show_objects');
1261 $tbl->setRowTemplate(
"tpl.shop_objects_row.html",
"Services/Payment");
1263 $tbl->addColumn($this->lng->txt(
'title'),
'title',
'10%');
1264 $tbl->addColumn($this->lng->txt(
'status'),
'status',
'10%');
1265 $tbl->addColumn($this->lng->txt(
'paya_pay_method'),
'pay_method',
'10%');
1266 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'15%');
1267 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
1268 $tbl->addColumn($this->lng->txt(
'paya_count_purchaser'),
'purchasers',
'10%');
1269 $tbl->addColumn(
'',
'options',
'10%');
1271 $tbl->setData($a_result_set);
1273 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1288 case 'deleteVendorsObject':
1289 $this->deleteVendors();
1292 case 'editVendorObject':
1293 $this->editVendor();
1296 case 'performEditVendorObject':
1310 unset(
$_POST[
'transaction_type']);
1311 unset(
$_POST[
'transaction_value']);
1316 unset(
$_POST[
'customer']);
1317 unset(
$_POST[
'pay_method']);
1318 unset(
$_POST[
'updateView']);
1319 unset(
$_POST[
"adm_filter_title_id"]);
1327 global $rbacsystem, $ilToolbar,$ilObjDataCache;
1329 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
1332 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
1334 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
1337 $ilToolbar->addButton($this->lng->txt(
'paya_add_customer'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
1339 if (
$_POST[
'updateView'] == 1)
1342 $_SESSION[
'pay_statistics'][
'updateView'] =
true;
1345 $_SESSION[
'pay_statistics'][
'transaction_type'] = isset(
$_POST[
'transaction_type']) ?
$_POST[
'transaction_type'] :
'' ;
1346 $_SESSION[
'pay_statistics'][
'transaction_value'] = isset(
$_POST[
'transaction_value']) ?
$_POST[
'transaction_value'] :
'';
1347 $_SESSION[
'pay_statistics'][
'adm_filter_title_id'] = (int)
$_POST[
'adm_filter_title_id'];
1349 if(
$_SESSION[
'pay_statistics'][
'from_check'] ==
'1')
1351 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] =
$_POST[
'from'][
'date'][
'd'];
1352 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] =
$_POST[
'from'][
'date'][
'm'];
1353 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] =
$_POST[
'from'][
'date'][
'y'];
1357 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] =
'';
1358 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] =
'';
1359 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] =
'';
1362 if(
$_SESSION[
'pay_statistics'][
'until_check']==
'1')
1364 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] =
$_POST[
'til'][
'date'][
'd'];
1365 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] =
$_POST[
'til'][
'date'][
'm'];
1366 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] =
$_POST[
'til'][
'date'][
'y'];
1370 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] =
'';
1371 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] =
'';
1372 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] =
'';
1383 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
1386 $filter_form->setFormAction($this->ctrl->getFormAction($this));
1387 $filter_form->setTitle($this->lng->txt(
'pay_filter'));
1388 $filter_form->setId(
'formular');
1389 $filter_form->setTableWidth(
'100 %');
1391 $o_hide_check =
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'),
'show_filter');
1392 $o_hide_check->setValue(1);
1393 $o_hide_check->setChecked(
$_POST[
'show_filter'] ? 1 : 0);
1396 $o_hidden->setValue(1);
1397 $o_hidden->setPostVar(
'updateView');
1398 $o_hide_check->addSubItem($o_hidden);
1401 $trans_option = array($this->lng->txt(
'pay_starting'),$this->lng->txt(
'pay_ending'));
1402 $trans_value = array(
'0',
'1');
1403 $o_transaction_type->setTitle($this->lng->txt(
'paya_transaction'));
1404 $o_transaction_type->setOptions($trans_option);
1405 $o_transaction_type->setValue(
$_SESSION[
'pay_statistics'][
'transaction_type']);
1406 $o_transaction_type->setPostVar(
'transaction_type');
1407 $o_hide_check->addSubItem($o_transaction_type);
1410 $o_transaction_val->setValue(
$_SESSION[
'pay_statistics'][
'transaction_value']);
1411 $o_transaction_val->setPostVar(
'transaction_value');
1412 $o_hide_check->addSubItem($o_transaction_val);
1415 $o_customer->setTitle($this->lng->txt(
'paya_customer'));
1416 $o_customer->setValue(
$_SESSION[
'pay_statistics'][
'customer']);
1417 $o_customer->setPostVar(
'customer');
1418 $o_hide_check->addSubItem($o_customer);
1421 $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
1422 $o_vendor->setValue(
$_SESSION[
'pay_statistics'][
'vendor']);
1423 $o_vendor->setPostVar(
'vendor');
1424 $o_hide_check->addSubItem($o_vendor);
1426 $o_from_check =
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_from'),
'from_check');
1427 $o_from_check->setValue(1);
1428 $o_from_check->setChecked(
$_SESSION[
'pay_statistics'][
'from_check'] ? 1 : 0);
1431 $o_date_from->setPostVar(
'from');
1433 if(
$_SESSION[
'pay_statistics'][
'from_check'] ==
'1')
1435 $o_date_from->setValueByArray(
$_SESSION[
'pay_statistics'][
'from']);
1436 $o_date_from->checkInput();
1439 $o_from_check->addSubItem($o_date_from);
1440 $o_hide_check->addSubItem($o_from_check);
1442 $o_until_check =
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_til'),
'until_check');
1443 $o_until_check->setValue(1);
1444 $o_until_check->setChecked(
$_SESSION[
'pay_statistics'][
'until_check'] ? 1 : 0);
1447 $o_date_until->setPostVar(
'til');
1449 if(
$_SESSION[
'pay_statistics'][
'until_check'] ==
'1')
1451 $o_date_until->setValueByArray(
$_SESSION[
'pay_statistics'][
'til']);
1452 $o_date_until->checkInput();
1455 $o_until_check->addSubItem($o_date_until);
1456 $o_hide_check->addSubItem($o_until_check);
1460 $title_options[
'all']=$this->lng->txt(
'pay_all');
1461 $unique_titles = $this->booking_obj->getUniqueTitles();
1463 if(is_array($unique_titles) && count($unique_titles))
1465 foreach($unique_titles as
$ref_id)
1467 $title_options[
$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
1472 $o_object_title->setTitle($this->lng->txt(
'title'));
1473 $o_object_title->setOptions($title_options);
1474 $o_object_title->setValue(
$_SESSION[
"pay_statistics"][
"adm_filter_title_id"]);
1475 $o_object_title->setPostVar(
'adm_filter_title_id');
1476 $o_hide_check->addSubItem($o_object_title);
1479 $payed_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
1481 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
1482 $o_payed->setOptions($payed_option);
1483 $o_payed->setValue(
$_SESSION[
'pay_statistics'][
'payed']);
1484 $o_payed->setPostVar(
'payed');
1486 $o_hide_check->addSubItem($o_payed);
1489 $access_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
1491 $o_access->setTitle($this->lng->txt(
'paya_access'));
1492 $o_access->setOptions($access_option);
1493 $o_access->setValue(
$_SESSION[
'pay_statistics'][
'access']);
1494 $o_access->setPostVar(
'access');
1495 $o_hide_check->addSubItem($o_access);
1498 $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
1499 $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions(
'all'));
1500 $o_paymethod->setValue(
$_SESSION[
'pay_statistics'][
'pay_method']);
1501 $o_paymethod->setPostVar(
'pay_method');
1502 $o_hide_check->addSubItem($o_paymethod);
1504 $filter_form->addCommandButton(
'statistic', $this->lng->txt(
'pay_update_view'));
1505 $filter_form->addCommandButton(
'resetFilter', $this->lng->txt(
'pay_reset_filter'));
1507 $filter_form->addItem($o_hide_check);
1509 $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
1515 if(!count($bookings = $this->booking_obj->getBookings()))
1523 # $this->__showButton('exportVendors',$this->lng->txt('excel_export'));
1525 $img_change =
"<img src=\"".ilUtil::getImagePath(
"edit.gif").
"\" alt=\"".
1526 $this->lng->txt(
"edit").
"\" title=\"".$this->lng->txt(
"edit").
1527 "\" border=\"0\" vspace=\"0\"/>";
1529 include_once
'Services/User/classes/class.ilObjUser.php';
1530 $object_title_cache = array();
1531 $user_title_cache = array();
1534 foreach($bookings as $booking)
1536 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
1538 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
1543 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
1547 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
1549 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
1554 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
1556 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
1558 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
1562 if(ANONYMOUS_USER_ID == $booking[
'customer_id'])
1565 $purchaser_name = $booking[
'name_extern'];
1566 $tmp_purchaser_email = $booking[
'email_extern'];
1572 $purchaser_name = $tmp_purchaser_name[
'firstname'].
' '.$tmp_purchaser_name[
'lastname'];
1575 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
1578 $transaction = $booking[
'transaction_extern'];
1580 $transaction .= $booking[
'transaction'].
"<br> (" . $str_paymethod .
")";
1582 $f_result[$counter][
'transaction'] = $transaction;
1583 $f_result[$counter][
'object_title'] = ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
1584 $f_result[$counter][
'vendor'] = ($tmp_vendor !=
'' ?
'['.$tmp_vendor.
']' : $this->lng->txt(
'user_deleted'));
1585 $f_result[$counter][
'customer'] = ($tmp_purchaser !=
'' ?
1586 $purchaser_name.
' ['.$tmp_purchaser.
']<br>'
1587 .$tmp_purchaser_email
1588 : $this->lng->txt(
'user_deleted'));
1591 if($booking[
'duration'] != 0)
1593 $f_result[$counter][
'duration'] = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
1597 $f_result[$counter][
'duration'] = $this->lng->txt(
"unlimited_duration");
1600 $f_result[$counter][
'price'] = $booking[
'price'].
' '.$booking[
'currency_unit'];
1601 $f_result[$counter][
'discount'] = ($booking[
'discount'] !=
'' ? ($booking[
'discount'].
' '.$booking[
'currency_unit']) :
' ');
1603 $payed_access = $booking[
'payed'] ?
1604 $this->lng->txt(
'yes') :
1605 $this->lng->txt(
'no');
1607 $payed_access .=
'/';
1608 $payed_access .= $booking[
'access_granted'] ?
1609 $this->lng->txt(
'yes') :
1610 $this->lng->txt(
'no');
1612 $f_result[$counter][
'payed_access'] = $payed_access;
1614 $this->ctrl->setParameter($this,
"booking_id",$booking[
'booking_id']);
1615 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editStatistic").
"\">".$this->lng->txt(
"edit").
"</a></div>";
1617 $f_result[$counter][
'edit'] = $link_change;
1621 unset($tmp_purchaser);
1632 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
1634 if(!isset(
$_GET[
'booking_id']))
1637 $this->showStatistics();
1642 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'statistic'));
1644 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
1645 $this->ctrl->setParameter($this,
'booking_id',(
int)
$_GET[
'booking_id']);
1648 if($a_show_confirm_delete)
1653 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDelete"));
1654 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_stat"));
1655 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"statistic");
1656 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDelete");
1658 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
1664 $bookings = $this->booking_obj->getBookings();
1665 $booking = $bookings[(int) $_GET[
'booking_id']];
1671 $oForm->setFormAction($this->ctrl->getFormAction($this));
1672 $oForm->setId(
'stat_form');
1673 $oForm->setTableWidth(
'50 %');
1675 if(is_object($tmp_user))
1677 $frm_user = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
1681 $frm_user = $this->lng->txt(
'user_deleted');
1683 $oForm->setTitle($frm_user);
1690 $oTitleGUI->
setValue($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
1691 $oForm->addItem($oTitleGUI);
1695 $oTransactionGUI->
setValue($booking[
'transaction']);
1696 $oForm->addItem($oTransactionGUI);
1701 if(is_object($tmp_vendor))
1703 $frm_vendor = $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']';
1707 $frm_vendor = $this->lng->txt(
'user_deleted');
1709 $oVendorGUI->
setValue($frm_vendor);
1710 $oForm->addItem($oVendorGUI);
1715 $oForm->addItem($oPaymethodGUI);
1720 $oForm->addItem($oOrderdateGUI);
1724 if($booking[
'duration'] != 0)
1726 $frm_duration = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
1730 $frm_duration = $this->lng->txt(
"unlimited_duration");
1732 $oDurationGUI->
setValue($frm_duration);
1733 $oForm->addItem($oDurationGUI);
1737 $oPriceGUI->
setValue($booking[
'price'].
' '.$booking[
'currency_unit']);
1738 $oForm->addItem($oPriceGUI);
1742 $payed_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
1744 $oPayedGUI->setTitle($this->lng->txt(
'paya_payed'));
1745 $oPayedGUI->setOptions($payed_option);
1746 $oPayedGUI->setValue($booking[
'payed']);
1747 $oPayedGUI->setPostVar(
'payed');
1748 $oForm->addItem($oPayedGUI);
1752 $access_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
1754 $oAccessGUI->setTitle($this->lng->txt(
'paya_access'));
1755 $oAccessGUI->setOptions($payed_option);
1756 $oAccessGUI->setValue($booking[
'access_granted']);
1757 $oAccessGUI->setPostVar(
'access');
1758 $oForm->addItem($oAccessGUI);
1760 $oForm->addCommandButton(
'updateStatistic',$this->lng->txt(
'save'));
1761 $oForm->addCommandButton(
'deleteStatistic',$this->lng->txt(
'delete'));
1767 $oForm2->setId(
'cust_form');
1768 $oForm2->setTableWidth(
'50 %');
1769 $oForm2->setTitle($frm_user);
1773 $email = (!$tmp_user) ? $this->lng->txt(
'user_deleted') : $tmp_user->getEmail();
1775 $oForm2->addItem($oEmailGUI);
1779 $oStreetGUI->
setValue($booking[
'street']);
1780 $oForm2->addItem($oStreetGUI);
1784 $oPoBoxGUI->
setValue($booking[
'po_box']);
1785 $oForm2->addItem($oPoBoxGUI);
1789 $oPoBoxGUI->
setValue($booking[
'zipcode']);
1790 $oForm2->addItem($oPoBoxGUI);
1794 $oCityGUI->
setValue($booking[
'city']);
1795 $oForm2->addItem($oCityGUI);
1799 $oCountryGUI->
setValue($booking[
'country']);
1800 $oForm2->addItem($oCountryGUI);
1803 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
1804 $this->tpl->setVariable(
'FORM_2',$oForm2->getHTML());
1810 if(!isset(
$_GET[
'booking_id']))
1819 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
1820 $this->booking_obj->setAccess((
int)
$_POST[
'access']);
1821 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
1823 if($this->booking_obj->update())
1841 if(!isset(
$_GET[
'booking_id']))
1856 if(!isset(
$_GET[
'booking_id']))
1865 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
1866 if(!$this->booking_obj->delete())
1868 die(
'Error deleting booking');
1886 $tabs_gui->clearTargets();
1887 if ($rbacsystem->checkAccess(
'visible,read',$this->object->getRefId()))
1890 $tabs_gui->addTarget(
'settings',$this->ctrl->getLinkTarget($this,
'generalSettings'),
1891 array(
'saveGeneralSettings',
'generalSettings ',
'saveBmfSettings',
'savePaypalSettings',
'paypalSettings',
1892 'saveEPaySettings',
'epaySettings',
'saveERPsettings',
'delERPpreview',
'',
'testERPsettings',
'erpSettings',
'',
'view'),
'',
'');
1895 $tabs_gui->addTarget(
'bookings',
1896 $this->ctrl->getLinkTarget($this,
'statistic'),
1897 array(
'statistic',
'editStatistic',
'updateStatistic',
'deleteStatistic',
'performDelete',
1898 'resetFilter',
'exportVendors',
'addCustomer',
'saveCustomer',
'showObjectSelector',
1899 'searchUserSP',
'performSearchSP'),
'',
'');
1901 $tabs_gui->addTarget(
'objects',
1902 $this->ctrl->getLinkTarget($this,
'objects'),
1903 array(
'updateObjectDetails',
'deleteObject',
'performObjectDelete',
'objects',
1904 'editPrices',
'addPrice',
'editDetails',
'resetObjectFilter'),
'',
'');
1906 $tabs_gui->addTarget(
'vendors',
1907 $this->ctrl->getLinkTarget($this,
'vendors'),
1908 array(
'vendors',
'searchUser',
'search',
'performSearch',
'addVendor',
'addUser',
'exportVendors',
'deleteVendors',
'performDeleteVendors',
1909 'cancelDeleteVendors',
'editVendor',
'performEditVendor'),
'',
'');
1911 #TODO: CURRENCY not finished yet
1919 $tabs_gui->addTarget(
'pay_methods',
1920 $this->ctrl->getLinkTarget($this,
'payMethods'), array(
'payMethods',
'savePayMethods'),
'',
'');
1923 $tabs_gui->addTarget(
'topics',
1924 $this->ctrl->getLinkTargetByClass(
'ilshoptopicsgui',
''),
'payment_topics',
'',
'');
1927 $tabs_gui->addTarget(
'vats',
1928 $this->ctrl->getLinkTarget($this,
'vats'),
'vats',
'',
'');
1931 if ($rbacsystem->checkAccess(
'edit_permission',$this->object->getRefId()))
1934 $tabs_gui->addTarget(
'perm_settings',
1935 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
'perm'), array(
'perm',
'info',
'owner'),
'ilpermissiongui');
1960 if ((
$_GET[
'cmd'] ==
'') || (
$_GET[
'cmd'] ==
'view') || ($a_sub_tab ==
'generalSettings'))
1961 $a_sub_tab =
'generalSettings';
1963 $this->tabs_gui->addSubTabTarget(
'pays_general',
1964 $this->ctrl->getLinkTargetByClass(
'ilobjpaymentsettingsgui',
'generalSettings'),
1965 '',
'',
'',$a_sub_tab ==
'generalSettings' ?
true :
false);
1967 $this->tabs_gui->addSubTabTarget(
'pays_bmf',
1968 $this->ctrl->getLinkTargetByClass(
'ilobjpaymentsettingsgui',
'bmfSettings'),
1969 '',
'',
'',$a_sub_tab ==
'bmfSettings' ?
true :
false);
1971 $this->tabs_gui->addSubTabTarget(
'pays_paypal',
1972 $this->ctrl->getLinkTargetByClass(
'ilobjpaymentsettingsgui',
'paypalSettings'),
1973 '',
'',
'',$a_sub_tab ==
'paypalSettings' ?
true :
false);
1975 $this->tabs_gui->addSubTabTarget(
'pays_epay',
1976 $this->ctrl->getLinkTargetByClass(
'ilobjpaymentsettingsgui',
'epaySettings'),
1977 '',
'',
'',$a_sub_tab ==
'epaySettings' ?
true :
false);
1979 $this->tabs_gui->addSubTabTarget(
'pays_erp',
1980 $this->ctrl->getLinkTargetByClass(
'ilobjpaymentsettingsgui',
'erpSettings'),
1981 '',
'',
'',$a_sub_tab ==
'erpSettings' ?
true :
false);
1991 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
1993 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
1996 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
1998 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
2004 $form->setFormAction($this->ctrl->getFormAction($this,
'saveGeneralSettings'));
2005 $form->setTitle($this->lng->txt(
'pays_general_settings'));
2007 $form->addCommandButton(
'saveGeneralSettings',$this->lng->txt(
'save'));
2010 $formItem =
new ilCheckboxInputGUI($this->lng->txt(
'pay_enable_shop'),
'shop_enabled');
2012 $formItem->setInfo($this->lng->txt(
'pay_enable_shop_info'));
2013 $form->addItem($formItem);
2015 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_currency_unit'),
'currency_unit');
2017 $formItem->setValue($this->error !=
'' && isset(
$_POST[
'currency_unit'])
2020 $formItem->setRequired(
true);
2021 $form->addItem($formItem);
2025 $formItem->setCols(35);
2026 $formItem->setRequired(
true);
2027 $formItem->setValue($this->error !=
'' && isset(
$_POST[
'address'])
2030 $form->addItem($formItem);
2034 $formItem->setCols(35);
2035 $formItem->setRequired(
true);
2036 $formItem->setValue($this->error !=
'' && isset(
$_POST[
'bank_data'])
2039 $form->addItem($formItem);
2043 $formItem->setCols(35);
2044 $formItem->setValue($this->error !=
'' && isset(
$_POST[
'add_info'])
2047 $form->addItem($formItem);
2049 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_pdf_path'),
'pdf_path');
2050 $formItem->
setValue($this->error !=
"" && isset(
$_POST[
'pdf_path'])
2053 $formItem->setRequired(
true);
2054 $form->addItem($formItem);
2057 $formItem =
new ilSelectInputGUI($this->lng->txt(
'pay_topics_default_sorting_type'),
'topics_sorting_type');
2058 $formItem->
setValue($genSetData[
'topics_sorting_type']);
2060 1 => $this->lng->txt(
'pay_topics_sort_by_title'),
2061 2 => $this->lng->txt(
'pay_topics_sort_by_date'),
2062 3 => $this->lng->txt(
'pay_topics_sort_manually')
2064 $formItem->setOptions($options);
2065 $form->addItem($formItem);
2068 $formItem =
new ilSelectInputGUI($this->lng->txt(
'pay_topics_default_sorting_direction'),
'topics_sorting_direction');
2069 $formItem->
setValue($genSetData[
'topics_sorting_direction']);
2071 'asc' => $this->lng->txt(
'sort_asc'),
2072 'desc' => $this->lng->txt(
'sort_desc'),
2074 $formItem->setOptions($options);
2075 $form->addItem($formItem);
2078 $formItem =
new ilCheckboxInputGUI($this->lng->txt(
'pay_topics_allow_custom_sorting'),
'topics_allow_custom_sorting');
2079 $formItem->
setChecked((
int)$genSetData[
'topics_allow_custom_sorting']);
2080 $formItem->setInfo($this->lng->txt(
'pay_topics_allow_custom_sorting_info'));
2081 $form->addItem($formItem);
2084 $formItem =
new ilCheckboxInputGUI($this->lng->txt(
'pay_hide_filtering'),
'objects_allow_custom_sorting');
2085 $formItem->
setChecked((
int)$genSetData[
'objects_allow_custom_sorting']);
2086 $formItem->setInfo($this->lng->txt(
'pay_hide_filtering_info'));
2087 $form->addItem($formItem);
2090 $formItem =
new ilSelectInputGUI($this->lng->txt(
'pay_max_hits'),
'max_hits');
2091 $formItem->
setValue($genSetData[
'max_hits']);
2093 for($i = 10; $i <= 100; $i += 10)
2097 $formItem->setOptions($options);
2098 $formItem->setInfo($this->lng->txt(
'pay_max_hits_info'));
2099 $form->addItem($formItem);
2102 $formItem =
new ilCheckboxInputGUI($this->lng->txt(
'pay_hide_advanced_search'),
'hide_advanced_search');
2103 $formItem->
setChecked((
int)$genSetData[
'hide_advanced_search']);
2104 $formItem->setInfo($this->lng->txt(
'pay_hide_advanced_search_info'));
2105 $form->addItem($formItem);
2109 $formItem->
setChecked((
int)$genSetData[
'hide_news']);
2110 $formItem->setInfo($this->lng->txt(
'pay_hide_news_info'));
2111 $form->addItem($formItem);
2114 $formItem =
new ilCheckboxInputGUI($this->lng->txt(
'pay_hide_coupons'),
'hide_coupons');
2115 $formItem->
setChecked((
int)$genSetData[
'hide_coupons']);
2116 $formItem->setInfo($this->lng->txt(
'pay_hide_coupons'));
2117 $form->addItem($formItem);
2119 $this->tpl->setVariable(
'FORM',$form->getHTML());
2127 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2129 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2132 include_once
'./Services/Payment/classes/class.ilGeneralSettings.php';
2136 if (
$_POST[
'currency_unit'] ==
'' ||
2137 $_POST[
'address'] ==
'' ||
2138 $_POST[
'bank_data'] ==
'' ||
2139 $_POST[
'pdf_path'] ==
'')
2141 $this->error = $this->lng->txt(
'pays_general_settings_not_valid');
2147 $genSet->clearAll();
2155 'topics_allow_custom_sorting',
2156 'topics_sorting_type',
2157 'topics_sorting_direction',
2160 'hide_advanced_search',
2162 'objects_allow_custom_sorting',
2169 $genSet->setAll($values);
2183 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2185 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2188 include_once
'./Services/Payment/classes/class.ilEPaySettings.php';
2190 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pays_epay_settings.html',
'Services/Payment');
2194 $ep = $ePayObj->getAll();
2197 $form->setFormAction($this->ctrl->getFormAction($this,
'saveEPaySettings'));
2198 $form->setTitle($this->lng->txt(
'pays_epay_settings'));
2200 $form->addCommandButton(
'saveEPaySettings',$this->lng->txt(
'save'));
2203 array(
'pays_epay_server_host',
'server_host',
true, null),
2204 array(
'pays_epay_server_path',
'server_path',
true, null),
2205 array(
'pays_epay_merchant_number',
'merchant_number',
true, null),
2206 array(
'pays_epay_auth_token',
'auth_token',
true,
'pays_epay_auth_token_info'),
2207 array(
'pays_epay_auth_email',
'auth_email',
true,
'pays_epay_auth_email_info')
2210 foreach ($fields as
$f)
2214 $fi->setRequired($f[2]);
2215 if ($f[3] != null ) $fi->setInfo($this->lng->txt($f[3]));
2216 if ($f[1] ==
'auth_token') $fi->setInputType(
'password');
2217 $form->addItem($fi);
2220 $formItem =
new ilCheckboxInputGUI($this->lng->txt(
'pays_epay_instant_capture'),
'instant_capture');
2221 $formItem->
setChecked($ep[
'instant_capture'] == 1);
2222 $formItem->setInfo($this->lng->txt(
'pays_epay_instant_capture_info'));
2223 $form->addItem($formItem);
2225 $this->tpl->setVariable(
'EPAY_INFO', $this->lng->txt(
'pays_epay_info'));
2226 $this->tpl->setVariable(
'EPAY_SETTINGS',$form->getHTML());
2231 include_once
'./Services/Payment/classes/class.ilEPaySettings.php';
2233 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2235 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2242 $arr[
'instant_capture'] = isset(
$_POST[
'instant_capture']) ? 1 : 0;
2244 $epSet->setAll($arr);
2246 if (!$epSet->valid())
2248 $this->error = $this->lng->txt(
'pays_epay_settings_not_valid');
2268 $erp->loadSettings($erps_id);
2269 $set = $erp->getSettings(0);
2272 array(
"pays_eco_agreement",
"agreement", 10),
2273 array(
"username",
"username", 16),
2274 array(
"password",
"password", 16),
2275 array(
"pays_eco_product_number",
"product", 6),
2276 array(
"pays_eco_payment_terms",
"terms", 6),
2277 array(
"pays_eco_layout",
"layout", 6),
2278 array(
"pays_eco_cur_handle_code",
"code", 3)
2281 foreach ($fields as
$f)
2285 $txt->setValue($set[$f[1]]);
2286 if ($f[0] ==
'password') $txt->setInputType(
'password');
2287 $op->addSubItem($txt);
2304 require_once
'./Services/Payment/classes/class.ilERP_eco.php';
2314 $frm->setFormAction($this->ctrl->getFormAction($this,
'saveEEPsettings'));
2315 $frm->setTitle($this->lng->txt(
'pays_erp_settings'));
2319 $preview_link =
"<br/><a href='".
ilERP::getPreviewUrl() .
"' target='_blank'>" . $this->lng->txt(
'pays_erp_invoice_preview') .
"</a>";
2320 $frm->addCommandButton(
'delERPpreview', $this->lng->txt(
'pays_erp_invoice_delpreview') );
2323 $frm->addCommandButton(
'saveERPsettings',$this->lng->txt(
'save'));
2324 $frm->addCommandButton(
'testERPsettings',$this->lng->txt(
'test'));
2326 $savepdf =
new ilCheckboxInputGUI($this->lng->txt(
'pays_erp_invoice_copies'),
'save_copy');
2333 $rdo->
setInfo(
"The ERP is currently in development");
2335 $rdo->setValue($active[
'erp_id']);
2337 foreach ($systems as $system)
2339 $desc = $system[
'description'];
2340 $desc .= empty($system[
'url']) ?
'' :
' <a href="'.$system[
'url'].
'" target="_blank">' . $this->lng->txt(
"additional_info") .
"</a>";
2344 $function =
"getERPform_" . $system[
'erp_short'];
2345 $this->$function(&$op, $active[
'erps_id']);
2347 $rdo->addOption($op);
2349 $frm->addItem($rdo);
2351 $savepdf->setChecked( $active[
'save_copy'] );
2354 $save_msg = $this->lng->txt(
'pays_erp_invoice_copies_info') .
' ' .ilERP::getSaveDirectory();
2356 if (!is_writable(
ilERP::getSaveDirectory() )) $save_msg .=
"<br/><b>" . $this->lng->txt(
'pays_erp_invoice_nowrite') .
"</b>";
2357 $save_msg .= $preview_link;
2358 $savepdf->setInfo($save_msg);
2359 $frm->addItem($savepdf);
2361 $chk->
setInfo($this->lng->txt(
'enable_ean_info'));
2362 $frm->addItem($chk);
2374 require_once
'./Services/Payment/classes/class.ilERP.php';
2379 require_once
'./Services/Payment/classes/class.ilERP_none.php';
2383 require_once
'./Services/Payment/classes/class.ilERP_eco.php';
2397 $a[
'use_ean'] = (isset(
$_POST[
'use_ean'])) ? 1 : 0;
2398 $a[
'save_copy'] = (isset(
$_POST[
'save_copy'])) ? 1 : 0;
2405 require_once
'./Services/Payment/classes/class.ilERP.php';
2417 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2419 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'),$this->ilias->error_obj->MESSAGE);
2426 assert ($active[
'erp_id'] == (
int)
$_POST[
'erp_id']);
2428 $cls =
"ilERPDebtor_" . $active[
'erp_short'] ;
2429 require_once
'./Services/Payment/classes/class.' . $cls .
".php";
2435 $nr = rand(1030,1040);
2436 if ($deb->getDebtorByNumber($nr))
2438 $good .= $this->lng->txt(
'pays_erp_tst_existing');
2442 $deb->setTestValues();
2443 $deb->createDebtor($nr);
2445 $good = $this->lng->txt(
'pays_erp_tst_new');
2448 $good .=
" " . $nr .
", " . $deb->getName() .
" ";
2450 $amount = rand(10,1000);
2452 $good .= $this->lng->txt(
'pays_erp_tst_billed') .
" " . $pcs .
" x " . $amount .
2453 "<br/>" . $this->lng->txt(
'total') .
" " . number_format( $pcs*$amount, 2,
',',
'.');
2455 $deb->createInvoice();
2456 $deb->createInvoiceLine( 0, $this->lng->txt(
'pays_erp_tst_product'), $pcs, $amount);
2457 $deb->createInvoiceLine( 0,
"www.ilias.dk", 1, 1);
2458 $v = $deb->bookInvoice();
2459 $good .=
", # " . $deb->getInvoiceNumber();
2461 $attach = $deb->getInvoicePDF($v);
2463 $deb->saveInvoice($attach,
true);
2464 $deb->sendInvoice($this->lng->txt(
'pay_order_paid_subject'), $deb->getName() .
",\n" . $this->lng->txt(
'pays_erp_invoice_attached'), $ilUser->getEmail(), $attach,
"faktura");
2466 $good .=
"<br/>" . $ilUser->getEmail() .
" => " . $this->lng->txt(
'mail_sent');
2487 if (!$instance->looksValid()) $message = str_replace(
'%s', $instance->getName, $this->lng->txt(
'pays_erp_bad_settings'));
2492 $instance->connect();
2493 ilUtil::sendInfo(str_replace(
'%s', $instance->getName(), $this->lng->txt(
"pays_erp_connection_established")));
2508 if(!$rbacsystem->checkAccess(
'write', $this->object->getRefId()))
2510 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'),$this->ilias->error_obj->MESSAGE);
2514 $system = (int)
$_POST[
'erp_id'];
2516 $instance->setSettings($settings);
2527 $instance->setActive($system);
2528 $instance->saveSettings($settings);
2529 ilUtil::sendSuccess(str_replace(
'%s', $instance->getName(), $this->lng->txt(
'pays_erp_updated_settings')));
2543 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2545 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2547 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.pays_erp_settings.html',
'Services/Payment');
2551 $this->tpl->setVariable(
'ERP_INFO', $this->lng->txt(
'pays_erp_info'));
2552 $this->tpl->setVariable(
'ERP_SETTINGS',$form->getHTML());
2560 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2562 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2565 include_once
'./Services/Payment/classes/class.ilPaypalSettings.php';
2567 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
2572 $form->setFormAction($this->ctrl->getFormAction($this,
'savePaypalSettings'));
2573 $form->setTitle($this->lng->txt(
'pays_paypal_settings'));
2575 $form->addCommandButton(
'savePaypalSettings',$this->lng->txt(
'save'));
2577 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_server_host'),
'server_host');
2578 $formItem->
setValue($ppSet->getServerHost());
2579 $form->addItem($formItem);
2581 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_server_path'),
'server_path');
2582 $formItem->
setValue($ppSet->getServerPath());
2583 $form->addItem($formItem);
2585 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_email_vendor'),
'vendor');
2586 $formItem->
setValue($ppSet->getVendor());
2587 $form->addItem($formItem);
2589 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_auth_token'),
'auth_token');
2590 $formItem->
setValue($ppSet->getAuthToken());
2591 $form->addItem($formItem);
2593 $formItem =
new ilTextInputGUI($this->lng->txt(
'pays_page_style'),
'page_style');
2594 $formItem->
setValue($ppSet->getPageStyle());
2595 $form->addItem($formItem);
2597 $this->tpl->setVariable(
'FORM',$form->getHTML());
2602 include_once
'./Services/Payment/classes/class.ilPaypalSettings.php';
2607 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2609 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2621 if (
$_POST[
'server_host'] ==
'' ||
2622 $_POST[
'server_path'] ==
'' ||
2623 $_POST[
'vendor'] ==
'' ||
2624 $_POST[
'auth_token'] ==
'')
2626 $this->error = $this->lng->txt(
'pays_paypal_settings_not_valid');
2645 #include_once './Services/Table/classes/class.ilTable2GUI.php';
2647 global $rbacsystem, $ilToolbar;
2650 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2652 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2657 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
2659 include_once(
"./Services/Form/classes/class.ilUserLoginAutoCompleteInputGUI.php");
2662 $ilToolbar->addInputItem($ul,
true);
2663 $ilToolbar->addFormButton($this->lng->txt(
"add"),
"search");
2664 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
2666 $this->
object->initPaymentVendorsObject();
2667 if(!count($vendors = $this->object->payment_vendors_obj->getVendors()))
2677 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDeleteVendors"));
2678 $oConfirmationGUI->setHeaderText($this->lng->txt(
"pays_sure_delete_selected_vendors"));
2679 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"vendors");
2680 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDeleteVendors");
2684 if(in_array($vendor[
'vendor_id'],
$_SESSION[
'pays_vendor']))
2690 $delete_row = $tmp_obj->getLogin().
' '.
2691 $vendor[
'cost_center'].
' '.
2693 $oConfirmationGUI->addItem(
'',$delete_row, $delete_row);
2698 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML()); #
2703 $f_result = array();
2710 $_SESSION[
'pays_vendor']) ? 1 : 0,
"vendor[]", $vendor[
'vendor_id']);
2711 $f_result[$counter][
'login'] = $tmp_obj->getLogin();
2712 $f_result[$counter][
'cost_center'] = $vendor[
'cost_center'];
2726 include_once
'./Services/Payment/classes/class.ilPaymentExcelWriterAdapter.php';
2736 $workbook = $pewa->getWorkbook();
2737 @$workbook->close();
2742 include_once
'./Services/Excel/classes/class.ilExcelUtils.php';
2743 include_once
'./Services/Payment/classes/class.ilPaymentVendors.php';
2747 $workbook = $pewa->getWorkbook();
2748 $worksheet = $workbook->addWorksheet(utf8_decode($this->lng->txt(
'bookings')));
2750 $worksheet->mergeCells(0,0,0,3);
2751 $worksheet->setColumn(0,0,16);
2752 $worksheet->setColumn(0,1,32);
2753 $worksheet->setColumn(0,2,32);
2754 $worksheet->setColumn(0,3,16);
2755 $worksheet->setColumn(0,4,16);
2756 $worksheet->setColumn(0,5,16);
2757 $worksheet->setColumn(0,6,24);
2758 $worksheet->setColumn(0,7,8);
2759 $worksheet->setColumn(0,8,12);
2760 $worksheet->setColumn(0,9,16);
2762 $title = $this->lng->txt(
'bookings');
2763 $title .=
' '.$this->lng->txt(
'as_of').
' ';
2764 $title .= strftime(
'%Y-%m-%d %R',time());
2766 $worksheet->writeString(0,0,
$title,$pewa->getFormatTitle());
2786 if(!count($bookings = $this->booking_obj->getBookings()))
2791 include_once
'Services/User/classes/class.ilObjUser.php';
2792 $object_title_cache = array();
2793 $user_title_cache = array();
2796 foreach($bookings as $booking)
2798 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
2800 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
2805 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
2807 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
2809 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
2814 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
2816 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
2818 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
2825 $tmp_purchaser =
''.$tmp_purchaser_name[
'firstname'].
' '.$tmp_purchaser_name[
'lastname'].
' ['.$tmp_purchaser_login.
']';
2826 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
2829 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
2835 $worksheet->writeString($counter,3,
ilExcelUtils::_convert_text(($tmp_vendor !=
'' ? $tmp_vendor : $this->lng->txt(
'user_deleted'))));
2837 $worksheet->writeString($counter,5,
ilExcelUtils::_convert_text(($tmp_purchaser !=
'' ? $tmp_purchaser : $this->lng->txt(
'user_deleted'))));
2839 $worksheet->writeString($counter,7,strftime(
'%Y-%m-%d %R',$booking[
'order_date']));
2840 $worksheet->writeString($counter,8,$booking[
'duration']);
2843 $payed_access = $booking[
'payed'] ?
2844 $this->lng->txt(
'yes') :
2845 $this->lng->txt(
'no');
2847 $payed_access .=
'/';
2848 $payed_access .= $booking[
'access_granted'] ?
2849 $this->lng->txt(
'yes') :
2850 $this->lng->txt(
'no');
2852 $worksheet->writeString($counter,10,$payed_access);
2862 unset($tmp_purchaser);
2870 include_once
'./Services/Excel/classes/class.ilExcelUtils.php';
2872 $this->
object->initPaymentVendorsObject();
2874 $workbook = $pewa->getWorkbook();
2878 $worksheet->mergeCells(0,0,0,2);
2879 $worksheet->setColumn(1,0,32);
2880 $worksheet->setColumn(1,1,32);
2881 $worksheet->setColumn(1,2,32);
2883 $title = $this->lng->txt(
'bookings');
2884 $title .=
' '.$this->lng->txt(
'as_of').
' ';
2885 $title .= strftime(
'%Y-%m-%d %R',time());
2887 $worksheet->writeString(0,0,
$title,$pewa->getFormatTitle());
2893 if(!count($vendors = $this->object->payment_vendors_obj->getVendors()))
2915 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
2919 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
2922 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2924 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2927 if(count($askForDeletingAddresses))
2932 $oConfirmationGUI->setFormAction($ilCtrl->getFormAction($this,
"deleteAddressesForPaymethods"));
2933 $oConfirmationGUI->setHeaderText($this->lng->txt(
"info_delete_sure"));
2934 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"paymethods");
2935 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"deleteAddressesForPaymethods");
2937 foreach($askForDeletingAddresses as $pm_id)
2941 $oConfirmationGUI->addHiddenItem(
'pm_id[]',$pm_id);
2942 $oConfirmationGUI->additem(
'paymethod',$pm_obj->getPmId(), $this->lng->txt(
'delete_addresses_bill').
' -> '.
ilPayMethods::getStringByPaymethod($pm_obj->getPmTitle()));
2945 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHtml());
2950 $paymethods = $obj_paymethods->readAll();
2952 $result = array(); $counter = 0;
2953 foreach($paymethods as $paymethod)
2956 $result[$counter][
'pm_enabled'] =
ilUtil::formCheckbox($paymethod[
'pm_enabled'] ? 1 : 0,
'pm_enabled['.$paymethod[
'pm_id'].
']',1);
2957 $result[$counter][
'save_usr_adr'] =
ilUtil::formCheckbox($paymethod[
'save_usr_adr'] ? 1 : 0,
'save_usr_adr['.$paymethod[
'pm_id'].
']',1);
2958 $this->ctrl->clearParameters($this);
2964 $this->ctrl->setParameter($this,
'cmd',
'savePayMethods');
2966 $tbl->setTitle($this->lng->txt(
'pays_pay_methods'));
2968 $tbl->setId(
'tbl_paymethods');
2969 $tbl->setRowTemplate(
"tpl.shop_paymethods_row.html",
"Services/Payment");
2971 $tbl->addColumn($this->lng->txt(
'title'),
'pm_title',
'10%');
2972 $tbl->addColumn($this->lng->txt(
'enabled'),
'pm_enabled',
'10%');
2973 $tbl->addColumn($this->lng->txt(
'save_customer_address'),
'save_usr_adr',
'10%');
2974 $tbl->addCommandButton(
'savePayMethods', $this->lng->txt(
'save'));
2976 $tbl->disable(
'sort');
2977 $tbl->setData($result);
2979 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
2986 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
2991 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
2993 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
2998 $askForDeletingAddresses = array();
3000 for($i = 1; $i <= $count_pm; $i++)
3002 if(!array_key_exists($i,
$_POST[
'pm_enabled']) && ilPayMethods::_PmEnabled($i) == 1)
3014 if(!array_key_exists($i,
$_POST[
'pm_enabled']) && ilPayMethods::_PmEnabled($i) == 0)
3025 $askForDeletingAddresses[] = $i;
3038 $tmp = $this->
payMethodsObject($askForDeletingAddresses,$oConfirmationGUI);
3039 if(!$askForDeletingAddresses)
3057 if(!count(
$_POST[
'vendor']))
3085 include_once
'./Services/Payment/classes/class.ilPaymentTrustees.php';
3090 if(!$rbacsystem->checkAccess(
'write', $this->object->getRefId()))
3092 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'),$this->ilias->error_obj->MESSAGE);
3095 $this->
object->initPaymentVendorsObject();
3099 $this->
object->payment_vendors_obj->delete($vendor);
3116 if(!$rbacsystem->checkAccess(
"write", $this->object->getRefId()))
3118 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
3121 if(!count(
$_POST[
'vendor']))
3128 if(count(
$_POST[
'vendor']) > 1)
3138 $this->
object->initPaymentVendorsObject();
3140 if (!is_array($this->object->payment_vendors_obj->vendors[
$_SESSION[
'pays_vendor']]))
3147 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
3150 $form_gui->setFormAction($this->ctrl->getFormAction($this,
'performEditVendor'));
3151 $form_gui->setTitle($this->lng->txt(
'pays_vendor'));
3155 $form_gui->addItem($oVendorGUI);
3157 $oCostcenterGUI =
new ilTextInputGUI($this->lng->txt(
'pays_cost_center'),
'cost_center');
3158 $oCostcenterGUI->
setValue($this->error !=
'' && isset(
$_POST[
'cost_center'])
3161 $form_gui->addItem($oCostcenterGUI);
3163 $form_gui->addCommandButton(
'performEditVendor',$this->lng->txt(
'save'));
3164 $this->tpl->setVariable(
'FORM', $form_gui->getHTML());
3172 if(!$rbacsystem->checkAccess(
'write', $this->object->getRefId()))
3174 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'),$this->ilias->error_obj->MESSAGE);
3192 $this->
object->initPaymentVendorsObject();
3194 if (!is_array($this->object->payment_vendors_obj->vendors[
$_SESSION[
'pays_vendor']]))
3200 if (
$_POST[
'cost_center'] ==
'')
3202 $this->error = $this->lng->txt(
'pays_cost_center_not_valid');
3205 $this->editVendor();
3209 $this->
object->initPaymentVendorsObject();
3210 $this->
object->payment_vendors_obj->update(
$_SESSION[
'pays_vendor'],
$_POST[
'cost_center']);
3221 global $rbacsystem,
$tree, $ilToolbar;
3224 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
3226 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
3229 include_once
'./Services/Payment/classes/class.ilPaymentObjectSelector.php';
3231 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_object_selector.html',
'Services/Payment');
3233 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'statistic'));
3237 $exp =
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), strtolower(get_class($this)));
3238 $exp->
setExpand(
$_GET[
'paya_link_expand'] ?
$_GET[
'paya_link_expand'] : $tree->readRootId());
3239 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
3243 $this->tpl->setVariable(
'EXPLORER',$exp->getOutput());
3285 global $rbacsystem,
$tree, $ilToolbar;
3287 if(!$rbacsystem->checkAccess(
'read', $this->object->getRefId()))
3289 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
3294 if(!isset(
$_POST[
'search_str']))
3309 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
3310 # $ilToolbar->addButton($this->lng->txt('crs_new_search'), $this->ctrl->getLinkTarget($this, 'searchUser'));
3313 $f_result = array();
3314 foreach($result as $user)
3321 $f_result[$counter][
'login'] = $tmp_obj->getLogin();
3322 $f_result[$counter][
'lastname'] = $tmp_obj->getLastname();
3323 $f_result[$counter][
'firstname'] = $tmp_obj->getFirstname();
3338 if(!$rbacsystem->checkAccess(
'write', $this->object->getRefId()))
3340 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'),$this->ilias->error_obj->MESSAGE);
3342 if(!
$_POST[
'vendor_login'])
3357 $this->
object->initPaymentVendorsObject();
3359 if($this->object->payment_vendors_obj->isAssigned(
$usr_id))
3366 $this->
object->payment_vendors_obj->add(
$usr_id);
3379 if(!$rbacsystem->checkAccess(
'write', $this->object->getRefId()))
3381 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_write'),$this->ilias->error_obj->MESSAGE);
3384 $this->lng->loadLanguageModule(
'crs');
3385 if(!is_array(
$_POST[
'user']))
3393 $this->
object->initPaymentVendorsObject();
3395 $already_assigned = $assigned = 0;
3398 if($this->object->payment_vendors_obj->isAssigned($usr_id))
3400 ++$already_assigned;
3403 $this->
object->payment_vendors_obj->add($usr_id);
3411 $message .= $this->lng->txt(
'pays_assigned_vendors').
' '.$assigned;
3413 if($already_assigned)
3415 $message .=
'<br />'.$this->lng->txt(
'pays_already_assigned_vendors').
' '.$already_assigned;
3428 if(!isset(
$_GET[
'sell_id']))
3430 ilUtil::sendFailiure($this->lng->txt(
'paya_no_booking_id_given'));
3436 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
3437 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
3439 $this->lng->loadLanguageModule(
'search');
3440 $this->ctrl->setParameter($this,
'sell_id',
$_GET[
'sell_id']);
3443 $form_gui->setFormAction($this->ctrl->getFormAction($this));
3444 $form_gui->setTitle($this->lng->txt(
'search_user'));
3445 $form_gui->setId(
'search_form');
3447 $oTitle =
new ilTextInputGUI($this->lng->txt(
'search_search_term'),
'search_str');
3449 $oTitle->setSize(40);
3450 $oTitle->setValue(
$_POST[
'search_str']);
3451 $form_gui->addItem($oTitle);
3454 $form_gui->addCommandButton(
'performSearchSP', $this->lng->txt(
'search'));
3455 $form_gui->addCommandButton(
'bookings', $this->lng->txt(
'cancel'));
3457 $this->tpl->setVariable(
'FORM',$form_gui->getHTML());
3467 if(!trim(
$_POST[
'search_str']))
3470 $this->statistics();
3482 if(!isset(
$_GET[
'sell_id']))
3490 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
3491 $this->ctrl->setParameter($this,
'sell_id',
$_GET[
'sell_id']);
3493 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUserSP'));
3496 $f_result = array();
3497 foreach($result as $user)
3503 $f_result[$counter][
'user_id'] = $user[
'id'];
3504 $f_result[$counter][
'login'] = $tmp_obj->getLogin();
3505 $f_result[$counter][
'firstname'] = $tmp_obj->getFirstname();
3506 $f_result[$counter][
'lastname'] = $tmp_obj->getLastname();
3520 if(!isset(
$_GET[
'sell_id']))
3528 if(!isset(
$_POST[
'user_id']))
3535 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
3536 $this->ctrl->setParameter($this,
'sell_id',
$_GET[
'sell_id']);
3538 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'searchUserSP'));
3540 $this->ctrl->setParameter($this,
'user_id',
$_POST[
'user_id']);
3549 $tmp_object[
'title'] = $tmp_obj->getTitle();
3553 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
3561 $oForm->setFormAction($this->ctrl->getFormAction($this,
'saveCustomer'));
3562 $oForm->setTitle($this->lng->txt($tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']'));
3566 $oTransaction->setTitle($this->lng->txt(
'paya_transaction'));
3568 $oTransaction->setValue(
$_POST[
'transaction']);
3569 $oTransaction->setPostVar(
'transaction');
3570 $oForm->addItem($oTransaction);
3574 $oObject->
setValue($tmp_object[
'title']);
3575 $oForm->addItem($oObject);
3579 $oVendor->
setValue($tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
3580 $oForm->addItem($oVendor);
3583 $oPayMethods =
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'),
'pay_method');
3584 $payOptions = ilPaymethods::getPayMethodsOptions(
false);
3585 $oPayMethods->setOptions($payOptions);
3586 $oPayMethods->setValue(
$_POST[
'pay_method']);
3587 $oPayMethods->setPostVar(
'pay_method');
3588 $oForm->addItem($oPayMethods);
3591 $duration_opions = array();
3593 $prices = $prices_obj->getPrices();
3595 if (is_array($prices = $prices_obj->getPrices()))
3597 foreach($prices as $price)
3599 $duration_options[$price[
'price_id']] =
3600 #$price['duration'].' '.$this->lng->txt('paya_months').', '.ilPaymentPrices::_getPriceString($price['price_id']);
3605 $oDuration =
new ilSelectInputGUI($this->lng->txt(
'duration'),
'duration');
3607 $oDuration->setValue(
$_POST[
'duration']);
3608 $oForm->addItem($oDuration);
3612 $payed_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
3614 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
3615 $o_payed->setOptions($payed_option);
3616 $o_payed->setValue(
$_POST[
'payed']);
3617 $o_payed->setPostVar(
'payed');
3618 $oForm->addItem($o_payed);
3622 $access_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
3624 $o_access->setTitle($this->lng->txt(
'paya_access'));
3625 $o_access->setOptions($access_option);
3626 $o_access->setValue(
$_POST[
'access']);
3627 $o_access->setPostVar(
'access');
3629 $oForm->addItem($o_access);
3631 $oForm->addCommandButton(
'saveCustomer',$this->lng->txt(
'save'));
3632 $oForm->addCommandButton(
'bookings', $this->lng->txt(
'cancel'));
3634 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
3640 global
$ilias, $ilUser,$ilObjDataCache;
3642 if(!isset(
$_GET[
'sell_id']))
3650 if(!isset(
$_GET[
'user_id']))
3658 if (
$_POST[
'pay_method'] ==
'' ||
3659 $_POST[
'duration'] ==
'')
3672 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$this->user_obj->getId().
'_'.substr((
string) time(),-3);
3673 $transaction = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
3674 $this->booking_obj->setTransaction($transaction);
3675 $this->booking_obj->setTransactionExtern(
$_POST[
'transaction']);
3676 $this->booking_obj->setPobjectId($pObjectId);
3677 $this->booking_obj->setCustomerId(
$_GET[
'user_id']);
3678 $this->booking_obj->setVendorId($obj->getVendorId());
3680 $this->booking_obj->setPayMethod(
$_POST[
'pay_method']);
3681 $this->booking_obj->setOrderDate(time());
3685 $this->booking_obj->setDuration($price[
'duration']);
3686 $this->booking_obj->setPrice($price[
'price']);
3687 $this->booking_obj->setAccess((
int)
$_POST[
'access']);
3688 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
3689 $this->booking_obj->setVoucher(
'');
3691 $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
3692 $obj_type = $ilObjDataCache->lookupType(
$obj_id);
3693 $obj_title = $ilObjDataCache->lookupTitle(
$obj_id);
3696 $oVAT =
new ilShopVats((
int)$obj->getVatId());
3697 $obj_vat_rate = $oVAT->
getRate();
3698 $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
3700 $this->booking_obj->setObjectTitle($obj_title);
3701 $this->booking_obj->setVatRate($obj_vat_rate);
3702 $this->booking_obj->setVatUnit($obj_vat_unit);
3704 $currency_id = $price[
'currency'];
3706 $this->booking_obj->setCurrencyUnit($currency_unit);
3707 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
3710 if($save_user_address_enabled == 1)
3713 $user_id[] =
$_GET[
"user_id"];
3717 $this->booking_obj->setStreet($cust_obj[
$_GET[
"user_id"]][
'street'],
'');
3719 $this->booking_obj->setZipcode($cust_obj[$_GET[
"user_id"]][
'zipcode']);
3720 $this->booking_obj->setCity($cust_obj[$_GET[
"user_id"]][
'city']);
3721 $this->booking_obj->setCountry($cust_obj[$_GET[
"user_id"]][
'country']);
3724 if($this->booking_obj->add())
3740 $this->ctrl->setParameter($this,
'cmd',
'statistic');
3743 $tbl->setTitle($this->lng->txt(
"bookings"));
3744 $tbl->setId(
'tbl_show_statistics');
3745 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html",
"Services/Payment");
3747 $tbl->addColumn($this->lng->txt(
'paya_transaction'),
'transaction',
'10%');
3748 $tbl->addColumn($this->lng->txt(
'title'),
'object_title',
'10%');
3749 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
3750 $tbl->addColumn($this->lng->txt(
'paya_customer'),
'customer',
'10%');
3751 $tbl->addColumn($this->lng->txt(
'paya_order_date'),
'order_date',
'10%');
3752 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
3753 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'5%');
3754 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'),
'discount',
'5%');
3755 $tbl->addColumn($this->lng->txt(
'paya_payed_access'),
'payed_access',
'5%');
3756 $tbl->addColumn(
'',
'edit',
'5%');
3758 $tbl->addCommandButton(
'exportVendors',$this->lng->txt(
'excel_export'));
3759 $tbl->setData($a_result_set);
3761 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
3768 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
3775 $this->ctrl->setParameter($this,
'cmd',
'vendors');
3778 $tbl->setTitle($this->lng->txt(
"vendors"));
3779 $tbl->setId(
'tbl_show_vendors');
3780 $tbl->setRowTemplate(
"tpl.shop_users_row.html",
"Services/Payment");
3782 $tbl->addColumn(
'',
'vendor_id',
'1%');
3783 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'login',
'10%');
3784 $tbl->addColumn($this->lng->txt(
'pays_cost_center'),
'cost_center',
'10%');
3785 $tbl->addColumn($this->lng->txt(
'pays_number_bookings'),
'number_bookings',
'10%');
3787 $tbl->addMultiCommand(
"editVendor", $this->lng->txt(
'pays_edit_vendor'));
3788 $tbl->addMultiCommand(
"deleteVendors", $this->lng->txt(
'pays_delete_vendor'));
3790 $tbl->addCommandButton(
'exportVendors',$this->lng->txt(
'excel_export'));
3792 $tbl->setData($a_result_set);
3793 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
3802 $tbl->setTitle($this->lng->txt(
"pays_header_select_vendor"));
3803 $tbl->setId(
'tbl_search_user_vendor');
3804 $tbl->setRowTemplate(
"tpl.shop_users_row.html",
"Services/Payment");
3806 $tbl->addColumn(
' ',
'vendor_id',
'3%',
true);
3807 $tbl->addColumn($this->lng->txt(
'login'),
'login',
'32%');
3808 $tbl->addColumn($this->lng->txt(
'firstname'),
'firstname',
'32%');
3809 $tbl->addColumn($this->lng->txt(
'lastname'),
'lastname',
'32%');
3811 $tbl->setSelectAllCheckbox(
'vendor_id');
3812 $tbl->addMultiCommand(
"addUser", $this->lng->txt(
"add"));
3813 $tbl->addCommandButton(
'vendors',$this->lng->txt(
'cancel'));
3816 $tbl->setData($a_result_set);
3817 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
3824 include_once(
'./classes/class.ilSearch.php');
3826 $this->lng->loadLanguageModule(
'content');
3829 $search->setPerformUpdate(
false);
3831 $search->setCombination(
'and');
3832 $search->setSearchFor(array(0 =>
'usr'));
3833 $search->setSearchType(
'new');
3835 if($search->validate($message))
3837 $search->performSearch();
3842 $this->ctrl->redirect($this,
'searchUser');
3844 return $search->getResultByType(
'usr');
3849 include_once(
'./classes/class.ilSearch.php');
3851 $this->lng->loadLanguageModule(
'content');
3853 $search =
new ilSearch($this->user_obj->getId());
3856 $search->setCombination(
'and');
3857 $search->setSearchFor(array(0 =>
'usr'));
3858 $search->setSearchType(
'new');
3860 if($search->validate($message))
3862 $search->performSearchSPObject();
3867 $this->ctrl->redirect($this,
'searchUserSP');
3869 return $search->getResultByType(
'usr');
3873 $this->ctrl->setParameter($this,
'sell_id',
$_GET[
'sell_id']);
3876 $tbl->setTitle($this->lng->txt(
'users'));
3877 $tbl->setId(
'tbl_search_user_vendor');
3878 $tbl->setRowTemplate(
"tpl.shop_users_row.html",
"Services/Payment");
3880 $tbl->addColumn(
' ',
'user_id',
'3%',
true);
3881 $tbl->addColumn($this->lng->txt(
'login'),
'login',
'32%');
3882 $tbl->addColumn($this->lng->txt(
'firstname'),
'firstname',
'32%');
3883 $tbl->addColumn($this->lng->txt(
'lastname'),
'lastname',
'32%');
3886 $tbl->addMultiCommand(
"addCustomer", $this->lng->txt(
"add"));
3887 $tbl->addCommandButton(
'statistic',$this->lng->txt(
'cancel'));
3890 $tbl->setData($a_result_set);
3891 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
3899 if(!$ilAccess->checkAccess(
'read',
'', $this->object->getRefId()))
3901 $this->ilias->raiseError($this->lng->txt(
'msg_no_perm_read'), $this->ilias->error_obj->MESSAGE);
3904 include_once
'Services/Table/classes/class.ilTable2GUI.php';
3906 $tbl->setId(
'pay_vats_tbl');
3907 $tbl->setFormAction($this->ctrl->getFormAction($this),
'createVat');
3908 $tbl->setTitle($this->lng->txt(
'payment_tax_rates'));
3909 $tbl->setRowTemplate(
'tpl.shop_vats_list_row.html',
'Services/Payment');
3911 $tbl->setDefaultOrderField(
'title');
3915 $tbl->addColumn(
'',
'check',
'1%');
3916 $tbl->addColumn($this->lng->txt(
'vat_title'),
'vat_title',
'33%');
3917 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'33%');
3918 $tbl->addColumn(
'',
'commands',
'33%');
3921 $oShopVatsList->read();
3925 if($oShopVatsList->hasItems())
3927 $tbl->enable(
'select_all');
3928 $tbl->setSelectAllCheckbox(
'vat_id');
3931 foreach($oShopVatsList as $oVAT)
3934 $result[$counter][
'vat_title'] = $oVAT->getTitle();
3936 $this->ctrl->setParameter($this,
'vat_id', $oVAT->getId());
3937 $result[$counter][
'edit_text'] = $this->lng->txt(
'edit');
3938 $result[$counter][
'edit_url'] = $this->ctrl->getLinkTarget($this,
'editVat');
3939 $result[$counter][
'delete_text'] = $this->lng->txt(
'delete');
3940 $result[$counter][
'delete_url'] = $this->ctrl->getLinkTarget($this,
'confirmDeleteVat');
3941 $this->ctrl->clearParameters($this);
3945 $tbl->addMultiCommand(
'confirmDeleteVat', $this->lng->txt(
'delete'));
3949 $tbl->disable(
'header');
3950 $tbl->disable(
'footer');
3952 $tbl->setNoEntriesText($this->lng->txt(
'paya_no_vats_assigned'));
3955 $tbl->setData($result);
3957 $tbl->addCommandButton(
'createVat', $this->lng->txt(
'paya_insert_vats'));
3959 $this->tpl->setContent($tbl->getHTML());
3966 if((
int)
$_GET[
'vat_id'] && !isset(
$_POST[
'vat_id']))
3972 $c_gui->setFormAction($this->ctrl->getFormAction($this,
'performDeleteVat'));
3973 $c_gui->setHeaderText($this->lng->txt(
'paya_sure_delete_vats'));
3974 $c_gui->setCancel($this->lng->txt(
'cancel'),
'vats');
3975 $c_gui->setConfirm($this->lng->txt(
'confirm'),
'performDeleteVat');
3978 foreach((array)
$_POST[
'vat_id'] as $vat_id)
3983 $c_gui->addItem(
'vat_id[]', $oVAT->getId(), $oVAT->getTitle());
3995 return $this->tpl->setContent($c_gui->getHTML());
4005 if(!is_array(
$_POST[
'vat_id']))
4010 foreach(
$_POST[
'vat_id'] as $vat_id)
4031 $this->tpl->setContent($this->form->getHtml());
4038 $this->tpl->setContent($this->form->getHtml());
4044 if($a_type ==
'edit')
4046 $this->ctrl->setParameter($this,
'vat_id',
$_GET[
'vat_id']);
4047 $this->form->setFormAction($this->ctrl->getFormAction($this,
'updateVat'));
4048 $this->form->setTitle($this->lng->txt(
'payment_edit_vat'));
4052 $this->form->setFormAction($this->ctrl->getFormAction($this,
'saveVat'));
4053 $this->form->setTitle($this->lng->txt(
'payment_add_vat'));
4056 $oTitle =
new ilTextInputGUI($this->lng->txt(
'title'),
'vat_title');
4058 $oTitle->setSize(40);
4059 $oTitle->setRequired(
true);
4060 $oTitle->setInfo($this->lng->txt(
'payment_vat_title_info'));
4061 $this->form->addItem($oTitle);
4063 $oRate =
new ilTextInputGUI($this->lng->txt(
'vat_rate'),
'vat_rate');
4066 $oRate->setRequired(
true);
4067 $oRate->setInfo($this->lng->txt(
'payment_vat_rate_info'));
4068 $this->form->addItem($oRate);
4070 if($a_type ==
'edit')
4072 $this->form->addCommandButton(
'updateVat', $this->lng->txt(
'save'));
4076 $this->form->addCommandButton(
'saveVat', $this->lng->txt(
'save'));
4079 $this->form->addCommandButton(
'vats', $this->lng->txt(
'cancel'));
4085 $this->form->setValuesByArray(array(
4086 'vat_title' => $oVAT->getTitle(),
4087 'vat_rate' => $oVAT->getRate()
4094 if(!$this->form->checkInput())
4096 $this->form->setValuesByPost();
4097 return $this->tpl->setContent($this->form->getHtml());
4102 $this->form->getItemByPostVar(
'vat_rate')->setAlert($this->lng->txt(
'payment_vat_input_invalid'));
4103 $this->form->setValuesByPost();
4104 return $this->tpl->setContent($this->form->getHtml());
4110 $oVAT->setTitle($this->form->getInput(
'vat_title'));
4111 $oVAT->setRate((
float)str_replace(
',',
'.', $this->form->getInput(
'vat_rate')));
4117 $this->form->setValuesByPost();
4118 return $this->tpl->setContent($this->form->getHtml());
4128 if(!$this->form->checkInput())
4130 $this->form->setValuesByPost();
4131 return $this->tpl->setContent($this->form->getHtml());
4136 $this->form->getItemByPostVar(
'vat_rate')->setAlert($this->lng->txt(
'payment_vat_input_invalid'));
4137 $this->form->setValuesByPost();
4138 return $this->tpl->setContent($this->form->getHtml());
4144 $oVAT->setTitle($this->form->getInput(
'vat_title'));
4145 $oVAT->setRate((
float)str_replace(
',',
'.', $this->form->getInput(
'vat_rate')));
4151 $this->form->setValuesByPost();
4152 return $this->tpl->setContent($this->form->getHtml());
4164 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
4171 $del_bookings = $this->booking_obj->deleteAddressesByPaymethod((
int)$pay_method);
4182 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
4186 foreach($currency_res as $cur)
4189 $f_result[$counter][
'is_default'] = $cur[
'is_default'] == 1 ? $this->lng->txt(
'yes') : $this->lng->txt(
'no');
4191 $f_result[$counter][
'currency_unit'] = $cur[
'unit'];
4192 $f_result[$counter][
'iso_code'] = $cur[
'iso_code'];
4193 $f_result[$counter][
'currency_symbol'] = $cur[
'symbol'];
4194 $f_result[$counter][
'conversion_rate'] = $cur[
'conversion_rate'];
4201 $tbl->setTitle($this->lng->txt(
"currencies"));
4202 $tbl->setId(
'tbl_show_currencies');
4203 $tbl->setRowTemplate(
"tpl.shop_currencies_row.html",
"Services/Payment");
4205 $tbl->addColumn(
' ',
'currency_id',
'1%',
true);
4206 $tbl->addColumn($this->lng->txt(
'is_default'),
'is_default',
'5%');
4207 $tbl->addColumn($this->lng->txt(
'currency_unit'),
'currency_unit',
'10%');
4208 $tbl->addColumn($this->lng->txt(
'iso_code'),
'iso_code',
'20%');
4209 $tbl->addColumn($this->lng->txt(
'currency_symbol'),
'currency_symbol',
'20%');
4210 $tbl->addColumn($this->lng->txt(
'conversion_rate'),
'conversion_rate',
'15%');
4211 $tbl->addColumn(
'',
'options',
'5%');
4213 $this->ctrl->setParameter($this,
'cmd',
'currencies');
4215 $tbl->addMultiCommand(
'updateDefaultCurrency', $this->lng->txt(
'paya_set_default_currency'));
4216 $tbl->addMultiCommand(
"editCurrency",$this->lng->txt(
'edit'));
4217 $tbl->addMultiCommand(
"deleteCurrency", $this->lng->txt(
'delete'));
4219 $tbl->addCommandButton(
'addCurrency',$this->lng->txt(
'add_currency'));
4220 $tbl->setData($f_result);
4221 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
4226 if(isset(
$_POST[
'currency_id'] ))
4237 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
4239 $form->setFormAction($this->ctrl->getFormAction($this));
4240 $form->setTitle($this->lng->txt(
'paya_add_currency'));
4242 $o_Unit =
new ilTextInputGUI($this->lng->txt(
'paya_currency_unit'),
'currency_unit');
4244 $o_Unit->setPostVar(
'currency_unit');
4245 $o_Unit->setRequired(
true);
4247 $o_Isocode =
new ilTextInputGUI($this->lng->txt(
'iso_code'),
'iso_code');
4249 $o_Isocode->setPostVar(
'iso_code');
4250 $o_Isocode->setRequired(
true);
4252 $o_Symbol =
new ilTextInputGUI($this->lng->txt(
'symbol'),
'symbol');
4254 $o_Symbol->setPostVar(
'symbol');
4255 $o_Symbol->setRequired(
true);
4257 $o_Conversionrate =
new IlTextInputGUI($this->lng->txt(
'conversion_rate'),
'conversion_rate');
4258 $o_Conversionrate->setValue(
$_POST[
'conversion_rate']);
4259 $o_Conversionrate->setPostVar(
'conversion_rate');
4260 $o_Conversionrate->setRequired(
true);
4262 $form->addItem($o_Unit);
4263 $form->addItem($o_Isocode);
4264 $form->addItem($o_Symbol);
4265 $form->addItem($o_Conversionrate);
4267 $form->addCommandButton(
'saveCurrency', $this->lng->txt(
'save'));
4268 $form->addCommandButton(
'currencies', $this->lng->txt(
'cancel'));
4270 $this->tpl->setVariable(
'FORM', $form->getHTML());
4276 $obj_currency->setUnit(
$_POST[
'currency_unit']);
4277 $obj_currency->setIsoCode(
$_POST[
'iso_code']);
4278 $obj_currency->setSymbol(
$_POST[
'symbol']);
4279 $obj_currency->setConversionRate(
$_POST[
'conversion_rate']);
4280 $obj_currency->addCurrency();
4286 $currency_id =
$_POST[
'currency_id'];
4289 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
4291 $form->setFormAction($this->ctrl->getFormAction($this));
4292 $form->setTitle($this->lng->txt(
'paya_edit_currency'));
4294 $o_Unit =
new ilTextInputGUI($this->lng->txt(
'paya_currency_unit'),
'currency_unit');
4295 $o_Unit->
setValue($obj_currency[$currency_id][
'unit']);
4296 $o_Unit->setPostVar(
'currency_unit');
4297 $o_Unit->setRequired(
true);
4299 $o_Isocode =
new ilTextInputGUI($this->lng->txt(
'iso_code'),
'iso_code');
4300 $o_Isocode->
setValue($obj_currency[$currency_id][
'iso_code']);
4301 $o_Isocode->setPostVar(
'iso_code');
4302 $o_Isocode->setRequired(
true);
4304 $o_Symbol =
new ilTextInputGUI($this->lng->txt(
'symbol'),
'symbol');
4305 $o_Symbol->
setValue($obj_currency[$currency_id][
'symbol']);
4306 $o_Symbol->setPostVar(
'symbol');
4307 $o_Symbol->setRequired(
true);
4309 $o_Conversionrate =
new IlTextInputGUI($this->lng->txt(
'conversion_rate'),
'conversion_rate');
4310 $o_Conversionrate->setValue($obj_currency[$currency_id][
'conversion_rate']);
4311 $o_Conversionrate->setPostVar(
'conversion_rate');
4312 $o_Conversionrate->setRequired(
true);
4315 $o_hidden->setValue($obj_currency[$currency_id][
'currency_id']);
4316 $o_hidden->setPostVar(
'currency_id');
4317 $form->addItem($o_hidden);
4319 $form->addItem($o_Unit);
4320 $form->addItem($o_Isocode);
4321 $form->addItem($o_Symbol);
4322 $form->addItem($o_Conversionrate);
4324 $form->addCommandButton(
'updateCurrency', $this->lng->txt(
'save'));
4325 $form->addCommandButton(
'currencies', $this->lng->txt(
'cancel'));
4327 $this->tpl->setVariable(
'FORM', $form->getHTML());
4334 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
4339 $this->ctrl->setParameter($this,
'currency_id',(
int)
$_POST[
'currency_id']);
4341 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDeleteCurrency"));
4343 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_selected_currency"));
4344 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"currencies");
4345 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDeleteCurrency");
4349 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHtml());
4354 if(!
$_SESSION[
'currency_id'])
return false;
4357 $obj_currency->deleteCurrency();
4363 if(!
$_POST[
'currency_id'])
return false;
4366 $obj_currency->setUnit(
$_POST[
'currency_unit']);
4367 $obj_currency->setIsoCode(
$_POST[
'iso_code']);
4368 $obj_currency->setSymbol(
$_POST[
'symbol']);
4369 $obj_currency->setConversionRate(
$_POST[
'conversion_rate']);
4371 $obj_currency->updateCurrency();