index.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. if (cfr('AGENTS')) {
  3. //listing stricts agent assign
  4. if (ubRouting::checkGet('ajaxagenassign')) {
  5. web_AgentAssignStrictShow();
  6. }
  7. //listing auto agent assign
  8. if (ubRouting::checkGet('ajaxagenassignauto')) {
  9. web_AgentAssignAutoShow();
  10. }
  11. //mb some custom options?
  12. $alter_conf = $ubillingConfig->getAlter();
  13. //if deleting agent
  14. if (ubRouting::checkGet('delete', false) and ! ubRouting::checkGet('extinfo')) {
  15. zb_ContrAhentDelete(ubRouting::get('delete'));
  16. ubRouting::nav("?module=contrahens");
  17. }
  18. //if deleting strict assign for user
  19. if (ubRouting::checkGet(array('deleteassignstrict', 'username'))) {
  20. zb_AgentAssignStrictDelete(ubRouting::get('username'));
  21. ubRouting::nav("?module=contrahens");
  22. }
  23. //if adding new agent
  24. if (wf_CheckPost(array('newcontrname'))) {
  25. $bankacc = ubRouting::post('newbankacc');
  26. $bankname = ubRouting::post('newbankname');
  27. $bankcode = ubRouting::post('newbankcode');
  28. $edrpo = ubRouting::post('newedrpo');
  29. $ipn = ubRouting::post('newipn');
  30. $licensenum = ubRouting::post('newlicensenum');
  31. $juraddr = ubRouting::post('newjuraddr');
  32. $phisaddr = ubRouting::post('newphisaddr');
  33. $phone = ubRouting::post('newphone');
  34. $contrname = ubRouting::post('newcontrname');
  35. $agnameabbr = ubRouting::post('newagnameabbr');
  36. $agsignatory = ubRouting::post('newagsignatory');
  37. $agsignatory2 = ubRouting::post('newagsignatory2');
  38. $agbasis = ubRouting::post('newagbasis');
  39. $agmail = ubRouting::post('newagmail');
  40. $siteurl = ubRouting::post('newsiteurl');
  41. zb_ContrAhentAdd($bankacc, $bankname, $bankcode, $edrpo, $ipn, $licensenum, $juraddr, $phisaddr, $phone, $contrname, $agnameabbr, $agsignatory, $agsignatory2, $agbasis, $agmail, $siteurl);
  42. ubRouting::nav("?module=contrahens");
  43. }
  44. if (ubRouting::checkGet('edit', false) and ! ubRouting::checkGet('extinfo')) {
  45. //if someone changing agent
  46. if (ubRouting::post('changecontrname')) {
  47. $ahentid = ubRouting::get('edit');
  48. $bankacc = ubRouting::post('changebankacc');
  49. $bankname = ubRouting::post('changebankname');
  50. $bankcode = ubRouting::post('changebankcode');
  51. $edrpo = ubRouting::post('changeedrpo');
  52. $ipn = ubRouting::post('changeipn');
  53. $licensenum = ubRouting::post('changelicensenum');
  54. $juraddr = ubRouting::post('changejuraddr');
  55. $phisaddr = ubRouting::post('changephisaddr');
  56. $phone = ubRouting::post('changephone');
  57. $contrname = ubRouting::post('changecontrname');
  58. $agnameabbr = ubRouting::post('changeagnameabbr');
  59. $agsignatory = ubRouting::post('changeagsignatory');
  60. $agsignatory2 = ubRouting::post('changeagsignatory2');
  61. $agbasis = ubRouting::post('changeagbasis');
  62. $agmail = ubRouting::post('changeagmail');
  63. $siteurl = ubRouting::post('changesiteurl');
  64. zb_ContrAhentChange($ahentid, $bankacc, $bankname, $bankcode, $edrpo, $ipn, $licensenum, $juraddr, $phisaddr, $phone, $contrname, $agnameabbr, $agsignatory, $agsignatory2, $agbasis, $agmail, $siteurl);
  65. ubRouting::nav("?module=contrahens");
  66. }
  67. // show edit form
  68. show_window(__('Edit'), zb_ContrAhentEditForm(ubRouting::get('edit')));
  69. show_window('', wf_BackLink('?module=contrahens'));
  70. }
  71. // show or manipulate extended agent info
  72. if (ubRouting::checkGet('extinfo')) {
  73. if ($ubillingConfig->getAlterParam('AGENTS_EXTINFO_ON')) {
  74. // edit extended agent info
  75. if (ubRouting::checkPost('extinfeditmode') and ubRouting::checkPost('extinfrecid') and ubRouting::checkPost('extinfagentid')) {
  76. zb_EditAgentExtInfoRec(ubRouting::post('extinfrecid'), ubRouting::post('extinfagentid'),
  77. ubRouting::post('extinfsrvtype'), ubRouting::post('extinfintpaysysname'),
  78. ubRouting::post('extinfintpaysysid'), ubRouting::post('extinfintpaysyssrvid'),
  79. ubRouting::post('extinfintpaysystoken'), ubRouting::post('extinfintpaysyskey'),
  80. ubRouting::post('extinfintpaysyspasswd'), ubRouting::post('extinfintpayfeeinfo'),
  81. ubRouting::post('extinfintpaysyscallbackurl'));
  82. // add extended agent info
  83. } elseif (ubRouting::checkPost('extinfeditmode', false) and ubRouting::checkPost('extinfagentid')) {
  84. zb_CreateAgentExtInfoRec(ubRouting::post('extinfagentid'), ubRouting::post('extinfsrvtype'),
  85. ubRouting::post('extinfintpaysysname'), ubRouting::post('extinfintpaysysid'),
  86. ubRouting::post('extinfintpaysyssrvid'), ubRouting::post('extinfintpaysystoken'),
  87. ubRouting::post('extinfintpaysyskey'), ubRouting::post('extinfintpaysyspasswd'),
  88. ubRouting::post('extinfintpayfeeinfo'), ubRouting::post('extinfintpaysyscallbackurl'));
  89. } elseif (ubRouting::checkGet('delete')) {
  90. zb_DeleteAgentExtInfoRec(ubRouting::get('delete'));
  91. }
  92. show_window(__('Extended info'), zb_RenderAgentExtInfoTable(ubRouting::get('extinfo')) .
  93. wf_delimiter() .
  94. (ubRouting::checkGet('edit') ? zb_AgentEditExtInfoForm(ubRouting::get('edit')) : zb_AgentEditExtInfoForm()) .
  95. wf_delimiter() .
  96. (ubRouting::checkGet('edit') ? wf_BackLink('?module=contrahens&extinfo=' . ubRouting::get('extinfo')) : wf_BackLink('?module=contrahens'))
  97. );
  98. } else {
  99. show_error(__('This module is disabled'));
  100. }
  101. }
  102. //list ahents if not editing
  103. if (!ubRouting::checkGet(array('edit'), false) and ( !ubRouting::checkGet('agentstats')) and ! ubRouting::checkGet('extinfo')) {
  104. $statsControl = wf_Link('?module=contrahens&agentstats=true', web_icon_charts());
  105. show_window(__('Available contrahens') . ' ' . $statsControl, zb_ContrAhentShow());
  106. show_window('', wf_modalAuto(web_icon_create() . ' ' . __('Create new contrahent'), __('Create new contrahent'), zb_ContrAhentAddForm(), 'ubButton'));
  107. }
  108. //check agents region assign
  109. if ($alter_conf['AGENTS_ASSIGN']) {
  110. //if delete assign
  111. if (ubRouting::checkGet('deleteassign', false)) {
  112. zb_AgentAssignDelete(ubRouting::get('deleteassign'));
  113. ubRouting::nav("?module=contrahens");
  114. }
  115. //if adding assign
  116. if (wf_CheckPost(array('newassign'), false)) {
  117. zb_AgentAssignAdd(ubRouting::post('ahentsel'), ubRouting::post('newassign'));
  118. ubRouting::nav("?module=contrahens");
  119. }
  120. //list assigns if not editing
  121. if ((!ubRouting::checkGet(array('edit'), false)) and ( !ubRouting::checkGet('agentstats')) and ! ubRouting::checkGet('extinfo')) {
  122. $renderAutoAssign = ubRouting::checkPost('renderautoassign') ? ubRouting::post('renderautoassign') : FALSE;
  123. show_window(__('Contrahent assign'), web_AgentAssignForm());
  124. show_window(__('Available assigns'), web_AgentAssignShow($renderAutoAssign));
  125. show_window($renderAutoAssign ? __('Automatic assigns') : __('Assign overrides'), web_AgentAssignRender($renderAutoAssign));
  126. }
  127. //agent assigned users stats
  128. if (ubRouting::checkGet('agentstats')) {
  129. $privateTariffsMask = @$alter_conf['PRIVATE_TARIFFS_MASK'];
  130. show_window(__('Available assigns'), zb_AgentStatsRender($privateTariffsMask));
  131. show_window('', wf_BackLink('?module=contrahens'));
  132. }
  133. }
  134. } else {
  135. show_error(__('You cant control this module'));
  136. }