install.sql 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. -- TABLE: bundles
  2. CREATE TABLE IF NOT EXISTS `bx_credits_bundles` (
  3. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  4. `added` int(11) NOT NULL,
  5. `name` varchar(255) NOT NULL,
  6. `title` varchar(255) NOT NULL,
  7. `description` varchar(255) NOT NULL,
  8. `amount` int(11) NOT NULL DEFAULT '0',
  9. `bonus` int(11) NOT NULL DEFAULT '0',
  10. `price` float NOT NULL DEFAULT '0',
  11. `active` tinyint(4) NOT NULL DEFAULT '0',
  12. `order` int(11) NOT NULL DEFAULT '0',
  13. PRIMARY KEY (`id`)
  14. );
  15. -- TABLE: orders
  16. CREATE TABLE IF NOT EXISTS `bx_credits_orders` (
  17. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  18. `profile_id` int(11) unsigned NOT NULL default '0',
  19. `bundle_id` int(11) unsigned NOT NULL default '0',
  20. `count` int(11) unsigned NOT NULL default '0',
  21. `order` varchar(32) NOT NULL default '',
  22. `license` varchar(32) NOT NULL default '',
  23. `type` varchar(16) NOT NULL default '',
  24. `added` int(11) unsigned NOT NULL default '0',
  25. `expired` int(11) unsigned NOT NULL default '0',
  26. `new` tinyint(1) NOT NULL default '1',
  27. PRIMARY KEY (`id`),
  28. KEY `order_id` (`bundle_id`, `profile_id`),
  29. KEY `license` (`license`)
  30. );
  31. CREATE TABLE IF NOT EXISTS `bx_credits_orders_deleted` (
  32. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  33. `profile_id` int(11) unsigned NOT NULL default '0',
  34. `bundle_id` int(11) unsigned NOT NULL default '0',
  35. `count` int(11) unsigned NOT NULL default '0',
  36. `order` varchar(32) NOT NULL default '',
  37. `license` varchar(32) NOT NULL default '',
  38. `type` varchar(16) NOT NULL default '',
  39. `added` int(11) unsigned NOT NULL default '0',
  40. `expired` int(11) unsigned NOT NULL default '0',
  41. `new` tinyint(1) NOT NULL default '1',
  42. `reason` varchar(16) NOT NULL default '',
  43. `deleted` int(11) unsigned NOT NULL default '0',
  44. PRIMARY KEY (`id`),
  45. KEY `order_id` (`bundle_id`, `profile_id`),
  46. KEY `license` (`license`)
  47. );
  48. -- TABLE: profiles
  49. CREATE TABLE IF NOT EXISTS `bx_credits_profiles` (
  50. `id` int(11) NOT NULL DEFAULT '0',
  51. `wdw_clearing` int(11) unsigned NOT NULL default '0',
  52. `wdw_minimum` int(11) unsigned NOT NULL default '0',
  53. `wdw_remaining` int(11) unsigned NOT NULL default '0',
  54. `balance` float NOT NULL DEFAULT '0',
  55. PRIMARY KEY (`id`)
  56. );
  57. -- TABLE: history
  58. CREATE TABLE IF NOT EXISTS `bx_credits_history` (
  59. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  60. `first_pid` int(11) NOT NULL DEFAULT '0',
  61. `second_pid` int(11) NOT NULL DEFAULT '0',
  62. `amount` float NOT NULL DEFAULT '0',
  63. `type` varchar(16) NOT NULL default '',
  64. `direction` enum('in', 'out') NOT NULL DEFAULT 'in',
  65. `order` varchar(32) NOT NULL default '',
  66. `data` text NOT NULL default '',
  67. `info` varchar(255) NOT NULL DEFAULT '',
  68. `date` int(11) NOT NULL DEFAULT '0',
  69. `cleared` int(11) NOT NULL DEFAULT '0',
  70. PRIMARY KEY (`id`),
  71. KEY `date` (`date`, `type`, `direction`)
  72. );
  73. -- TABLE: withdrawals
  74. CREATE TABLE IF NOT EXISTS `bx_credits_withdrawals` (
  75. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  76. `performer_id` int(11) unsigned NOT NULL default '0',
  77. `profile_id` int(11) unsigned NOT NULL default '0',
  78. `amount` float NOT NULL DEFAULT '0',
  79. `rate` float NOT NULL DEFAULT '0',
  80. `message` text NOT NULL default '',
  81. `order` varchar(32) NOT NULL default '',
  82. `added` int(11) unsigned NOT NULL default '0',
  83. `confirmed` int(11) unsigned NOT NULL default '0',
  84. `status` enum('requested', 'canceled', 'confirmed') NOT NULL DEFAULT 'requested',
  85. PRIMARY KEY (`id`)
  86. );
  87. -- FORMS: credit
  88. INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  89. ('bx_credits_credit', 'bx_credits', '_bx_credits_form_credit', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', '', '', '', '', 'a:1:{i:0;s:9:"do_submit";}', '', 0, 1, 'BxCreditsFormCredit', 'modules/boonex/credits/classes/BxCreditsFormCredit.php');
  90. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  91. ('bx_credits_credit', 'bx_credits_credit_send', 'bx_credits', 0, '_bx_credits_form_credit_display_send'),
  92. ('bx_credits_credit', 'bx_credits_credit_grant', 'bx_credits', 0, '_bx_credits_form_credit_display_grant'),
  93. ('bx_credits_credit', 'bx_credits_credit_withdraw_request', 'bx_credits', 0, '_bx_credits_form_credit_display_withdraw_request');
  94. INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
  95. ('bx_credits_credit', 'bx_credits', 'balance', '', '', 0, 'text', '_bx_credits_form_credit_input_sys_balance', '_bx_credits_form_credit_input_balance', '', 0, 0, 0, 'a:1:{s:8:"disabled";s:8:"disabled";}', '', '', '', '', '', 'Xss', '', 1, 0),
  96. ('bx_credits_credit', 'bx_credits', 'cleared', '', '', 0, 'text', '_bx_credits_form_credit_input_sys_cleared', '_bx_credits_form_credit_input_cleared', '_bx_credits_form_credit_input_cleared_inf', 0, 0, 0, 'a:1:{s:8:"disabled";s:8:"disabled";}', '', '', '', '', '', 'Xss', '', 1, 0),
  97. ('bx_credits_credit', 'bx_credits', 'rate', '', '', 0, 'text', '_bx_credits_form_credit_input_sys_rate', '_bx_credits_form_credit_input_rate', '', 0, 0, 0, 'a:1:{s:8:"disabled";s:8:"disabled";}', '', '', '', '', '', 'Xss', '', 1, 0),
  98. ('bx_credits_credit', 'bx_credits', 'result', '', '', 0, 'text', '_bx_credits_form_credit_input_sys_result', '_bx_credits_form_credit_input_result', '', 0, 0, 0, 'a:1:{s:8:"disabled";s:8:"disabled";}', '', '', '', '', '', 'Xss', '', 1, 0),
  99. ('bx_credits_credit', 'bx_credits', 'amount', '', '', 0, 'text', '_bx_credits_form_credit_input_sys_amount', '_bx_credits_form_credit_input_amount', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_credits_form_credit_input_amount_err', 'Xss', '', 1, 0),
  100. ('bx_credits_credit', 'bx_credits', 'message', '', '', 0, 'textarea', '_bx_credits_form_credit_input_sys_message', '_bx_credits_form_credit_input_message', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  101. ('bx_credits_credit', 'bx_credits', 'profile', '', '', 0, 'custom', '_bx_credits_form_credit_input_sys_profile', '_bx_credits_form_credit_input_profile', '', 1, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  102. ('bx_credits_credit', 'bx_credits', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  103. ('bx_credits_credit', 'bx_credits', 'do_submit', '_bx_credits_form_credit_input_do_submit', '', 0, 'submit', '_bx_credits_form_credit_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  104. ('bx_credits_credit', 'bx_credits', 'do_cancel', '_bx_credits_form_credit_input_do_cancel', '', 0, 'button', '_bx_credits_form_credit_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
  105. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  106. ('bx_credits_credit_send', 'profile', 2147483647, 1, 1),
  107. ('bx_credits_credit_send', 'amount', 2147483647, 1, 2),
  108. ('bx_credits_credit_send', 'message', 2147483647, 1, 3),
  109. ('bx_credits_credit_send', 'controls', 2147483647, 1, 4),
  110. ('bx_credits_credit_send', 'do_submit', 2147483647, 1, 5),
  111. ('bx_credits_credit_send', 'do_cancel', 2147483647, 1, 6),
  112. ('bx_credits_credit_grant', 'profile', 2147483647, 1, 1),
  113. ('bx_credits_credit_grant', 'amount', 2147483647, 1, 2),
  114. ('bx_credits_credit_grant', 'message', 2147483647, 1, 3),
  115. ('bx_credits_credit_grant', 'controls', 2147483647, 1, 4),
  116. ('bx_credits_credit_grant', 'do_submit', 2147483647, 1, 5),
  117. ('bx_credits_credit_grant', 'do_cancel', 2147483647, 1, 6),
  118. ('bx_credits_credit_withdraw_request', 'balance', 2147483647, 1, 1),
  119. ('bx_credits_credit_withdraw_request', 'cleared', 2147483647, 1, 2),
  120. ('bx_credits_credit_withdraw_request', 'rate', 2147483647, 1, 3),
  121. ('bx_credits_credit_withdraw_request', 'amount', 2147483647, 1, 4),
  122. ('bx_credits_credit_withdraw_request', 'result', 2147483647, 1, 5),
  123. ('bx_credits_credit_withdraw_request', 'message', 2147483647, 1, 6),
  124. ('bx_credits_credit_withdraw_request', 'controls', 2147483647, 1, 7),
  125. ('bx_credits_credit_withdraw_request', 'do_submit', 2147483647, 1, 8),
  126. ('bx_credits_credit_withdraw_request', 'do_cancel', 2147483647, 1, 9);
  127. -- FORMS: bundle
  128. INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  129. ('bx_credits_bundle', 'bx_credits', '_bx_credits_form_bundle', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', 'bx_credits_bundles', 'id', '', '', 'a:1:{i:0;s:9:"do_submit";}', '', 0, 1, 'BxCreditsFormBundle', 'modules/boonex/credits/classes/BxCreditsFormBundle.php');
  130. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  131. ('bx_credits_bundle', 'bx_credits_bundle_add', 'bx_credits', 0, '_bx_credits_form_bundle_display_add'),
  132. ('bx_credits_bundle', 'bx_credits_bundle_edit', 'bx_credits', 0, '_bx_credits_form_bundle_display_edit');
  133. INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
  134. ('bx_credits_bundle', 'bx_credits', 'title', '', '', 0, 'text_translatable', '_bx_credits_form_bundle_input_sys_title', '_bx_credits_form_bundle_input_title', '', 1, 0, 0, '', '', '', 'AvailTranslatable', 'a:1:{i:0;s:5:"title";}', '_bx_credits_form_bundle_input_title_err', 'Xss', '', 1, 0),
  135. ('bx_credits_bundle', 'bx_credits', 'description', '', '', 0, 'textarea_translatable', '_bx_credits_form_bundle_input_sys_description', '_bx_credits_form_bundle_input_description', '', 0, 0, 3, '', '', '', '', '', '', 'XssHtml', '', 1, 0),
  136. ('bx_credits_bundle', 'bx_credits', 'name', '', '', 0, 'text', '_bx_credits_form_bundle_input_sys_name', '_bx_credits_form_bundle_input_name', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_credits_form_bundle_input_name_err', 'Xss', '', 1, 0),
  137. ('bx_credits_bundle', 'bx_credits', 'amount', '', '', 0, 'text', '_bx_credits_form_bundle_input_sys_amount', '_bx_credits_form_bundle_input_amount', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_credits_form_bundle_input_amount_err', 'Xss', '', 1, 0),
  138. ('bx_credits_bundle', 'bx_credits', 'bonus', '', '', 0, 'text', '_bx_credits_form_bundle_input_sys_bonus', '_bx_credits_form_bundle_input_bonus', '', 0, 0, 0, '', '', '', '', '', '', 'Xss', '', 1, 0),
  139. ('bx_credits_bundle', 'bx_credits', 'price', '', '', 0, 'price', '_bx_credits_form_bundle_input_sys_price', '_bx_credits_form_bundle_input_price', '', 1, 0, 0, '', '', '', 'Avail', '', '_bx_credits_form_bundle_input_price_err', 'Xss', '', 1, 0),
  140. ('bx_credits_bundle', 'bx_credits', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  141. ('bx_credits_bundle', 'bx_credits', 'do_submit', '_bx_credits_form_bundle_input_do_submit', '', 0, 'submit', '_bx_credits_form_bundle_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  142. ('bx_credits_bundle', 'bx_credits', 'do_cancel', '_bx_credits_form_bundle_input_do_cancel', '', 0, 'button', '_bx_credits_form_bundle_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
  143. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  144. ('bx_credits_bundle_add', 'name', 2147483647, 1, 1),
  145. ('bx_credits_bundle_add', 'title', 2147483647, 1, 2),
  146. ('bx_credits_bundle_add', 'description', 2147483647, 1, 3),
  147. ('bx_credits_bundle_add', 'amount', 2147483647, 1, 4),
  148. ('bx_credits_bundle_add', 'bonus', 2147483647, 1, 5),
  149. ('bx_credits_bundle_add', 'price', 2147483647, 1, 6),
  150. ('bx_credits_bundle_add', 'controls', 2147483647, 1, 7),
  151. ('bx_credits_bundle_add', 'do_submit', 2147483647, 1, 8),
  152. ('bx_credits_bundle_add', 'do_cancel', 2147483647, 1, 9),
  153. ('bx_credits_bundle_edit', 'name', 2147483647, 1, 1),
  154. ('bx_credits_bundle_edit', 'title', 2147483647, 1, 2),
  155. ('bx_credits_bundle_edit', 'description', 2147483647, 1, 3),
  156. ('bx_credits_bundle_edit', 'amount', 2147483647, 1, 4),
  157. ('bx_credits_bundle_edit', 'bonus', 2147483647, 1, 5),
  158. ('bx_credits_bundle_edit', 'price', 2147483647, 1, 6),
  159. ('bx_credits_bundle_edit', 'controls', 2147483647, 1, 7),
  160. ('bx_credits_bundle_edit', 'do_submit', 2147483647, 1, 8),
  161. ('bx_credits_bundle_edit', 'do_cancel', 2147483647, 1, 9);
  162. -- FORMS: profile
  163. INSERT INTO `sys_objects_form`(`object`, `module`, `title`, `action`, `form_attrs`, `table`, `key`, `uri`, `uri_title`, `submit_name`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`) VALUES
  164. ('bx_credits_profile', 'bx_credits', '_bx_credits_form_profile', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', 'bx_credits_profiles', 'id', '', '', 'a:1:{i:0;s:9:"do_submit";}', '', 0, 1, 'BxCreditsFormProfile', 'modules/boonex/credits/classes/BxCreditsFormProfile.php');
  165. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  166. ('bx_credits_profile', 'bx_credits_profile_edit', 'bx_credits', 0, '_bx_credits_form_profile_display_edit');
  167. INSERT INTO `sys_form_inputs`(`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
  168. ('bx_credits_profile', 'bx_credits', 'wdw_clearing', '', '', 0, 'text', '_bx_credits_form_profile_input_sys_wdw_clearing', '_bx_credits_form_profile_input_wdw_clearing', '_bx_credits_form_profile_input_wdw_clearing_inf', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  169. ('bx_credits_profile', 'bx_credits', 'wdw_minimum', '', '', 0, 'text', '_bx_credits_form_profile_input_sys_wdw_minimum', '_bx_credits_form_profile_input_wdw_minimum', '_bx_credits_form_profile_input_wdw_minimum_inf', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  170. ('bx_credits_profile', 'bx_credits', 'wdw_remaining', '', '', 0, 'text', '_bx_credits_form_profile_input_sys_wdw_remaining', '_bx_credits_form_profile_input_wdw_remaining', '_bx_credits_form_profile_input_wdw_remaining_inf', 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  171. ('bx_credits_profile', 'bx_credits', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  172. ('bx_credits_profile', 'bx_credits', 'do_submit', '_bx_credits_form_profile_input_do_submit', '', 0, 'submit', '_bx_credits_form_profile_input_sys_do_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  173. ('bx_credits_profile', 'bx_credits', 'do_cancel', '_bx_credits_form_profile_input_do_cancel', '', 0, 'button', '_bx_credits_form_bundle_input_sys_do_cancel', '', '', 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 1, 0);
  174. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  175. ('bx_credits_profile_edit', 'wdw_clearing', 2147483647, 1, 1),
  176. ('bx_credits_profile_edit', 'wdw_minimum', 2147483647, 1, 2),
  177. ('bx_credits_profile_edit', 'wdw_remaining', 2147483647, 1, 3),
  178. ('bx_credits_profile_edit', 'controls', 2147483647, 1, 4),
  179. ('bx_credits_profile_edit', 'do_submit', 2147483647, 1, 5),
  180. ('bx_credits_profile_edit', 'do_cancel', 2147483647, 1, 6);
  181. -- STUDIO: page & widget
  182. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  183. (3, 'bx_credits', '_bx_credits', '_bx_credits', 'bx_credits@modules/boonex/credits/|std-icon.svg');
  184. SET @iPageId = LAST_INSERT_ID();
  185. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  186. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  187. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  188. (@iPageId, 'bx_credits', 'extensions', '{url_studio}module.php?name=bx_credits', '', 'bx_credits@modules/boonex/credits/|std-icon.svg', '_bx_credits', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}');
  189. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  190. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));