123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?php
- /**
- * @file
- * Install, update and uninstall functions for the uc_ups module.
- */
- /**
- * Implements hook_schema().
- */
- function uc_ups_schema() {
- $schema = array();
- $schema['uc_ups_products'] = array(
- 'description' => 'Stores product information for UPS 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,
- ),
- 'pkg_type' => array(
- 'description' => 'The type of package in which the product will be shipped.',
- 'type' => 'varchar',
- 'length' => 2,
- '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_ups_uninstall() {
- variable_del('uc_ups_access_license');
- variable_del('uc_ups_shipper_number');
- variable_del('uc_ups_user_id');
- variable_del('uc_ups_password');
- variable_del('uc_ups_connection_address');
- variable_del('uc_ups_services');
- variable_del('uc_ups_pickup_type');
- variable_del('uc_ups_pkg_type');
- variable_del('uc_ups_classification');
- variable_del('uc_ups_negotiated_rates');
- variable_del('uc_ups_all_in_one');
- variable_del('uc_ups_unit_system');
- variable_del('uc_ups_insurance');
- variable_del('uc_ups_rate_markup');
- variable_del('uc_ups_rate_markup_type');
- variable_del('uc_ups_weight_markup');
- variable_del('uc_ups_weight_markup_type');
- }
- /**
- * Separates markup variables into rate_markup and weight_markup.
- */
- function uc_ups_update_7300() {
- // Rename variables while preserving previous setting values
- variable_set('uc_ups_rate_markup', variable_get('uc_ups_markup', ''));
- variable_set('uc_ups_rate_markup_type', variable_get('uc_ups_markup_type', ''));
- // Remove old variables
- variable_del('uc_ups_markup');
- variable_del('uc_ups_markup_type');
- }
- /**
- * Updates UPS Production URL.
- */
- function uc_ups_update_7301() {
- $current = variable_get('uc_ups_connection_address', '');
- // If currently using production URL, update variable to new value.
- if ($current == 'https://www.ups.com/ups.app/xml/') {
- variable_set('uc_ups_connection_address',
- 'https://onlinetools.ups.com/ups.app/xml/');
- }
- }
|