BUG 0000 improving the calendar code

This commit is contained in:
Carlos Pacha
2011-10-28 17:41:03 -04:00
parent 89b9dbab56
commit 7eef666151
2 changed files with 10 additions and 10 deletions

View File

@@ -55,7 +55,6 @@ class CalendarHolidays extends BaseCalendarHolidays {
function deleteAllCalendarHolidays($CalendarUid){ function deleteAllCalendarHolidays($CalendarUid){
$toDelete=$this->getCalendarHolidays($CalendarUid); $toDelete=$this->getCalendarHolidays($CalendarUid);
foreach($toDelete as $key => $holidayInfo){ foreach($toDelete as $key => $holidayInfo){
print_r($holidayInfo);
$CalendarUid = $holidayInfo['CALENDAR_UID']; $CalendarUid = $holidayInfo['CALENDAR_UID'];
$CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME']; $CalendarHolidayName = $holidayInfo['CALENDAR_HOLIDAY_NAME'];
$CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START']; $CalendarHolidayStart = $holidayInfo['CALENDAR_HOLIDAY_START'];

View File

@@ -57,17 +57,18 @@ class Admin extends Controller
} }
$fields['BUSINESS_DAY'] = $businessDayArray; $fields['BUSINESS_DAY'] = $businessDayArray;
//validating if the calendar is new, it means that we don't have the $_GET array
$holidayArray = array(); $fields['HOLIDAY']=(isset ( $_GET['id'] )&&$_GET['id']!='')?$fields['HOLIDAY']:array();
for($i=0;$i<sizeof($fields['HOLIDAY']);$i++) { $holidayArray = array();
$holidayArray[$i] = $fields['HOLIDAY'][$i+1]; for($i=0;$i<sizeof($fields['HOLIDAY']);$i++) {
$holidayArray[$i] = $fields['HOLIDAY'][$i+1];
}
}
$_GET ['id']= is_null($_GET ['id'])?'':$_GET ['id']; $_GET ['id']= (isset ( $_GET['id'] )&&$_GET['id']!='')?$_GET['id']:'';
$fields['HOLIDAY'] = $holidayArray; $fields['HOLIDAY'] = $holidayArray;
$fields['NEWCALENDAR'] = 'NO'; $fields['NEWCALENDAR'] = 'NO';
if(isset ( $_GET ['id'] )&&$_GET ['id']=='') { if(isset ( $_GET['id'] )&&$_GET['id']=='') {
$fields['CALENDAR_UID'] = G::GenerateUniqueID(); $fields['CALENDAR_UID'] = G::GenerateUniqueID();
$fields['NEWCALENDAR'] = 'YES'; $fields['NEWCALENDAR'] = 'YES';
} }
@@ -76,4 +77,4 @@ class Admin extends Controller
G::RenderPage('publish', 'extJs'); G::RenderPage('publish', 'extJs');
} }
} }