Révision b858700c
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/commerce/commerce.info | ||
---|---|---|
12 | 12 |
; Central Entity Controller. |
13 | 13 |
files[] = includes/commerce.controller.inc |
14 | 14 |
|
15 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
16 |
version = "7.x-1.8"
|
|
15 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
16 |
version = "7.x-1.9"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "commerce" |
19 |
datestamp = "1374609067"
|
|
19 |
datestamp = "1394061805"
|
|
20 | 20 |
|
drupal7/sites/all/modules/commerce/commerce.module | ||
---|---|---|
95 | 95 |
$fields = array(); |
96 | 96 |
|
97 | 97 |
// Loop through the fields looking for any fields of the specified type. |
98 |
foreach (field_info_fields() as $field_name => $field) {
|
|
99 |
if ($field['type'] == $field_type) { |
|
98 |
foreach (field_info_field_map() as $field_name => $field_stub) {
|
|
99 |
if ($field_stub['type'] == $field_type) {
|
|
100 | 100 |
// Add this field to the return array if no entity type was specified or |
101 | 101 |
// if the specified type exists in the field's bundles array. |
102 |
if (empty($entity_type) || in_array($entity_type, array_keys($field['bundles']))) { |
|
102 |
if (empty($entity_type) || in_array($entity_type, array_keys($field_stub['bundles']))) { |
|
103 |
$field = field_info_field($field_name); |
|
103 | 104 |
$fields[$field_name] = $field; |
104 | 105 |
} |
105 | 106 |
} |
... | ... | |
537 | 538 |
// Include the currency file and invoke the currency info hook. |
538 | 539 |
module_load_include('inc', 'commerce', 'includes/commerce.currency'); |
539 | 540 |
$currencies['all'] = module_invoke_all('commerce_currency_info'); |
540 |
drupal_alter('commerce_currency_info', $currencies['all']); |
|
541 |
drupal_alter('commerce_currency_info', $currencies['all'], $language->language);
|
|
541 | 542 |
|
542 | 543 |
// Add default values if they don't exist. |
543 | 544 |
foreach ($currencies['all'] as $currency_code => $currency) { |
... | ... | |
1139 | 1140 |
$account = $user; |
1140 | 1141 |
} |
1141 | 1142 |
|
1142 |
// Read the base table from the query if available or default to the first |
|
1143 |
// table in the query's tables array. |
|
1144 |
if (!isset($base_table) && !$base_table = $query->getMetaData('base_table')) { |
|
1145 |
// Assume that the base table is the first table if not set. It will result |
|
1146 |
// in an invalid query if the first table is not the table we expect, |
|
1147 |
// forcing the caller to actually properly pass a base table in that case. |
|
1148 |
$tables = &$query->getTables(); |
|
1149 |
reset($tables); |
|
1150 |
$base_table = key($tables); |
|
1151 |
} |
|
1152 |
|
|
1153 | 1143 |
// Do not apply any conditions for users with administrative view permissions. |
1154 | 1144 |
if (user_access('administer ' . $entity_type . ' entities', $account) |
1155 | 1145 |
|| user_access('view any ' . $entity_type . ' entity', $account)) { |
... | ... | |
1159 | 1149 |
// Get the entity type info array for the current access check and prepare a |
1160 | 1150 |
// conditions object. |
1161 | 1151 |
$entity_info = entity_get_info($entity_type); |
1152 |
|
|
1153 |
// If a base table wasn't specified, attempt to read it from the query if |
|
1154 |
// available, look for a table in the query's tables array that matches the |
|
1155 |
// base table of the given entity type, or just default to the first table. |
|
1156 |
if (!isset($base_table) && !$base_table = $query->getMetaData('base_table')) { |
|
1157 |
// Initialize the base table to the first table in the array. If a table can |
|
1158 |
// not be found that matches the entity type's base table, this will result |
|
1159 |
// in an invalid query if the first table is not the table we expect, |
|
1160 |
// forcing the caller to actually properly pass a base table in that case. |
|
1161 |
$tables = $query->getTables(); |
|
1162 |
reset($tables); |
|
1163 |
$base_table = key($tables); |
|
1164 |
|
|
1165 |
foreach ($tables as $table_info) { |
|
1166 |
if (!($table_info instanceof SelectQueryInterface)) { |
|
1167 |
// If this table matches the entity type's base table, use its table |
|
1168 |
// alias as the base table for the purposes of bundle and ownership |
|
1169 |
// access checks. |
|
1170 |
if ($table_info['table'] == $entity_info['base table']) { |
|
1171 |
$base_table = $table_info['alias']; |
|
1172 |
} |
|
1173 |
} |
|
1174 |
} |
|
1175 |
} |
|
1176 |
|
|
1177 |
// Prepare an OR container for conditions. Conditions will be added that seek |
|
1178 |
// to grant access, meaning any particular type of permission check may grant |
|
1179 |
// access even if none of the others apply. At the end of this function, if no |
|
1180 |
// conditions have been added to the array, a condition will be added that |
|
1181 |
// always returns FALSE (1 = 0). |
|
1162 | 1182 |
$conditions = db_or(); |
1163 | 1183 |
|
1164 | 1184 |
// Perform bundle specific permission checks for the specified entity type. |
1185 |
// In the event that the user has permission to view every bundle of the given |
|
1186 |
// entity type, $really_restricted will remain FALSE, indicating that it is |
|
1187 |
// safe to exit this function without applying any additional conditions. If |
|
1188 |
// the user only had such permission for a subset of the defined bundles, |
|
1189 |
// conditions representing those access checks would still be added. |
|
1165 | 1190 |
$really_restricted = FALSE; |
1166 | 1191 |
|
1167 | 1192 |
// Loop over every possible bundle for the given entity type. |
... | ... | |
1242 | 1267 |
form_error($element, t('Use a positive number for the options list limit or else leave it blank for no limit.')); |
1243 | 1268 |
} |
1244 | 1269 |
} |
1270 |
|
|
1271 |
/** |
|
1272 |
* Implements hook_theme_registry_alter(). |
|
1273 |
* |
|
1274 |
* The Entity API theme function template_preprocess_entity() assumes the |
|
1275 |
* presence of a path key in an entity URI array, which isn't strictly required |
|
1276 |
* by Drupal core itself. Until this is fixed in the Entity API code, we replace |
|
1277 |
* that function with a Commerce specific version. |
|
1278 |
* |
|
1279 |
* @todo Remove when https://drupal.org/node/1934382 is resolved. |
|
1280 |
*/ |
|
1281 |
function commerce_theme_registry_alter(&$theme_registry) { |
|
1282 |
// Copy the preprocess functions array and remove the core preprocess function |
|
1283 |
// along with the Entity API's and this module's. |
|
1284 |
$functions = drupal_map_assoc($theme_registry['entity']['preprocess functions']); |
|
1285 |
unset($functions['template_preprocess'], $functions['template_preprocess_entity'], $functions['commerce_preprocess_entity']); |
|
1286 |
|
|
1287 |
// Unshift the core preprocess function and the Commerce specific function so |
|
1288 |
// they appear at the beginning of the array in the desired order. |
|
1289 |
array_unshift($functions, 'template_preprocess', 'commerce_preprocess_entity'); |
|
1290 |
|
|
1291 |
// Update the function list in the theme registry. |
|
1292 |
$theme_registry['entity']['preprocess functions'] = array_values($functions); |
|
1293 |
} |
|
1294 |
|
|
1295 |
/** |
|
1296 |
* Processes variables for entity.tpl.php, replacing template_preprocess_entity(). |
|
1297 |
* |
|
1298 |
* @see commerce_theme_registry_alter() |
|
1299 |
* @todo Remove when https://drupal.org/node/1934382 is resolved. |
|
1300 |
*/ |
|
1301 |
function commerce_preprocess_entity(&$variables) { |
|
1302 |
$variables['view_mode'] = $variables['elements']['#view_mode']; |
|
1303 |
$entity_type = $variables['elements']['#entity_type']; |
|
1304 |
$variables['entity_type'] = $entity_type; |
|
1305 |
$entity = $variables['elements']['#entity']; |
|
1306 |
$variables[$variables['elements']['#entity_type']] = $entity; |
|
1307 |
$info = entity_get_info($entity_type); |
|
1308 |
|
|
1309 |
$variables['title'] = check_plain(entity_label($entity_type, $entity)); |
|
1310 |
|
|
1311 |
$uri = entity_uri($entity_type, $entity); |
|
1312 |
$variables['url'] = $uri && isset($uri['path']) ? url($uri['path'], $uri['options']) : FALSE; |
|
1313 |
|
|
1314 |
if (isset($variables['elements']['#page'])) { |
|
1315 |
// If set by the caller, respect the page property. |
|
1316 |
$variables['page'] = $variables['elements']['#page']; |
|
1317 |
} |
|
1318 |
else { |
|
1319 |
// Else, try to automatically detect it. |
|
1320 |
$variables['page'] = $uri && isset($uri['path']) && $uri['path'] == $_GET['q']; |
|
1321 |
} |
|
1322 |
|
|
1323 |
// Helpful $content variable for templates. |
|
1324 |
$variables['content'] = array(); |
|
1325 |
foreach (element_children($variables['elements']) as $key) { |
|
1326 |
$variables['content'][$key] = $variables['elements'][$key]; |
|
1327 |
} |
|
1328 |
|
|
1329 |
if (!empty($info['fieldable'])) { |
|
1330 |
// Make the field variables available with the appropriate language. |
|
1331 |
field_attach_preprocess($entity_type, $entity, $variables['content'], $variables); |
|
1332 |
} |
|
1333 |
list(, , $bundle) = entity_extract_ids($entity_type, $entity); |
|
1334 |
|
|
1335 |
// Gather css classes. |
|
1336 |
$variables['classes_array'][] = drupal_html_class('entity-' . $entity_type); |
|
1337 |
$variables['classes_array'][] = drupal_html_class($entity_type . '-' . $bundle); |
|
1338 |
|
|
1339 |
// Add RDF type and about URI. |
|
1340 |
if (module_exists('rdf')) { |
|
1341 |
$variables['attributes_array']['about'] = empty($uri['path']) ? NULL: url($uri['path']); |
|
1342 |
$variables['attributes_array']['typeof'] = empty($entity->rdf_mapping['rdftype']) ? NULL : $entity->rdf_mapping['rdftype']; |
|
1343 |
} |
|
1344 |
|
|
1345 |
// Add suggestions. |
|
1346 |
$variables['theme_hook_suggestions'][] = $entity_type; |
|
1347 |
$variables['theme_hook_suggestions'][] = $entity_type . '__' . $bundle; |
|
1348 |
$variables['theme_hook_suggestions'][] = $entity_type . '__' . $bundle . '__' . $variables['view_mode']; |
|
1349 |
if ($id = entity_id($entity_type, $entity)) { |
|
1350 |
$variables['theme_hook_suggestions'][] = $entity_type . '__' . $id; |
|
1351 |
} |
|
1352 |
} |
drupal7/sites/all/modules/commerce/commerce_ui.info | ||
---|---|---|
4 | 4 |
dependencies[] = commerce |
5 | 5 |
core = 7.x |
6 | 6 |
|
7 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
8 |
version = "7.x-1.8"
|
|
7 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
8 |
version = "7.x-1.9"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "commerce" |
11 |
datestamp = "1374609067"
|
|
11 |
datestamp = "1394061805"
|
|
12 | 12 |
|
drupal7/sites/all/modules/commerce/includes/commerce.controller.inc | ||
---|---|---|
94 | 94 |
$function($this->entityType, $entity); |
95 | 95 |
} |
96 | 96 |
|
97 |
// Invoke the hook. If rules is there, use the rule funtion so that a rules |
|
98 |
// event is invoked too. |
|
99 |
if (module_exists('rules')) { |
|
100 |
rules_invoke_all($this->entityType . '_' . $hook, $entity); |
|
101 |
} |
|
102 |
else { |
|
103 |
module_invoke_all($this->entityType . '_' . $hook, $entity); |
|
104 |
} |
|
97 |
// Invoke the hook. |
|
98 |
module_invoke_all($this->entityType . '_' . $hook, $entity); |
|
105 | 99 |
// Invoke the respective entity level hook. |
106 | 100 |
if ($hook == 'presave' || $hook == 'insert' || $hook == 'update' || $hook == 'delete') { |
107 | 101 |
module_invoke_all('entity_' . $hook, $entity, $this->entityType); |
108 | 102 |
} |
103 |
// Invoke rules. |
|
104 |
if (module_exists('rules')) { |
|
105 |
rules_invoke_event($this->entityType . '_' . $hook, $entity); |
|
106 |
} |
|
109 | 107 |
} |
110 | 108 |
|
111 | 109 |
/** |
... | ... | |
181 | 179 |
} |
182 | 180 |
|
183 | 181 |
try { |
184 |
// Load the stored entity, if any. |
|
185 |
if (!empty($entity->{$this->idKey}) && !isset($entity->original)) { |
|
182 |
// Load the stored entity, if any. If this save was invoked during a |
|
183 |
// previous save's insert or update hook, this means the $entity->original |
|
184 |
// value already set on the entity will be replaced with the entity as |
|
185 |
// saved. This will allow any original entity comparisons in the current |
|
186 |
// save process to react to the most recently saved version of the entity. |
|
187 |
if (!empty($entity->{$this->idKey})) { |
|
186 | 188 |
// In order to properly work in case of name changes, load the original |
187 | 189 |
// entity using the id key if it is available. |
188 | 190 |
$entity->original = entity_load_unchanged($this->entityType, $entity->{$this->idKey}); |
... | ... | |
243 | 245 |
|
244 | 246 |
// Ignore slave server temporarily. |
245 | 247 |
db_ignore_slave(); |
246 |
unset($entity->is_new); |
|
248 |
|
|
249 |
// We unset the original version of the entity after the current save as |
|
250 |
// it no longer accurately represents the version of the entity saved in |
|
251 |
// the database. However, if this save was invoked during a previous |
|
252 |
// save's insert or update hook, this means that any hook implementations |
|
253 |
// executing after this save will no longer have an original version of |
|
254 |
// the entity to compare against. Attempting to compare against the non- |
|
255 |
// existent original entity in code or Rules will result in an error. |
|
247 | 256 |
unset($entity->original); |
257 |
unset($entity->is_new); |
|
248 | 258 |
unset($entity->revision); |
249 | 259 |
|
250 | 260 |
return $return; |
drupal7/sites/all/modules/commerce/includes/commerce.currency.inc | ||
---|---|---|
753 | 753 |
'minor_unit' => t('bani'), |
754 | 754 |
'major_unit' => t('Lei'), |
755 | 755 |
), |
756 |
'MKD' => array( |
|
757 |
'code' => 'MKD', |
|
758 |
'symbol' => 'ден', |
|
759 |
'name' => t('Macedonian denar'), |
|
760 |
'symbol_placement' => 'after', |
|
761 |
'numeric_code' => '807', |
|
762 |
'code_placement' => 'hidden', |
|
763 |
'minor_unit' => t('Deni'), |
|
764 |
'major_unit' => t('Denari'), |
|
765 |
), |
|
756 | 766 |
'MMK' => array( |
757 | 767 |
'code' => 'MMK', |
758 | 768 |
'symbol' => 'MMK', |
... | ... | |
875 | 885 |
), |
876 | 886 |
'NZD' => array( |
877 | 887 |
'code' => 'NZD', |
878 |
'symbol' => 'NZ$',
|
|
888 |
'symbol' => '$', |
|
879 | 889 |
'name' => t('New Zealand Dollar'), |
890 |
'symbol_placement' => 'before', |
|
891 |
'code_placement' => 'hidden', |
|
880 | 892 |
'numeric_code' => '554', |
881 | 893 |
'minor_unit' => t('Cent'), |
882 | 894 |
'major_unit' => t('Dollar'), |
drupal7/sites/all/modules/commerce/modules/cart/commerce_cart.info | ||
---|---|---|
21 | 21 |
; Simple tests |
22 | 22 |
files[] = tests/commerce_cart.test |
23 | 23 |
|
24 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
25 |
version = "7.x-1.8"
|
|
24 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
25 |
version = "7.x-1.9"
|
|
26 | 26 |
core = "7.x" |
27 | 27 |
project = "commerce" |
28 |
datestamp = "1374609067"
|
|
28 |
datestamp = "1394061805"
|
|
29 | 29 |
|
drupal7/sites/all/modules/commerce/modules/cart/commerce_cart.install | ||
---|---|---|
26 | 26 |
|
27 | 27 |
return t('All eligible product attribute fields have been updated to continue using the attribute selection widget.'); |
28 | 28 |
} |
29 |
|
|
30 |
/** |
|
31 |
* Disable the new local action to apply pricing rules to an order. |
|
32 |
*/ |
|
33 |
function commerce_cart_update_7101() { |
|
34 |
variable_set('commerce_order_apply_pricing_rules_link', FALSE); |
|
35 |
return t('A new local action link on order edit forms for applying pricing rules to an order has been disabled by default; enable it on the order settings form if desired.'); |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* Adjust the new shopping cart refresh frequency to occur continuously to match |
|
40 |
* the long-standing behavior of the process. |
|
41 |
*/ |
|
42 |
function commerce_cart_update_7102() { |
|
43 |
variable_set('commerce_cart_refresh_frequency', 0); |
|
44 |
return t('New order settings have been added to let you reduce the frequency of the shopping cart refresh. This update set it to occur continuously as it has been, but we recommend you implement some delay unless you have a unique product pricing situation that demands pricing updates every time a shopping cart is loaded.'); |
|
45 |
} |
drupal7/sites/all/modules/commerce/modules/cart/commerce_cart.module | ||
---|---|---|
8 | 8 |
* special considerations to associate it with a user and |
9 | 9 |
*/ |
10 | 10 |
|
11 |
// Define constants for the shopping cart refresh modes. |
|
12 |
define('COMMERCE_CART_REFRESH_ALWAYS', 'always'); |
|
13 |
define('COMMERCE_CART_REFRESH_OWNER_ONLY', 'owner_only'); |
|
14 |
define('COMMERCE_CART_REFRESH_ACTIVE_CART_ONLY', 'active_cart_only'); |
|
11 | 15 |
|
12 | 16 |
/** |
13 | 17 |
* Implements hook_menu(). |
... | ... | |
39 | 43 |
'file' => 'includes/commerce_cart.pages.inc', |
40 | 44 |
); |
41 | 45 |
|
46 |
// If the Order UI module is installed, add a local action to it that lets an |
|
47 |
// administrator execute a cart order refresh on the order. Modules that |
|
48 |
// define their own order edit menu item are also responsible for defining |
|
49 |
// their own local action menu items if needed. |
|
50 |
if (module_exists('commerce_order_ui')) { |
|
51 |
$items['admin/commerce/orders/%commerce_order/edit/refresh'] = array( |
|
52 |
'title' => 'Apply pricing rules', |
|
53 |
'description' => 'Executes the cart order refresh used to apply all current pricing rules on the front end.', |
|
54 |
'page callback' => 'drupal_get_form', |
|
55 |
'page arguments' => array('commerce_cart_order_refresh_form', 3), |
|
56 |
'access callback' => 'commerce_cart_order_refresh_form_access', |
|
57 |
'access arguments' => array(3), |
|
58 |
'type' => MENU_LOCAL_ACTION, |
|
59 |
'file' => 'includes/commerce_cart.admin.inc', |
|
60 |
); |
|
61 |
} |
|
62 |
|
|
42 | 63 |
return $items; |
43 | 64 |
} |
44 | 65 |
|
... | ... | |
74 | 95 |
drupal_goto('cart'); |
75 | 96 |
} |
76 | 97 |
|
98 |
/** |
|
99 |
* Access callback: determines access to the "Apply pricing rules" local action. |
|
100 |
*/ |
|
101 |
function commerce_cart_order_refresh_form_access($order) { |
|
102 |
// Do not show the link for cart orders as they're refreshed automatically. |
|
103 |
if (commerce_cart_order_is_cart($order)) { |
|
104 |
return FALSE; |
|
105 |
} |
|
106 |
|
|
107 |
// Returns TRUE if the link is enabled via the order settings form and the |
|
108 |
// user has access to update the order. |
|
109 |
return variable_get('commerce_order_apply_pricing_rules_link', TRUE) && commerce_order_access('update', 3); |
|
110 |
} |
|
111 |
|
|
77 | 112 |
/** |
78 | 113 |
* Implements hook_hook_info(). |
79 | 114 |
*/ |
... | ... | |
308 | 343 |
drupal_set_message(t('%title removed from your cart.', array('%title' => $title))); |
309 | 344 |
} |
310 | 345 |
|
346 |
/** |
|
347 |
* Implements hook_form_FORM_ID_alter(). |
|
348 |
* |
|
349 |
* Adds a checkbox to the order settings form to enable the local action on |
|
350 |
* order edit forms to apply pricing rules. |
|
351 |
*/ |
|
352 |
function commerce_cart_form_commerce_order_settings_form_alter(&$form, &$form_state) { |
|
353 |
$form['commerce_order_apply_pricing_rules_link'] = array( |
|
354 |
'#type' => 'checkbox', |
|
355 |
'#title' => t('Enable the local action link on order edit forms to apply pricing rules.'), |
|
356 |
'#description' => t('Even if enabled the link will not appear on shopping cart order edit forms.'), |
|
357 |
'#default_value' => variable_get('commerce_order_apply_pricing_rules_link', TRUE), |
|
358 |
'#weight' => 10, |
|
359 |
); |
|
360 |
|
|
361 |
// Add a fieldset for settings pertaining to the shopping cart refresh. |
|
362 |
$form['cart_refresh'] = array( |
|
363 |
'#type' => 'fieldset', |
|
364 |
'#title' => t('Shopping cart refresh'), |
|
365 |
'#description' => t('Shopping cart orders comprise orders in shopping cart and some checkout related order statuses. These settings let you control the shopping cart orders are refreshed, the process during which product prices are recalculated, to improve site performance in the case of excessive refreshes on sites with less dynamic pricing needs.'), |
|
366 |
'#weight' => 40, |
|
367 |
); |
|
368 |
$form['cart_refresh']['commerce_cart_refresh_mode'] = array( |
|
369 |
'#type' => 'radios', |
|
370 |
'#title' => t('Shopping cart refresh mode'), |
|
371 |
'#options' => array( |
|
372 |
COMMERCE_CART_REFRESH_ALWAYS => t('Refresh a shopping cart when it is loaded regardless of who it belongs to.'), |
|
373 |
COMMERCE_CART_REFRESH_OWNER_ONLY => t('Only refresh a shopping cart when it is loaded if it belongs to the current user.'), |
|
374 |
COMMERCE_CART_REFRESH_ACTIVE_CART_ONLY => t("Only refresh a shopping cart when it is loaded if it is the current user's active shopping cart."), |
|
375 |
), |
|
376 |
'#default_value' => variable_get('commerce_cart_refresh_mode', COMMERCE_CART_REFRESH_OWNER_ONLY), |
|
377 |
); |
|
378 |
$form['cart_refresh']['commerce_cart_refresh_frequency'] = array( |
|
379 |
'#type' => 'textfield', |
|
380 |
'#title' => t('Shopping cart refresh frequency'), |
|
381 |
'#description' => t('Shopping carts will only be refreshed if more than the specified number of seconds have passed since they were last refreshed.'), |
|
382 |
'#default_value' => variable_get('commerce_cart_refresh_frequency', 30), |
|
383 |
'#required' => TRUE, |
|
384 |
'#size' => 32, |
|
385 |
'#field_suffix' => t('seconds'), |
|
386 |
'#element_validate' => array('commerce_cart_validate_refresh_frequency'), |
|
387 |
); |
|
388 |
$form['cart_refresh']['commerce_cart_refresh_force'] = array( |
|
389 |
'#type' => 'checkbox', |
|
390 |
'#title' => t('Always refresh shopping cart orders on shopping cart and checkout form pages regardless of other settings.'), |
|
391 |
'#description' => t('Note: this option only applies to the core /cart and /checkout/* paths.'), |
|
392 |
'#default_value' => variable_get('commerce_cart_refresh_force', TRUE), |
|
393 |
); |
|
394 |
} |
|
395 |
|
|
396 |
/** |
|
397 |
* Form element validation handler for the cart refresh frequency value. |
|
398 |
*/ |
|
399 |
function commerce_cart_validate_refresh_frequency($element, &$form_state) { |
|
400 |
$value = $element['#value']; |
|
401 |
if ($value !== '' && (!is_numeric($value) || intval($value) != $value || $value < 0)) { |
|
402 |
form_error($element, t('%name must be 0 or a positive integer.', array('%name' => $element['#title']))); |
|
403 |
} |
|
404 |
} |
|
405 |
|
|
311 | 406 |
/** |
312 | 407 |
* Implements hook_form_FORM_ID_alter(). |
313 | 408 |
* |
... | ... | |
508 | 603 |
*/ |
509 | 604 |
function commerce_cart_user_update(&$edit, $account, $category) { |
510 | 605 |
// If the e-mail address was changed... |
511 |
if ($account->mail != $edit['original']->mail) { |
|
606 |
if (!empty($edit['original']->mail) && $account->mail != $edit['original']->mail) {
|
|
512 | 607 |
// Load the user's shopping cart orders. |
513 | 608 |
$query = new EntityFieldQuery(); |
514 | 609 |
|
... | ... | |
579 | 674 |
} |
580 | 675 |
} |
581 | 676 |
|
677 |
/** |
|
678 |
* Checks if a cart order should be refreshed based on the shopping cart refresh |
|
679 |
* settings on the order settings form. |
|
680 |
* |
|
681 |
* @param $order |
|
682 |
* The cart order to check. |
|
683 |
* |
|
684 |
* @return |
|
685 |
* Boolean indicating whether or not the cart order can be refreshed. |
|
686 |
*/ |
|
687 |
function commerce_cart_order_can_refresh($order) { |
|
688 |
global $user; |
|
689 |
|
|
690 |
// Force the shopping cart refresh on /cart and /checkout/* paths if enabled. |
|
691 |
if (variable_get('commerce_cart_refresh_force', TRUE) && |
|
692 |
(current_path() == 'cart' || strpos(current_path(), 'checkout/') === 0)) { |
|
693 |
return TRUE; |
|
694 |
} |
|
695 |
|
|
696 |
// Prevent refresh for orders that don't match the current refresh mode. |
|
697 |
switch (variable_get('commerce_cart_refresh_mode', COMMERCE_CART_REFRESH_OWNER_ONLY)) { |
|
698 |
case COMMERCE_CART_REFRESH_OWNER_ONLY: |
|
699 |
// If the order is anonymous, check the session to see if the order |
|
700 |
// belongs to the current user. Otherwise just check that the order uid |
|
701 |
// matches the current user. |
|
702 |
if ($order->uid == 0 && !commerce_cart_order_session_exists($order->order_id)) { |
|
703 |
return FALSE; |
|
704 |
} |
|
705 |
elseif ($order->uid != $user->uid) { |
|
706 |
return FALSE; |
|
707 |
} |
|
708 |
break; |
|
709 |
|
|
710 |
case COMMERCE_CART_REFRESH_ACTIVE_CART_ONLY: |
|
711 |
// Check to see if the order ID matches the current user's cart order ID. |
|
712 |
if (commerce_cart_order_id($user->uid) != $order->order_id) { |
|
713 |
return FALSE; |
|
714 |
} |
|
715 |
break; |
|
716 |
|
|
717 |
case COMMERCE_CART_REFRESH_ALWAYS: |
|
718 |
default: |
|
719 |
// Continue on if shopping cart orders should always refresh. |
|
720 |
break; |
|
721 |
} |
|
722 |
|
|
723 |
// Check to see if the last cart refresh happened long enough ago. |
|
724 |
$seconds = variable_get('commerce_cart_refresh_frequency', 15); |
|
725 |
|
|
726 |
if (!empty($seconds) && !empty($order->data['last_cart_refresh']) && |
|
727 |
REQUEST_TIME - $order->data['last_cart_refresh'] < $seconds) { |
|
728 |
return FALSE; |
|
729 |
} |
|
730 |
|
|
731 |
return TRUE; |
|
732 |
} |
|
733 |
|
|
582 | 734 |
/** |
583 | 735 |
* Implements hook_commerce_order_load(). |
584 | 736 |
* |
... | ... | |
592 | 744 |
|
593 | 745 |
foreach ($orders as $order) { |
594 | 746 |
// Refresh only if this order object represents the latest revision of a |
595 |
// shopping cart order and it hasn't been refreshed already. |
|
747 |
// shopping cart order, it hasn't been refreshed already in this request |
|
748 |
// and it meets the criteria in the shopping cart refresh settings. |
|
596 | 749 |
if (!isset($refreshed[$order->order_id]) && |
597 | 750 |
commerce_cart_order_is_cart($order) && |
598 |
commerce_order_is_latest_revision($order)) { |
|
751 |
commerce_order_is_latest_revision($order) && |
|
752 |
commerce_cart_order_can_refresh($order)) { |
|
753 |
// Update the last cart refresh timestamp and record the order's current |
|
754 |
// changed timestamp to detect if the order is actually updated. |
|
755 |
$order->data['last_cart_refresh'] = REQUEST_TIME; |
|
756 |
|
|
757 |
$unchanged_data = $order->data; |
|
758 |
$last_changed = $order->changed; |
|
759 |
|
|
599 | 760 |
// Refresh the order and add its ID to the refreshed array. |
600 | 761 |
$refreshed[$order->order_id] = TRUE; |
601 | 762 |
commerce_cart_order_refresh($order); |
763 |
|
|
764 |
// If order wasn't updated during the refresh, we need to manually update |
|
765 |
// the last cart refresh timestamp in the database. |
|
766 |
if ($order->changed == $last_changed) { |
|
767 |
db_update('commerce_order') |
|
768 |
->fields(array('data' => serialize($unchanged_data))) |
|
769 |
->condition('order_id', $order->order_id) |
|
770 |
->execute(); |
|
771 |
|
|
772 |
db_update('commerce_order_revision') |
|
773 |
->fields(array('data' => serialize($unchanged_data))) |
|
774 |
->condition('order_id', $order->order_id) |
|
775 |
->condition('revision_id', $order->revision_id) |
|
776 |
->execute(); |
|
777 |
} |
|
602 | 778 |
} |
603 | 779 |
} |
604 | 780 |
} |
... | ... | |
877 | 1053 |
|
878 | 1054 |
/** |
879 | 1055 |
* Refreshes the contents of a shopping cart by finding the most current prices |
880 |
* for any product line items on the order.
|
|
1056 |
* for any product line items on the order. |
|
881 | 1057 |
* |
882 | 1058 |
* @param $order |
883 | 1059 |
* The order object whose line items should be refreshed. |
... | ... | |
925 | 1101 |
rules_invoke_event('commerce_product_calculate_sell_price', $cloned_line_item); |
926 | 1102 |
} |
927 | 1103 |
|
928 |
// Allow other modules alter line items on a shopping cart refresh. |
|
1104 |
// Allow other modules to alter line items on a shopping cart refresh.
|
|
929 | 1105 |
module_invoke_all('commerce_cart_line_item_refresh', $cloned_line_item, $order_wrapper); |
930 | 1106 |
|
931 | 1107 |
// Delete this line item if it no longer has a valid price. |
... | ... | |
1126 | 1302 |
// If no order existed, create one now. |
1127 | 1303 |
if (empty($order)) { |
1128 | 1304 |
$order = commerce_cart_order_new($uid); |
1305 |
$order->data['last_cart_refresh'] = REQUEST_TIME; |
|
1129 | 1306 |
} |
1130 | 1307 |
|
1131 | 1308 |
// Set the incoming line item's order_id. |
... | ... | |
1528 | 1705 |
* A fully formed product line item whose data will be used in the following |
1529 | 1706 |
* ways by the form: |
1530 | 1707 |
* - $line_item->data['context']['product_ids']: an array of product IDs to |
1531 |
* include on the form. |
|
1708 |
* include on the form or the string 'entity' if the context array includes |
|
1709 |
* an entity array with information for accessing the product IDs from an |
|
1710 |
* entity's product reference field. |
|
1711 |
* - $line_item->data['context']['entity']: if the product_ids value is the |
|
1712 |
* string 'entity', an associative array with the keys 'entity_type', |
|
1713 |
* 'entity_id', and 'product_reference_field_name' that points to the |
|
1714 |
* location of the product IDs used to build the form. |
|
1532 | 1715 |
* - $line_item->data['context']['add_to_cart_combine']: a boolean indicating |
1533 | 1716 |
* whether or not to attempt to combine the product added to the cart with |
1534 | 1717 |
* existing line items of matching fields. |
... | ... | |
1574 | 1757 |
$default_quantity = $line_item->quantity; |
1575 | 1758 |
|
1576 | 1759 |
// Retrieve the array of product IDs from the line item's context data array. |
1577 |
$product_ids = array(); |
|
1578 |
|
|
1579 |
// If the product IDs setting tells us to use entity values... |
|
1580 |
if ($line_item->data['context']['product_ids'] == 'entity' && |
|
1581 |
is_array($line_item->data['context']['entity'])) { |
|
1582 |
$entity_data = $line_item->data['context']['entity']; |
|
1583 |
|
|
1584 |
// Load the specified entity. |
|
1585 |
$entity = entity_load_single($entity_data['entity_type'], $entity_data['entity_id']); |
|
1586 |
|
|
1587 |
// Extract the product IDs from the specified product reference field. |
|
1588 |
if (!empty($entity->{$entity_data['product_reference_field_name']})) { |
|
1589 |
$product_ids = entity_metadata_wrapper($entity_data['entity_type'], $entity)->{$entity_data['product_reference_field_name']}->raw(); |
|
1590 |
} |
|
1591 |
} |
|
1592 |
elseif (is_array($line_item->data['context']['product_ids'])) { |
|
1593 |
$product_ids = $line_item->data['context']['product_ids']; |
|
1594 |
} |
|
1760 |
$product_ids = commerce_cart_add_to_cart_form_product_ids($line_item); |
|
1595 | 1761 |
|
1596 | 1762 |
// If we don't have a list of products to load, just bail out early. |
1597 | 1763 |
// There is nothing we can or have to do in that case. |
... | ... | |
2142 | 2308 |
$classes[] = 'commerce-product-field-empty'; |
2143 | 2309 |
} |
2144 | 2310 |
|
2145 |
$element += array(
|
|
2146 |
'#prefix' => '<div class="' . implode(' ', $classes) . '">',
|
|
2147 |
'#suffix' => '</div>',
|
|
2148 |
);
|
|
2311 |
// Append the prefix and suffix around existing values if necessary.
|
|
2312 |
$element += array('#prefix' => '', '#suffix' => '');
|
|
2313 |
$element['#prefix'] = '<div class="' . implode(' ', $classes) . '">' . $element['#prefix'];
|
|
2314 |
$element['#suffix'] .= '</div>';
|
|
2149 | 2315 |
|
2150 | 2316 |
$commands[] = ajax_command_replace('.' . $replacement_class, drupal_render($element)); |
2151 | 2317 |
} |
... | ... | |
2273 | 2439 |
'commerce_cart_add_to_cart_form' => array( |
2274 | 2440 |
'label' => t('Add to Cart form'), |
2275 | 2441 |
'description' => t('Display an Add to Cart form for the referenced product.'), |
2276 |
'field types' => array('commerce_product_reference'), |
|
2442 |
'field types' => array('commerce_product_reference', 'entityreference'),
|
|
2277 | 2443 |
'settings' => array( |
2278 | 2444 |
'show_quantity' => FALSE, |
2279 | 2445 |
'default_quantity' => 1, |
... | ... | |
2337 | 2503 |
else { |
2338 | 2504 |
$element['line_item_type'] = array( |
2339 | 2505 |
'#type' => 'hidden', |
2340 |
'#value' => key($types),
|
|
2506 |
'#value' => reset($types),
|
|
2341 | 2507 |
); |
2342 | 2508 |
} |
2343 | 2509 |
} |
... | ... | |
2390 | 2556 |
$product_ids = array(); |
2391 | 2557 |
|
2392 | 2558 |
foreach ($items as $delta => $item) { |
2393 |
$product_ids[] = $item['product_id']; |
|
2559 |
if (isset($item['product_id'])) { |
|
2560 |
$product_ids[] = $item['product_id']; |
|
2561 |
} |
|
2562 |
elseif (module_exists('entityreference') && isset($item['target_id'])) { |
|
2563 |
$product_ids[] = $item['target_id']; |
|
2564 |
} |
|
2394 | 2565 |
} |
2395 | 2566 |
|
2396 | 2567 |
if ($display['type'] == 'commerce_cart_add_to_cart_form') { |
... | ... | |
2442 | 2613 |
$cart_context['entity_id'] = $entity_id; |
2443 | 2614 |
unset($cart_context['entity']); |
2444 | 2615 |
|
2616 |
// Remove any Views data added to the context by views_handler_field_field. |
|
2617 |
// It unnecessarily increases the size of rows in the cache_form table for |
|
2618 |
// Add to Cart form state data. |
|
2619 |
if (!empty($cart_context['display']) && is_array($cart_context['display'])) { |
|
2620 |
unset($cart_context['display']['views_view']); |
|
2621 |
unset($cart_context['display']['views_field']); |
|
2622 |
unset($cart_context['display']['views_row_id']); |
|
2623 |
} |
|
2624 |
|
|
2445 | 2625 |
// Add the context for displaying product fields in the context of an entity |
2446 | 2626 |
// that references the product by looking at the entity this product |
2447 | 2627 |
// reference field is attached to. |
... | ... | |
2480 | 2660 |
} |
2481 | 2661 |
} |
2482 | 2662 |
|
2663 |
/** |
|
2664 |
* Returns an array of product IDs used for building an Add to Cart form from |
|
2665 |
* the context information in a line item's data array. |
|
2666 |
* |
|
2667 |
* @param $line_item |
|
2668 |
* The line item whose data array includes a context array used for building |
|
2669 |
* an Add to Cart form. |
|
2670 |
* |
|
2671 |
* @return |
|
2672 |
* The array of product IDs extracted from the line item. |
|
2673 |
* |
|
2674 |
* @see commerce_cart_add_to_cart_form() |
|
2675 |
*/ |
|
2676 |
function commerce_cart_add_to_cart_form_product_ids($line_item) { |
|
2677 |
$product_ids = array(); |
|
2678 |
|
|
2679 |
if (empty($line_item->data['context']) || |
|
2680 |
empty($line_item->data['context']['product_ids']) || |
|
2681 |
($line_item->data['context']['product_ids'] == 'entity' && empty($line_item->data['context']['entity']))) { |
|
2682 |
return $product_ids; |
|
2683 |
} |
|
2684 |
|
|
2685 |
// If the product IDs setting tells us to use entity values... |
|
2686 |
if ($line_item->data['context']['product_ids'] == 'entity' && |
|
2687 |
is_array($line_item->data['context']['entity'])) { |
|
2688 |
$entity_data = $line_item->data['context']['entity']; |
|
2689 |
|
|
2690 |
// Load the specified entity. |
|
2691 |
$entity = entity_load_single($entity_data['entity_type'], $entity_data['entity_id']); |
|
2692 |
|
|
2693 |
// Extract the product IDs from the specified product reference field. |
|
2694 |
if (!empty($entity->{$entity_data['product_reference_field_name']})) { |
|
2695 |
$product_ids = entity_metadata_wrapper($entity_data['entity_type'], $entity)->{$entity_data['product_reference_field_name']}->raw(); |
|
2696 |
} |
|
2697 |
} |
|
2698 |
elseif (is_array($line_item->data['context']['product_ids'])) { |
|
2699 |
$product_ids = $line_item->data['context']['product_ids']; |
|
2700 |
} |
|
2701 |
|
|
2702 |
return $product_ids; |
|
2703 |
} |
|
2704 |
|
|
2483 | 2705 |
/** |
2484 | 2706 |
* Implements hook_preprocess_views_view(). |
2485 | 2707 |
*/ |
... | ... | |
2488 | 2710 |
|
2489 | 2711 |
// Add the shopping cart stylesheet to the cart or form if they are not empty. |
2490 | 2712 |
if ($view->name == 'commerce_cart_block' || $view->name == 'commerce_cart_form') { |
2491 |
if (!empty($view->result)) { |
|
2492 |
drupal_add_css(drupal_get_path('module', 'commerce_cart') . '/theme/commerce_cart.theme.css'); |
|
2493 |
} |
|
2713 |
drupal_add_css(drupal_get_path('module', 'commerce_cart') . '/theme/commerce_cart.theme.css'); |
|
2494 | 2714 |
} |
2495 | 2715 |
} |
2496 | 2716 |
|
drupal7/sites/all/modules/commerce/modules/cart/includes/commerce_cart.admin.inc | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Administrative forms and page callbacks for the Cart module. |
|
6 |
*/ |
|
7 |
|
|
8 |
|
|
9 |
/** |
|
10 |
* Form callback: confirmation form for manually refreshing an order. |
|
11 |
* |
|
12 |
* @param $order |
|
13 |
* The order object to apply the card refresh to. |
|
14 |
* |
|
15 |
* @return |
|
16 |
* The form array to confirm the refresh. |
|
17 |
* |
|
18 |
* @see confirm_form() |
|
19 |
*/ |
|
20 |
function commerce_cart_order_refresh_form($form, &$form_state, $order) { |
|
21 |
$form['order_id'] = array( |
|
22 |
'#type' => 'value', |
|
23 |
'#value' => $order->order_id, |
|
24 |
); |
|
25 |
|
|
26 |
// Build a description of what the user may expect to occur on submission. |
|
27 |
$items = array( |
|
28 |
t('All product prices will be reset and recalculated using the product pricing rules defined on this site.'), |
|
29 |
t('Non-product line items may or may not be updated depending on the type.'), |
|
30 |
t('Custom prices entered on the edit form will be lost.'), |
|
31 |
); |
|
32 |
|
|
33 |
$form = confirm_form($form, |
|
34 |
t('Are you sure you want to apply pricing rules to order @number?', array('@number' => $order->order_number)), |
|
35 |
'admin/commerce/orders/' . $order->order_id . '/edit', |
|
36 |
'<p>' . theme('item_list', array('items' => $items)) . '</p>', |
|
37 |
t('Apply pricing rules'), |
|
38 |
t('Cancel') |
|
39 |
); |
|
40 |
|
|
41 |
return $form; |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* Form submit callback for commerce_cart_order_refresh_form(). |
|
46 |
*/ |
|
47 |
function commerce_cart_order_refresh_form_submit($form, &$form_state) { |
|
48 |
if ($order = commerce_order_load($form_state['values']['order_id'])) { |
|
49 |
commerce_cart_order_refresh($order); |
|
50 |
drupal_set_message(t('Pricing rules have been applied and the order updated.')); |
|
51 |
$form_state['redirect'] = 'admin/commerce/orders/' . $order->order_id . '/edit'; |
|
52 |
} |
|
53 |
else { |
|
54 |
drupal_set_message(t('Order not found.'), 'error'); |
|
55 |
$form_state['redirect'] = 'admin/commerce/orders'; |
|
56 |
} |
|
57 |
} |
drupal7/sites/all/modules/commerce/modules/cart/includes/commerce_cart.checkout_pane.inc | ||
---|---|---|
55 | 55 |
function commerce_cart_contents_pane_checkout_form($form, &$form_state, $checkout_pane, $order) { |
56 | 56 |
$pane_form = array(); |
57 | 57 |
|
58 |
drupal_add_css(drupal_get_path('module', 'commerce_cart') . '/theme/commerce_cart.theme.css'); |
|
59 |
|
|
60 | 58 |
// Extract the View and display keys from the cart contents pane setting. |
61 | 59 |
list($view_id, $display_id) = explode('|', variable_get('commerce_cart_contents_pane_view', 'commerce_cart_summary|default')); |
62 | 60 |
|
... | ... | |
64 | 62 |
'#markup' => commerce_embed_view($view_id, $display_id, array($order->order_id)), |
65 | 63 |
); |
66 | 64 |
|
65 |
// Attach the Cart and Price module CSS to accommodate the order total area |
|
66 |
// handler's CSS being reloaded properly on a form rebuild. |
|
67 |
$pane_form['cart_contents_views']['#attached']['css'][] = drupal_get_path('module', 'commerce_cart') . '/theme/commerce_cart.theme.css'; |
|
68 |
$pane_form['cart_contents_views']['#attached']['css'][] = drupal_get_path('module', 'commerce_price') . '/theme/commerce_price.theme.css'; |
|
69 |
|
|
67 | 70 |
return $pane_form; |
68 | 71 |
} |
69 | 72 |
|
drupal7/sites/all/modules/commerce/modules/cart/includes/views/handlers/commerce_cart_handler_field_add_to_cart_form.inc | ||
---|---|---|
91 | 91 |
$line_item->data['context']['add_to_cart_combine'] = $this->options['combine']; |
92 | 92 |
|
93 | 93 |
// Generate a form ID for this add to cart form. |
94 |
$form_id = commerce_cart_add_to_cart_form_id($product_ids, $default_quantity);
|
|
94 |
$form_id = commerce_cart_add_to_cart_form_id($product_ids); |
|
95 | 95 |
|
96 | 96 |
// Add the display path to the line item's context data array if specified. |
97 | 97 |
if ($this->options['display_path']) { |
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.api.php | ||
---|---|---|
41 | 41 |
} |
42 | 42 |
} |
43 | 43 |
|
44 |
/** |
|
45 |
* Allows modules to confirm that an order may proceed to checkout. |
|
46 |
* |
|
47 |
* If any implementation of this hook returns TRUE, the given order can proceed |
|
48 |
* to checkout. However, if no implementations of this hook exist and return |
|
49 |
* TRUE, the checkout router will simply redirect away to the front page. |
|
50 |
* |
|
51 |
* @param $order |
|
52 |
* The order being confirmed for checkout. |
|
53 |
* |
|
54 |
* @return |
|
55 |
* Boolean value indicating whether or not the order can proceed to checkout. |
|
56 |
*/ |
|
57 |
function hook_commerce_checkout_order_can_checkout($order) { |
|
58 |
// Allow orders with one or more product line items to proceed to checkout. |
|
59 |
// If there are no line items on the order, redirect away. |
|
60 |
$wrapper = entity_metadata_wrapper('commerce_order', $order); |
|
61 |
|
|
62 |
if (commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()) > 0) { |
|
63 |
return TRUE; |
|
64 |
} |
|
65 |
} |
|
66 |
|
|
44 | 67 |
/** |
45 | 68 |
* Allows modules to perform business logic when an order completes checkout. |
46 | 69 |
* |
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.info | ||
---|---|---|
4 | 4 |
dependencies[] = commerce |
5 | 5 |
dependencies[] = commerce_ui |
6 | 6 |
dependencies[] = commerce_order |
7 |
dependencies[] = commerce_product_reference |
|
8 | 7 |
dependencies[] = entity |
9 | 8 |
dependencies[] = rules |
10 | 9 |
core = 7.x |
... | ... | |
13 | 12 |
; Simple tests |
14 | 13 |
files[] = tests/commerce_checkout.test |
15 | 14 |
|
16 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
17 |
version = "7.x-1.8"
|
|
15 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
16 |
version = "7.x-1.9"
|
|
18 | 17 |
core = "7.x" |
19 | 18 |
project = "commerce" |
20 |
datestamp = "1374609067"
|
|
19 |
datestamp = "1394061805"
|
|
21 | 20 |
|
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.install | ||
---|---|---|
84 | 84 |
function commerce_checkout_update_7100() { |
85 | 85 |
variable_del('commerce_checkout_completion_message_override'); |
86 | 86 |
} |
87 |
|
|
88 |
/** |
|
89 |
* Disable the new local action to simulate checkout completion for an order. |
|
90 |
*/ |
|
91 |
function commerce_checkout_update_7101() { |
|
92 |
variable_set('commerce_order_simulate_checkout_link', FALSE); |
|
93 |
return t('A new local action link on order edit forms for simulating checkout completion for an order has been disabled by default; enable it on the order settings form if desired.'); |
|
94 |
} |
|
95 |
|
|
96 |
/** |
|
97 |
* Disable the new checkout completion rule that updates order created dates to |
|
98 |
* the checkout completion date. |
|
99 |
*/ |
|
100 |
function commerce_checkout_update_7102() { |
|
101 |
variable_set('enable_commerce_checkout_order_created_date_update', FALSE); |
|
102 |
return t('A new core checkout completion rule has been added that updates order creation timestamps to the time of checkout completion. It has been disabled by default to not interfere with existing order workflows, but you may enable it in your checkout settings if desired.'); |
|
103 |
} |
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.module | ||
---|---|---|
81 | 81 |
'file' => 'includes/commerce_checkout.admin.inc', |
82 | 82 |
); |
83 | 83 |
|
84 |
// If the Order UI module is installed, add a local action to it that lets an |
|
85 |
// administrator invoke the checkout completion event on the order. Modules |
|
86 |
// that define their own order edit menu item are also responsible for |
|
87 |
// defining their own local action menu items if needed. |
|
88 |
if (module_exists('commerce_order_ui')) { |
|
89 |
$items['admin/commerce/orders/%commerce_order/edit/checkout'] = array( |
|
90 |
'title' => 'Simulate checkout completion', |
|
91 |
'description' => 'Directly invokes the checkout completion rules on the order.', |
|
92 |
'page callback' => 'drupal_get_form', |
|
93 |
'page arguments' => array('commerce_checkout_complete_form', 3), |
|
94 |
'access callback' => 'commerce_checkout_complete_form_access', |
|
95 |
'access arguments' => array(3), |
|
96 |
'type' => MENU_LOCAL_ACTION, |
|
97 |
'file' => 'includes/commerce_checkout.admin.inc', |
|
98 |
); |
|
99 |
} |
|
100 |
|
|
84 | 101 |
return $items; |
85 | 102 |
} |
86 | 103 |
|
104 |
/** |
|
105 |
* Access callback: determines access to the "Simulate checkout completion" |
|
106 |
* local action. |
|
107 |
*/ |
|
108 |
function commerce_checkout_complete_form_access($order) { |
|
109 |
// Returns TRUE if the link is enabled via the order settings form and the |
|
110 |
// user has access to update the order. |
|
111 |
return variable_get('commerce_order_simulate_checkout_link', TRUE) && commerce_order_access('update', 3); |
|
112 |
} |
|
113 |
|
|
87 | 114 |
/** |
88 | 115 |
* Implements hook_hook_info(). |
89 | 116 |
*/ |
... | ... | |
257 | 284 |
} |
258 | 285 |
} |
259 | 286 |
|
287 |
/** |
|
288 |
* Implements hook_form_FORM_ID_alter(). |
|
289 |
* |
|
290 |
* Adds a checkbox to the order settings form to enable the local action on |
|
291 |
* order edit forms to simulate checkout completion. |
|
292 |
*/ |
|
293 |
function commerce_checkout_form_commerce_order_settings_form_alter(&$form, &$form_state) { |
|
294 |
$form['commerce_order_simulate_checkout_link'] = array( |
|
295 |
'#type' => 'checkbox', |
|
296 |
'#title' => t('Enable the local action link on order edit forms to simulate checkout completion.'), |
|
297 |
'#default_value' => variable_get('commerce_order_simulate_checkout_link', TRUE), |
|
298 |
'#weight' => 20, |
|
299 |
); |
|
300 |
} |
|
301 |
|
|
260 | 302 |
/** |
261 | 303 |
* Implements hook_form_FORM_ID_alter(). |
262 | 304 |
* |
... | ... | |
568 | 610 |
return $checkout_panes; |
569 | 611 |
} |
570 | 612 |
|
613 |
/** |
|
614 |
* Resets the cached list of checkout panes. |
|
615 |
*/ |
|
616 |
function commerce_checkout_panes_reset() { |
|
617 |
$checkout_panes = &drupal_static('commerce_checkout_panes'); |
|
618 |
$checkout_panes = NULL; |
|
619 |
} |
|
620 |
|
|
571 | 621 |
/** |
572 | 622 |
* Saves a checkout pane's configuration to the database. |
573 | 623 |
* |
... | ... | |
848 | 898 |
return 'checkout/' . $order->order_id . $page_id; |
849 | 899 |
} |
850 | 900 |
|
901 |
/** |
|
902 |
* Determines whether or not the given order can proceed to checkout. |
|
903 |
* |
|
904 |
* This function operates as a confirmation rather than a falsification, meaning |
|
905 |
* that any module implementing hook_commerce_checkout_order_can_checkout() can |
|
906 |
* confirm the order may proceed to checkout. |
|
907 |
* |
|
908 |
* The default core implementation is in commerce_product_reference.module and |
|
909 |
* allows any order containing a product line item to proceed to checkout. |
|
910 |
* |
|
911 |
* More complex logic can be implemented via hook_commerce_checkout_router(). |
|
912 |
* |
|
913 |
* @param $order |
|
914 |
* The order being confirmed for checkout. |
|
915 |
* |
|
916 |
* @return |
|
917 |
* Boolean value indicating whether or not the order can proceed to checkout. |
|
918 |
* |
|
919 |
* @see commerce_product_reference_commerce_checkout_order_can_checkout() |
|
920 |
*/ |
|
921 |
function commerce_checkout_order_can_checkout($order) { |
|
922 |
$proceed = FALSE; |
|
923 |
|
|
924 |
// Manually invoke hook functions to use the bitwise operator that will update |
|
925 |
// the return value to TRUE if any implementation returns TRUE and ignore any |
|
926 |
// FALSE return values if it is already set to TRUE. |
|
927 |
foreach (module_implements('commerce_checkout_order_can_checkout') as $module) { |
|
928 |
$function = $module . '_commerce_checkout_order_can_checkout'; |
|
929 |
$proceed |= $function($order); |
|
930 |
} |
|
931 |
|
|
932 |
return $proceed; |
|
933 |
} |
|
934 |
|
|
851 | 935 |
/** |
852 | 936 |
* Completes the checkout process for the given order. |
853 | 937 |
*/ |
drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.rules_defaults.inc | ||
---|---|---|
14 | 14 |
|
15 | 15 |
$rules = array(); |
16 | 16 |
|
17 |
// Add a reaction rule to set the order created date to the checkout |
|
18 |
// completion date. This was added in a point release and thus will be |
|
19 |
// disabled by default for updated sites based on a variable set in an update |
|
20 |
// hook but enabled by default for new sites. |
|
21 |
$rule = rules_reaction_rule(); |
|
22 |
|
|
23 |
$rule->label = t('Set the order created date to the checkout completion date'); |
|
24 |
$rule->tags = array('Commerce Checkout'); |
|
25 |
$rule->active = variable_get('enable_commerce_checkout_order_created_date_update', TRUE); |
|
26 |
|
|
27 |
$rule |
|
28 |
->event('commerce_checkout_complete') |
|
29 |
->action('data_set', array( |
|
30 |
'data:select' => 'commerce-order:created', |
|
31 |
'value:select' => 'site:current-date', |
|
32 |
)); |
|
33 |
|
|
34 |
$rule->weight = -10; |
|
35 |
|
|
36 |
$rules['commerce_checkout_order_created_date_update'] = $rule; |
|
37 |
|
|
17 | 38 |
// Add a reaction rule to update an order to the default status of the pending |
18 | 39 |
// order status upon checkout completion. |
19 | 40 |
$rule = rules_reaction_rule(); |
drupal7/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.admin.inc | ||
---|---|---|
398 | 398 |
|
399 | 399 |
return $content; |
400 | 400 |
} |
401 |
|
|
402 |
/** |
|
403 |
* Form callback: confirmation form for manually invoking the checkout |
|
404 |
* completion event for an order. |
|
405 |
* |
|
406 |
* @param $order |
|
407 |
* The order object to process checkout completion on. |
|
408 |
* |
|
409 |
* @return |
|
410 |
* The form array to confirm the process. |
|
411 |
* |
|
412 |
* @see confirm_form() |
|
413 |
*/ |
|
414 |
function commerce_checkout_complete_form($form, &$form_state, $order) { |
|
415 |
$form['order_id'] = array( |
|
416 |
'#type' => 'value', |
|
417 |
'#value' => $order->order_id, |
|
418 |
); |
|
419 |
|
|
420 |
// Build a description of what the user may expect to occur on submission. |
|
421 |
$items = array( |
|
422 |
t('The normal checkout completion process will be invoked on this order.'), |
|
423 |
t('This may involve order status updates and e-mail notifications.'), |
|
424 |
); |
|
425 |
|
|
426 |
$form = confirm_form($form, |
|
427 |
t('Are you sure you want to simulate checkout completion for order @number?', array('@number' => $order->order_number)), |
|
428 |
'admin/commerce/orders/' . $order->order_id . '/edit', |
|
429 |
'<p>' . theme('item_list', array('items' => $items)) . '</p>', |
|
430 |
t('Simulate checkout completion'), |
|
431 |
t('Cancel') |
|
432 |
); |
|
433 |
|
|
434 |
return $form; |
|
435 |
} |
|
436 |
|
|
437 |
/** |
|
438 |
* Form submit callback for commerce_checkout_complete_form(). |
|
439 |
*/ |
|
440 |
function commerce_checkout_complete_form_submit($form, &$form_state) { |
|
441 |
if ($order = commerce_order_load($form_state['values']['order_id'])) { |
|
442 |
commerce_checkout_complete($order); |
|
443 |
drupal_set_message(t('Checkout completion rules have been executed for the order.')); |
|
444 |
$form_state['redirect'] = 'admin/commerce/orders/' . $order->order_id . '/edit'; |
|
445 |
} |
|
446 |
else { |
|
447 |
drupal_set_message(t('Order not found.'), 'error'); |
|
448 |
$form_state['redirect'] = 'admin/commerce/orders'; |
|
449 |
} |
|
450 |
} |
drupal7/sites/all/modules/commerce/modules/checkout/includes/commerce_checkout.pages.inc | ||
---|---|---|
39 | 39 |
} |
40 | 40 |
} |
41 | 41 |
|
42 |
// If there are no line items on the order, redirect away. |
|
43 |
$wrapper = entity_metadata_wrapper('commerce_order', $order); |
|
44 |
|
|
45 |
if (commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()) == 0) { |
|
42 |
// Ensure the order can proceed to checkout; if not, redirect away. |
|
43 |
if (!commerce_checkout_order_can_checkout($order)) { |
|
46 | 44 |
drupal_goto('<front>'); |
47 | 45 |
} |
48 | 46 |
|
... | ... | |
231 | 229 |
* are happy, we move on to the next page. |
232 | 230 |
*/ |
233 | 231 |
function commerce_checkout_form_validate($form, &$form_state) { |
234 |
global $user; |
|
235 |
|
|
236 | 232 |
$checkout_page = $form_state['checkout_page']; |
237 | 233 |
|
238 | 234 |
// Load a fresh copy of the order stored in the form. |
drupal7/sites/all/modules/commerce/modules/checkout/tests/commerce_checkout.test | ||
---|---|---|
175 | 175 |
$this->assertTitle(t('Review order') . ' | Drupal', t('When clicking in the \'Continue\' button, the title displayed corresponds with the current checkout phase: \'Review order\'')); |
176 | 176 |
|
177 | 177 |
// Finish checkout process |
178 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
178 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
179 | 179 |
|
180 | 180 |
// Reload the order directly from db to update status. |
181 | 181 |
$order = commerce_order_load_multiple(array($this->order->order_id), array(), TRUE); |
... | ... | |
263 | 263 |
$this->assertNoRaw(t('The e-mail address %mail is not valid.', array('%mail' => $user_mail)), t('A warning message is not displayed when the e-mail address for the anonymous user is valid')); |
264 | 264 |
|
265 | 265 |
// Finish checkout process for good. |
266 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
266 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
267 | 267 |
} |
268 | 268 |
|
269 | 269 |
/** |
... | ... | |
331 | 331 |
$this->assertEqual(reset($order)->status, 'checkout_review', t('Order status is \'Checkout Review\' in the review phase.')); |
332 | 332 |
|
333 | 333 |
// Finish checkout process |
334 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
334 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
335 | 335 |
|
336 | 336 |
// Reload the order directly from db to check status. |
337 | 337 |
$order = commerce_order_load_multiple(array($this->order->order_id), array(), TRUE); |
... | ... | |
381 | 381 |
$this->drupalPost(NULL, $info, t('Continue to next step')); |
382 | 382 |
|
383 | 383 |
// Finish checkout process |
384 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
384 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
385 | 385 |
|
386 | 386 |
// Reload the order directly from db to check its owner. |
387 | 387 |
$order = commerce_order_load_multiple(array($this->order->order_id), array(), TRUE); |
... | ... | |
427 | 427 |
$this->drupalPost(NULL, $info, t('Continue to next step')); |
428 | 428 |
|
429 | 429 |
// Finish checkout process |
430 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
430 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
431 | 431 |
|
432 | 432 |
// Reload the order directly from db to check its owner. |
433 | 433 |
$order = commerce_order_load_multiple(array($this->order->order_id), array(), TRUE); |
... | ... | |
514 | 514 |
$this->assertCheckoutPageNotAccessible($this->order, 'complete'); |
515 | 515 |
|
516 | 516 |
// Fill in the payment method and continue the process. |
517 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
517 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
518 | 518 |
|
519 | 519 |
// At this point, only the complete page should be accessible. |
520 | 520 |
$this->assertCheckoutPageNotAccessible($this->order, ''); |
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer.api.php | ||
---|---|---|
29 | 29 |
* - name: the translatable name of the profile type, used as the title of the |
30 | 30 |
* corresponding checkout pane |
31 | 31 |
* - description: a translatable description of the intended use of data |
32 |
* contained in this type of customer information profile |
|
32 |
* contained in this type of customer profile. This description will be |
|
33 |
* displayed on the profile types administrative page and on the customer |
|
34 |
* profiles add page. |
|
33 | 35 |
* - help: a translatable help message to be displayed at the top of the |
34 |
* administrative add / edit form for profiles of this type |
|
36 |
* administrative add / edit form for profiles of this type. The Drupal |
|
37 |
* core help module or any module invoking hook_help needs to be enabled |
|
38 |
* to take advantage of this help text. |
|
35 | 39 |
* - addressfield: boolean indicating whether or not the profile type should |
36 | 40 |
* have a default address field; defaults to TRUE |
37 | 41 |
* - label_callback: name of the function to use to determine the label of |
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer.info | ||
---|---|---|
21 | 21 |
; Simple tests |
22 | 22 |
; files[] = tests/commerce_customer.test |
23 | 23 |
|
24 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
25 |
version = "7.x-1.8"
|
|
24 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
25 |
version = "7.x-1.9"
|
|
26 | 26 |
core = "7.x" |
27 | 27 |
project = "commerce" |
28 |
datestamp = "1374609067"
|
|
28 |
datestamp = "1394061805"
|
|
29 | 29 |
|
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer.module | ||
---|---|---|
773 | 773 |
/** |
774 | 774 |
* Implements hook_query_TAG_alter(). |
775 | 775 |
*/ |
776 |
function commerce_customer_profile_query_commerce_customer_profile_access_alter(QueryAlterableInterface $query) {
|
|
776 |
function commerce_customer_query_commerce_customer_profile_access_alter(QueryAlterableInterface $query) { |
|
777 | 777 |
return commerce_entity_access_query_alter($query, 'commerce_customer_profile'); |
778 | 778 |
} |
779 | 779 |
|
... | ... | |
1420 | 1420 |
*/ |
1421 | 1421 |
function commerce_customer_profile_copy_fields($info, &$target, $source, &$form_state) { |
1422 | 1422 |
list($entity_type, $bundle, $pane_id) = $info; |
1423 |
$form_state['order']->data['profile_copy'][$pane_id]['elements'] = array(); |
|
1423 | 1424 |
|
1424 | 1425 |
// Loop over all the field instances that could be attached to this entity. |
1425 | 1426 |
foreach (field_info_instances($entity_type, $bundle) as $field_name => $instance) { |
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer_ui.info | ||
---|---|---|
1 | 1 |
name = Customer UI |
2 | 2 |
description = Exposes a default UI for Customers through profile edit forms and default Views. |
3 | 3 |
package = Commerce |
4 |
dependencies[] = contextual |
|
5 | 4 |
dependencies[] = field_ui |
6 | 5 |
dependencies[] = commerce |
7 | 6 |
dependencies[] = commerce_ui |
... | ... | |
10 | 9 |
core = 7.x |
11 | 10 |
configure = admin/commerce/customer-profiles/types |
12 | 11 |
|
13 |
; Module includes |
|
14 |
files[] = includes/commerce_customer_ui.profiles.inc |
|
15 |
files[] = includes/commerce_customer_ui.profile_types.inc |
|
16 |
|
|
17 |
; Views includes |
|
18 |
files[] = includes/views/commerce_customer_ui.views_default.inc |
|
19 |
|
|
20 | 12 |
; Simple tests |
21 | 13 |
files[] = tests/commerce_customer_ui.test |
22 | 14 |
|
23 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
24 |
version = "7.x-1.8"
|
|
15 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
16 |
version = "7.x-1.9"
|
|
25 | 17 |
core = "7.x" |
26 | 18 |
project = "commerce" |
27 |
datestamp = "1374609067"
|
|
19 |
datestamp = "1394061805"
|
|
28 | 20 |
|
drupal7/sites/all/modules/commerce/modules/customer/commerce_customer_ui.module | ||
---|---|---|
185 | 185 |
|
186 | 186 |
// Return the user defined help text per customer profile type when adding profiles. |
187 | 187 |
if ($arg[1] == 'commerce' && $arg[2] == 'customer-profiles' && $arg[3] == 'add' && $arg[4]) { |
188 |
$profile_type = commerce_customer_profile_type_load($arg[5]);
|
|
188 |
$profile_type = commerce_customer_profile_type_load($arg[4]);
|
|
189 | 189 |
return (!empty($profile_type['help']) ? '<p>' . filter_xss_admin($profile_type['help']) . '</p>' : ''); |
190 | 190 |
} |
191 | 191 |
} |
drupal7/sites/all/modules/commerce/modules/customer/includes/commerce_customer_ui.profile_types.inc | ||
---|---|---|
32 | 32 |
|
33 | 33 |
// If no profile types are defined... |
34 | 34 |
if (empty($rows)) { |
35 |
// Add a standard empty row with a link to add a new profile type.
|
|
35 |
// Add a standard empty row. |
|
36 | 36 |
$rows[] = array( |
37 | 37 |
array( |
38 |
'data' => t('There are no customer profile types yet. <a href="@link">Add profile type</a>.', array('@link' => url('admin/commerce/customers/profiles/types/add'))),
|
|
38 |
'data' => t('There are no customer profile types defined on this site.'),
|
|
39 | 39 |
'colspan' => 2, |
40 | 40 |
) |
41 | 41 |
); |
drupal7/sites/all/modules/commerce/modules/customer/includes/views/handlers/commerce_customer_handler_field_customer_profile_link_delete.inc | ||
---|---|---|
18 | 18 |
$profile->type = $this->get_value($values, 'type'); |
19 | 19 |
$profile->uid = $this->get_value($values, 'uid'); |
20 | 20 |
|
21 |
if (!commerce_customer_profile_access('update', $profile)) {
|
|
21 |
if (!commerce_customer_profile_access('delete', $profile)) {
|
|
22 | 22 |
return; |
23 | 23 |
} |
24 | 24 |
|
drupal7/sites/all/modules/commerce/modules/customer/tests/commerce_customer_profile_dummy_type.info | ||
---|---|---|
5 | 5 |
core = 7.x |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
9 |
version = "7.x-1.8"
|
|
8 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
9 |
version = "7.x-1.9"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "commerce" |
12 |
datestamp = "1374609067"
|
|
12 |
datestamp = "1394061805"
|
|
13 | 13 |
|
drupal7/sites/all/modules/commerce/modules/customer/tests/commerce_customer_ui.test | ||
---|---|---|
407 | 407 |
$this->drupalPost(NULL, $info, t('Continue to next step')); |
408 | 408 |
|
409 | 409 |
// Finish checkout process |
410 |
$this->drupalPost(NULL, array('commerce_payment[payment_details][name]' => 'Example payment method'), t('Continue to next step'));
|
|
410 |
$this->drupalPost(NULL, array(), t('Continue to next step')); |
|
411 | 411 |
|
412 | 412 |
// Login with store admin. |
413 | 413 |
$this->drupalLogin($this->store_admin); |
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item.info | ||
---|---|---|
22 | 22 |
; Simple tests |
23 | 23 |
; files[] = tests/commerce_line_item.test |
24 | 24 |
|
25 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
26 |
version = "7.x-1.8"
|
|
25 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
26 |
version = "7.x-1.9"
|
|
27 | 27 |
core = "7.x" |
28 | 28 |
project = "commerce" |
29 |
datestamp = "1374609067"
|
|
29 |
datestamp = "1394061805"
|
|
30 | 30 |
|
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item_ui.info | ||
---|---|---|
1 | 1 |
name = Line Item UI |
2 | 2 |
description = Exposes a default UI for Line Items through line item type forms and default Views. |
3 | 3 |
package = Commerce |
4 |
dependencies[] = contextual |
|
5 | 4 |
dependencies[] = field_ui |
6 | 5 |
dependencies[] = commerce |
7 | 6 |
dependencies[] = commerce_ui |
... | ... | |
10 | 9 |
core = 7.x |
11 | 10 |
configure = admin/commerce/config/line-items |
12 | 11 |
|
13 |
; Information added by drupal.org packaging script on 2013-07-23
|
|
14 |
version = "7.x-1.8"
|
|
12 |
; Information added by Drupal.org packaging script on 2014-03-05
|
|
13 |
version = "7.x-1.9"
|
|
15 | 14 |
core = "7.x" |
16 | 15 |
project = "commerce" |
17 |
datestamp = "1374609067"
|
|
16 |
datestamp = "1394061805"
|
|
18 | 17 |
|
drupal7/sites/all/modules/commerce/modules/line_item/commerce_line_item_ui.module | ||
---|---|---|
112 | 112 |
return '<p>' . t('Line items represent anything on an order that affects the order total. Each line item must be of one of the line item types listed below, which define how these items interact with Add to Cart forms, the shopping cart, the order edit page, and more. Line item types are defined by modules, with some modules also allowing you to clone line item types through this interface.') . '</p>'; |
113 | 113 |
} |
114 | 114 |
} |
115 |
|
|
116 |
|
|
117 |
/** |
|
118 |
* Implements hook_views_api(). |
|
119 |
* |
|
120 |
function commerce_line_item_ui_views_api() { |
|
121 |
return array( |
|
122 |
'api' => 3, |
|
123 |
'path' => drupal_get_path('module', 'commerce_line_item_ui') . '/includes/views', |
|
124 |
); |
|
125 |
}*/ |
drupal7/sites/all/modules/commerce/modules/line_item/includes/views/handlers/commerce_line_item_handler_field_edit_quantity.inc | ||
---|---|---|
61 | 61 |
$field_name = $this->options['id']; |
62 | 62 |
foreach (element_children($form[$field_name]) as $row_id) { |
63 | 63 |
// Ensure the quantity is actually a numeric value. |
64 |
$line_item_id = $form[$field_name][$row_id]['#line_item_id']; |
|
65 | 64 |
if (!is_numeric($form_state['values'][$field_name][$row_id]) || $form_state['values'][$field_name][$row_id] < 0) { |
Formats disponibles : Unified diff
Weekly update of contrib modules