static function addPresets($company_id, $country) { if ($company_id == '') { return FALSE; } switch (strtolower($country)) { case 'ca': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('New Years Day'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Good Friday'); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Canada Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Canada Day'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(1); $rhf->setMonth(7); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Labour Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(1); $rhf->setDayOfWeek(1); //$rhf->setDayOfMonth( 1 ); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Xmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Christmas'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } //BC Holidays Debug::text('Saving.... British Columbia Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('BC - British Columbia Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(1); $rhf->setDayOfWeek(1); //$rhf->setDayOfMonth( 1 ); $rhf->setMonth(8); if ($rhf->isValid()) { $rhf->Save(); } //AB Holidays Debug::text('Saving.... Family Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('AB - Family Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(3); $rhf->setDayOfWeek(1); //$rhf->setDayOfMonth( 1 ); $rhf->setMonth(2); if ($rhf->isValid()) { $rhf->Save(); } //Holidays across different provinces Debug::text('Saving.... Victoria Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Victoria Day'); $rhf->setType(30); $rhf->setSpecialDay(0); $rhf->setPivotDayDirection(10); $rhf->setDayOfWeek(1); $rhf->setDayOfMonth(24); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Thanksgiving', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Thanksgiving Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(2); $rhf->setDayOfWeek(1); //$rhf->setDayOfMonth( 1 ); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Rememberance Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Rememberance Day'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(11); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } break; case 'us': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('New Years Day'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Independence Day'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(4); $rhf->setMonth(7); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Veterans Day'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(11); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Christmas'); $rhf->setType(10); $rhf->setSpecialDay(0); //$rhf->setWeekInterval( $data['week_interval'] ); //$rhf->setDayOfWeek( $data['day_of_week'] ); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Martin Luther King Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(3); $rhf->setDayOfWeek(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Presidents Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(3); $rhf->setDayOfWeek(1); $rhf->setMonth(2); if ($rhf->isValid()) { $rhf->Save(); } //Pivot Day $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Memorial Day'); $rhf->setType(30); $rhf->setSpecialDay(0); $rhf->setPivotDayDirection(20); $rhf->setDayOfWeek(1); $rhf->setDayOfMonth(24); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Labor Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(1); $rhf->setDayOfWeek(1); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Columbus Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(2); $rhf->setDayOfWeek(1); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Thanksgiving Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(4); $rhf->setDayOfWeek(4); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Day After Thanksgiving Day'); $rhf->setType(20); $rhf->setSpecialDay(0); $rhf->setWeekInterval(4); $rhf->setDayOfWeek(5); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName('Good Friday'); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } break; case 'cr': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('New Years Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Thursday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Thursday')); $rhf->setType(20); $rhf->setSpecialDay(2); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Friday')); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Juan Santamaria Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Juan Santamaria Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(11); $rhf->setMonth(4); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Labour Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Anexion de Guanacaste Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Anexion de Guanacaste Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(7); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Virgen de los Angeles Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Virgen de los Angeles Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(2); $rhf->setMonth(8); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Mothers Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Mothers Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(8); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Independence Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Independence Day CR')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Culture Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Culture Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(12); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } break; case 'gt': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('New Years Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Wednesday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Wednesday')); $rhf->setType(20); $rhf->setSpecialDay(3); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Thursday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Thursday')); $rhf->setType(20); $rhf->setSpecialDay(2); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Friday')); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Labour Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Army Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Army Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(30); $rhf->setMonth(6); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Virgin Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Virgin Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(8); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Independence Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Independence Day CR')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... 1944 Revolution Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('1944 Revolution Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(20); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... All Saint Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('All Saint Day')); $rhf->setType(30); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas Eve', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas Eve')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(24); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } break; case 'hn': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('New Years Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Thursday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Thursday')); $rhf->setType(20); $rhf->setSpecialDay(2); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Friday')); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Saturday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Saturday')); $rhf->setType(20); $rhf->setSpecialDay(2); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Labour Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Independence Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Independence Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Morazan Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Morazan Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(3); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Culture Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Culture Day')); $rhf->setType(30); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(12); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Armed Forces Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Armed Forces Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(21); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } break; case 'sv': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('New Years Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Thursday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Thursday')); $rhf->setType(20); $rhf->setSpecialDay(2); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Friday')); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Labour Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Bank Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Bank Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(30); $rhf->setMonth(6); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... San Salvador Party', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('San Salvador Party')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(4); $rhf->setMonth(8); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Independence Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Independence Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Columbus Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Columbus Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(12); $rhf->setMonth(10); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... All Saints Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('All Saints Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(2); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... First Cry of Independence', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('First Cry of Independence')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(5); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } break; case 'ni': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('New Years Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Thursday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Thursday')); $rhf->setType(20); $rhf->setSpecialDay(2); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Friday')); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Labour Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Revolution Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Revolution Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(19); $rhf->setMonth(7); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... San Jacinto Battle', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('San Jacinto Battle')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(14); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Independence Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Independence Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(15); $rhf->setMonth(9); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } break; case 'pa': Debug::text('Saving.... New Years', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('New Years Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Martyr`s Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Martyr`s Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(9); $rhf->setMonth(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Good Friday/Easter', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Good Friday')); $rhf->setType(20); $rhf->setSpecialDay(1); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Labour Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Labour Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(1); $rhf->setMonth(5); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Separation Day (from Colombia)', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Separation Day from Colombia')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(3); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Flag Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Flag Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(4); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Primer Grito de Independencia de la Villa de los Santos', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Primer Grito de Independencia de la Villa de los Santos')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(10); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Independence Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Independence Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(28); $rhf->setMonth(11); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Mothers Day', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Mothers Day')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(8); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } Debug::text('Saving.... Christmas', __FILE__, __LINE__, __METHOD__, 10); $rhf = new RecurringHolidayFactory(); $rhf->setCompany($company_id); $rhf->setName(TTi18n::gettext('Christmas')); $rhf->setType(10); $rhf->setSpecialDay(0); $rhf->setDayOfMonth(25); $rhf->setMonth(12); if ($rhf->isValid()) { $rhf->Save(); } break; } return TRUE; }
$smarty->assign('title', TTi18n::gettext($title = 'Edit Recurring Holiday')); // See index.php /* * Get FORM variables */ extract(FormVariables::GetVariables(array('action', 'id', 'data'))); $rhf = new RecurringHolidayFactory(); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': //Debug::setVerbosity(11); Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); $rhf->setId($data['id']); $rhf->setCompany($current_company->getId()); $rhf->setName($data['name']); $rhf->setType($data['type_id']); /* if ( isset($data['easter']) ) { $rhf->setEaster( TRUE ); } else { $rhf->setEaster( FALSE ); } */ $rhf->setSpecialDay($data['special_day_id']); $rhf->setWeekInterval($data['week_interval']); $rhf->setPivotDayDirection($data['pivot_day_direction_id']); if ($data['type_id'] == 20) { $rhf->setDayOfWeek($data['day_of_week_20']); } elseif ($data['type_id'] == 30) { $rhf->setDayOfWeek($data['day_of_week_30']);