Changeset 27

Show
Ignore:
Timestamp:
12/22/08 11:48:12 (2 years ago)
Author:
matthew
Message:

Correctly stores hosting start date, expiry date and term length.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • drupal/modules/iutilities/trunk/iutilities.module

    r26 r27  
    4242        ); 
    4343        $next_year = time() + 31556926; 
     44        $default_expiry = variable_get('hosting_expiry_date', $next_year); 
     45        if (!is_array($default_expiry)) { 
     46                $default_expiry = array( 
     47                        'month' => format_date($default_expiry, 'custom', 'n'), 
     48                        'day' => format_date($default_expiry, 'custom', 'j'), 
     49                        'year' => format_date($default_expiry, 'custom', 'Y'), 
     50                ); 
     51        }        
    4452        $now = time(); 
    45         $expiry_date = variable_get('hosting_expiry_date', $next_year); 
    46         $start_date = variable_get('hosting_start_date',$now); 
     53        $default_start = variable_get('hosting_start_date',$now); 
     54        if (!is_array($default_start)) { 
     55                $default_start = array( 
     56                        'month' => format_date($default_start, 'custom', 'n'), 
     57                        'day' => format_date($default_start, 'custom', 'j'), 
     58                        'year' => format_date($default_start, 'custom', 'Y'), 
     59                ); 
     60        }        
    4761        $form['i_hostingdate']['hosting_start_date'] = array( 
    4862                '#type' => 'date', 
    49                 '#title' => t('Hosting start date.'), 
    50                 '#default_value' => array( 
    51                         'month' => format_date($start_date, 'custom', 'n'), 
    52                         'day' => format_date($start_date, 'custom', 'j'), 
    53                         'year' => format_date($start_date, 'custom', 'Y'), 
    54                 ), 
     63                '#title' => t('Hosting start date'), 
     64                '#default_value' => $default_start, 
    5565                '#description' => t("Hosting for this site began on the date here. This should not be changed once set."), 
    5666                '#required' => TRUE, 
     
    5868        $form['i_hostingdate']['hosting_expiry_date'] = array( 
    5969                '#type' => 'date', 
    60                 '#title' => t('Hosting expiry date.'), 
    61                 '#default_value' => array( 
    62                         'month' => format_date($expiry_date, 'custom', 'n'), 
    63                         'day' => format_date($expiry_date, 'custom', 'j'), 
    64                         'year' => format_date($expiry_date, 'custom', 'Y'), 
    65                 ), 
     70                '#title' => t('Hosting expiry date'), 
     71                '#default_value' => $default_expiry, 
    6672                '#description' => t("Hosting for this site expires on the date here. Users with the role defined above will recieve reminder emails when the renewal date approaches"), 
    6773                '#required' => TRUE,