Simple change to Renew License validation to allow subtraction

Created on 17 February 2015, over 10 years ago
Updated 19 August 2025, 4 days ago

I propose a simple change in the Renew License operation to permit negative integers. This will allow more flexibility for expiration date control. In the following code, I changed "element_validate_integer_positive" to "element_validate_integer". Adding -5 days seems to go through and bring the expiration date 5 days earlier.

function commerce_license_renew_action_form($context) {
...
  $form['duration'] = array(
    '#type' => 'container',
    'duration_value' => array(
      '#type' => 'textfield',
      '#title' => t('Renew the license for another:'),
      '#size' => 5,
      '#default_value' => $default_value,
      // '#element_validate' => array('element_validate_integer_positive'),
      '#element_validate' => array('element_validate_integer'),
    ),

I would also love to have the ability to set a specific expiration date, but that's a bit more involved.

πŸ’¬ Support request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mr.andrey

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024