summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Cambra2012-09-07 09:12:55 (GMT)
committer Pedro Cambra2012-09-07 09:12:55 (GMT)
commitf213116a5ebc513e71580ea33a2bd435eb172a8f (patch)
tree6274851127d16be1b4105cf61cc78816e754c2d7
parent3ef94ef1c29bc5689094620441bc37a073f4b32c (diff)
Issue #1775386 by firkin, jucallme: Make coupon pass Coder Review.
-rw-r--r--commerce_coupon.module12
-rw-r--r--includes/commerce_coupon.checkout_pane.inc7
2 files changed, 9 insertions, 10 deletions
diff --git a/commerce_coupon.module b/commerce_coupon.module
index 95529b2..daa5402 100644
--- a/commerce_coupon.module
+++ b/commerce_coupon.module
@@ -11,7 +11,7 @@
/**
* Implements hook_entity_info().
*
- * This function provides informations about the coupon entities.
+ * This function provides information about the coupon entities.
*/
function commerce_coupon_entity_info() {
$entity_info['commerce_coupon'] = array(
@@ -204,7 +204,7 @@ function commerce_coupon_generate_coupon_code($length = NULL) {
* Returns TRUE if the code is valid else FALSE.
*/
function commerce_coupon_code_is_valid($code, $order) {
- global $commerce_coupon_validation_error_message;
+ global $_commerce_coupon_validation_error_message;
// Trim trailing spaces
$code = trim($code);
@@ -219,7 +219,7 @@ function commerce_coupon_code_is_valid($code, $order) {
// Check if the coupon is already applied to this order. In any case we
// never want that a coupon is applied twice.
if (commerce_coupon_code_is_in_order($code, $order)) {
- $commerce_coupon_validation_error_message = t('Sorry, you can only apply a coupon once per order.');
+ $_commerce_coupon_validation_error_message = t('Sorry, you can only apply a coupon once per order.');
return FALSE;
}
@@ -719,7 +719,7 @@ function commerce_coupon_delete_multiple(array $commerce_coupon_ids) {
* @return
* Boolean indicating whether or not the coupon can be deleted.
*
- * @see commerce_product_can_delete
+ * @see commerce_product_can_delete()
*/
function commerce_coupon_can_delete($coupon) {
// Return FALSE if the given coupon does not have an ID; it need not be
@@ -865,8 +865,8 @@ function commerce_coupon_machine_name_code($coupon) {
$coupon_code = $coupon->commerce_coupon_code[LANGUAGE_NONE][0]['value'];
// Set the pattern replacement to the default one that drupal uses for
// machine names.
- // @see form_process_machine_name
- return preg_replace('/_+/', '_', preg_replace('/[^a-z0-9]/', '_', strtolower($coupon_code)));
+ // @see form_process_machine_name()
+ return preg_replace('/_+/', '_', preg_replace('/[^a-z0-9]/', '_', drupal_strtolower($coupon_code)));
}
/**
diff --git a/includes/commerce_coupon.checkout_pane.inc b/includes/commerce_coupon.checkout_pane.inc
index 53bd71c..088b2a3 100644
--- a/includes/commerce_coupon.checkout_pane.inc
+++ b/includes/commerce_coupon.checkout_pane.inc
@@ -39,8 +39,7 @@ function commerce_coupon_pane_checkout_form($form, &$form_state, $checkout_pane,
* Check whether the coupon code is valid.
*/
function commerce_coupon_pane_checkout_form_validate($form, &$form_state, $checkout_pane, $order) {
- //@todo I think global function should start and end with an underscore
- global $commerce_coupon_validation_error_message;
+ global $_commerce_coupon_validation_error_message;
// Check if coupon code is empty.
if (empty($form_state['values']['commerce_coupon']['coupon_code'])) {
@@ -52,8 +51,8 @@ function commerce_coupon_pane_checkout_form_validate($form, &$form_state, $check
return TRUE;
}
else {
- if (isset($commerce_coupon_validation_error_message)) {
- $message = $commerce_coupon_validation_error_message;
+ if (isset($_commerce_coupon_validation_error_message)) {
+ $message = $_commerce_coupon_validation_error_message;
}
else {
$message = t('Your coupon code is not valid.');