After patch from miimooo.

This commit is contained in:
mattbk
2015-10-06 13:59:53 -05:00
parent bb1313bad9
commit efefb7cd23
51 changed files with 427 additions and 741 deletions

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views.views.inc,v 1.13.2.5.2.25 2010/12/22 18:49:05 hanoii Exp $
/**
* @file
* Views 2 hooks and callback registries.
@ -43,14 +44,8 @@ function uc_views_views_data() {
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
'name field' => 'title',
'numeric' => TRUE,
'validate type' => 'order_product_id',
),
);
$data['uc_order_products']['model'] = array(
'title' => t('SKU'),
'help' => $order_products['fields']['model']['description'],
@ -433,7 +428,7 @@ function uc_views_views_data() {
),
);
}
$data['uc_orders'][$prefix.'_full_name'] = array(
'title' => t('!titleprefix full name', $args),
'help' => $prefix == 'delivery' ? t('The full name (first and last) of the person receiving shipment.') : t('The full name (first and last) of the person paying for the order.'),
@ -529,7 +524,7 @@ function uc_views_views_data() {
// join to the uc_order_products, if used as base, via uc_orders
$data[$key]['table']['join']['uc_order_products'] = $data[$key]['table']['join']['uc_orders'];
$data[$key]['table']['join']['uc_order_products']['left_table'] = 'uc_orders';
$data[$key]['country_id'] = array(
'title' => t($value['prefix'].' country id'),
'help' => $order_schema['fields'][$value['field']]['description'],
@ -640,7 +635,7 @@ function uc_views_views_data() {
// join to the uc_order_products, if used as base, via uc_orders
$data[$key]['table']['join']['uc_order_products'] = $data[$key]['table']['join']['uc_orders'];
$data[$key]['table']['join']['uc_order_products']['left_table'] = 'uc_orders';
$data[$key]['zone_id'] = array(
'title' => t($value['prefix'].' zone id'),
'help' => $order_schema['fields'][$value['field']]['description'],
@ -666,7 +661,7 @@ function uc_views_views_data() {
);
$data[$key]['zone_name'] = array(
'title' => t($value['prefix'].' zone name'),
'help' => t(preg_replace('/id|ID/i', ' ', $order_schema['fields'][$value['field']]['description'])),
'help' => t(ereg_replace(' (id|ID) ', ' ', $order_schema['fields'][$value['field']]['description'])),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE,
@ -702,7 +697,7 @@ function uc_views_views_data() {
// line items
$line_items = array();
foreach (_line_item_list() as $line_item) {
if (!in_array($line_item['id'], array('subtotal', 'tax_subtotal', 'total')) && $line_item['stored']) {
if (!in_array($line_item['id'], array('subtotal', 'tax_subtotal', 'total', 'generic')) && $line_item['stored']) {
$line_items[$line_item['id']] = $line_item['title'];
}
}
@ -744,7 +739,7 @@ function uc_views_views_data() {
'float' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_float',
'handler' => 'views_handler_filter_amount',
),
);
}
@ -1002,9 +997,5 @@ function uc_views_views_plugins() {
* Implementation of hook_views_query_substitutions().
*/
function uc_views_views_query_substitutions($view) {
if (module_exists('uc_cart')) {
if ($cart_id = uc_cart_get_id(FALSE)) {
return array('***CURRENT_CART_ID***' => $cart_id);
}
}
return array('***CURRENT_CART_ID***' => uc_cart_get_id());
}

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views.views_default.inc,v 1.2.2.4 2009/06/30 08:54:23 madsph Exp $
/**
* @file
@ -95,10 +96,6 @@ function uc_views_views_default_views() {
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'view all orders',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Orders');
@ -161,275 +158,5 @@ function uc_views_views_default_views() {
$views[$view->name] = $view;
if (module_exists('draggableviews')) {
$view = new view;
$view->name = 'product_order';
$view->description = '';
$view->tag = 'Ubercart';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'sell_price' => array(
'label' => 'Sell price',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => 0,
'precision' => '0',
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'format' => 'uc_price',
'revision' => 'themed',
'exclude' => 0,
'id' => 'sell_price',
'table' => 'uc_products',
'field' => 'sell_price',
'relationship' => 'none',
),
'ordering' => array(
'label' => 'List position',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 0,
'id' => 'ordering',
'table' => 'uc_products',
'field' => 'ordering',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'ordering' => array(
'order' => 'ASC',
'id' => 'ordering',
'table' => 'uc_products',
'field' => 'ordering',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'is_product' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'is_product',
'table' => 'uc_products',
'field' => 'is_product',
'relationship' => 'none',
),
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'tid' => array(
'operator' => 'or',
'value' => array(),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => 0,
'operator' => 'tid_op',
'identifier' => 'tid',
'label' => 'Taxonomy term',
'optional' => 1,
'single' => 1,
'remember' => 0,
'reduce' => 0,
),
'type' => 'select',
'limit' => TRUE,
'vid' => variable_get('uc_catalog_vid', 0),
'id' => 'tid',
'table' => 'term_node',
'field' => 'tid',
'hierarchy' => 1,
'relationship' => 'none',
'reduce_duplicates' => 0,
),
));
$handler->override_option('access', array(
'type' => 'perm',
'perm' => 'administer products',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('title', 'Product display order');
$handler->override_option('items_per_page', 30);
$handler->override_option('use_pager', '1');
$handler->override_option('style_plugin', 'draggabletable');
$handler->override_option('style_options', array(
'override' => 1,
'sticky' => 0,
'order' => 'asc',
'columns' => array(
'title' => 'title',
'sell_price' => 'sell_price',
'ordering' => 'ordering',
),
'info' => array(
'title' => array(
'sortable' => 0,
'separator' => '',
),
'sell_price' => array(
'sortable' => 0,
'separator' => '',
),
'ordering' => array(
'separator' => '',
),
),
'default' => -1,
'tabledrag_order' => array(
'field' => 'ordering',
'handler' => 'ubercart',
),
'tabledrag_order_visible' => array(
'visible' => 0,
),
'tabledrag_hierarchy' => array(
'field' => 'none',
'handler' => 'native',
),
'tabledrag_hierarchy_visible' => array(
'visible' => 0,
),
'draggableviews_depth_limit' => '0',
'draggableviews_repair' => array(
'repair' => 0,
),
'tabledrag_types_add' => 'Add type',
'tabledrag_expand' => array(
'expand_links' => 0,
'collapsed' => 0,
'by_uid' => 0,
),
'draggableviews_extensions' => array(
'extension_top' => '3',
'extension_bottom' => '3',
),
'tabledrag_lock' => array(
'lock' => 0,
),
'draggableviews_default_on_top' => '1',
'draggableviews_button_text' => 'Save order',
'draggableviews_arguments' => array(
'use_args' => 0,
),
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'admin/store/products/order');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$views[$view->name] = $view;
}
return $views;
}

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_cart_user.inc,v 1.1 2009/03/25 11:12:37 madsph Exp $
/**
* Field handler to provide simple renderer that allows linking to a user from a cart id.

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_conditional_addtocart.inc,v 1.1 2009/04/17 07:50:06 madsph Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_conditional_buyitnow.inc,v 1.2 2009/04/17 07:50:06 madsph Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_country.inc,v 1.1 2009/03/23 09:26:49 madsph Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_money_amount.inc,v 1.1.2.3 2009/12/17 21:01:15 hanoii Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_actions.inc,v 1.1.2.1.2.1 2010/11/18 02:18:28 longwave Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_cc_data.inc,v 1.1.2.1 2010/01/12 15:17:29 hanoii Exp $
/**
* @file
@ -12,16 +13,7 @@ class uc_views_handler_field_order_cc_data extends views_handler_field {
$crypt = new uc_encryption_class;
$data = unserialize($values->{$this->field_alias});
$cc_data = $data['cc_data'];
// In recent ubercart versions, they base64_encode() the payment details
// before encrypting. We can detect encoded data by the lack of colons,
// due to base64's limited character set.
// see uc_credit_cache()
$decrypted_data = $crypt->decrypt($key, $cc_data);
if (strpos($decrypted_data, ':') === FALSE) {
$decrypted_data = base64_decode($decrypted_data);
}
$cc_data = unserialize($decrypted_data);
$cc_data = unserialize($crypt->decrypt($key, $cc_data));
return $cc_data[$this->definition['cc field']];
}

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_cost.inc,v 1.1.2.1 2010/01/12 15:17:29 hanoii Exp $
/**
* @file
@ -19,7 +20,7 @@ class uc_views_handler_field_order_cost extends uc_views_handler_field_money_amo
function render($values) {
$this->field_alias = 'order_cost';
$cost = db_result(db_query("SELECT SUM(qty * cost) FROM {uc_order_products} WHERE order_id = %d", $values->{$this->aliases['order_id']}));
$cost = db_result(db_query("SELECT SUM(cost) FROM {uc_order_products} WHERE order_id = %d", $values->{$this->aliases['order_id']}));
$values->{$this->field_alias} = $cost;
return parent::render($values);
}

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_fullname.inc,v 1.1.2.1 2010/02/27 00:14:24 hanoii Exp $
/**
* @file
@ -30,16 +31,16 @@ class uc_views_handler_field_order_fullname extends views_handler_field {
'#default_value' => $this->options['format'],
);
}
function query() {
$this->ensure_my_table();
$this->add_additional_fields();
}
function render($values) {
$prefix = $this->definition['prefix'];
$first = check_plain($values->{$this->aliases[$prefix . '_first_name']});
$last = check_plain($values->{$this->aliases[$prefix . '_last_name']});
$first = $values->{$this->aliases[$prefix . '_first_name']};
$last = $values->{$this->aliases[$prefix . '_last_name']};
switch ($this->options['format']) {
case 'last_first':
return "$last $first";
@ -49,4 +50,4 @@ class uc_views_handler_field_order_fullname extends views_handler_field {
return "$first $last";
}
}
}
}

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_id.inc,v 1.1.4.2 2010/12/15 02:16:37 longwave Exp $
/**
* @file
* Contains the basic 'order' field handler.

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_status.inc,v 1.1.2.2 2009/07/01 05:27:21 madsph Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_order_weight.inc,v 1.1.2.1 2010/12/22 17:18:02 hanoii Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_field_zone.inc,v 1.1 2009/03/24 09:43:50 madsph Exp $
/**
* @file

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_filter_cart_current.inc,v 1.1.2.1 2010/11/18 17:31:43 longwave Exp $
/**
* Filter handler for the current cart.

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_filter_country.inc,v 1.2 2009/03/24 09:43:50 madsph Exp $
/**
* Filter by country code
*/

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_filter_payment_method.inc,v 1.1.2.1 2009/11/02 12:06:14 madsph Exp $
/**
* @file
@ -7,7 +8,7 @@
*/
/**
* Filter by payment method
* Filter by payment method
*
*/
class uc_views_handler_filter_payment_method extends views_handler_filter_in_operator {
@ -24,12 +25,16 @@ class uc_views_handler_filter_payment_method extends views_handler_filter_in_ope
*returns an array of DISTINCT payment methods from the uc_oders table
*/
function _distinct_payment_methods() {
$methods = array();
$result = db_query("SELECT DISTINCT payment_method AS payment_methods FROM {uc_orders}");
while ($pm = db_fetch_object($result)) {
$methods[$pm->payment_methods] = $pm->payment_methods;
}
return $methods;
$methods = array();
$result = db_query("SELECT DISTINCT payment_method AS payment_methods FROM {uc_orders}");
while($pm = db_fetch_object($result)) {
$methods[$pm->payment_methods] = $pm->payment_methods;
}
return $methods;
}

View File

@ -1,4 +1,5 @@
<?php
// $Id: uc_views_handler_filter_zone.inc,v 1.1 2009/03/24 09:43:50 madsph Exp $
/**
* Filter by zone code
*/

View File

@ -1,4 +1,5 @@
<?php
// $Id: views_handler_filter_order_status.inc,v 1.1 2009/03/09 09:36:12 madsph Exp $
/**
* Filter by order status
* Thank you river_t for the Patch!