security update link,module_filters,search_api_solr,ubercart,views

This commit is contained in:
2019-04-24 16:39:12 +02:00
parent 0aea7a0db1
commit 514f3bd89e
497 changed files with 9038 additions and 3662 deletions

View File

@@ -30,7 +30,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
/**
* Creates a new order.
*/
function createOrder($fields = array()) {
protected function createOrder($fields = array()) {
$order = uc_order_new();
foreach ($fields as $key => $value) {
$order->$key = $value;
@@ -55,7 +55,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
return $order;
}
function testCartAPI() {
/**
* Tests cart API.
*/
public function testCartApi() {
// Test the empty cart.
$items = uc_cart_get_contents();
$this->assertEqual($items, array(), 'Cart is an empty array.');
@@ -99,7 +102,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
foreach ($items as $item) {
uc_cart_remove_item($item->nid, NULL, $item->data);
}
// @TODO: remove the need for this
// @todo Remove the need for this.
uc_cart_get_contents(NULL, 'rebuild');
$items = uc_cart_get_contents();
@@ -113,7 +116,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertEqual($items, array(), 'Cart is emptied correctly.');
}
function testCart() {
/**
* Tests basic cart functionality.
*/
public function testCart() {
module_enable(array('uc_cart_entity_test'));
// Test the empty cart.
@@ -160,7 +166,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertText('hook_uc_cart_item_delete fired');
}
function testCartMerge() {
/**
* Tests that anonymous cart is merged into authenticated cart upon login.
*/
public function testCartMerge() {
// Add an item to the cart as an anonymous user.
$this->drupalLogin($this->customer);
$this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
@@ -178,7 +187,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertFieldByName('items[0][qty]', 2, t('The product quantity is 2.'));
}
function testDeletedCartItem() {
/**
* Tests that cart automatically removes products that have been deleted.
*/
public function testDeletedCartItem() {
// Add a product to the cart, then delete the node.
$this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
node_delete($this->product->nid);
@@ -189,7 +201,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertEqual(uc_cart_get_total_qty(), 0, 'There are no items in the cart.');
}
function testMaximumQuantityRule() {
/**
* Tests Rule integration for uc_cart_maximum_product_qty reaction rule.
*/
public function testMaximumQuantityRule() {
// Enable the example maximum quantity rule.
$rule = rules_config_load('uc_cart_maximum_product_qty');
$rule->active = TRUE;
@@ -204,8 +219,12 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertFieldByName('items[0][qty]', 10);
}
function testCheckout() {
// Allow customer to specify username and password, but don't log in after checkout.
/**
* Tests the checkout process.
*/
public function testCheckout() {
// Allow customer to specify username and password,
// but don't log in after checkout.
$settings = array(
'uc_cart_new_account_name' => TRUE,
'uc_cart_new_account_password' => TRUE,
@@ -285,7 +304,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->drupalLogout();
$this->drupalLogin($new_user);
// Test again with an existing email address
// Test again with an existing email address.
$this->drupalLogout();
$this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
$this->checkout(array('panes[customer][primary_email]' => $this->customer->mail));
@@ -293,7 +312,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertRaw('order has been attached to the account we found');
}
function testCheckoutNewUsername() {
/**
* Tests generating a new account at checkout.
*/
public function testCheckoutNewUsername() {
// Configure the checkout for this test.
$this->drupalLogin($this->adminUser);
$settings = array(
@@ -326,7 +348,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertText('A new account has been created');
}
function testCheckoutBlockedUser() {
/**
* Tests blocked user checkout.
*/
public function testCheckoutBlockedUser() {
// Block user after checkout.
$settings = array(
'uc_new_customer_status_active' => FALSE,
@@ -347,7 +372,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertTrue(empty($mail), 'No unblocked user email found.');
}
function testCheckoutLogin() {
/**
* Tests logging in the customer after checkout.
*/
public function testCheckoutLogin() {
// Log in after checkout.
variable_set('uc_new_customer_login', TRUE);
@@ -371,7 +399,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$this->assertText('There are no products in your shopping cart.');
}
function testCheckoutComplete() {
/**
* Tests checkout complete functioning.
*/
public function testCheckoutComplete() {
// Payment notification is received first.
$order_data = array('primary_email' => 'simpletest@ubercart.org');
$order = $this->createOrder($order_data);
@@ -381,7 +412,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
// Check that a new account was created.
$this->assertTrue(strpos($output['#message'], 'new account has been created') !== FALSE, 'Checkout message mentions new account.');
// 2 e-mails: new account, customer invoice
// 2 e-mails: new account, customer invoice.
$mails = $this->drupalGetMails();
$this->assertEqual(count($mails), 2, '2 e-mails were sent.');
variable_del('drupal_test_email_collector');
@@ -397,7 +428,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$output = uc_cart_complete_sale($order, TRUE);
uc_payment_enter($order->order_id, 'SimpleTest', $order->order_total);
// 2 e-mails: new account, customer invoice
// 2 e-mails: new account, customer invoice.
$mails = $this->drupalGetMails();
$this->assertEqual(count($mails), 2, '2 e-mails were sent.');
variable_del('drupal_test_email_collector');
@@ -415,13 +446,13 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
// Check that no new account was created.
$this->assertTrue(strpos($output['#message'], 'order has been attached to the account') !== FALSE, 'Checkout message mentions existing account.');
// 1 e-mail: customer invoice
// 1 e-mail: customer invoice.
$mails = $this->drupalGetMails();
$this->assertEqual(count($mails), 1, '1 e-mail was sent.');
variable_del('drupal_test_email_collector');
}
function testCheckoutRoleAssignment() {
public function testCheckoutRoleAssignment() {
// Add role assignment to the test product.
$rid = $this->drupalCreateRole(array('access content'));
$this->drupalLogin($this->adminUser);
@@ -445,7 +476,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$order = uc_order_load($order->order_id);
$this->assertEqual($order->order_status, 'payment_received', 'Shippable order was set to payment received.');
// 3 e-mails: new account, customer invoice, role assignment
// 3 e-mails: new account, customer invoice, role assignment.
$mails = $this->drupalGetMails();
$this->assertEqual(count($mails), 3, '3 e-mails were sent.');
variable_del('drupal_test_email_collector');
@@ -462,7 +493,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$order = uc_order_load($order->order_id);
$this->assertEqual($order->order_status, 'completed', 'Non-shippable order was set to completed.');
// 2 e-mails: customer invoice, role assignment
// 2 e-mails: customer invoice, role assignment.
$mails = $this->drupalGetMails();
$this->assertEqual(count($mails), 2, '2 e-mails were sent.');
variable_del('drupal_test_email_collector');
@@ -471,7 +502,7 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
/**
* Tests that cart orders are marked abandoned after a timeout.
*/
function testCartOrderTimeout() {
public function testCartOrderTimeout() {
$this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
$this->drupalPost('cart', array(), 'Checkout');
$this->assertText(
@@ -509,7 +540,8 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
$order_id = db_query("SELECT order_id FROM {uc_orders} WHERE delivery_first_name = :name", array(':name' => $oldname))->fetchField();
if ($order_id) {
// Go to a different page, then back to order - make sure order_id is the same.
// Go to a different page, then back to order to make sure
// order_id is the same.
$this->drupalGet('<front>');
$this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
$this->drupalPost('cart', array(), 'Checkout');
@@ -527,7 +559,8 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
->execute();
$old_order = uc_order_load($order_id);
// Go to a different page, then back to order - verify that we are using a new order.
// Go to a different page, then back to order to verify that we are
// using a new order.
$this->drupalGet('<front>');
$this->drupalPost('cart', array(), 'Checkout');
$this->assertNoRaw($oldname, 'Customer name was cleared after timeout.');
@@ -546,7 +579,10 @@ class UbercartCartCheckoutTestCase extends UbercartTestHelper {
}
}
function testCustomerInformationCheckoutPane() {
/**
* Tests functioning of customer information pane on checkout page.
*/
public function testCustomerInformationCheckoutPane() {
// Log in as a customer and add an item to the cart.
$this->drupalLogin($this->customer);
$this->drupalPost('node/' . $this->product->nid, array(), t('Add to cart'));
@@ -588,7 +624,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
);
}
function testAddToCartRedirect() {
/**
* Tests add-to-cart redirection.
*/
public function testAddToCartRedirect() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/store/settings/cart');
$this->assertField(
@@ -625,7 +664,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
$this->assertTrue($this->getUrl() == $url, 'Add to cart no-redirect works with a query string.');
}
function testMinimumSubtotal() {
/**
* Tests minimum subtotal for checkout.
*/
public function testMinimumSubtotal() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/store/settings/cart');
$this->assertField(
@@ -640,12 +682,12 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
t('Save configuration')
);
// Create two products, one below the minimum price, and one above the minimum price.
// Create two products, one below the minimum price and one above.
$product_below_limit = $this->createProduct(array('sell_price' => $minimum_subtotal - 1));
$product_above_limit = $this->createProduct(array('sell_price' => $minimum_subtotal + 1));
$this->drupalLogout();
// Check to see if the lower priced product triggers the minimum price logic.
// Checks if the lower priced product triggers the minimum price logic.
$this->drupalPost(
'node/' . $product_below_limit->nid,
array(),
@@ -660,7 +702,8 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
t('Prevented checkout below the minimum order total.')
);
// Add another product to the cart, and verify that we land on the checkout page.
// Add another product to the cart, and verify that we land on
// the checkout page.
$this->drupalPost(
'node/' . $product_above_limit->nid,
array(),
@@ -674,7 +717,7 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
$this->assertText('Enter your billing address and information here.');
}
function testEmptyCart() {
public function testEmptyCart() {
// Test that the feature is not enabled by default.
$this->drupalPost('node/' . $this->product->nid, array(), 'Add to cart');
$this->assertNoRaw('Empty cart');
@@ -693,7 +736,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
$this->assertText('There are no products in your shopping cart.');
}
function testContinueShopping() {
/**
* Tests that continue shopping link returns customer to the correct place.
*/
public function testContinueShopping() {
// Continue shopping link should take you back to the product page.
$this->drupalPost(
'node/' . $this->product->nid,
@@ -747,7 +793,10 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
);
}
function testCartBreadcrumb() {
/**
* Tests the shopping cart page breadcrumb.
*/
public function testCartBreadcrumb() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/store/settings/cart');
$this->assertField(
@@ -785,6 +834,7 @@ class UbercartCartSettingsTestCase extends UbercartTestHelper {
t('The breadcrumb link is set correctly.')
);
}
}
/**
@@ -800,7 +850,10 @@ class UbercartCheckoutSettingsTestCase extends UbercartTestHelper {
);
}
function testEnableCheckout() {
/**
* Tests enabling checkout functionality.
*/
public function testEnableCheckout() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/store/settings/checkout');
$this->assertField(
@@ -827,7 +880,10 @@ class UbercartCheckoutSettingsTestCase extends UbercartTestHelper {
);
}
function testAnonymousCheckout() {
/**
* Tests anonymous checkout functionality.
*/
public function testAnonymousCheckout() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/store/settings/checkout');
$this->assertField(
@@ -855,4 +911,5 @@ class UbercartCheckoutSettingsTestCase extends UbercartTestHelper {
t('The checkout page is not displayed.')
);
}
}

View File

@@ -3,9 +3,8 @@ core = 7.x
dependencies[] = uc_cart
hidden = TRUE
; Information added by Drupal.org packaging script on 2016-07-16
version = "7.x-3.10"
; Information added by Drupal.org packaging script on 2019-03-06
version = "7.x-3.12"
core = "7.x"
project = "ubercart"
datestamp = "1468644909"
datestamp = "1551862392"

View File

@@ -9,11 +9,12 @@
* General settings for the shopping cart.
*
* @see uc_cart_cart_settings_form_validate()
*
* @ingroup forms
*/
function uc_cart_cart_settings_form($form, &$form_state) {
// Put fieldsets into vertical tabs
// Put fieldsets into vertical tabs.
$form['cart-settings'] = array(
'#type' => 'vertical_tabs',
'#attached' => array(
@@ -39,12 +40,12 @@ function uc_cart_cart_settings_form($form, &$form_state) {
$form['general']['panes'][$id]['uc_cap_' . $id . '_enabled'] = array(
'#type' => 'checkbox',
'#title' => check_plain($pane['title']),
'#default_value' => variable_get('uc_cap_'. $pane['id'] .'_enabled', $pane['enabled']),
'#default_value' => variable_get('uc_cap_' . $pane['id'] . '_enabled', $pane['enabled']),
);
$form['general']['panes'][$id]['uc_cap_' . $id . '_weight'] = array(
'#type' => 'weight',
'#delta' => 10,
'#default_value' => variable_get('uc_cap_'. $pane['id'] .'_weight', $pane['weight']),
'#default_value' => variable_get('uc_cap_' . $pane['id'] . '_weight', $pane['weight']),
'#attributes' => array('class' => array('uc-cart-pane-weight')),
);
}
@@ -218,7 +219,7 @@ function uc_cart_cart_settings_form_validate($form, &$form_state) {
*/
function uc_cart_checkout_settings_form($form, &$form_state) {
// Put fieldsets into vertical tabs
// Put fieldsets into vertical tabs.
$form['checkout-settings'] = array(
'#type' => 'vertical_tabs',
'#attached' => array(

View File

@@ -128,14 +128,13 @@ function hook_uc_cart_display($item) {
'#markup' => node_access('view', $node) ? l($item->title, 'node/' . $node->nid) : check_plain($item->title),
);
$element['#total'] = $item->price * $item->qty;
$element['data'] = array('#type' => 'hidden', '#value' => serialize($item->data));
$element['qty'] = array(
'#type' => 'textfield',
'#default_value' => $item->qty,
'#size' => 5,
'#maxlength' => 6
'#maxlength' => 6,
);
if ($description = uc_product_get_description($item)) {

View File

@@ -1,9 +1,10 @@
<?php
/**
* @file
*
* Contains the controller for uc_cart_item entities.
*/
class UcCartItemController extends EntityAPIController {
/**
@@ -21,7 +22,7 @@ class UcCartItemController extends EntityAPIController {
parent::attachLoad($items, $revision_id);
}
/**
/**
* Saves a cart item entity.
*
* Cart items are deleted if saved with a quantity of zero.
@@ -52,4 +53,5 @@ class UcCartItemController extends EntityAPIController {
return parent::buildContent($product, $view_mode, $langcode, $content);
}
}

View File

@@ -16,9 +16,8 @@ files[] = uc_cart.controller.inc
configure = admin/store/settings/cart
; Information added by Drupal.org packaging script on 2016-07-16
version = "7.x-3.10"
; Information added by Drupal.org packaging script on 2019-03-06
version = "7.x-3.12"
core = "7.x"
project = "ubercart"
datestamp = "1468644909"
datestamp = "1551862392"

View File

@@ -5,7 +5,6 @@
* Entity metadata hooks for uc_cart.module.
*/
/**
* Implements hook_entity_property_info().
*/

View File

@@ -18,7 +18,7 @@ function uc_cart_schema() {
'description' => 'Unique identifier for cart item.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
'not null' => TRUE,
),
'cart_id' => array(
'description' => 'A user-specific cart ID. For authenticated users, their {users}.uid. For anonymous users, a token.',

View File

@@ -22,7 +22,6 @@ define('UC_CART_ORDER_TIMEOUT', 86400); // 24 hours
*/
define('UC_CART_CHECKOUT_TIMEOUT', 1800); // 30 minutes
/**
* Implements hook_menu().
*/
@@ -378,7 +377,7 @@ function uc_cart_block_view($delta = '') {
'item_text' => $item_text,
'total' => $total,
'summary_links' => $summary_links,
'collapsed' => variable_get('uc_cart_block_collapsed', TRUE)
'collapsed' => variable_get('uc_cart_block_collapsed', TRUE),
));
return $block;
@@ -597,6 +596,7 @@ function uc_cart_login_update($uid) {
* @see uc_cart_view_form_checkout()
* @see theme_uc_cart_view_form()
* @see uc_cart_view_table()
*
* @ingroup forms
*/
function uc_cart_view_form($form, &$form_state, $items = NULL) {
@@ -608,7 +608,7 @@ function uc_cart_view_form($form, &$form_state, $items = NULL) {
);
$i = 0;
$display_items = entity_view('uc_cart_item', $items, 'cart');
$display_items = entity_view('uc_cart_item', $items, 'cart', NULL, TRUE);
foreach (element_children($display_items['uc_cart_item']) as $key) {
$display_item = $display_items['uc_cart_item'][$key];
if (count(element_children($display_item))) {
@@ -716,7 +716,7 @@ function uc_cart_view_form_submit($form, &$form_state) {
// if a qty has changed.
foreach ($form['items'] as $key => $item) {
if (isset($item['qty']['#default_value']) && $item['qty']['#default_value'] != $form_state['values']['items'][$key]['qty']) {
uc_cart_update_item_object((object)$form_state['values']);
uc_cart_update_item_object((object) $form_state['values']);
}
}
}
@@ -813,10 +813,10 @@ function uc_cart_view_table($table) {
/**
* Returns the URL redirect for the continue shopping element on the cart page.
*
* @param $unset
* @param bool $unset
* TRUE or FALSE indicating whether or not to unset the last URL variable.
*
* @return
* @return string
* The URL or Drupal path that will be used for the continue shopping element.
*/
function uc_cart_continue_shopping_url($unset = TRUE) {
@@ -979,13 +979,13 @@ function uc_cart_complete_sale_account($order) {
$order->uid = $account->uid;
$order->data['new_user']['name'] = $fields['name'];
$order->data['complete_sale'] = 'new_user';
$order->data['complete_sale'] = 'new_user';
}
/**
* Returns the unique cart_id of the user.
*
* @param $create
* @param bool $create
* Toggle auto creation of cart id.
*
* @return
@@ -1013,7 +1013,7 @@ function uc_cart_get_id($create = TRUE) {
* (optional) Carts are statically cached by default. If set to "rebuild",
* the cache will be ignored and the cart reloaded from the database.
*
* @return
* @return array
* An array of cart items.
*/
function uc_cart_get_contents($cid = NULL, $action = NULL) {
@@ -1086,7 +1086,7 @@ function uc_cart_get_contents($cid = NULL, $action = NULL) {
* The cart ID of the shopping cart whose items we're totalling; defaults to
* the current user's cart.
*
* @return
* @return int
* An integer representing the total number of items in the cart.
*/
function uc_cart_get_total_qty($cid = NULL) {
@@ -1349,7 +1349,7 @@ function uc_cart_is_shippable($cart_id = NULL) {
/**
* Removes panes from the list that match the given conditions.
*
* @return
* @return array
* A checkout pane array with panes filtered out that have key values
* matching the combinations in the $remove array.
*/

View File

@@ -2,8 +2,7 @@
/**
* @file
* This file contains the Rules hooks and functions necessary to
* make the cart related entity, conditions, events, and actions work.
* Hooks and functions for uc_cart Rules integration.
*/
/**

View File

@@ -48,7 +48,7 @@ function uc_cart_default_rules_configuration() {
// Setup a default predicate for admin checkout notifications.
$rule = rules_reaction_rule();
$rule ->label = t('E-mail admin checkout notification');
$rule->label = t('E-mail admin checkout notification');
$rule->active = TRUE;
$rule->event('uc_checkout_complete')
->action('uc_order_email_invoice', array(

View File

@@ -5,7 +5,6 @@
* Variable module hook implementations.
*/
/**
* Implements hook_variable_group_info().
*/

View File

@@ -271,7 +271,7 @@ function uc_checkout_pane_address($pane, $op, $order, &$form_state, $description
}
}
if ($element['#name'] == "panes[$pane][select_address]") {
if ($element['#name'] == "panes[$pane][select_address]" && isset($addresses[$element['#value']])) {
$address = $addresses[$element['#value']];
foreach ($address as $field => $value) {
$form_state['input']['panes'][$pane][$pane . '_' . $field] = $value;