Left file: C:\Users\dbh\Documents\Downloads\uc_coupon-6.x-1.x-dev.tar\uc_coupon-6.x-1.x-dev\uc_coupon\uc_coupon.module Right file: C:\Users\dbh\Documents\Downloads\uc_coupon\uc_coupon.module 12a13 > * 20090526 David Harrison, Linker Systems, Inc. Added valid_from as a start date for coupons 140a142 > $header[] = array('data' => t('Valid from'), 'field' => 'valid_from'); //$$$ 144c146 < $result = pager_query('SELECT cid, name, value, code, type, valid_until, bulk FROM {uc_coupons} WHERE status = %d'. tablesort_sql($header), 20, 0, NULL, $view_type == 'inactive' ? 0 : 1); --- > $result = pager_query('SELECT cid, name, value, code, type, valid_from, valid_until, bulk FROM {uc_coupons} WHERE status = %d'. tablesort_sql($header), 20, 0, NULL, $view_type == 'inactive' ? 0 : 1); 153c155 < --- > 162,163c164 < $rows[] = array($row->name, $code, $value, format_date($row->valid_until, 'custom', variable_get('uc_date_format_default', 'm/d/Y')), $actions); < } --- > $rows[] = array($row->name, $code, $value, format_date($row->valid_from, 'custom', variable_get('uc_date_format_default', 'm/d/Y')), format_date($row->valid_until, 'custom', variable_get('uc_date_format_default', 'm/d/Y')), $actions); } 197a199 > $value->valid_from = time(); //$$$ 203a206 > $value->valid_from = array('year' => format_date($value->valid_from, 'custom', 'Y'), 'month' => format_date($value->valid_from, 'custom', 'n'), 'day' => format_date($value->valid_from, 'custom', 'j')); //$$$ 264a268,276 > //$$$ form section for valid_from > $form['valid_from'] = array( > '#type' => 'date', > '#title' => t('Start date'), > '#default_value' => $value->valid_from, > '#required' => TRUE, > '#after_build' => array('_uc_coupon_date_range'), > ); > 599a612 > $valid_from = mktime(0, 0, 0, $form_state['values']['valid_from']['month'], $form_state['values']['valid_from']['day'], $form_state['values']['valid_from']['year']); //$$$ 660c673 < db_query("INSERT INTO {uc_coupons} (name, code, value, type, status, valid_until, max_uses, minimum_order, data, bulk, bulk_seed) VALUES ('%s', '%s', %f, '%s', %d, %d, %d, %d, '%s', %d, '%s')", $form_state['values']['name'], $code, $form_state['values']['value'], $form_state['values']['type'], $form_state['values']['status'], $valid_until, $form_state['values']['max_uses'], $form_state['values']['minimum_order'], serialize($data), $form_state['values']['bulk_generate'], md5(uniqid())); --- > db_query("INSERT INTO {uc_coupons} (name, code, value, type, status, valid_from, valid_until, max_uses, minimum_order, data, bulk, bulk_seed) VALUES ('%s', '%s', %f, '%s', %d, %d, %d, %d, %d, '%s', %d, '%s')", $form_state['values']['name'], $code, $form_state['values']['value'], $form_state['values']['type'], $form_state['values']['status'], $valid_from, $valid_until, $form_state['values']['max_uses'], $form_state['values']['minimum_order'], serialize($data), $form_state['values']['bulk_generate'], md5(uniqid())); 664c677 < db_query("UPDATE {uc_coupons} SET name = '%s', code = '%s', value = %f, type = '%s', status = %d, valid_until = %d, max_uses = %d, minimum_order = %d, data = '%s', bulk = %d WHERE cid = %d", $form_state['values']['name'], $code, $form_state['values']['value'], $form_state['values']['type'], $form_state['values']['status'], $valid_until, $form_state['values']['max_uses'], $form_state['values']['minimum_order'], serialize($data), $form_state['values']['bulk_generate'], $form['#uc_coupon_cid']); --- > db_query("UPDATE {uc_coupons} SET name = '%s', code = '%s', value = %f, type = '%s', status = %d, valid_from = %d, valid_until = %d, max_uses = %d, minimum_order = %d, data = '%s', bulk = %d WHERE cid = %d", $form_state['values']['name'], $code, $form_state['values']['value'], $form_state['values']['type'], $form_state['values']['status'], $valid_from, $valid_until, $form_state['values']['max_uses'], $form_state['values']['minimum_order'], serialize($data), $form_state['values']['bulk_generate'], $form['#uc_coupon_cid']); 745c758 < $coupon = db_fetch_object(db_query("SELECT * FROM {uc_coupons} WHERE code = '%s' AND status = 1 AND bulk = 0 AND valid_until > %d", $code, time())); --- > $coupon = db_fetch_object(db_query("SELECT * FROM {uc_coupons} WHERE code = '%s' AND status = 1 AND bulk = 0 AND valid_from<%d AND valid_until > %d", $code, time(), time())); 803c816 < $result->message = t('This coupon code is invalid or has expired.'); --- > $result->message = t('This coupon code is invalid, has not started, or has expired.');