=== modified file 'payment/uc_2checkout/uc_2checkout.module'
--- payment/uc_2checkout/uc_2checkout.module 2010-03-03 15:47:24 +0000
+++ payment/uc_2checkout/uc_2checkout.module 2010-03-05 14:13:18 +0000
@@ -75,11 +75,11 @@
}
/**
- * Implement hook_payment_method().
+ * Implement hook_uc_payment_method().
*
* @see uc_payment_method_2checkout()
*/
-function uc_2checkout_payment_method() {
+function uc_2checkout_uc_payment_method() {
$path = base_path() . drupal_get_path('module', 'uc_2checkout');
$title = variable_get('uc_2checkout_method_title', t('Credit card on a secure server:'));
$title .= '
';
=== modified file 'payment/uc_authorizenet/uc_authorizenet.module'
--- payment/uc_authorizenet/uc_authorizenet.module 2010-03-03 15:47:24 +0000
+++ payment/uc_authorizenet/uc_authorizenet.module 2010-03-05 14:13:59 +0000
@@ -71,9 +71,9 @@
}
/**
- * Implement hook_payment_gateway().
+ * Implement hook_uc_payment_gateway().
*/
-function uc_authorizenet_payment_gateway() {
+function uc_authorizenet_uc_payment_gateway() {
$gateways[] = array(
'id' => 'authorizenet',
'title' => t('Authorize.net'),
=== modified file 'payment/uc_credit/test_gateway.module'
--- payment/uc_credit/test_gateway.module 2009-07-11 19:04:32 +0000
+++ payment/uc_credit/test_gateway.module 2010-03-05 14:11:20 +0000
@@ -12,7 +12,7 @@
* Hook Functions (Ubercart)
******************************************************************************/
-function test_gateway_payment_gateway() {
+function test_gateway_uc_payment_gateway() {
$gateways[] = array(
'id' => 'test_gateway',
'title' => t('Test Gateway'),
=== modified file 'payment/uc_credit/uc_credit.admin.inc'
--- payment/uc_credit/uc_credit.admin.inc 2010-02-25 15:57:05 +0000
+++ payment/uc_credit/uc_credit.admin.inc 2010-03-04 21:05:15 +0000
@@ -300,7 +300,7 @@
$data['ref_id'] = $form_state['values']['select_ref'];
}
- $result = uc_payment_process('credit', $form_state['values']['order_id'], $form_state['values']['amount'], $data, TRUE, NULL, FALSE);
+ $result = uc_payment_process_payment('credit', $form_state['values']['order_id'], $form_state['values']['amount'], $data, TRUE, NULL, FALSE);
if ($result) {
$crypt = new uc_encryption_class;
=== modified file 'payment/uc_credit/uc_credit.module'
--- payment/uc_credit/uc_credit.module 2010-03-03 15:47:24 +0000
+++ payment/uc_credit/uc_credit.module 2010-03-05 14:15:29 +0000
@@ -258,9 +258,9 @@
******************************************************************************/
/**
- * Implement hook_store_status().
+ * Implement hook_uc_store_status().
*/
-function uc_credit_store_status() {
+function uc_credit_uc_store_status() {
// Throw up an error row if encryption has not been set up yet.
if ($key = uc_credit_encryption_key()) {
$statuses[] = array(
@@ -289,9 +289,9 @@
}
/**
- * Implement hook_order().
+ * Implement hook_uc_order().
*/
-function uc_credit_order($op, &$arg1, $arg2) {
+function uc_credit_uc_order($op, &$arg1, $arg2) {
// Set up the encryption key and object for saving and loading.
if ($arg1->payment_method == 'credit' && ($op == 'save' || $op == 'load')) {
// Log an error if encryption isn't configured properly.
@@ -315,7 +315,7 @@
);
// Attempt to process the CC payment.
- $pass = uc_payment_process('credit', $arg1->order_id, $arg1->order_total, $data, TRUE, NULL, FALSE);
+ $pass = uc_payment_process_payment('credit', $arg1->order_id, $arg1->order_total, $data, TRUE, NULL, FALSE);
// If the payment failed, store the data back in the session and
// halt the checkout process.
=== modified file 'payment/uc_cybersource/uc_cybersource.module'
--- payment/uc_cybersource/uc_cybersource.module 2010-03-03 15:47:24 +0000
+++ payment/uc_cybersource/uc_cybersource.module 2010-03-05 14:15:44 +0000
@@ -68,9 +68,9 @@
******************************************************************************/
/**
- * Implement hook_payment_gateway().
+ * Implement hook_uc_payment_gateway().
*/
-function uc_cybersource_payment_gateway() {
+function uc_cybersource_uc_payment_gateway() {
$gateways[] = array(
'id' => 'cybersource',
'title' => t('CyberSource'),
=== modified file 'payment/uc_google_checkout/uc_google_checkout.module'
--- payment/uc_google_checkout/uc_google_checkout.module 2010-03-03 15:47:24 +0000
+++ payment/uc_google_checkout/uc_google_checkout.module 2010-03-05 14:16:00 +0000
@@ -227,7 +227,7 @@
* Hook Functions (Ubercart) *
******************************************************************************/
-function uc_google_checkout_cart_pane() {
+function uc_google_checkout_uc_cart_pane() {
$panes[] = array(
'id' => 'uc_google_checkout',
'title' => t('Google Checkout'),
@@ -242,7 +242,7 @@
return $panes;
}
-function uc_google_checkout_order_pane() {
+function uc_google_checkout_uc_order_pane() {
$panes[] = array(
'id' => 'email_allowed',
'callback' => 'uc_google_checkout_pane_email_allowed',
@@ -256,7 +256,7 @@
return $panes;
}
-function uc_google_checkout_line_item() {
+function uc_google_checkout_uc_line_item() {
$items[] = array(
'id' => 'gc_coupon',
'title' => t('Google Checkout Coupon'),
@@ -275,7 +275,7 @@
return $items;
}
-function uc_google_checkout_order($op, &$arg1, $arg2) {
+function uc_google_checkout_uc_order($op, &$arg1, $arg2) {
switch ($op) {
case 'load':
$result = db_query("SELECT * FROM {uc_gc_orders} WHERE order_id = :id", array(':id' => $arg1->order_id));
@@ -305,9 +305,9 @@
}
/**
- * Implement hook_payment_method().
+ * Implement hook_uc_payment_method().
*/
-function uc_google_checkout_payment_method() {
+function uc_google_checkout_uc_payment_method() {
$methods[] = array(
'id' => 'google_checkout',
'name' => t('Google Checkout'),
@@ -321,7 +321,7 @@
return $methods;
}
-function uc_google_checkout_payment_gateway() {
+function uc_google_checkout_uc_payment_gateway() {
$gateways[] = array(
'id' => 'google_checkout',
'title' => t('Google Checkout'),
@@ -331,7 +331,7 @@
return $gateways;
}
-function uc_google_checkout_shipment($op, $shipment) {
+function uc_google_checkout_uc_shipment($op, $shipment) {
switch ($op) {
case 'save':
$google_order_number = uc_google_checkout_get_google_number($shipment->order_id);
=== modified file 'payment/uc_payment/uc_payment.admin.inc'
--- payment/uc_payment/uc_payment.admin.inc 2010-02-26 17:06:41 +0000
+++ payment/uc_payment/uc_payment.admin.inc 2010-03-04 21:05:15 +0000
@@ -289,7 +289,7 @@
unset($_SESSION['uc_payment_amount']);
unset($_SESSION['uc_payment_data']);
- uc_payment_process($form_state['values']['method'], $form_state['values']['order_id'],
+ uc_payment_process_payment($form_state['values']['method'], $form_state['values']['order_id'],
$form_state['values']['amount'], unserialize($form_state['values']['p_data']), FALSE,
$form_state['values']['p_selected']);
=== modified file 'payment/uc_payment/uc_payment.api.php'
--- payment/uc_payment/uc_payment.api.php 2010-02-02 16:01:30 +0000
+++ payment/uc_payment/uc_payment.api.php 2010-03-05 14:11:20 +0000
@@ -12,6 +12,35 @@
*/
/**
+ * Take action when a payment is entered for an order.
+ *
+ * @param $order
+ * The order object.
+ * @param $method
+ * The name of the payment method used.
+ * @param $amount
+ * The value of the payment.
+ * @param $account
+ * The user account that entered the order. When the payment is entered
+ * during checkout, this is probably the order's user. Otherwise, it is
+ * likely a store administrator.
+ * @param $data
+ * Extra data associated with the transaction.
+ * @param $comment
+ * Any comments from the user about the transaction.
+ */
+function hook_uc_payment_entered($order, $method, $amount, $account, $data, $comment) {
+ drupal_set_message(t('User @uid entered a @method payment of @amount for order @order_id.',
+ array(
+ '@uid' => $account->uid,
+ '@method' => $method,
+ '@amount' => uc_price($amount, array('location' => 'hook-payment', 'revision' => 'formatted-original')),
+ '@order_id' => $order->order_id,
+ ))
+ );
+}
+
+/**
* Register payment gateway callbacks.
*
* @see @link http://www.ubercart.org/docs/api/hook_payment_gateway @endlink
@@ -33,7 +62,7 @@
* - value: The name of a function that returns an array of settings form
* elements for the gateway.
*/
-function hook_payment_gateway() {
+function hook_uc_payment_gateway() {
$gateways[] = array(
'id' => 'test_gateway',
'title' => t('Test Gateway'),
@@ -55,7 +84,7 @@
* @return
* An array of payment methods.
*/
-function hook_payment_method() {
+function hook_uc_payment_method() {
$methods[] = array(
'id' => 'check',
'name' => t('Check'),
@@ -69,35 +98,6 @@
}
/**
- * Take action when a payment is entered for an order.
- *
- * @param $order
- * The order object.
- * @param $method
- * The name of the payment method used.
- * @param $amount
- * The value of the payment.
- * @param $account
- * The user account that entered the order. When the payment is entered
- * during checkout, this is probably the order's user. Otherwise, it is
- * likely a store administrator.
- * @param $data
- * Extra data associated with the transaction.
- * @param $comment
- * Any comments from the user about the transaction.
- */
-function hook_uc_payment_entered($order, $method, $amount, $account, $data, $comment) {
- drupal_set_message(t('User @uid entered a @method payment of @amount for order @order_id.',
- array(
- '@uid' => $account->uid,
- '@method' => $method,
- '@amount' => uc_price($amount, array('location' => 'hook-payment', 'revision' => 'formatted-original')),
- '@order_id' => $order->order_id,
- ))
- );
-}
-
-/**
* @} End of "addtogroup hooks".
*/
=== modified file 'payment/uc_payment/uc_payment.module'
--- payment/uc_payment/uc_payment.module 2010-03-03 16:14:51 +0000
+++ payment/uc_payment/uc_payment.module 2010-03-05 14:16:54 +0000
@@ -240,9 +240,9 @@
******************************************************************************/
/**
- * Implement hook_order().
+ * Implement hook_uc_order().
*/
-function uc_payment_order($op, &$arg1) {
+function uc_payment_uc_order($op, &$arg1) {
switch ($op) {
case 'submit':
$func = _payment_method_data($arg1->payment_method, 'callback');
@@ -289,9 +289,9 @@
}
/**
- * Implement hook_checkout_pane().
+ * Implement hook_uc_checkout_pane().
*/
-function uc_payment_checkout_pane() {
+function uc_payment_uc_checkout_pane() {
$panes[] = array(
'id' => 'payment',
'title' => t('Payment method'),
@@ -304,9 +304,9 @@
}
/**
- * Implement hook_order_pane().
+ * Implement hook_uc_order_pane().
*/
-function uc_payment_order_pane() {
+function uc_payment_uc_order_pane() {
$panes[] = array(
'id' => 'payment',
'callback' => 'uc_order_pane_payment',
@@ -321,9 +321,9 @@
}
/**
- * Implement hook_order_state().
+ * Implement hook_uc_order_state().
*/
-function uc_payment_order_state() {
+function uc_payment_uc_order_state() {
$states[] = array(
'id' => 'payment_received',
'title' => t('Payment received'),
@@ -500,7 +500,7 @@
* @return
* TRUE or FALSE indicating whether or not the payment was processed.
*/
-function uc_payment_process($method, $order_id, $amount, $data = NULL, $default = FALSE, $selected = NULL, $redirect = TRUE) {
+function uc_payment_process_payment($method, $order_id, $amount, $data = NULL, $default = FALSE, $selected = NULL, $redirect = TRUE) {
$result = array();
// Get an array of enabled payment gateways available for the payment method.
@@ -738,7 +738,7 @@
return $methods;
}
- $methods = module_invoke_all('payment_method');
+ $methods = module_invoke_all('uc_payment_method');
foreach ($methods as $i => $value) {
$methods[$i]['checkout'] = variable_get('uc_payment_method_'. $methods[$i]['id'] .'_checkout', $methods[$i]['checkout']);
$methods[$i]['weight'] = variable_get('uc_payment_method_'. $methods[$i]['id'] .'_weight', $methods[$i]['weight']);
@@ -764,7 +764,7 @@
* Build a list of payment gateways defined in the enabled modules.
*/
function _payment_gateway_list($filter = NULL, $enabled_only = FALSE) {
- $gateways = module_invoke_all('payment_gateway');
+ $gateways = module_invoke_all('uc_payment_gateway');
foreach ($gateways as $i => $value) {
$gateways[$i]['enabled'] = variable_get('uc_pg_'. $gateways[$i]['id'] .'_enabled', TRUE);
=== modified file 'payment/uc_payment_pack/uc_payment_pack.module'
--- payment/uc_payment_pack/uc_payment_pack.module 2010-03-03 15:47:24 +0000
+++ payment/uc_payment_pack/uc_payment_pack.module 2010-03-05 14:17:09 +0000
@@ -47,9 +47,9 @@
}
/**
- * Implement hook_payment_method().
+ * Implement hook_uc_payment_method().
*/
-function uc_payment_pack_payment_method() {
+function uc_payment_pack_uc_payment_method() {
$methods[] = array(
'id' => 'check',
'name' => t('Check', array(), array('context' => 'cheque')),
=== modified file 'payment/uc_paypal/uc_paypal.module'
--- payment/uc_paypal/uc_paypal.module 2010-03-03 15:47:24 +0000
+++ payment/uc_paypal/uc_paypal.module 2010-03-05 14:17:59 +0000
@@ -131,9 +131,9 @@
******************************************************************************/
/**
- * Implement hook_cart_pane().
+ * Implement hook_uc_cart_pane().
*/
-function uc_paypal_cart_pane() {
+function uc_paypal_uc_cart_pane() {
$panes[] = array(
'id' => 'uc_paypal_ec',
'title' => t('PayPal Express Checkout'),
@@ -149,9 +149,9 @@
}
/**
- * Implement hook_payment_gateway().
+ * Implement hook_uc_payment_gateway().
*/
-function uc_paypal_payment_gateway() {
+function uc_paypal_uc_payment_gateway() {
$gateways[] = array(
'id' => 'paypal_wpp',
'title' => t('PayPal Website Payments Pro'),
@@ -165,9 +165,9 @@
}
/**
- * Implement hook_payment_method().
+ * Implement hook_uc_payment_method().
*/
-function uc_paypal_payment_method() {
+function uc_paypal_uc_payment_method() {
$path = base_path() . drupal_get_path('module', 'uc_credit');
$title1 = ''
. t('PayPal - pay without sharing your financial information.');
=== modified file 'payment/uc_paypal/uc_paypal.pages.inc'
--- payment/uc_paypal/uc_paypal.pages.inc 2010-02-25 15:57:05 +0000
+++ payment/uc_paypal/uc_paypal.pages.inc 2010-03-05 14:11:20 +0000
@@ -342,7 +342,7 @@
$order->quote['rate'] = $_POST['rate'][isset($_POST['quote-option']) ? strval($_POST['quote-option']) : 0];
$order->quote['quote_form'] = rawurldecode($_POST['quote-form']);
- $methods = module_invoke_all('shipping_method');
+ $methods = module_invoke_all('uc_shipping_method');
$method = $methods[$order->quote['method']];
$label = is_null($_POST['quote-option']) ? t('Error calculating shipping') : $method['quote']['accessorials'][$order->quote['accessorials']];
$result = db_query("SELECT line_item_id FROM {uc_order_line_items} WHERE order_id = :id AND type = :type", array(':id' => $order->order_id, ':type' => 'shipping'));
=== modified file 'shipping/uc_flatrate/uc_flatrate.module'
--- shipping/uc_flatrate/uc_flatrate.module 2010-03-03 15:47:24 +0000
+++ shipping/uc_flatrate/uc_flatrate.module 2010-03-05 14:18:20 +0000
@@ -197,9 +197,9 @@
}
/**
- * Implement hook_shipping_method().
+ * Implement hook_uc_shipping_method().
*/
-function uc_flatrate_shipping_method() {
+function uc_flatrate_uc_shipping_method() {
$methods = array();
$enabled = variable_get('uc_quote_enabled', array());
=== modified file 'shipping/uc_quote/uc_quote.admin.inc'
--- shipping/uc_quote/uc_quote.admin.inc 2010-03-03 18:44:20 +0000
+++ shipping/uc_quote/uc_quote.admin.inc 2010-03-05 14:11:20 +0000
@@ -214,7 +214,7 @@
'#tree' => TRUE,
);
$weight = variable_get('uc_quote_type_weight', array());
- $shipping_methods = module_invoke_all('shipping_method');
+ $shipping_methods = module_invoke_all('uc_shipping_method');
$method_types = array();
foreach ($shipping_methods as $method) {
$method_types[$method['quote']['type']][] = $method['title'];
=== modified file 'shipping/uc_quote/uc_quote.api.php'
--- shipping/uc_quote/uc_quote.api.php 2010-02-10 18:54:01 +0000
+++ shipping/uc_quote/uc_quote.api.php 2010-03-05 14:11:20 +0000
@@ -52,7 +52,7 @@
* output this array so the method doesn't need to be found just for the
* package types.
*/
-function hook_shipping_method() {
+function hook_uc_shipping_method() {
$methods = array();
$enabled = variable_get('uc_quote_enabled', array('ups' => TRUE));
@@ -109,7 +109,7 @@
* @return
* An array of shipping types keyed by a machine-readable name.
*/
-function hook_shipping_type() {
+function hook_uc_shipping_type() {
$weight = variable_get('uc_quote_type_weight', array('small_package' => 0));
$types = array();
=== modified file 'shipping/uc_quote/uc_quote.module'
--- shipping/uc_quote/uc_quote.module 2010-03-04 21:24:00 +0000
+++ shipping/uc_quote/uc_quote.module 2010-03-05 14:19:48 +0000
@@ -307,7 +307,7 @@
* configurations.
*/
function uc_quote_ca_trigger() {
- $methods = module_invoke_all('shipping_method');
+ $methods = module_invoke_all('uc_shipping_method');
$triggers = array();
foreach ($methods as $id => $method) {
$triggers['get_quote_from_'. $id] = array(
@@ -399,7 +399,7 @@
}
// Otherwise, look harder.
if (is_array($order->line_items)) {
- $methods = module_invoke_all('shipping_method');
+ $methods = module_invoke_all('uc_shipping_method');
$accessorials = $methods[$settings['method']]['quote']['accessorials'];
foreach ($order->line_items as $line_item) {
@@ -417,7 +417,7 @@
*/
function uc_quote_condition_order_shipping_method_form($form_state, $settings = array()) {
$form = array();
- $methods = module_invoke_all('shipping_method');
+ $methods = module_invoke_all('uc_shipping_method');
$enabled = variable_get('uc_quote_enabled', array());
$options = array();
@@ -507,9 +507,9 @@
******************************************************************************/
/**
- * Implement hook_cart_pane().
+ * Implement hook_uc_cart_pane().
*/
-function uc_quote_cart_pane($items) {
+function uc_quote_uc_cart_pane($items) {
if (arg(0) == 'cart') {
if (!variable_get('uc_cap_quotes_enabled', FALSE) || (variable_get('uc_cart_delivery_not_shippable', TRUE) && !uc_cart_is_shippable())) {
return array();
@@ -528,7 +528,7 @@
/**
* Define the shipping quote checkout pane.
*/
-function uc_quote_checkout_pane() {
+function uc_quote_uc_checkout_pane() {
$panes[] = array('id' => 'quotes',
'callback' => 'uc_checkout_pane_quotes',
'title' => t('Calculate shipping cost'),
@@ -542,7 +542,7 @@
/**
* Defines the shipping quote order pane.
*/
-function uc_quote_order_pane() {
+function uc_quote_uc_order_pane() {
$panes = array();
$panes[] = array(
@@ -559,23 +559,23 @@
}
/**
- * Implement hook_add_to_cart().
- */
-function uc_quote_add_to_cart() {
- unset($_SESSION['quote']);
-}
-
-/**
- * Implement hook_update_cart_item().
- */
-function uc_quote_update_cart_item() {
- unset($_SESSION['quote']);
-}
-
-/**
- * Implement hook_order().
- */
-function uc_quote_order($op, &$arg1, $arg2) {
+ * Implement hook_uc_add_to_cart().
+ */
+function uc_quote_uc_add_to_cart() {
+ unset($_SESSION['quote']);
+}
+
+/**
+ * Implement hook_uc_update_cart_item().
+ */
+function uc_quote_uc_update_cart_item() {
+ unset($_SESSION['quote']);
+}
+
+/**
+ * Implement hook_uc_order().
+ */
+function uc_quote_uc_order($op, &$arg1, $arg2) {
switch ($op) {
case 'submit':
unset($_SESSION['quote']);
@@ -605,9 +605,9 @@
}
/**
- * Implement hook_line_item().
+ * Implement hook_uc_line_item().
*/
-function uc_quote_line_item() {
+function uc_quote_uc_line_item() {
$items[] = array(
'id' => 'shipping',
'title' => t('Shipping'),
@@ -622,9 +622,9 @@
}
/**
- * Implement hook_shipping_type().
+ * Implement hook_uc_shipping_type().
*/
-function uc_quote_shipping_type() {
+function uc_quote_uc_shipping_type() {
$weight = variable_get('uc_quote_type_weight', array('small_package' => 0));
$types = array();
@@ -750,7 +750,7 @@
$type_weight = $all_types[$type]['weight'];
}
}
- $methods = array_filter(module_invoke_all('shipping_method'), '_uc_quote_method_enabled');
+ $methods = array_filter(module_invoke_all('uc_shipping_method'), '_uc_quote_method_enabled');
uasort($methods, '_uc_quote_type_sort');
$method_choices = array();
foreach ($methods as $method) {
@@ -951,7 +951,7 @@
$arg1->quote['method'] = $quote_option[0];
$arg1->quote['accessorials'] = $quote_option[1];
$_SESSION['quote']['quote_form'] = rawurldecode($_POST['quote-form']);
- $methods = array_filter(module_invoke_all('shipping_method'), '_uc_quote_method_enabled');
+ $methods = array_filter(module_invoke_all('uc_shipping_method'), '_uc_quote_method_enabled');
$method = $methods[$quote_option[0]];
$quote_data = array();
@@ -1103,7 +1103,7 @@
$order->quote['method'] = $quote_option[0];
$order->quote['accessorials'] = $quote_option[1];
$order->quote['quote_form'] = rawurldecode($_POST['quote-form']);
- $methods = array_filter(module_invoke_all('shipping_method'), '_uc_quote_method_enabled');
+ $methods = array_filter(module_invoke_all('uc_shipping_method'), '_uc_quote_method_enabled');
$method = $methods[$quote_option[0]];
$quote_data = array();
@@ -1184,7 +1184,7 @@
'#markup' => '
'. print_r($product, TRUE) .''); drupal_set_message('$order:
'. print_r($order, TRUE) .''); @@ -286,7 +286,7 @@ * - weight: The list position of the state. * - scope: Either "specific" or "general". */ -function hook_order_state() { +function hook_uc_order_state() { $states[] = array( 'id' => 'canceled', 'title' => t('Canceled'), === modified file 'uc_order/uc_order.line_item.inc' --- uc_order/uc_order.line_item.inc 2010-02-08 21:59:21 +0000 +++ uc_order/uc_order.line_item.inc 2010-03-05 14:11:21 +0000 @@ -180,13 +180,13 @@ return $items; } - $items = module_invoke_all('line_item', NULL); + $items = module_invoke_all('uc_line_item', NULL); foreach ($items as $i => $value) { $items[$i]['enabled'] = variable_get('uc_li_'. $items[$i]['id'] .'_enabled', (!isset($items[$i]['enabled']) ? TRUE : $items[$i]['enabled'])); $items[$i]['weight'] = variable_get('uc_li_'. $items[$i]['id'] .'_weight', (!isset($items[$i]['weight']) ? 1 : $items[$i]['weight'])); } - drupal_alter('line_item_data', $items); + drupal_alter('uc_line_item_data', $items); usort($items, 'uc_weight_sort'); === modified file 'uc_order/uc_order.module' --- uc_order/uc_order.module 2010-03-03 18:44:20 +0000 +++ uc_order/uc_order.module 2010-03-05 14:27:35 +0000 @@ -576,9 +576,9 @@ ******************************************************************************/ /** - * Implement hook_order_pane(). + * Implement hook_uc_order_pane(). */ -function uc_order_order_pane() { +function uc_order_uc_order_pane() { $panes[] = array( 'id' => 'ship_to', 'callback' => 'uc_order_pane_ship_to', @@ -656,9 +656,9 @@ } /** - * Implement hook_order_state(). + * Implement hook_uc_order_state(). */ -function uc_order_order_state() { +function uc_order_uc_order_state() { $states[] = array( 'id' => 'canceled', 'title' => t('Canceled'), @@ -688,9 +688,9 @@ } /** - * Implement hook_line_item(). + * Implement hook_uc_line_item(). */ -function uc_order_line_item() { +function uc_order_uc_line_item() { $items[] = array( 'id' => 'subtotal', 'title' => t('Subtotal'), @@ -1109,7 +1109,7 @@ if (is_array($order->products)) { foreach ($order->products as $product) { - drupal_alter('order_product', $product, $order); + drupal_alter('uc_order_product', $product, $order); uc_order_product_save($order->order_id, $product); } } @@ -1350,7 +1350,7 @@ } } foreach ($items as &$item) { - drupal_alter('line_item', $item, $order); + drupal_alter('uc_line_item', $item, $order); } usort($items, 'uc_weight_sort'); @@ -1379,8 +1379,8 @@ // Attempt the update if the order exists. if ($order !== FALSE) { // Return false if any module says the update is not good to go. - foreach (module_implements('order') as $module) { - $function = $module .'_order'; + foreach (module_implements('uc_order') as $module) { + $function = $module .'_uc_order'; // $order must be passed by reference. if (function_exists($function) && ($return = $function('can_update', $order, $status))){ for ($i = 0; $i < count($return); $i++) { @@ -1493,8 +1493,8 @@ * be passed by reference. */ function uc_order_module_invoke($op, &$order, $edit) { - foreach (module_implements('order') as $module) { - $function = $module .'_order'; + foreach (module_implements('uc_order') as $module) { + $function = $module .'_uc_order'; if (function_exists($function)) { $function($op, $order, $edit); } @@ -1554,8 +1554,8 @@ $total += uc_line_items_calculate($order); - foreach (module_implements('order') as $module) { - $function = $module .'_order'; + foreach (module_implements('uc_order') as $module) { + $function = $module .'_uc_order'; // $order must be passed by reference. Since hook_order() may be // unknowingly implemented (see date_order() in date_api.module), we verify // the results are numeric before continuing. @@ -1598,8 +1598,8 @@ } // See if any other modules have a say in the matter... - foreach (module_implements('cart_item') as $module) { - $function = $module .'_cart_item'; + foreach (module_implements('uc_cart_item') as $module) { + $function = $module .'_uc_cart_item'; if (function_exists($function) && $function('can_ship', $product)) { // $product must be passed by reference. $result[] = TRUE; @@ -1750,7 +1750,7 @@ * ids for use in a SQL query. */ function uc_order_state_list($scope = 'all', $sql = FALSE) { - $states = module_invoke_all('order_state'); + $states = module_invoke_all('uc_order_state'); foreach ($states as $i => $value) { if ($scope != 'all' && $states[$i]['scope'] != $scope) { unset($states[$i]); @@ -1937,8 +1937,8 @@ } else { // See if any modules have a say in this order's eligibility for deletion - foreach (module_implements('order') as $module) { - $function = $module .'_order'; + foreach (module_implements('uc_order') as $module) { + $function = $module .'_uc_order'; // $order must be passed by reference. if (function_exists($function) && ($response = $function('can_delete', $order, NULL))) { // Break out early if possible. @@ -1961,7 +1961,7 @@ } } - $extra = module_invoke_all('order_actions', $order); + $extra = module_invoke_all('uc_order_actions', $order); if (count($extra)) { $actions = array_merge($actions, $extra); } === modified file 'uc_order/uc_order.order_pane.inc' --- uc_order/uc_order.order_pane.inc 2010-02-26 20:08:47 +0000 +++ uc_order/uc_order.order_pane.inc 2010-03-05 14:11:21 +0000 @@ -1084,7 +1084,7 @@ return $panes; } - $panes = module_invoke_all('order_pane', NULL); + $panes = module_invoke_all('uc_order_pane', NULL); foreach ($panes as $i => $value) { $panes[$i]['enabled'] = variable_get('uc_order_pane_'. $panes[$i]['id'] .'_enabled', (!isset($panes[$i]['enabled']) ? TRUE : $panes[$i]['enabled'])); $panes[$i]['weight'] = variable_get('uc_order_pane_'. $panes[$i]['id'] .'_weight_'. $view, (!isset($panes[$i]['weight']) ? 0 : $panes[$i]['weight'])); === modified file 'uc_product/uc_product.admin.inc' --- uc_product/uc_product.admin.inc 2010-03-03 16:42:05 +0000 +++ uc_product/uc_product.admin.inc 2010-03-05 14:28:00 +0000 @@ -346,7 +346,7 @@ */ function uc_product_feature_settings_form($form, &$form_state) { $titles = array(); - $features = module_invoke_all('product_feature'); + $features = module_invoke_all('uc_product_feature'); foreach ($features as $feature) { $titles[] = $feature['title']; } @@ -511,7 +511,7 @@ * uc_product_feature_add_form_submit() */ function uc_product_feature_add_form($form, &$form_state) { - foreach (module_invoke_all('product_feature') as $feature) { + foreach (module_invoke_all('uc_product_feature') as $feature) { $options[$feature['id']] = $feature['title']; } ksort($options); @@ -660,10 +660,10 @@ variable_set('comment_'. $pcid, variable_get('comment_product', COMMENT_NODE_READ_WRITE)); } - module_invoke_all('product_class', $pcid, 'insert'); + module_invoke_all('uc_product_class', $pcid, 'insert'); } else { - module_invoke_all('product_class', $pcid, 'update'); + module_invoke_all('uc_product_class', $pcid, 'update'); } node_types_rebuild(); @@ -711,7 +711,7 @@ db_delete('uc_product_classes') ->condition('pcid', $form_state['values']['pcid']) ->execute(); - module_invoke_all('product_class', $form_state['values']['pcid'], 'delete'); + module_invoke_all('uc_product_class', $form_state['values']['pcid'], 'delete'); uc_product_node_info(TRUE); node_types_rebuild(); menu_rebuild(); === modified file 'uc_product/uc_product.api.php' --- uc_product/uc_product.api.php 2010-02-02 16:01:30 +0000 +++ uc_product/uc_product.api.php 2010-03-05 14:11:21 +0000 @@ -25,7 +25,7 @@ * additional information to the node type because it is a product type * should delete this information. */ -function hook_product_class($type, $op) { +function hook_uc_product_class($type, $op) { switch ($op) { case 'delete': db_query("DELETE FROM {uc_class_attributes} WHERE pcid = '%s'", $type); @@ -48,7 +48,7 @@ * @return * A structured array that can be fed into drupal_render(). */ -function hook_product_description($product) { +function hook_uc_product_description($product) { $description = array( 'attributes' => array( '#product' => array( @@ -98,26 +98,11 @@ * @param $product * The product being described. */ -function hook_product_description_alter(&$description, $product) { +function hook_uc_product_description_alter(&$description, $product) { $description['attributes']['#weight'] = 2; } /** - * List node types which should be considered products. - * - * Trusts the duck philosophy of object identification: if it walks like a duck, - * quacks like a duck, and has feathers like a duck, it's probably a duck. - * Products are nodes with prices, SKUs, and everything else Übercart expects - * them to have. - * - * @return - * Array of node type ids. - */ -function hook_product_types() { - return array('product_kit'); -} - -/** * Notify core of any SKUs your module adds to a given node. * * NOTE: DO NOT map the array keys, as the possibility for numeric SKUs exists, and @@ -141,6 +126,21 @@ } /** + * List node types which should be considered products. + * + * Trusts the duck philosophy of object identification: if it walks like a duck, + * quacks like a duck, and has feathers like a duck, it's probably a duck. + * Products are nodes with prices, SKUs, and everything else Übercart expects + * them to have. + * + * @return + * Array of node type ids. + */ +function hook_uc_product_types() { + return array('product_kit'); +} + +/** * @} End of "addtogroup hooks". */ === modified file 'uc_product/uc_product.module' --- uc_product/uc_product.module 2010-03-04 20:24:44 +0000 +++ uc_product/uc_product.module 2010-03-05 14:53:54 +0000 @@ -102,7 +102,7 @@ 'type' => MENU_DEFAULT_LOCAL_TASK, 'file' => 'uc_product.admin.inc', ); - $features = module_invoke_all('product_feature'); + $features = module_invoke_all('uc_product_feature'); if (!empty($features)) { $items['node/%node/edit/features'] = array( 'title' => 'Features', @@ -1137,18 +1137,20 @@ ******************************************************************************/ /** - * Implement hook_product_types(). + * Implement hook_uc_product_types(). */ -function uc_product_product_types() { +function uc_product_uc_product_types() { return array_keys(uc_product_node_info()); } /** + * Implement hook_uc_store_status(). + * * Display the status of the product image handlers. * * @see uc_product_image_defaults() */ -function uc_product_store_status() { +function uc_product_uc_store_status() { module_load_include('inc', 'content', 'includes/content.crud'); // Check for filefields on products. if ($field = variable_get('uc_image_product', '')) { @@ -1176,9 +1178,9 @@ } /** - * Implement hook_cart_display(). + * Implement hook_uc_cart_display(). */ -function uc_product_cart_display($item) { +function uc_product_uc_cart_display($item) { $node = node_load($item->nid); $element = array(); $element['nid'] = array('#type' => 'value', '#value' => $node->nid); @@ -1219,9 +1221,9 @@ } /** - * Implement hook_update_cart_item(). + * Implement hook_uc_update_cart_item(). */ -function uc_product_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { +function uc_product_uc_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { if (!$nid) return NULL; $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id(); if ($qty < 1) { @@ -1241,17 +1243,17 @@ } /** - * Implement hook_add_to_cart_data(). + * Implement hook_uc_add_to_cart_data(). */ -function uc_product_add_to_cart_data($form_values) { +function uc_product_uc_add_to_cart_data($form_values) { $node = node_load($form_values['nid']); return array('shippable' => $node->shippable); } /** - * Implement hook_product_class(). + * Implement hook_uc_product_class(). */ -function uc_product_product_class($pcid, $op) { +function uc_product_uc_product_class($pcid, $op) { switch ($op) { case 'insert': db_update('node_type') @@ -1453,7 +1455,7 @@ * @see uc_catalog_buy_it_now_form() */ function uc_catalog_buy_it_now_form_submit($form, &$form_state) { - $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], 1, module_invoke_all('add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); + $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], 1, module_invoke_all('uc_add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); } /** @@ -1563,7 +1565,7 @@ * @see uc_product_add_to_cart_form() */ function uc_product_add_to_cart_form_submit($form, &$form_state) { - $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], $form_state['values']['qty'], module_invoke_all('add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); + $form_state['redirect'] = uc_cart_add_item($form_state['values']['nid'], $form_state['values']['qty'], module_invoke_all('uc_add_to_cart_data', $form_state['values']), NULL, variable_get('uc_cart_add_item_msg', TRUE)); } /** @@ -1685,7 +1687,7 @@ * Return an array of product node types. */ function uc_product_types() { - return module_invoke_all('product_types'); + return module_invoke_all('uc_product_types'); } /** @@ -1874,10 +1876,10 @@ */ function uc_product_get_description($product) { // Run through implementations of hook_product_description() - $description = module_invoke_all('product_description', $product); + $description = module_invoke_all('uc_product_description', $product); // Now allow alterations via hook_product_description_alter() - drupal_alter('product_description', $description, $product); + drupal_alter('uc_product_description', $description, $product); return drupal_render($description); } @@ -1912,7 +1914,7 @@ static $features; if (empty($features)) { - foreach (module_invoke_all('product_feature') as $feature) { + foreach (module_invoke_all('uc_product_feature') as $feature) { $features[$feature['id']] = $feature; } } === modified file 'uc_product_kit/uc_product_kit.module' --- uc_product_kit/uc_product_kit.module 2010-03-03 18:44:20 +0000 +++ uc_product_kit/uc_product_kit.module 2010-03-05 14:30:45 +0000 @@ -911,16 +911,16 @@ ******************************************************************************/ /** - * Implement hook_product_types(). + * Implement hook_uc_product_types(). */ -function uc_product_kit_product_types() { +function uc_product_kit_uc_product_types() { return array('product_kit'); } /** - * Implement hook_store_status(). + * Implement hook_uc_store_status(). */ -function uc_product_kit_store_status() { +function uc_product_kit_uc_store_status() { if (module_exists('filefield')) { module_load_include('inc', 'content', 'includes/content.crud'); // Check for filefields on products. @@ -939,9 +939,9 @@ } /** - * Implement hook_add_to_cart(). + * Implement hook_uc_add_to_cart(). */ -function uc_product_kit_add_to_cart($nid, $qty, $kit_data) { +function uc_product_kit_uc_add_to_cart($nid, $qty, $kit_data) { $node = node_load($nid); if ($node->type == 'product_kit') { $cart = uc_cart_get_contents(); @@ -950,7 +950,7 @@ $product_data = array(); foreach ($node->products as $product) { - $data = array('kit_id' => $node->nid, 'module' => 'uc_product_kit') + module_invoke_all('add_to_cart_data', $kit_data['products'][$product->nid]); + $data = array('kit_id' => $node->nid, 'module' => 'uc_product_kit') + module_invoke_all('uc_add_to_cart_data', $kit_data['products'][$product->nid]); $product_data[$product->nid] = $data; foreach ($cart as $item) { if ($item->nid == $product->nid && isset($item->data['kit_id']) && $item->data['kit_id'] == $node->nid) { @@ -994,9 +994,9 @@ } /** - * Implement hook_cart_item(). + * Implement hook_uc_cart_item(). */ -function uc_product_kit_cart_item($op, &$item) { +function uc_product_kit_uc_cart_item($op, &$item) { switch ($op) { case 'load': if (isset($item->data['kit_id']) && ($kit = node_load($item->data['kit_id'])) && $kit->mutable != UC_PRODUCT_KIT_MUTABLE) { @@ -1010,7 +1010,7 @@ } /** - * Implement hook_order_product_alter(). + * Implement hook_uc_order_product_alter(). * * The hookups for making product kits work on the order edit admin screen. * @@ -1019,7 +1019,7 @@ * @param $order * The order being edited. */ -function uc_product_kit_order_product_alter(&$product, $order) { +function uc_product_kit_uc_order_product_alter(&$product, $order) { if ($product->type !== 'product_kit') { return; } @@ -1031,12 +1031,12 @@ // Load all the attributes/discounts/etc as if we were adding it to the // cart. - $kit_product->data = module_invoke_all('add_to_cart_data', $_POST['sub_products'][$kit_product->nid]); + $kit_product->data = module_invoke_all('uc_add_to_cart_data', $_POST['sub_products'][$kit_product->nid]); $kit_product->data['kit_id'] = $product->nid; // Run the product through the alter mill. - foreach (module_implements('cart_item') as $module) { - $function = $module .'_cart_item'; + foreach (module_implements('uc_cart_item') as $module) { + $function = $module .'_uc_cart_item'; if (function_exists($function)) { // $product must be passed by reference. $function('load', $kit_product); @@ -1058,7 +1058,7 @@ ); $kit_product->price = uc_price($price_info, $context); - drupal_alter('order_product', $kit_product, $order); + drupal_alter('uc_order_product', $kit_product, $order); // Save the individual item to the order. uc_order_product_save($order->order_id, $kit_product); @@ -1068,7 +1068,7 @@ $product->skip_save = TRUE; } /** - * Implement hook_cart_display(). + * Implement hook_uc_cart_display(). * * Displays either the kit as a whole, or each individual product based on the * store configuration. Each product in the cart that was added by uc_product_kit @@ -1081,7 +1081,7 @@ * @return * A form element array to be processed by uc_cart_view_form(). */ -function uc_product_kit_cart_display($item) { +function uc_product_kit_uc_cart_display($item) { static $elements = array(); static $products; $unique_id = $item->data['unique_id']; @@ -1171,11 +1171,11 @@ } /** - * Implement hook_update_cart_item(). + * Implement hook_uc_update_cart_item(). * * Handles individual products or entire kits. */ -function uc_product_kit_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { +function uc_product_kit_uc_update_cart_item($nid, $data = array(), $qty, $cid = NULL) { if (!$nid) return NULL; $cid = !(is_null($cid) || empty($cid)) ? $cid : uc_cart_get_id(); if ($qty < 1) { === modified file 'uc_roles/uc_roles.module' --- uc_roles/uc_roles.module 2010-03-03 15:47:24 +0000 +++ uc_roles/uc_roles.module 2010-03-05 14:46:17 +0000 @@ -492,9 +492,9 @@ ******************************************************************************/ /** - * Implement hook_cart_item(). + * Implement hook_uc_cart_item(). */ -function uc_roles_cart_item($op, &$item) { +function uc_roles_uc_cart_item($op, &$item) { switch ($op) { case 'can_ship': $roles = db_query("SELECT * FROM {uc_roles_products} WHERE nid = :nid", array(':nid' => $item->nid)); @@ -519,9 +519,9 @@ } /** - * Implement hook_product_feature(). + * Implement hook_uc_product_feature(). */ -function uc_roles_product_feature() { +function uc_roles_uc_product_feature() { $features[] = array( 'id' => 'role', 'title' => t('Role assignment'), @@ -534,9 +534,9 @@ } /** - * Implement hook_store_status(). + * Implement hook_uc_store_status(). */ -function uc_roles_store_status() { +function uc_roles_uc_store_status() { $message = array(); $role_choices = _uc_roles_get_choices(); if (empty($role_choices)) { === modified file 'uc_store/uc_store.admin.inc' --- uc_store/uc_store.admin.inc 2010-02-26 17:06:41 +0000 +++ uc_store/uc_store.admin.inc 2010-03-05 14:11:22 +0000 @@ -30,7 +30,7 @@ ); } - $results = module_invoke_all('store_status'); + $results = module_invoke_all('uc_store_status'); foreach ($results as $message) { switch ($message['status']) { === modified file 'uc_store/uc_store.api.php' --- uc_store/uc_store.api.php 2010-02-02 16:01:30 +0000 +++ uc_store/uc_store.api.php 2010-03-05 14:11:22 +0000 @@ -12,38 +12,6 @@ */ /** - * Add status messages to the "Store administration" page. - * - * This hook is used to add items to the store status table on the main store - * administration screen. Each item gets a row in the table that consists of a - * status icon, title, and description. These items should be used to give - * special instructions, notifications, or indicators for components of the cart - * enabled by the modules. At a glance, a store owner should be able to look here - * and see if a critical component of your module is not functioning properly. - * - * For example, if the catalog module is installed and it cannot find the catalog - * taxonomy vocabulary, it will show an error message here to alert the store - * administrator. - * - * @return - * An array of tore status items which are arrays with the following keys: - * - "status": "ok", "warning", or "error" depending on the message. - * - "title" The title of the status message or module that defines it. - * - "desc": The description; can be any message, including links to pages and - * forms that deal with the issue being reported. - */ -function hook_store_status() { - if ($key = uc_credit_encryption_key()) { - $statuses[] = array( - 'status' => 'ok', - 'title' => t('Credit card encryption'), - 'desc' => t('Credit card data in the database is currently being encrypted.'), - ); - } - return $statuses; -} - -/** * Allow modules to alter the TAPIr table after the rows are populated. * * The example below adds a value for the custom 'designer' column to the table @@ -203,6 +171,38 @@ } /** + * Add status messages to the "Store administration" page. + * + * This hook is used to add items to the store status table on the main store + * administration screen. Each item gets a row in the table that consists of a + * status icon, title, and description. These items should be used to give + * special instructions, notifications, or indicators for components of the cart + * enabled by the modules. At a glance, a store owner should be able to look here + * and see if a critical component of your module is not functioning properly. + * + * For example, if the catalog module is installed and it cannot find the catalog + * taxonomy vocabulary, it will show an error message here to alert the store + * administrator. + * + * @return + * An array of tore status items which are arrays with the following keys: + * - "status": "ok", "warning", or "error" depending on the message. + * - "title" The title of the status message or module that defines it. + * - "desc": The description; can be any message, including links to pages and + * forms that deal with the issue being reported. + */ +function hook_uc_store_status() { + if ($key = uc_credit_encryption_key()) { + $statuses[] = array( + 'status' => 'ok', + 'title' => t('Credit card encryption'), + 'desc' => t('Credit card data in the database is currently being encrypted.'), + ); + } + return $statuses; +} + +/** * @} End of "addtogroup hooks". */ === modified file 'uc_taxes/uc_taxes.api.php' --- uc_taxes/uc_taxes.api.php 2010-02-02 16:01:30 +0000 +++ uc_taxes/uc_taxes.api.php 2010-03-05 14:11:22 +0000 @@ -19,7 +19,7 @@ * @return * An array of tax line item objects keyed by a module-specific id. */ -function hook_calculate_tax($order) { +function hook_uc_calculate_tax($order) { global $user; if (is_numeric($order)) { $order = uc_order_load($order); === modified file 'uc_taxes/uc_taxes.module' --- uc_taxes/uc_taxes.module 2010-03-03 15:47:24 +0000 +++ uc_taxes/uc_taxes.module 2010-03-05 14:31:56 +0000 @@ -131,9 +131,9 @@ ******************************************************************************/ /** - * Implement hook_line_item(). + * Implement hook_uc_line_item(). */ -function uc_taxes_line_item() { +function uc_taxes_uc_line_item() { $items[] = array( 'id' => 'tax', 'title' => t('Tax'), @@ -157,11 +157,11 @@ } /** - * Implement hook_order(). + * Implement hook_uc_order(). * * Update and save tax line items to the order. */ -function uc_taxes_order($op, $arg1, $arg2) { +function uc_taxes_uc_order($op, $arg1, $arg2) { switch ($op) { case 'save': $changes = array(); @@ -377,7 +377,7 @@ */ function uc_taxes_calculate($order) { // Find any taxes specified by enabled modules. - $taxes = module_invoke_all('calculate_tax', $order); + $taxes = module_invoke_all('uc_calculate_tax', $order); return $taxes; } @@ -385,7 +385,7 @@ /** * Calculate the amount and types of taxes that apply to an order. */ -function uc_taxes_calculate_tax($order) { +function uc_taxes_uc_calculate_tax($order) { global $user; if (is_numeric($order)) { $order = uc_order_load($order); @@ -469,7 +469,7 @@ function uc_taxes_javascript() { $order = $_POST['order']; if ($order = unserialize(rawurldecode($order))) { - $taxes = module_invoke_all('calculate_tax', $order); + $taxes = module_invoke_all('uc_calculate_tax', $order); $callback = _line_item_data('tax_subtotal', 'callback'); if (function_exists($callback)) { $subtotal = $callback('load', $order);