function duplicate($options = array())
{
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
if (isset($this->fields[$key])) {
$this->fields[$key] = $val;
}
}
}
$input = $this->fields;
$oldID = $input['id'];
unset($input['id']);
if ($newID = $this->add($input)) {
Calendar_Holiday::cloneCalendar($oldID, $newID);
CalendarSegment::cloneCalendar($oldID, $newID);
$this->updateDurationCache($newID);
return true;
}
return false;
}