index.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. if (cfr('OPENPAYZ')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. //check is openpayz enabled?
  5. if ($altCfg['OPENPAYZ_SUPPORT']) {
  6. $paySysLoadFlag = false;
  7. if (ubRouting::checkGet('transactionsearch') OR ubRouting::checkPost('searchpaysys')) {
  8. $paySysLoadFlag = true;
  9. }
  10. $opayz = new OpenPayz($paySysLoadFlag);
  11. //if manual processing transaction
  12. if ($altCfg['OPENPAYZ_MANUAL']) {
  13. if (ubRouting::checkGet('process', false)) {
  14. $transaction_data = $opayz->transactionGetData(ubRouting::get('process'));
  15. $customerid = $transaction_data['customerid'];
  16. $transaction_summ = $transaction_data['summ'];
  17. $transaction_paysys = $transaction_data['paysys'];
  18. $allcustomers = $opayz->getCustomers();
  19. if (isset($allcustomers[$customerid])) {
  20. if ($transaction_data['processed'] != 1) {
  21. $opayz->cashAdd($allcustomers[$customerid], $transaction_summ, $transaction_paysys);
  22. $opayz->transactionSetProcessed($transaction_data['id']);
  23. ubRouting::nav($opayz::URL_ME);
  24. } else {
  25. show_error(__('Already processed'));
  26. }
  27. } else {
  28. show_error(__('Selected user is absent in database!'));
  29. }
  30. }
  31. }
  32. if (ubRouting::checkGet('ajax')) {
  33. $opayz->transactionAjaxSource();
  34. }
  35. if (!ubRouting::checkGet('graphs')) {
  36. //download exported search
  37. if (ubRouting::checkGet('dload')) {
  38. zb_DownloadFile(base64_decode(ubRouting::get('dload')), 'docx');
  39. }
  40. //search some transactions here
  41. if (ubRouting::checkGet('transactionsearch')) {
  42. show_window(__('Search'), $opayz->renderSearchForm());
  43. //perform search
  44. if (ubRouting::checkPost(array('searchyear', 'searchmonth', 'searchpaysys'))) {
  45. $opayz->doSearch(ubRouting::post('searchyear'), ubRouting::post('searchmonth'), ubRouting::post('searchpaysys'));
  46. }
  47. } else {
  48. if (!ubRouting::checkGet('showtransaction')) {
  49. //show transactions list
  50. $opayz->renderTransactionList();
  51. } else {
  52. $opayz->renderTransactionDetails(ubRouting::get('showtransaction'));
  53. }
  54. }
  55. } else {
  56. show_window(__('Graphs'), $opayz->renderGraphs());
  57. }
  58. zb_BillingStats(true);
  59. } else {
  60. show_error(__('OpenPayz support not enabled'));
  61. }
  62. } else {
  63. show_error(__('You cant control this module'));
  64. }