uc_usps.install in Ubercart 7.3
Same filename and directory in other branches
Install, update and uninstall functions for the uc_usps module.
File
shipping/uc_usps/uc_usps.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the uc_usps module.
*/
/**
* Implements hook_schema().
*/
function uc_usps_schema() {
$schema = array();
$schema['uc_usps_products'] = array(
'description' => 'Stores product information for USPS shipping quotes.',
'fields' => array(
'vid' => array(
'description' => 'The {uc_products}.vid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'nid' => array(
'description' => 'The {uc_products}.nid.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'container' => array(
'description' => 'The package type in which the product will be shipped.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array(
'vid',
),
'foreign keys' => array(
'uc_products' => array(
'table' => 'uc_products',
'columns' => array(
'nid' => 'nid',
'vid' => 'vid',
),
),
),
);
return $schema;
}
/**
* Implements hook_uninstall().
*/
function uc_usps_uninstall() {
variable_del('uc_usps_user_id');
variable_del('uc_usps_services');
variable_del('uc_usps_env_services');
variable_del('uc_usps_intl_services');
variable_del('uc_usps_intl_env_services');
variable_del('uc_usps_rate_markup');
variable_del('uc_usps_rate_markup_type');
variable_del('uc_usps_weight_markup');
variable_del('uc_usps_weight_markup_type');
variable_del('uc_usps_all_in_one');
variable_del('uc_usps_insurance');
variable_del('uc_usps_delivery_confirmation');
variable_del('uc_usps_signature_confirmation');
variable_del('uc_usps_online_rates');
}
/**
* Separates markup variables into rate_markup and weight_markup.
*/
function uc_usps_update_7300() {
// Rename variables while preserving previous setting values
variable_set('uc_usps_rate_markup', variable_get('uc_usps_markup', ''));
variable_set('uc_usps_rate_markup_type', variable_get('uc_usps_markup_type', ''));
// Remove old variables
variable_del('uc_usps_markup');
variable_del('uc_usps_markup_type');
}
Functions
Name | Description |
---|---|
uc_usps_schema | Implements hook_schema(). |
uc_usps_uninstall | Implements hook_uninstall(). |
uc_usps_update_7300 | Separates markup variables into rate_markup and weight_markup. |