Revize 222
Přidáno uživatelem Michal Kliment před více než 15 roky(ů)
freenetis/trunk/kohana/application/helpers/date.php | ||
---|---|---|
|
||
return date("Y-m-d",mktime(0,0,0,$month,$day,$year));
|
||
}
|
||
|
||
/**
|
||
* Function to finding difference between 2 dates
|
||
* @param $date_a date in format 'YYYY-mm-dd'
|
||
* @param $date_b date in format 'YYYY-mm-dd'
|
||
* @return <type>
|
||
*/
|
||
|
||
public static function diff_month($date_a = '0000-00-00', $date_b = '0000-00-00')
|
||
{
|
||
$year_a = (int) substr($date_a,0,4);
|
||
$year_b = (int) substr($date_b,0,4);
|
||
$month_a = (int) substr($date_a,5,2);
|
||
$month_b = (int) substr($date_b,5,2);
|
||
|
||
return ($year_a * 12 + $month_a) - ($year_b * 12 + $month_b);
|
||
}
|
||
} // End date
|
freenetis/trunk/kohana/application/controllers/membership_interrupts.php | ||
---|---|---|
|
||
$from_date = date::round_month($from['day'],$from['month'],$from['year']);
|
||
$to_date = date::round_month($to['day'],$to['month'],$to['year']);
|
||
|
||
$diff = strtotime($to_date) -strtotime($from_date);
|
||
|
||
|
||
$diff = date::diff_month($to_date,$from_date);
|
||
if ($diff < 0)
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.date from must be smaller then date to').'.');
|
||
}
|
||
|
||
if ($diff < 2678400)
|
||
if ($diff < 1)
|
||
{
|
||
$input->add_error('required', url_lang::lang('texts.minimal duration of interrupt is one month').'.');
|
||
}
|
Také k dispozici: Unified diff
Opravena chyba nedovolujici vytvorit preruseni clenstvi jenom na 1 mesic.