/[drupal]/contributions/modules/uc_fee/uc_fee.install
ViewVC logotype

Contents of /contributions/modules/uc_fee/uc_fee.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Sun Nov 16 23:47:51 2008 UTC (12 months, 1 week ago) by mrfelton
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--1, DRUPAL-6--2
File MIME type: text/x-php
Initial commit of uc_fee module. This module allows fees to be added to products which will appear as line items. Fees are configurable at the class and product level.
1 <?php
2 // $Id$
3
4 /**
5 * @file
6 * Install file for the Gemini Booking module.
7 */
8
9 /**
10 * Implementation of hook_schema
11 */
12 function uc_fee_schema() {
13
14 $schema['uc_fees'] = array(
15 'description' => t('Fees: the fees that may apply to products.'),
16 'fields' => array(
17 'fid' => array(
18 'description' => t('Primary identifier for fees.'),
19 'type' => 'serial',
20 'unsigned' => TRUE,
21 'not null' => TRUE,
22 ),
23 'name' => array(
24 'type' => 'varchar',
25 'length' => 255,
26 'not null' => TRUE,
27 'default' => '',
28 ),
29 'price' => array(
30 'description' => t("The adjustment to a product's price with the chosen fee."),
31 'type' => 'numeric',
32 'precision' => 10,
33 'scale' => 2,
34 'not null' => TRUE,
35 'default' => 0,
36 ),
37 'ordering' => array(
38 'description' => t('Determines the sort order of fees.'),
39 'type' => 'int',
40 'size' => 'tiny',
41 'not null' => TRUE,
42 'default' => 0,
43 ),
44 'description' => array(
45 'description' => t('Description of the fee.'),
46 'type' => 'varchar',
47 'length' => 255,
48 'not null' => TRUE,
49 'default' => '',
50 ),
51 ),
52 'primary key' => array('fid'),
53 );
54
55 $schema['uc_class_fees'] = array(
56 'description' => t('Fees copied to a product of a certain class when it is created.'),
57 'fields' => array(
58 'pcid' => array(
59 'description' => t('The product node type.'),
60 'type' => 'varchar',
61 'length' => 32,
62 'not null' => TRUE,
63 'default' => '',
64 ),
65 'fid' => array(
66 'description' => t('Primary identifier for fees.'),
67 'type' => 'int',
68 'unsigned' => TRUE,
69 'not null' => TRUE,
70 'default' => 0,
71 ),
72 'ordering' => array(
73 'description' => t('Determines the sort order of fees.'),
74 'type' => 'int',
75 'size' => 'tiny',
76 'not null' => TRUE,
77 'default' => 0,
78 ),
79 'default_price' => array(
80 'description' => t("The adjustment to a product's price with the chosen fee."),
81 'type' => 'numeric',
82 'precision' => 10,
83 'scale' => 2,
84 'not null' => TRUE,
85 'default' => 0,
86 ),
87 ),
88 'primary key' => array('pcid', 'fid'),
89 );
90
91 $schema['uc_product_fees'] = array(
92 'description' => t('Fees copied to a product.'),
93 'fields' => array(
94 'nid' => array(
95 'description' => t('The product node ID.'),
96 'type' => 'int',
97 'unsigned' => TRUE,
98 'not null' => TRUE,
99 'default' => 0,
100 ),
101 'fid' => array(
102 'description' => t('Primary identifier for fees.'),
103 'type' => 'int',
104 'unsigned' => TRUE,
105 'not null' => TRUE,
106 'default' => 0,
107 ),
108 'ordering' => array(
109 'description' => t('Determines the sort order of fees.'),
110 'type' => 'int',
111 'size' => 'tiny',
112 'not null' => TRUE,
113 'default' => 0,
114 ),
115 'default_price' => array(
116 'description' => t("The adjustment to a product's price with the chosen fee."),
117 'type' => 'numeric',
118 'precision' => 10,
119 'scale' => 2,
120 'not null' => TRUE,
121 'default' => 0,
122 ),
123 ),
124 'primary key' => array('nid', 'fid'),
125 );
126
127 return $schema;
128 }
129
130 /**
131 * Implementation of hook_install().
132 */
133 function uc_fee_install() {
134 // install the database table
135 $created = drupal_install_schema('uc_fee');
136 if ($created[0]['success']) {
137 drupal_set_message(t('Ubercart Fee module installed successfully.'));
138 }
139 else {
140 drupal_set_message(t('Table installation for the Ubercart Fee module was unsuccessful. The tables may need to be installed by hand. See the uc_fee.install file for the database schema.'), 'error');
141 }
142 }
143
144 /**
145 * Implementation of hook_uninstall()
146 */
147 function uc_fee_uninstall() {
148 db_query("DELETE FROM {variable} WHERE name LIKE 'uc_fee%'");
149 drupal_uninstall_schema('uc_fee');
150 }

  ViewVC Help
Powered by ViewVC 1.1.2