uc_google_checkout.install 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_google_checkout module.
  5. */
  6. /**
  7. * Implements hook_uninstall().
  8. */
  9. function uc_google_checkout_uninstall() {
  10. db_update('uc_order_statuses')
  11. ->fields(array(
  12. 'locked' => 0,
  13. ))
  14. ->condition(db_or()
  15. ->condition('order_status_id', 'in_google_checkout')
  16. ->condition('order_status_id', 'chargeable')
  17. )
  18. ->execute();
  19. db_delete('variable')
  20. ->condition('name', 'uc_google_checkout_%', 'LIKE')
  21. ->execute();
  22. }
  23. /**
  24. * Implements hook_requirements().
  25. */
  26. function uc_google_checkout_requirements($phase) {
  27. $t = get_t();
  28. $requirements['uc_google_checkout'] = array(
  29. 'title' => $t('Google Checkout'),
  30. 'description' => $t('Google Checkout is no longer in operation. This module cannot be installed, only uninstalled. If you already have it installed, you must uninstall it. Follow the instructions in the module\'s <a href="@readme">README.txt</a>', array('@readme' => '/' . drupal_get_path('module', 'uc_google_checkout') . '/README.txt')),
  31. 'severity' => REQUIREMENT_ERROR,
  32. );
  33. return $requirements;
  34. }
  35. /**
  36. * Implements hook_schema().
  37. */
  38. function uc_google_checkout_schema() {
  39. $schema = array();
  40. $schema['uc_gc_products'] = array(
  41. 'description' => 'Stores Google Checkout information for products.',
  42. 'fields' => array(
  43. 'vid' => array(
  44. 'description' => 'The {uc_products}.vid.',
  45. 'type' => 'int',
  46. 'unsigned' => TRUE,
  47. 'not null' => TRUE,
  48. 'default' => 0,
  49. ),
  50. 'nid' => array(
  51. 'description' => 'The {uc_products}.nid.',
  52. 'type' => 'int',
  53. 'unsigned' => TRUE,
  54. 'not null' => TRUE,
  55. 'default' => 0,
  56. ),
  57. 'gc_salable' => array(
  58. 'description' => 'A flag indicating whether the product can be sold with Google Checkout. 1 => Yes. 0 => No.',
  59. 'type' => 'int',
  60. 'size' => 'tiny',
  61. 'unsigned' => TRUE,
  62. 'not null' => TRUE,
  63. 'default' => 1,
  64. ),
  65. ),
  66. 'primary key' => array('vid'),
  67. 'foreign keys' => array(
  68. 'uc_products' => array(
  69. 'table' => 'uc_products',
  70. 'columns' => array(
  71. 'nid' => 'nid',
  72. 'vid' => 'vid',
  73. ),
  74. )
  75. ),
  76. );
  77. $schema['uc_gc_orders'] = array(
  78. 'description' => 'Stores Google Checkout orders information.',
  79. 'fields' => array(
  80. 'order_id' => array(
  81. 'description' => 'The {uc_orders}.order_id.',
  82. 'type' => 'int',
  83. 'unsigned' => TRUE,
  84. 'not null' => TRUE,
  85. 'default' => 0,
  86. ),
  87. 'gc_order_number' => array(
  88. 'description' => 'The Google Checkout order number.',
  89. 'type' => 'varchar',
  90. 'length' => 255,
  91. 'not null' => TRUE,
  92. 'default' => '0',
  93. ),
  94. 'financial_state' => array(
  95. 'description' => 'The order financial state.',
  96. 'type' => 'varchar',
  97. 'length' => 255,
  98. 'not null' => TRUE,
  99. 'default' => 'REVIEWING',
  100. ),
  101. 'fulfillment_state' => array(
  102. 'description' => 'The order fulfillment state.',
  103. 'type' => 'varchar',
  104. 'length' => 255,
  105. 'not null' => TRUE,
  106. 'default' => 'NEW',
  107. ),
  108. 'gc_total' => array(
  109. 'description' => 'The order total according to Google Checkout.',
  110. 'type' => 'numeric',
  111. 'precision' => 16,
  112. 'scale' => 5,
  113. 'not null' => TRUE,
  114. 'default' => 0.0,
  115. ),
  116. ),
  117. 'indexes' => array(
  118. 'gc_order_number' => array(array('gc_order_number', 20)),
  119. ),
  120. 'primary key' => array('order_id'),
  121. 'foreign keys' => array(
  122. 'uc_orders' => array(
  123. 'table' => 'uc_orders',
  124. 'columns' => array('order_id' => 'order_id'),
  125. ),
  126. ),
  127. );
  128. $schema['uc_gc_taxes'] = array(
  129. 'description' => 'Stores tax information for Google Checkout.',
  130. 'fields' => array(
  131. 'zone' => array(
  132. 'description' => 'The 2-letter state abberviation.',
  133. 'type' => 'varchar',
  134. 'length' => 2,
  135. 'not null' => TRUE,
  136. 'default' => '',
  137. ),
  138. 'rate' => array(
  139. 'description' => 'The tax rate.',
  140. 'type' => 'float',
  141. 'not null' => TRUE,
  142. 'default' => 0.0,
  143. ),
  144. 'tax_shipping' => array(
  145. 'description' => 'A flag indicating whether shipping costs are taxed.',
  146. 'type' => 'int',
  147. 'size' => 'tiny',
  148. 'not null' => TRUE,
  149. 'default' => 0,
  150. ),
  151. ),
  152. 'primary key' => array('zone'),
  153. );
  154. return $schema;
  155. }