install.sql 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. `amount` int(11) NOT NULL DEFAULT '0',
  8. `bonus` int(11) NOT NULL DEFAULT '0',
  9. `price` float NOT NULL DEFAULT '0',
  10. `active` tinyint(4) NOT NULL DEFAULT '0',
  11. `order` int(11) NOT NULL DEFAULT '0',
  12. PRIMARY KEY (`id`)
  13. );
  14. -- TABLE: orders
  15. CREATE TABLE IF NOT EXISTS `bx_credits_orders` (
  16. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  17. `profile_id` int(11) unsigned NOT NULL default '0',
  18. `bundle_id` int(11) unsigned NOT NULL default '0',
  19. `count` int(11) unsigned NOT NULL default '0',
  20. `order` varchar(32) NOT NULL default '',
  21. `license` varchar(32) NOT NULL default '',
  22. `type` varchar(16) NOT NULL default '',
  23. `added` int(11) unsigned NOT NULL default '0',
  24. `expired` int(11) unsigned NOT NULL default '0',
  25. `new` tinyint(1) NOT NULL default '1',
  26. PRIMARY KEY (`id`),
  27. KEY `order_id` (`bundle_id`, `profile_id`),
  28. KEY `license` (`license`)
  29. );
  30. CREATE TABLE IF NOT EXISTS `bx_credits_orders_deleted` (
  31. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  32. `profile_id` int(11) unsigned NOT NULL default '0',
  33. `bundle_id` int(11) unsigned NOT NULL default '0',
  34. `count` int(11) unsigned NOT NULL default '0',
  35. `order` varchar(32) NOT NULL default '',
  36. `license` varchar(32) NOT NULL default '',
  37. `type` varchar(16) NOT NULL default '',
  38. `added` int(11) unsigned NOT NULL default '0',
  39. `expired` int(11) unsigned NOT NULL default '0',
  40. `new` tinyint(1) NOT NULL default '1',
  41. `reason` varchar(16) NOT NULL default '',
  42. `deleted` int(11) unsigned NOT NULL default '0',
  43. PRIMARY KEY (`id`),
  44. KEY `order_id` (`bundle_id`, `profile_id`),
  45. KEY `license` (`license`)
  46. );
  47. -- TABLE: profiles
  48. CREATE TABLE IF NOT EXISTS `bx_credits_profiles` (
  49. `id` int(11) NOT NULL DEFAULT '0',
  50. `balance` float NOT NULL DEFAULT '0',
  51. PRIMARY KEY (`id`)
  52. );
  53. -- TABLE: history
  54. CREATE TABLE IF NOT EXISTS `bx_credits_history` (
  55. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  56. `first_pid` int(11) NOT NULL DEFAULT '0',
  57. `second_pid` int(11) NOT NULL DEFAULT '0',
  58. `amount` float NOT NULL DEFAULT '0',
  59. `direction` enum('in', 'out') NOT NULL DEFAULT 'in',
  60. `order` varchar(32) NOT NULL default '',
  61. `data` text NOT NULL default '',
  62. `info` varchar(255) NOT NULL DEFAULT '',
  63. `date` int(11) NOT NULL DEFAULT '0',
  64. PRIMARY KEY (`id`)
  65. );
  66. -- FORMS: credit
  67. 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
  68. ('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, 'BxCreditsFormWithdraw', 'modules/boonex/credits/classes/BxCreditsFormWithdraw.php');
  69. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  70. ('bx_credits_credit', 'bx_credits_credit_grant', 'bx_credits', 0, '_bx_credits_form_credit_display_grant'),
  71. ('bx_credits_credit', 'bx_credits_credit_withdraw_request', 'bx_credits', 0, '_bx_credits_form_credit_display_withdraw_request'),
  72. ('bx_credits_credit', 'bx_credits_credit_withdraw_confirm', 'bx_credits', 0, '_bx_credits_form_credit_display_withdraw_confirm');
  73. 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
  74. ('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),
  75. ('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),
  76. ('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),
  77. ('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),
  78. ('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),
  79. ('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),
  80. ('bx_credits_credit', 'bx_credits', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  81. ('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),
  82. ('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);
  83. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  84. ('bx_credits_credit_grant', 'profile', 2147483647, 1, 1),
  85. ('bx_credits_credit_grant', 'amount', 2147483647, 1, 2),
  86. ('bx_credits_credit_grant', 'message', 2147483647, 1, 3),
  87. ('bx_credits_credit_grant', 'controls', 2147483647, 1, 4),
  88. ('bx_credits_credit_grant', 'do_submit', 2147483647, 1, 5),
  89. ('bx_credits_credit_grant', 'do_cancel', 2147483647, 1, 6),
  90. ('bx_credits_credit_withdraw_request', 'balance', 2147483647, 1, 1),
  91. ('bx_credits_credit_withdraw_request', 'rate', 2147483647, 1, 2),
  92. ('bx_credits_credit_withdraw_request', 'amount', 2147483647, 1, 3),
  93. ('bx_credits_credit_withdraw_request', 'result', 2147483647, 1, 4),
  94. ('bx_credits_credit_withdraw_request', 'message', 2147483647, 1, 5),
  95. ('bx_credits_credit_withdraw_request', 'controls', 2147483647, 1, 6),
  96. ('bx_credits_credit_withdraw_request', 'do_submit', 2147483647, 1, 7),
  97. ('bx_credits_credit_withdraw_request', 'do_cancel', 2147483647, 1, 8),
  98. ('bx_credits_credit_withdraw_confirm', 'profile', 2147483647, 1, 1),
  99. ('bx_credits_credit_withdraw_confirm', 'amount', 2147483647, 1, 2),
  100. ('bx_credits_credit_withdraw_confirm', 'message', 2147483647, 1, 3),
  101. ('bx_credits_credit_withdraw_confirm', 'controls', 2147483647, 1, 4),
  102. ('bx_credits_credit_withdraw_confirm', 'do_submit', 2147483647, 1, 5),
  103. ('bx_credits_credit_withdraw_confirm', 'do_cancel', 2147483647, 1, 6);
  104. -- FORMS: bundle
  105. 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
  106. ('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');
  107. INSERT INTO `sys_form_displays`(`object`, `display_name`, `module`, `view_mode`, `title`) VALUES
  108. ('bx_credits_bundle', 'bx_credits_bundle_add', 'bx_credits', 0, '_bx_credits_form_bundle_display_add'),
  109. ('bx_credits_bundle', 'bx_credits_bundle_edit', 'bx_credits', 0, '_bx_credits_form_bundle_display_edit');
  110. 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
  111. ('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),
  112. ('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),
  113. ('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),
  114. ('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),
  115. ('bx_credits_bundle', 'bx_credits', 'price', '', '', 0, 'text', '_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),
  116. ('bx_credits_bundle', 'bx_credits', 'controls', '', 'do_submit,do_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  117. ('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),
  118. ('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);
  119. INSERT INTO `sys_form_display_inputs`(`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  120. ('bx_credits_bundle_add', 'name', 2147483647, 1, 1),
  121. ('bx_credits_bundle_add', 'title', 2147483647, 1, 2),
  122. ('bx_credits_bundle_add', 'amount', 2147483647, 1, 3),
  123. ('bx_credits_bundle_add', 'bonus', 2147483647, 1, 4),
  124. ('bx_credits_bundle_add', 'price', 2147483647, 1, 5),
  125. ('bx_credits_bundle_add', 'controls', 2147483647, 1, 6),
  126. ('bx_credits_bundle_add', 'do_submit', 2147483647, 1, 7),
  127. ('bx_credits_bundle_add', 'do_cancel', 2147483647, 1, 8),
  128. ('bx_credits_bundle_edit', 'name', 2147483647, 1, 1),
  129. ('bx_credits_bundle_edit', 'title', 2147483647, 1, 2),
  130. ('bx_credits_bundle_edit', 'amount', 2147483647, 1, 3),
  131. ('bx_credits_bundle_edit', 'bonus', 2147483647, 1, 4),
  132. ('bx_credits_bundle_edit', 'price', 2147483647, 1, 5),
  133. ('bx_credits_bundle_edit', 'controls', 2147483647, 1, 6),
  134. ('bx_credits_bundle_edit', 'do_submit', 2147483647, 1, 7),
  135. ('bx_credits_bundle_edit', 'do_cancel', 2147483647, 1, 8);
  136. -- STUDIO: page & widget
  137. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  138. (3, 'bx_credits', '_bx_credits', '_bx_credits', 'bx_credits@modules/boonex/credits/|std-icon.svg');
  139. SET @iPageId = LAST_INSERT_ID();
  140. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  141. SET @iParentPageOrder = (SELECT MAX(`order`) FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  142. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`) VALUES
  143. (@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";}');
  144. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  145. (@iParentPageId, LAST_INSERT_ID(), IF(ISNULL(@iParentPageOrder), 1, @iParentPageOrder + 1));