+
+
+
+
+
+
+
+
+ ';
+ echo $html_string;
+?>
diff --git a/oss/vtiger/trunk/modules/Calendar/index.php b/oss/vtiger/trunk/modules/Calendar/index.php
new file mode 100644
index 00000000..06bda1f8
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/index.php
@@ -0,0 +1,32 @@
+
diff --git a/oss/vtiger/trunk/modules/Calendar/language/en_us.lang.php b/oss/vtiger/trunk/modules/Calendar/language/en_us.lang.php
new file mode 100644
index 00000000..3b5cf4c5
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/language/en_us.lang.php
@@ -0,0 +1,442 @@
+'Calendar',
+'LBL_MODULE_TITLE'=>'Calendar: Home',
+'LBL_MODULE_APPOINTMENT'=>'Calendar: Appointment',
+'LBL_MODULE_APPOINTMENT_DETAIL'=>'Calendar: Appointment Detail',
+'LBL_SAVE'=>'Save',
+'LBL_RESET'=>'Cancel',
+'LBL_LIST_USER_NAME'=>'User Name',
+'LBL_LIST_NAME'=>'Name',
+'LBL_CALENDAR_SHARED'=>'Calendar currently shared with',
+'LBL_CALENDAR_SHARING'=>'Share calendar with',
+'LBL_SHARING_OPTION'=>'Can see my calendar?',
+'LBL_LIST_TOOLS'=>'Tools',
+'LBL_SETTINGS'=>'Settings',
+'LBL_CALSETTINGS'=>'Calendar Settings',
+'LBL_USE24'=>'Use 24 hours format',
+'LBL_CALSTART'=>'Start my calendar time at',
+'LBL_TIMESETTINGS'=>'Time Settings',
+'LBL_HOLDFOLLOWUP'=>'Hold followup on',
+'LBL_CALL' => 'Call',
+'LBL_MEET' => 'Meeting',
+'LBL_APPNT' => 'Appointment',
+'LBL_NEW_APPNT' => 'New Appointment',
+'LBL_NEW_APPNT_INFO' => 'Create a new appointment',
+'LBL_VIEW_DAY_APPNT_INFO' => 'View appointment(s) for this day',
+'LBL_CHANGE_APPNT' => 'see or change this appointment (%s - %s)',
+
+'LBL_DAY' => 'Day',
+'LBL_DAY_BUTTON_KEY' => 'D',
+'LBL_DAY_BUTTON_TITLE' => 'Day [Alt+D]',
+'LBL_DAY1' => 'Monday',
+'LBL_DAY2' => 'Tuesday',
+'LBL_DAY3' => 'Wednesday',
+'LBL_DAY4' => 'Thursday',
+'LBL_DAY5' => 'Friday',
+'LBL_DAY6' => 'Saturday',
+'LBL_DAY0' => 'Sunday',
+
+'LBL_SM_MON' => 'Mon',
+'LBL_SM_TUE' => 'Tue',
+'LBL_SM_WED' => 'Wed',
+'LBL_SM_THU' => 'Thu',
+'LBL_SM_FRI' => 'Fri',
+'LBL_SM_SAT' => 'Sat',
+'LBL_SM_SUN' => 'Sun',
+
+'LBL_DATE_TITLE' => 'Day %d, %A',
+
+'LBL_WEEK' => 'Week',
+'LBL_WEEK_BUTTON_KEY' => 'W',
+'LBL_WEEK_BUTTON_TITLE' => 'Week [Alt+W]',
+'LBL_WEEKS' => 'Weeks',
+'LBL_NEXT_WEEK' => 'next week',
+'LBL_LAST_WEEK' => 'last week',
+'LBL_4WEEKS_BACK' => '4 weeks back',
+'LBL_4WEEKS_PLUS' => '4 weeks plus',
+'LBL_RELOAD' => 'Reload',
+
+
+'LBL_APPCREATED_BY' => 'Created by',
+'LBL_AT_DATE_TIME' => 'at',
+
+'LBL_MON' => 'Month',
+'LBL_MON_BUTTON_KEY' => 'M',
+'LBL_MON_BUTTON_TITLE' => 'Month [Alt+M]',
+'LBL_PREV_MON' => 'Previous Month',
+'LBL_NEXT_MON' => 'Next Month',
+
+'LBL_YEAR_BUTTON_KEY'=>'Y',
+'LBL_PREV_YEAR'=>'Previous Year',
+'LBL_NEXT_YEAR' => 'Next Year',
+
+'LBL_APP_LOCATION' => 'Location',
+'LBL_APP_IGNORE_TIME' => 'ignore above times',
+'LBL_SUBJECT'=>'Subject:',
+'LBL_APP_DESCRIPTION' => 'Description',
+'LBL_CONTACT'=>'Contact:',
+'LBL_CONTACT_LIST'=>'Contact List:',
+
+'LBL_APP_IGNORE_TIME2' => '(i.e. the appointment takes place at no particular time on these day(s) )',
+
+'LBL_APP_ERR001' =>'Invalid Date in field %s!',
+'LBL_APP_ERR002' =>'start after end !',
+'LBL_APP_ERR003' =>'Missing Contact !',
+'LBL_APP_ERR004' =>'Missing Subject !',
+'ERR_DELETE_RECORD'=>"A record number must be specified to delete the appointment.",
+'DELETE_CONFIRMATION'=>"Are you sure you want to delete this appointment?",
+
+'AppLoc'=> Array('0' => 'Office'
+ , '1' => 'Out'
+ , '2' => 'Vacation'
+ , '3' => 'sick'
+ , '4' => 'Postponed'
+ , '5' => 'Option'
+ , '6' => 'Private'),
+
+'cal_month_long'=>array(
+"",
+"January",
+"February",
+"March",
+"April",
+"May",
+"June",
+"July",
+"August",
+"September",
+"October",
+"November",
+"December",
+),
+
+'cal_weekdays_short'=>array(
+"Sun",
+"Mon",
+"Tue",
+"Wed",
+"Thu",
+"Fri",
+"Sat",
+),
+'cal_weekdays_long'=>array(
+"Sunday",
+"Monday",
+"Tuesday",
+"Wednesday",
+"Thursday",
+"Friday",
+"Saturday",
+),
+'cal_month_short'=>array(
+"",
+"Jan",
+"Feb",
+"Mar",
+"Apr",
+"May",
+"Jun",
+"Jul",
+"Aug",
+"Sep",
+"Oct",
+"Nov",
+"Dec",
+),
+
+'LBL_TIME'=>'Time',
+'LBL_START_TIME' => 'Start Time',
+'LBL_END_TIME' => 'End Time',
+'LBL_START_DATE'=>'Start Date',
+'LBL_TIME_START'=>'Time Start',
+'LBL_DUE_DATE'=>'Due Date',
+'LBL_START_DATE_TIME'=>'Start Date & Time',
+'LBL_END_DATE_TIME'=>'End Date & Time',
+'LBL_TODO'=>'To Do',
+'LBL_TODOS'=>'To Dos',
+'LBL_EVENTS'=>'Events',
+'LBL_TOTALEVENTS'=>'My Total Events :',
+'LBL_TOTALTODOS'=>'My Total To Dos :',
+'LBL_VIEW'=>'View',
+'LBL_LISTVIEW'=>'List View',
+'LBL_HRVIEW'=>'Hour View',
+'LBL_WEEKVIEW'=>'Weekly Calendar View',
+'LBL_MONTHVIEW'=>'Monthly Calendar View',
+'LBL_YEARVIEW'=>'Yearly Calendar View',
+'LBL_STATUS'=>'Status',
+'LBL_ACTION'=>'Actions',
+'LBL_ADD'=>'Add',
+'LBL_OPENCAL'=>'Open Calendar',
+
+
+'LBL_ADD_EVENT'=>'Add Event',
+'LBL_ADDCALL'=>'Call',
+'LBL_ADDMEETING'=>'Meeting',
+'LBL_ADDTODO'=>'To Do',
+'LBL_BEFOREEVENT'=>'before the event starts',
+'LBL_BEFORETASK'=>'before the task starts',
+'LBL_EVENTDETAILS'=>'Event Details',
+'LBL_CURSTATUS'=>'Current Status',
+'LBL_ASSINGEDTO'=>'Assigned To',
+'LBL_RELATEDTO'=>'Related To',
+'LBL_PENDING'=>'Pending',
+'LBL_PUBLIC'=>'Mark Public',
+'LBL_MORE'=>'More',
+'LBL_EDIT'=>'Edit',
+'LBL_EVERYDAY'=>'Every Day',
+'LBL_EVERYWEEK'=>'Every Week',
+'LBL_EVERYMON'=>'Every Month',
+'LBL_WEEKS'=>'Week(s)',
+'LBL_MONTHS'=>'Month(s)',
+'LBL_YEAR'=>'Year',
+'LBL_NONE_SCHEDULED'=>'None Scheduled',
+
+'LBL_INVITE_INST1'=>'To invite, select the users from the "Available Users" list and click the "Add" button.',
+'LBL_INVITE_SHARE'=>'To share, select the users from the "Available Users" list and click the "Add" button.',
+'LBL_INVITE_INST2'=>'To remove, select the users from the "Selected Users" list and the click "Remove" button.',
+'LBL_SELUSR_INFO'=>' Selected users will receive an email about the Event.',
+'LBL_CALSHAREMESSAGE'=>'Share my calendar with the following selected users',
+'LBL_CALSHARE'=>'Calendar Sharing',
+'LBL_SEL_USERS'=>'Selected Users',
+'LBL_AVL_USERS'=>'Available Users',
+'LBL_ADD_BUTTON'=>'Add',
+'LBL_USERS'=>'Users',
+'LBL_RMV_BUTTON'=>'Remove',
+'LBL_SDRMD'=>'Send Reminder to',
+'LBL_ENABLE_REPEAT'=>'Enable Repeat',
+'LBL_REPEAT_ONCE'=>'Repeat once in every',
+'LBL_ADD_TODO'=>'Create To Do',
+'LBL_TODONAME'=>'To Do',
+'LBL_TODODATETIME'=>'Time & Date',
+
+
+
+
+
+//DON'T CONVERT THESE THEY ARE MAPPINGS - STARTS
+'db_last_name' => 'LBL_LIST_LAST_NAME',
+'db_first_name' => 'LBL_LIST_FIRST_NAME',
+'db_title' => 'LBL_LIST_TITLE',
+'db_email1' => 'LBL_LIST_EMAIL_ADDRESS',
+'db_email2' => 'LBL_LIST_EMAIL_ADDRESS',
+//DON'T CONVERT THESE THEY ARE MAPPINGS -ENDS
+'LBL_COMPLETED'=>'Mark Completed',
+'LBL_DEFERRED'=>'Mark Deferred',
+'LBL_HELD'=>'Mark Held',
+'LBL_NOTHELD'=>'Mark Not Held',
+'LBL_POSTPONE'=>'Postpone',
+'LBL_CHANGEOWNER'=>'Change Owner',
+'LBL_DEL'=>'Delete',
+
+//Added for actvity merge with calendar
+'LBL_SEARCH_FORM_TITLE'=>'Activity Search',
+'LBL_LIST_FORM_TITLE'=>'Activity List',
+'LBL_NEW_FORM_TITLE'=>'New Activity',
+'LBL_TASK_INFORMATION'=>'Task Information',
+'LBL_EVENT_INFORMATION'=>'Event Information',
+'LBL_CALENDAR_INFORMATION'=>'Calendar Information',
+
+'LBL_NAME'=>'Subject:',
+'LBL_ACTIVITY_NOTIFICATION'=>'This is a notification that an activity is assigned to you that has been',
+'LBL_ACTIVITY_INVITATION'=>'You have been invited for an activity that has been ',
+'LBL_DETAILS_STRING'=>'The details are',
+'LBL_REGARDS_STRING'=>'Thanks & Regards',
+'LBL_CONTACT_NAME'=>'Contact Name',
+'LBL_OPEN_ACTIVITIES'=>'Open Activities',
+'LBL_ACTIVITY'=>'Activity:',
+'LBL_HISTORY'=>'History',
+'LBL_UPCOMING'=>"My Upcoming and Pending Activities",
+'LBL_TODAY'=>'through ',
+
+'LBL_NEW_TASK_BUTTON_TITLE'=>'New Task [Alt+N]',
+'LBL_NEW_TASK_BUTTON_KEY'=>'N',
+'LBL_NEW_TASK_BUTTON_LABEL'=>'New Task',
+'LBL_SCHEDULE_MEETING_BUTTON_TITLE'=>'Schedule Meeting [Alt+M]',
+'LBL_SCHEDULE_MEETING_BUTTON_KEY'=>'M',
+'LBL_SCHEDULE_MEETING_BUTTON_LABEL'=>'Schedule Meeting',
+'LBL_SCHEDULE_CALL_BUTTON_TITLE'=>'Schedule Call [Alt+C]',
+'LBL_SCHEDULE_CALL_BUTTON_KEY'=>'C',
+'LBL_SCHEDULE_CALL_BUTTON_LABEL'=>'Schedule Call',
+'LBL_NEW_NOTE_BUTTON_TITLE'=>'New Document [Alt+T]',
+'LBL_NEW_ATTACH_BUTTON_TITLE'=>'Attach File [Alt+F]',
+'LBL_NEW_NOTE_BUTTON_KEY'=>'T',
+'LBL_NEW_ATTACH_BUTTON_KEY'=>'F',
+'LBL_NEW_NOTE_BUTTON_LABEL'=>'New Document',
+'LBL_NEW_ATTACH_BUTTON_LABEL'=>'Attach File',
+'LBL_TRACK_EMAIL_BUTTON_TITLE'=>'Track Email [Alt+K]',
+'LBL_TRACK_EMAIL_BUTTON_KEY'=>'K',
+'LBL_TRACK_EMAIL_BUTTON_LABEL'=>'Track Email',
+
+'LBL_LIST_CLOSE'=>'Close',
+'LBL_LIST_STATUS'=>'Status',
+'LBL_LIST_CONTACT'=>'Contact',
+//Added for 4.2 release for Account column support as shown by Fredy
+'LBL_LIST_ACCOUNT'=>'Account',
+'LBL_LIST_RELATED_TO'=>'Related to',
+'LBL_LIST_DUE_DATE'=>'Due Date',
+'LBL_LIST_DATE'=>'Date',
+'LBL_LIST_SUBJECT'=>'Subject',
+'LBL_LIST_LAST_MODIFIED'=>'Last Modified',
+'LBL_LIST_RECURRING_TYPE'=>'Recurring Type',
+
+'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.",
+'NTC_NONE_SCHEDULED'=>'None scheduled.',
+
+// Added vtiger_fields for Attachments in Activities/SubPanelView.php
+'LBL_ATTACHMENTS'=>'Attachments',
+'LBL_NEW_ATTACHMENT'=>'New Attachment',
+
+//Added vtiger_fields after RC1 - Release
+'LBL_ALL'=>'All',
+'LBL_CALL'=>'Call',
+'LBL_MEETING'=>'Meeting',
+'LBL_TASK'=>'Task',
+
+//Added for 4GA Release
+'Subject'=>'Subject',
+'Assigned To'=>'Assigned To',
+'Start Date & Time'=>'Start Date & Time',
+'Time Start'=>'Time Start',
+'Due Date'=>'Due Date',
+'Related To'=>'Related to',
+'Contact Name'=>'Contact Name',
+'Status'=>'Status',
+'Priority'=>'Priority',
+'Visibility'=>'Visibility',
+'Send Notification'=>'Send Notification',
+'Created Time'=>'Created Time',
+'Modified Time'=>'Modified Time',
+'Activity Type'=>'Activity Type',
+'Description'=>'Description',
+'Duration'=>'Duration',
+'Duration Minutes'=>'Duration Minutes',
+'Location'=>'Location',
+'No Time'=>'No Time',
+//Added for Send Reminder 4.2 release
+'Send Reminder'=>'Send Reminder',
+'LBL_YES'=>'Yes',
+'LBL_NO'=>'No',
+'LBL_DAYS'=>'day(s)',
+'LBL_MINUTES'=>'minutes',
+'LBL_HOURS'=>'hours',
+'LBL_BEFORE_EVENT'=>'before event',
+//Added for CustomView 4.2 Release
+'Close'=>'Close',
+'Start Date'=>'Start Date',
+'Type'=>'Type',
+'End Date'=>'End Date',
+'Recurrence'=> 'Recurring Events',
+'Recurring Type'=> 'Recurring Type',
+//Activities - Notification Error
+'LBL_NOTIFICATION_ERROR'=>'Mail Error : Please check your outgoing mail server configuration in Settings->Outgoing Mail Server Configuration OR MailId for the present user is not Configured',
+// Mike Crowe Mod --------------------------------------------------------added for generic search
+'LBL_GENERAL_INFORMATION'=>'General Information',
+
+'LBL_EVENTTYPE'=>'Event Type',
+'LBL_EVENTNAME'=>'Event Name',
+'LBL_EVENTSTAT'=>'Event starts at',
+'LBL_EVENTEDAT'=>'Event ends on',
+'LBL_INVITE'=>'Invite',
+'LBL_REPEAT'=>'Repeat',
+'LBL_REMINDER'=>'Reminder',
+'LBL_SENDREMINDER'=>'Send Reminder',
+'LBL_NOTIFICATION'=>'Notification',
+'LBL_SENDNOTIFICATION'=>'Send Notification',
+'LBL_RMD_ON'=>'Remind on',
+'LBL_REPEATEVENT'=>'Repeat once in every',
+'LBL_TIMEDATE'=>'Time & Date',
+'LBL_HR'=>'Hr',
+'LBL_MIN'=>'min',
+'LBL_EVENT'=>'Event',
+'Daily'=>'Day(s)',
+'Weekly'=>'Week(s)',
+'Monthly'=>'Month(s)',
+'Yearly'=>'Year',
+'createdtime'=>'Created Time',
+'modifiedtime'=>'Modified Time',
+'first'=>'First',
+'last'=>'Last',
+'High'=>'High',
+'Medium'=>'Medium',
+'Low'=>'Low',
+'LBL_SELECT'=>'Select',
+'LBL_ALL_EVENTS_TODOS'=>'All Events & Todos',
+'First'=>'First',
+'Last'=>'Last',
+'on'=>'on',
+'day of the month'=>'day of the month',
+'Private'=>'Private',
+'Public'=>'Public',
+
+//Added for existing Picklist entries
+
+'Planned'=>'Planned',
+'Held'=>'Held',
+'Not Held'=>'Not Held',
+'Completed'=>'Completed',
+'Deferred'=>'Deferred',
+'Not Started'=>'Not Started',
+'In Progress'=>'In Progress',
+'Pending Input'=>'Pending Input',
+'LBL_REMAINDER_DAY'=>'days',
+'LBL_REMAINDER_HRS'=>'hrs',
+'Call'=>'Call',
+'Meeting'=>'Meeting',
+
+//added to send dates and time in calendar notification/invitation mail.
+
+'Start date and time'=>'Start Date & Time',
+'End date and time'=>'End Date & Time',
+//this is for task
+'End date'=>'End date',
+'LBL_SET_DATE'=>'Set date..',
+'Recurrence'=>'Recurrence',
+
+//added to send invitation mail Subject.
+'INVITATION'=>' Invitation ',
+
+// Added/Updated for vtiger CRM 5.0.4
+'LBL_YEAR_BUTTON_TITLE'=>'Year [Alt+Y]',
+'LBL_SELECT_CONTACT'=>'Select Contacts',
+'SHARED_EVENT_DEL_MSG'=>'The User does not have permission to Edit/Delete Shared Event.',
+//added to fix ticket#4525
+'LBL_CREATED'=>'created',
+'LBL_UPDATED'=>'updated',
+
+//Added after 5.0.4 GA
+'LBL_BUSY' => 'Busy',
+
+//Custom Fields support for Calendar
+'LBL_CUSTOM_INFORMATION'=>'Custom Information',
+
+// Repeat Event support for Calendar
+'LBL_UNTIL' => 'Until',
+'LBL_SET_DATE'=>'Set Date',
+
+'LBL_MINE' =>'Mine',
+
+);
+
+?>
diff --git a/oss/vtiger/trunk/modules/Calendar/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Calendar/language/zh_cn.lang.php
new file mode 100644
index 00000000..db1fb31b
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/language/zh_cn.lang.php
@@ -0,0 +1,441 @@
+ '计划任务',
+ 'LBL_MODULE_TITLE' => '计划任务: 首页',
+ 'LBL_MODULE_APPOINTMENT' => '计划任务: 行程',
+ 'LBL_MODULE_APPOINTMENT_DETAIL' => '计划任务: 计划细节',
+'LBL_SAVE' => '保存',
+ 'LBL_RESET' => '取消',
+ 'LBL_LIST_USER_NAME' => '账号',
+ 'LBL_LIST_NAME' => '名称',
+'LBL_CALENDAR_SHARED' => '计划目前分享给',
+ 'LBL_CALENDAR_SHARING' => '分享计划给',
+ 'LBL_SHARING_OPTION' => '可以检视我的计划?',
+ 'LBL_LIST_TOOLS' => '工具',
+ 'LBL_SETTINGS' => '设定',
+ 'LBL_CALSETTINGS' => '计划任务设定',
+ 'LBL_USE24' => '使用 24 小时制',
+ 'LBL_CALSTART' => '计划任务开始时间',
+ 'LBL_TIMESETTINGS' => '时间设定',
+ 'LBL_OPENCAL' => '开放计划任务',
+ 'LBL_CALL' => '电话记录',
+ 'LBL_MEET' => '会议',
+ 'LBL_APPNT' => '行程',
+ 'LBL_NEW_APPNT' => '新增行程',
+ 'LBL_NEW_APPNT_INFO' => '建立一笔新的行程',
+ 'LBL_VIEW_DAY_APPNT_INFO' => '浏览今天的行程',
+ 'LBL_CHANGE_APPNT' => '察看或变更这个行程 (%s - %s)',
+
+ 'LBL_DAY' => '日',
+ 'LBL_DAY_BUTTON_KEY' => 'D',
+ 'LBL_DAY_BUTTON_TITLE' => '日 [Alt+D]',
+ 'LBL_DAY1' => '周一',
+ 'LBL_DAY2' => '周二',
+ 'LBL_DAY3' => '周三',
+ 'LBL_DAY4' => '周四',
+ 'LBL_DAY5' => '周五',
+ 'LBL_DAY6' => '周六',
+ 'LBL_DAY0' => '周日',
+
+ 'LBL_SM_MON' => '一',
+ 'LBL_SM_TUE' => '二',
+ 'LBL_SM_WED' => '三',
+ 'LBL_SM_THU' => '四',
+ 'LBL_SM_FRI' => '五',
+ 'LBL_SM_SAT' => '六',
+ 'LBL_SM_SUN' => '日',
+
+'LBL_DATE_TITLE' => 'Day %d, %A',
+
+ 'LBL_WEEK' => '周',
+ 'LBL_WEEK_BUTTON_KEY' => 'W',
+ 'LBL_WEEK_BUTTON_TITLE' => '周 [Alt+W]',
+ 'LBL_WEEKS' => '周',
+ 'LBL_NEXT_WEEK' => '下周',
+ 'LBL_LAST_WEEK' => '上周',
+ 'LBL_4WEEKS_BACK' => '四周前',
+ 'LBL_4WEEKS_PLUS' => '四周后',
+ 'LBL_RELOAD' => '重新加载',
+
+
+'LBL_APPCREATED_BY' => '建立者:',
+'LBL_AT_DATE_TIME' => '在',
+
+ 'LBL_MON' => '月',
+ 'LBL_MON_BUTTON_KEY' => 'M',
+ 'LBL_MON_BUTTON_TITLE' => '月 [Alt+M]',
+ 'LBL_PREV_MON' => '上个月',
+ 'LBL_NEXT_MON' => '下个月',
+
+ 'LBL_YEAR_BUTTON_KEY' => 'Y',
+ 'LBL_PREV_YEAR' => '去年',
+ 'LBL_NEXT_YEAR' => '明年',
+
+'LBL_APP_LOCATION' => '所在地',
+'LBL_APP_IGNORE_TIME' => '忽略',
+'LBL_SUBJECT'=>'主题:',
+'LBL_APP_DESCRIPTION' => '描述',
+'LBL_CONTACT'=>'联系方式:',
+'LBL_CONTACT_LIST'=>'联系人列表:',
+
+'LBL_APP_IGNORE_TIME2' => '(注:这个行程在该期间没有特定的时间 )',
+
+'LBL_APP_ERR001' =>'字段 %s产生错误!',
+ 'LBL_APP_ERR002' => '开始日期在结束日期之后 !',
+ 'LBL_APP_ERR003' => '漏填联系人 !',
+ 'LBL_APP_ERR004' => '漏填标题 !',
+'ERR_DELETE_RECORD' => '在删除行程前必须输入正确的记录编号.',
+ 'DELETE_CONFIRMATION' => '您确定要删除这次的行程?',
+
+'AppLoc'=> Array('0' => '办公室',
+ '1' => '户外',
+ '2' => '休假',
+ '3' => '病假',
+ '4' => '延期',
+ '5' => '随意',
+ '6' => '私人',),
+
+'cal_month_long'=>array(
+"",
+"一月",
+"二月",
+"三月",
+"四月",
+"五月",
+"六月",
+"七月",
+"八月",
+"九月",
+"十月",
+"十一月",
+"十二月",
+),
+
+'cal_weekdays_short'=>array(
+"日",
+"一",
+"二",
+"三",
+"四",
+"五",
+"六",
+),
+'cal_weekdays_long'=>array(
+"星期日",
+"星期一",
+"星期二",
+"星期三",
+"星期四",
+"星期五",
+"星期六",
+),
+'cal_month_short'=>array(
+"",
+"一月",
+"二月",
+"三月",
+"四月",
+"五月",
+"六月",
+"七月",
+"八月",
+"九月",
+"十月",
+"十一月",
+"十二月",
+),
+
+'LBL_TIME'=>'时间',
+'LBL_START_TIME' => '开始时间',
+'LBL_END_TIME' => '结束时间',
+'LBL_START_DATE'=>'开始日期',
+'LBL_TIME_START'=>'时间开始',
+'LBL_DUE_DATE'=>'到期日',
+'LBL_START_DATE_TIME'=>'开始日期 & 时间',
+'LBL_END_DATE_TIME'=>'结束日期 & 时间',
+'LBL_TODO'=>'待办',
+'LBL_TODOS'=>'待办事项',
+'LBL_EVENTS'=>'事件',
+'LBL_TOTALEVENTS'=>'我的全部事件 :',
+'LBL_TOTALTODOS'=>'我的待办事项 :',
+'LBL_VIEW'=>'查看',
+'LBL_LISTVIEW'=>'查看列表',
+'LBL_HRVIEW'=>'产看时间',
+'LBL_WEEKVIEW'=>'查看周历',
+'LBL_MONTHVIEW'=>'查看月历',
+'LBL_YEARVIEW'=>'查看年历',
+'LBL_STATUS'=>'状态',
+'LBL_ACTION'=>'操作',
+'LBL_ADD'=>'添加',
+'LBL_OPENCAL'=>'打开日历',
+
+
+'LBL_ADD_EVENT'=>'添加事件',
+'LBL_ADDCALL'=>'呼叫',
+'LBL_ADDMEETING'=>'会议',
+'LBL_ADDTODO'=>'待办',
+'LBL_BEFOREEVENT'=>'在事件开始之前',
+'LBL_BEFORETASK'=>'在任务开始之前',
+'LBL_EVENTDETAILS'=>'事件细节',
+'LBL_CURSTATUS'=>'当前状态',
+'LBL_ASSINGEDTO'=>'分配给',
+'LBL_RELATEDTO'=>'关联于',
+'LBL_PENDING'=>'即将发生',
+'LBL_PUBLIC'=>'标记公共',
+'LBL_MORE'=>'更多',
+'LBL_EDIT'=>'编辑',
+ 'LBL_EVERYDAY' => '每天',
+ 'LBL_EVERYWEEK' => '每周',
+ 'LBL_EVERYMON' => '每月',
+'LBL_WEEKS'=>'周',
+'LBL_MONTHS'=>'月',
+'LBL_YEAR'=>'年',
+'LBL_NONE_SCHEDULED'=>'没有行程',
+
+ 'LBL_INVITE_INST1' => '邀请的方式可以从目前使用者列表选择并且点选新增按钮',
+'LBL_INVITE_SHARE'=>'分享的方式可以从目前使用者列表选择并且点选新增按钮.',
+'LBL_INVITE_INST2' => '移除邀请的人可以从选择的使用者列表选择并且点选移除按钮',
+ 'LBL_SELUSR_INFO' => '选择的使用者会收到一封事件的通知。',
+ 'LBL_CALSHAREMESSAGE'=>'开放我的行事历给下面选择的使用者',
+'LBL_CALSHARE' => '开放行事历',
+ 'LBL_SEL_USERS' => '选择的使用者',
+ 'LBL_AVL_USERS' => '目前使用者',
+ 'LBL_ADD_BUTTON' => '新增',
+ 'LBL_USERS' => '使用者',
+'LBL_RMV_BUTTON'=>'移除',
+'LBL_SDRMD'=>'发送提醒讯息',
+'LBL_ENABLE_REPEAT'=>'启用循环',
+'LBL_REPEAT_ONCE'=>'循环频率',
+'LBL_ADD_TODO'=>'建立待办事项',
+'LBL_TODONAME'=>'待办事项',
+'LBL_TODODATETIME'=>'时间与日期',
+
+
+
+
+
+//DON'T CONVERT THESE THEY ARE MAPPINGS - STARTS
+'db_last_name' => 'LBL_LIST_LAST_NAME',
+'db_first_name' => 'LBL_LIST_FIRST_NAME',
+'db_title' => 'LBL_LIST_TITLE',
+'db_email1' => 'LBL_LIST_EMAIL_ADDRESS',
+'db_email2' => 'LBL_LIST_EMAIL_ADDRESS',
+//DON'T CONVERT THESE THEY ARE MAPPINGS -ENDS
+'LBL_COMPLETED' => '标示为完成',
+ 'LBL_DEFERRED' => '标示为延缓',
+ 'LBL_HELD' => '标示为执行',
+ 'LBL_NOTHELD' => '标示为不执行',
+ 'LBL_POSTPONE' => '延期',
+ 'LBL_CHANGEOWNER' => '修改负责人',
+ 'LBL_DEL' => '删除',
+
+//Added for actvity merge with calendar
+'LBL_SEARCH_FORM_TITLE'=>'搜索待办事项',
+'LBL_LIST_FORM_TITLE'=>'待办事项列表',
+'LBL_NEW_FORM_TITLE'=>'新增待办事项',
+'LBL_TASK_INFORMATION'=>'任务信息',
+'LBL_EVENT_INFORMATION'=>'事件信息',
+'LBL_CALENDAR_INFORMATION'=>'日历信息',
+
+'LBL_NAME' => '主题:',
+'LBL_ACTIVITY_NOTIFICATION'=>'这是通知活动分配给你',
+'LBL_ACTIVITY_INVITATION'=>'你被邀请参与一个活动 ',
+'LBL_DETAILS_STRING'=>'细节是',
+'LBL_REGARDS_STRING'=>'感谢和问候',
+ 'LBL_CONTACT_NAME' => '联系人',
+ 'LBL_OPEN_ACTIVITIES' => '进行中事项',
+ 'LBL_ACTIVITY' => '待办事项:',
+ 'LBL_HISTORY' => '纪录',
+ 'LBL_UPCOMING' => '即将到来与等待中待办事项',
+ 'LBL_TODAY' => '到',
+
+ 'LBL_NEW_TASK_BUTTON_TITLE' => '新增任务 [Alt+N]',
+ 'LBL_NEW_TASK_BUTTON_KEY' => 'N',
+ 'LBL_NEW_TASK_BUTTON_LABEL' => '新增任务',
+ 'LBL_SCHEDULE_MEETING_BUTTON_TITLE' => '安排会议 [Alt+M]',
+ 'LBL_SCHEDULE_MEETING_BUTTON_KEY' => 'M',
+ 'LBL_SCHEDULE_MEETING_BUTTON_LABEL' => '安排会议',
+ 'LBL_SCHEDULE_CALL_BUTTON_TITLE' => '安排电话 [Alt+C]',
+ 'LBL_SCHEDULE_CALL_BUTTON_KEY' => 'C',
+ 'LBL_SCHEDULE_CALL_BUTTON_LABEL' => '安排电话',
+ 'LBL_NEW_NOTE_BUTTON_TITLE' => '新增记事 [Alt+T]',
+ 'LBL_NEW_ATTACH_BUTTON_TITLE' => '附加档案 [Alt+F]',
+ 'LBL_NEW_NOTE_BUTTON_KEY' => 'T',
+ 'LBL_NEW_ATTACH_BUTTON_KEY' => 'F',
+ 'LBL_NEW_NOTE_BUTTON_LABEL' => '新增记事',
+ 'LBL_NEW_ATTACH_BUTTON_LABEL' => '附加档案',
+ 'LBL_TRACK_EMAIL_BUTTON_TITLE' => '追踪邮件 [Alt+K]',
+ 'LBL_TRACK_EMAIL_BUTTON_KEY' => 'K',
+ 'LBL_TRACK_EMAIL_BUTTON_LABEL' => '追踪邮件',
+
+ 'LBL_LIST_CLOSE' => '关闭',
+ 'LBL_LIST_STATUS' => '状态',
+ 'LBL_LIST_CONTACT' => '联系人',
+//Added for 4.2 release for Account column support as shown by Fredy
+'LBL_LIST_ACCOUNT' => '客户',
+ 'LBL_LIST_RELATED_TO' => '相关于',
+ 'LBL_LIST_DUE_DATE' => '结束日期',
+ 'LBL_LIST_DATE' => '日期',
+ 'LBL_LIST_SUBJECT' => '主旨1',
+ 'LBL_LIST_LAST_MODIFIED' => '最后更新',
+ 'LBL_LIST_RECURRING_TYPE' => '循环类型',
+
+'ERR_DELETE_RECORD'=>"一个记录编号必须被指定删除vtiger_account.",
+'NTC_NONE_SCHEDULED'=>'没有安排.',
+
+// Added vtiger_fields for Attachments in Activities/SubPanelView.php
+'LBL_ATTACHMENTS' => '附加档案',
+ 'LBL_NEW_ATTACHMENT' => '新增附加档案',
+
+//Added vtiger_fields after RC1 - Release
+'LBL_ALL'=>'全部',
+'LBL_CALL'=>'呼叫',
+'LBL_MEETING'=>'会议',
+'LBL_TASK'=>'任务',
+
+//Added for 4GA Release
+ 'Subject' => '主旨2',
+ 'Assigned To' => '负责人',
+ 'Start Date & Time' => '开始日期与时间',
+ 'Time Start' => '开始时间',
+ 'Due Date' => '到期日',
+ 'Related To' => '相关于',
+ 'Contact Name' => '联系人名称',
+ 'Status' => '状态',
+ 'Priority' => '优先级',
+ 'Visibility' => '显示',
+ 'Send Notification' => '寄送通知',
+ 'Created Time' => '建立时间',
+ 'Modified Time' => '修改时间',
+ 'Activity Type' => '活动类型',
+ 'Description' => '描述',
+ 'Duration' => '期间',
+ 'Duration Minutes' => '期间分钟',
+ 'Location' => '位置',
+ 'No Time' => '没有时间',
+//Added for Send Reminder 4.2 release
+ 'Send Reminder' => '提醒通知',
+'LBL_YES'=>'是',
+'LBL_NO'=>'否',
+'LBL_DAYS'=>'日',
+'LBL_MINUTES'=>'分',
+'LBL_HOURS'=>'时',
+'LBL_BEFORE_EVENT'=>'时间前',
+//Added for CustomView 4.2 Release
+ 'Close' => '关闭',
+ 'Start Date' => '开始日期',
+ 'Type' => '类型',
+ 'End Date' => '结束日期',
+ 'Recurrence' => '循环事件',
+ 'Recurring Type' => '循环类型',
+//Activities - Notification Error
+'LBL_NOTIFICATION_ERROR' => '邮件错误:请检查您的外寄邮件服务器设定,在 设定->外寄邮件服务器设定 或是目前使用者的邮件没有设定好',
+// Mike Crowe Mod --------------------------------------------------------added for generic search
+ 'LBL_GENERAL_INFORMATION' => '一般信息',
+
+'LBL_EVENTTYPE'=>'事件类型',
+'LBL_EVENTNAME'=>'事件名称',
+'LBL_EVENTSTAT'=>'事件开始于',
+'LBL_EVENTEDAT'=>'事件结束于',
+'LBL_INVITE'=>'邀请',
+'LBL_REPEAT'=>'重复',
+'LBL_REMINDER'=>'提示',
+'LBL_SENDREMINDER'=>'发送提示',
+'LBL_NOTIFICATION'=>'通知',
+'LBL_SENDNOTIFICATION'=>'发送通知',
+'LBL_RMD_ON'=>'提醒',
+'LBL_REPEATEVENT'=>'每个都重复一次',
+'LBL_TIMEDATE'=>'时间和日期',
+'LBL_HR'=>'时',
+'LBL_MIN'=>'分',
+'LBL_EVENT'=>'事件',
+'Daily'=>'天',
+'Weekly'=>'周',
+'Monthly'=>'月',
+'Yearly'=>'年',
+'createdtime'=>'建立时间',
+'modifiedtime'=>'修改时间',
+'first'=>'第一个',
+'last'=>'最后一个',
+'High'=>'高',
+'Medium'=>'中',
+'Low'=>'低',
+'LBL_SELECT'=>'选择',
+ 'LBL_ALL_EVENTS_TODOS' => '所有事件与工作',
+ 'First' => '第一笔',
+ 'Last' => '最后一笔',
+ 'on' => '于',
+ 'day of the month' => '日',
+'Private'=>'私有',
+'Public'=>'公共',
+
+//Added for existing Picklist entries
+
+'Planned' => '已规划',
+ 'Held' => '保留',
+'Not Held' => '不保留',
+ 'Completed' => '完成',
+ 'Deferred' => '延期',
+ 'Not Started' => '未开始',
+ 'In Progress' => '处理中',
+ 'Pending Input' => '等待输入',
+ 'LBL_REMAINDER_DAY' => '天',
+ 'LBL_REMAINDER_HRS' => '小时',
+ 'Call' => '电话',
+ 'Meeting' => '会议',
+
+//added to send dates and time in calendar notification/invitation mail.
+
+'Start date and time'=>'开始日期和时间',
+'End date and time'=>'结束日期和时间',
+//this is for task
+'End date'=>'结束日期',
+'LBL_SET_DATE'=>'设置日期..',
+'Recurrence'=>'再现',
+
+
+'INVITATION'=>' 邀请 ',
+
+
+'LBL_YEAR_BUTTON_TITLE'=>'Year [Alt+Y]',
+ 'LBL_SELECT_CONTACT' => '选择联系人',
+'SHARED_EVENT_DEL_MSG'=>'用户没有允许删除这个纪录.',
+//added to fix ticket#4525
+'LBL_CREATED'=>'created',
+'LBL_UPDATED'=>'updated',
+//Added after 5.0.4 GA
+'LBL_BUSY' => '忙碌',
+
+//Custom Fields support for Calendar
+'LBL_CUSTOM_INFORMATION'=>'自定义信息',
+
+// Repeat Event support for Calendar
+'LBL_UNTIL' => '至',
+'LBL_SET_DATE'=>'设置日期',
+
+'LBL_MINE' =>'我的',
+
+);
+
+?>
diff --git a/oss/vtiger/trunk/modules/Calendar/new_calendar.php b/oss/vtiger/trunk/modules/Calendar/new_calendar.php
new file mode 100644
index 00000000..afcf5490
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/new_calendar.php
@@ -0,0 +1,92 @@
+activity_view == "This Year"){
+ $mysel = 'year';
+ }else if($current_user->activity_view == "This Month"){
+ $mysel = 'month';
+ }else if($current_user->activity_view == "This Week"){
+ $mysel = 'week';
+ }else{
+ $mysel = 'day';
+ }
+}
+/* fix given by dartagnanlaf END --integrated by Minnie */
+$date_data = array();
+if ( isset($_REQUEST['day']))
+{
+
+ $date_data['day'] = $_REQUEST['day'];
+}
+
+if ( isset($_REQUEST['month']))
+{
+ $date_data['month'] = $_REQUEST['month'];
+}
+
+if ( isset($_REQUEST['week']))
+{
+ $date_data['week'] = $_REQUEST['week'];
+}
+
+if ( isset($_REQUEST['year']))
+{
+ if ($_REQUEST['year'] > 2037 || $_REQUEST['year'] < 1970)
+ {
+ print("".$app_strings['LBL_CAL_LIMIT_MSG']."");
+ exit;
+ }
+ $date_data['year'] = $_REQUEST['year'];
+}
+
+
+if(empty($date_data))
+{
+ $data_value=date('Y-m-d H:i:s');
+ preg_match('/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/',$data_value,$value);
+ $date_data = Array(
+ 'day'=>$value[3],
+ 'month'=>$value[2],
+ 'year'=>$value[1],
+ 'hour'=>$value[4],
+ 'min'=>$value[5],
+ );
+
+}
+$calendar_arr['calendar'] = new Calendar($mysel,$date_data);
+if($current_user->hour_format != '')
+ $calendar_arr['calendar']->hour_format=$current_user->hour_format;
+if ($viewBox == 'hourview' && ($mysel == 'day' || $mysel == 'week' || $mysel == 'month' || $mysel == 'year'))
+{
+ $calendar_arr['calendar']->add_Activities($current_user);
+}
+$calendar_arr['view'] = $mysel;
+calendar_layout($calendar_arr,$viewBox,$subtab);
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Calendar/script.js b/oss/vtiger/trunk/modules/Calendar/script.js
new file mode 100644
index 00000000..c90ceb8f
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/script.js
@@ -0,0 +1,1399 @@
+/*********************************************************************************
+
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is: vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ********************************************************************************/
+
+function DisableSharing()
+{
+
+ x = document.SharedList.selected_id.length;
+ idstring = "";
+ xx = 0;
+ if ( x == undefined)
+ {
+
+ if (document.SharedList.selected_id.checked)
+ {
+ document.SharedList.idlist.value=document.SharedList.selected_id.value;
+ }
+ else
+ {
+ alert(alert_arr.SELECT_ATLEAST_ONE_USER);
+ return false;
+ }
+ }
+ else
+ {
+ for(i = 0; i < x ; i++)
+ {
+ if(document.SharedList.selected_id[i].checked)
+ {
+ idstring = document.SharedList.selected_id[i].value +";"+idstring
+ xx++
+ }
+ }
+ if (xx != 0)
+ {
+ document.SharedList.idlist.value=idstring;
+ }
+ else
+ {
+ alert(alert_arr.SELECT_ATLEAST_ONE_USER);
+ return false;
+ }
+ }
+ if(confirm(alert_arr.DISABLE_SHARING_CONFIRMATION+xx+alert_arr.USERS))
+ {
+ document.SharedList.action="index.php?module=Calendar&action=disable_sharing&return_module=Calendar&return_action=calendar_share";
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+
+function showhide(argg)
+{
+ var x=document.getElementById(argg).style;
+ if (x.display=="none")
+ {
+ x.display="block"
+
+ }
+ else {
+ x.display="none"
+ }
+}
+
+
+function showhideRepeat(argg1,argg2)
+{
+ var x=document.getElementById(argg2).style;
+ var y=document.getElementById(argg1).checked;
+
+ if (y)
+ {
+ x.display="block";
+ }
+ else {
+ x.display="none";
+ }
+
+}
+
+
+
+function gshow(argg1,type,startdate,enddate,starthr,startmin,startfmt,endhr,endmin,endfmt,viewOption,subtab)
+{
+ smin = parseInt(startmin,10);
+ smin = smin - (smin%5);
+ var y=document.getElementById(argg1).style;
+
+ if(type != 'todo' && type!='')
+ {
+ for(var i=0;;i++){
+ if( document.EditView.activitytype[i].value == type){
+ document.EditView.activitytype[i].selected='yes';
+ break;
+ }
+ }
+
+ smin = _2digit(smin);
+ document.EditView.date_start.value = startdate;
+ document.EditView.starthr.value = starthr;
+ document.EditView.startmin.value = smin;
+ document.EditView.startfmt.value = startfmt;
+ document.EditView.viewOption.value = viewOption;
+ document.EditView.subtab.value = subtab;
+ calDuedatetime(type);
+ }
+ if(type == 'todo')
+ {
+ smin = _2digit(smin);
+ document.createTodo.task_date_start.value = startdate;
+ document.createTodo.task_due_date.value = enddate;
+ document.createTodo.starthr.value = starthr;
+ document.createTodo.startmin.value = smin;
+ document.createTodo.startfmt.value = startfmt;
+ document.createTodo.viewOption.value = viewOption;
+ document.createTodo.subtab.value = subtab;
+ }
+ if (y.display=="none")
+ {
+ y.display="block";
+ }
+}
+
+function rptoptDisp(Opt){
+ var currOpt = Opt.options[Opt.selectedIndex].value;
+ if(currOpt == "Daily")
+ {
+ ghide('repeatWeekUI');
+ ghide('repeatMonthUI');
+ }
+ else if(currOpt == "Weekly")
+ {
+ if(document.getElementById('repeatWeekUI').style.display == "none");
+ document.getElementById('repeatWeekUI').style.display = "block";
+ ghide('repeatMonthUI');
+ }
+ else if(currOpt == "Monthly")
+ {
+ ghide('repeatWeekUI');
+ if(document.getElementById('repeatMonthUI').style.display == "none");
+ document.getElementById('repeatMonthUI').style.display = "block";
+ }
+ else if(currOpt == "Yearly")
+ {
+ ghide('repeatWeekUI');
+ ghide('repeatMonthUI');
+ }
+}
+
+function Taskshow(argg1,type,startdate,starthr,startmin,startfmt)
+{
+ var y=document.getElementById(argg1).style;
+ if (y.display=="none")
+ {
+ document.EditView.date_start.value = startdate;
+ document.EditView.starthr.value = starthr;
+ document.EditView.startmin.value = startmin;
+ document.EditView.startfmt.value = startfmt;
+ y.display="block";
+ }
+}
+
+function ghide(argg2)
+{
+ var z=document.getElementById(argg2).style;
+ if (z.display=="block" )
+ {
+ z.display="none"
+
+ }
+}
+
+ function moveMe(arg1) {
+ var posx = 0;
+ var posy = 0;
+ var e=document.getElementById(arg1);
+
+ if (!e) var e = window.event;
+
+ if (e.pageX || e.pageY)
+ {
+ posx = e.pageX;
+ posy = e.pageY;
+ }
+ else if (e.clientX || e.clientY)
+ {
+ posx = e.clientX + document.body.scrollLeft;
+ posy = e.clientY + document.body.scrollTop;
+ }
+ }
+
+function switchClass(myModule,toStatus) {
+ var x=document.getElementById(myModule);
+ if($(x))
+ {
+ if (toStatus=="on") {
+ x.className="dvtSelectedCell";
+ }
+ if (toStatus=="off") {
+ x.className="dvtUnSelectedCell";
+ }
+ }
+
+}
+
+function enableCalstarttime()
+{
+ if(document.SharingForm.sttime_check.checked == true)
+ document.SharingForm.start_hour.disabled = false;
+ else
+ document.SharingForm.start_hour.disabled = true;
+}
+function check_form()
+{
+ formSelectColumnString('inviteesid','selectedusers');
+ if(trim(document.EditView.subject.value) == "")
+ {
+ alert(alert_arr.MISSING_EVENT_NAME);
+ document.EditView.subject.focus()
+ return false;
+ }
+ else
+ {
+ if(document.EditView.record.value != '')
+ {
+ document.EditView.mode.value = 'edit';
+ }
+ else
+ {
+ document.EditView.mode.value = 'create';
+ }
+ starthour = parseInt(document.EditView.starthr.value,10);
+ startmin = parseInt(document.EditView.startmin.value,10);
+ startformat = document.EditView.startfmt.value;
+ endhour = parseInt(document.EditView.endhr.value,10);
+ endmin = parseInt(document.EditView.endmin.value,10);
+ endformat = document.EditView.endfmt.value;
+ followupformat = document.EditView.followup_startfmt.value;
+ followuphour = parseInt(document.EditView.followup_starthr.value,10);
+ followupmin = parseInt(document.EditView.followup_startmin.value,10);
+ if(startformat != '')
+ {
+ if(startformat == 'pm')
+ {
+ if(starthour == 12)
+ starthour = 12;
+ else
+ starthour = starthour + 12;
+ }
+ else
+ {
+ if(starthour == 12)
+ starthour = 0;
+ else
+ starthour = starthour;
+ }
+ }
+ if(endformat != '')
+ {
+ if(endformat == 'pm')
+ {
+ if(endhour == 12)
+ endhour = 12;
+ else
+ endhour = endhour + 12;
+ }
+ else
+ {
+ if(endhour == 12)
+ endhour = 0;
+ else
+ endhour = endhour;
+ }
+ }
+ if(!dateValidate('date_start','Start date','OTH'))
+ {
+ return false;
+ }
+ if(!dateValidate('due_date','End date','OTH'))
+ {
+ return false;
+ }
+ if(dateComparison('due_date','End date','date_start','Start date','GE'))
+ {
+ var dateval1=getObj('date_start').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
+ var dateval2=getObj('due_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
+ var dateval3=getObj('followup_date').value.replace(/^\s+/g, '').replace(/\s+$/g, '');
+
+ var dateelements1=splitDateVal(dateval1)
+ var dateelements2=splitDateVal(dateval2)
+ var dateelements3=splitDateVal(dateval3)
+
+ dd1=dateelements1[0]
+ mm1=dateelements1[1]
+ yyyy1=dateelements1[2]
+
+ dd2=dateelements2[0]
+ mm2=dateelements2[1]
+ yyyy2=dateelements2[2]
+
+ dd3=dateelements3[0]
+ mm3=dateelements3[1]
+ yyyy3=dateelements3[2]
+
+ var date1=new Date()
+ var date2=new Date()
+ var date3=new Date()
+
+ date1.setYear(yyyy1)
+ date1.setMonth(mm1-1)
+ date1.setDate(dd1)
+ date1.setHours(starthour)
+ date1.setMinutes(startmin)
+
+ date2.setYear(yyyy2)
+ date2.setMonth(mm2-1)
+ date2.setDate(dd2)
+ date2.setHours(endhour)
+ date2.setMinutes(endmin)
+
+ date3.setYear(yyyy3)
+ date3.setMonth(mm3-1)
+ date3.setDate(dd3)
+
+ diff_ms = Math.abs(date2.getTime()-date1.getTime())/(1000*60);
+ hour = Math.floor(diff_ms/(60));
+ minute = Math.floor(diff_ms % 60)
+ document.EditView.duration_hours.value = hour;
+ document.EditView.duration_minutes.value = minute;
+
+ event_starthour = _2digit(starthour);
+ event_startmin = _2digit(startmin);
+ event_endhour = _2digit(endhour);
+ event_endmin = _2digit(endmin);
+ document.EditView.time_start.value = event_starthour+':'+event_startmin;
+ document.EditView.time_end.value = event_endhour+':'+event_endmin;
+ // Added for Aydin Kurt-Elli requirement START -by Minnie
+ if (document.EditView.followup.checked == true && document.getElementById('date_table_thirdtd').style.display == 'block')
+ {
+ if(!dateValidate('followup_date','Followup Date','OTH'))
+ {
+ return false;
+ }
+ if(followupformat != '')
+ {
+ if(followupformat == 'pm')
+ {
+ if(followuphour == 12)
+ followuphour = 12;
+ else
+ followuphour = followuphour + 12;
+ }
+ else
+ {
+ if(followuphour == 12)
+ followuphour = 0;
+ else
+ followuphour = followuphour;
+ }
+ }
+
+ if ( compareDates(date3,'Followup Date',date2,'End Date','GE'))
+ {
+ if (date3 <= date2)
+ {
+ if((followuphour*60+followupmin) <= (endhour*60+endmin))
+ {
+ alert(alert_arr.FOLLOWUPTIME_GREATER_THAN_STARTTIME);
+ document.EditView.followup_starthr.focus();
+ return false;
+ }
+ }
+ }
+ else return false;
+ //modified to set followup end date depends on the event or todo. If it is Event, the difference between followup start date and end date is 1hr. If it is todo then difference is 5mins.
+ date3.setMinutes(followupmin);
+ date3.setHours(followuphour);
+ if(document.EditView.activitytype[0].checked == true)
+ {
+ date3.setMinutes(parseInt(date3.getMinutes(),10)+5);
+ }
+ if(document.EditView.activitytype[1].checked == true)
+ {
+ date3.setMinutes(parseInt(date3.getMinutes(),10)+60);
+ }
+ var tempdate = getdispDate(date3);
+
+ followuphour = _2digit(followuphour);
+ followupmin = _2digit(followupmin);
+ followupendhour = _2digit(date3.getHours());
+ followupendmin = _2digit(date3.getMinutes());
+ document.EditView.followup_due_date.value = tempdate;
+ document.EditView.followup_time_start.value = followuphour+':'+followupmin;
+ document.EditView.followup_time_end.value = followupendhour+':'+followupendmin;
+ //end
+ }
+ // Added for Aydin Kurt-Elli requirement END -by Minnie -->
+
+ //added to avoid db error while giving characters in the repeat "every n no of day in month" text box
+ if((getObj("recurringcheck")) && (document.EditView.recurringcheck.checked == true) && (document.EditView.recurringtype.value =="Monthly"))
+ {
+ if((document.EditView.repeatMonth[0].checked == true) && ((parseInt(parseFloat(document.EditView.repeatMonth_date.value))!=document.EditView.repeatMonth_date.value) || document.EditView.repeatMonth_date.value=='' || parseInt(document.EditView.repeatMonth_date.value)>'31' || document.EditView.repeatMonth_date.value<='0'))
+ {
+ alert(alert_arr.INVALID +' "'+document.EditView.repeatMonth_date.value+'" ');
+ document.EditView.repeatMonth_date.focus();
+ return false;
+ }
+ }
+ //end
+
+
+ //added to check Start Date & Time,if Activity Status is Planned.//start
+ if(document.EditView.eventstatus.value == "Planned")
+ {
+ var chkdate=new Date()
+ chkdate.setMinutes(event_startmin)
+ chkdate.setHours(event_starthour)
+ chkdate.setYear(yyyy1)
+ chkdate.setMonth(mm1-1)
+ chkdate.setDate(dd1)
+ if(!comparestartdate(chkdate)) return false;
+
+ }
+
+ }
+ else
+ return false;
+ if(getObj("recurringcheck") && document.EditView.recurringcheck.checked == false)
+ {
+ document.EditView.recurringtype.value = '--None--';
+ }
+ return true;
+ }
+}
+
+function task_check_form()
+{
+ starthour = parseInt(document.createTodo.starthr.value,10);
+ startmin = parseInt(document.createTodo.startmin.value,10);
+ startformat = document.createTodo.startfmt.value;
+ if(startformat != '')
+ {
+ if(startformat == 'pm')
+ {
+ if(starthour == 12)
+ starthour = 12;
+ else
+ starthour = starthour + 12;
+
+ }
+ else
+ {
+ if(starthour == 12)
+ starthour = 0;
+ else
+ starthour = starthour;
+ }
+ }
+ starthour = _2digit(starthour);
+ startmin = _2digit(startmin);
+ document.createTodo.task_time_start.value = starthour+':'+startmin;
+ if(document.createTodo.record.value != '')
+ {
+ document.createTodo.mode.value = 'edit';
+ }
+ else
+ {
+ document.createTodo.mode.value = 'create';
+ }
+
+}
+
+
+function maintask_check_form()
+{
+ starthour = parseInt(document.EditView.starthr.value,10);
+ startmin = parseInt(document.EditView.startmin.value,10);
+ startformat = document.EditView.startfmt.value;
+ if(startformat != '')
+ {
+ if(startformat == 'pm')
+ {
+ if(starthour == 12)
+ starthour = 12;
+ else
+ starthour = starthour + 12;
+ }
+ else
+ {
+ if(starthour == 12)
+ starthour = 0;
+ else
+ starthour = starthour;
+ }
+ }
+ starthour = _2digit(starthour);
+ startmin = _2digit(startmin);
+ document.EditView.time_start.value = starthour+':'+startmin;
+}
+
+
+var moveupLinkObj,moveupDisabledObj,movedownLinkObj,movedownDisabledObj;
+
+function userEventSharing(selectedusrid,selcolid)
+{
+ formSelectColumnString(selectedusrid,selcolid);
+}
+
+
+function incUser(avail_users,sel_users)
+{
+ availListObj=getObj(avail_users)
+ selectedColumnsObj=getObj(sel_users)
+ var selectlength=selectedColumnsObj.length
+ var availlength=availListObj.length
+
+ for (i=0;i= 0)
+ selectedColumnsObj.remove(selectedColumnsObj.options.selectedIndex)
+ }
+
+}
+
+
+// function to delete activity related contact in calendar
+var del_ids = new Array();
+function removeActContacts()
+{
+ var avail_contacts = getObj('parentid');
+ // this block is to remove contacts and get deleted contact ids
+ if(avail_contacts.options.selectedIndex > -1)
+ {
+ for(m = 0; m < avail_contacts.options.length; m++)
+ {
+ if(avail_contacts.options[m].selected == true)
+ {
+ del_ids.push(avail_contacts.options[m].value);
+ avail_contacts.options[m] = null;
+ removeActContacts();
+ }
+ }
+ }
+ document.EditView.deletecntlist.value = del_ids.join(";");
+
+ // this block is to get available id list
+ var avail_ids = new Array();
+ for(n=0; n window.innerWidth ){
+ leftSide = eval(leftSide) - eval(widthM);
+ tagName.style.left = leftSide + 'px';
+ }
+ else
+ tagName.style.left= leftSide + 'px';
+ tagName.style.top= topSide + 'px';
+ tagName.style.display = 'block';
+ tagName.style.visibility = "visible";
+ if(type == 'event')
+ {
+ var heldstatus = "eventstatus=Held";
+ var notheldstatus = "eventstatus=Not Held";
+ var activity_mode = "Events";
+ var complete = document.getElementById("complete");
+ var pending = document.getElementById("pending");
+ var postpone = document.getElementById("postpone");
+ var actdelete = document.getElementById("actdelete");
+ var changeowner = document.getElementById("changeowner");
+ var OptionData = document.getElementById('view_Option').options[document.getElementById('view_Option').selectedIndex].value;
+
+ }
+ if(type == 'todo')
+ {
+ var heldstatus = "status=Completed";
+ var notheldstatus = "status=Deferred";
+ var activity_mode = "Task";
+ var complete = document.getElementById("taskcomplete");
+ var pending = document.getElementById("taskpending");
+ var postpone = document.getElementById("taskpostpone");
+ var actdelete = document.getElementById("taskactdelete");
+ var changeowner = document.getElementById("taskchangeowner");
+ var OptionData = '';
+ }
+ document.getElementById("idlist").value = id;
+ document.change_owner.hour.value = hour;
+ document.change_owner.day.value = day;
+ document.change_owner.view.value = view;
+ document.change_owner.month.value = month;
+ document.change_owner.year.value = year;
+ document.change_owner.subtab.value = type;
+ if(complete) complete.href="javascript:updateStatus("+id+",'"+heldstatus+"','"+view+"',"+hour+","+day+","+month+","+year+",'"+type+"')";
+ if(pending) pending.href="javascript:updateStatus("+id+",'"+notheldstatus+"','"+view+"',"+hour+","+day+","+month+","+year+",'"+type+"')";
+
+ if(postpone) postpone.href="index.php?module=Calendar&action=EditView&record="+id+"&return_action=index&activity_mode="+activity_mode+"&view="+view+"&hour="+hour+"&day="+day+"&month="+month+"&year="+year+"&viewOption="+OptionData+"&subtab="+type+"&maintab=Calendar";
+
+ if(actdelete) actdelete.href="javascript:delActivity("+id+",'"+view+"',"+hour+","+day+","+month+","+year+",'"+type+"')";
+
+ if(changeowner) changeowner.href="javascript:dispLayer('act_changeowner');";
+
+}
+
+function dispLayer(lay)
+{
+ var tagName = document.getElementById(lay);
+ tagName.style.visibility = 'visible';
+ tagName.style.display = 'block';
+}
+
+//check whether user form selected or group form selected
+function checkgroup()
+{
+ if($("group_checkbox").checked)
+ {
+ document.change_owner.lead_group_owner.style.display = "block";
+ document.change_owner.lead_owner.style.display = "none";
+ }
+ else
+ {
+ document.change_owner.lead_group_owner.style.display = "none";
+ document.change_owner.lead_owner.style.display = "block";
+ }
+}
+
+function calendarChangeOwner()
+{
+ var idlist = document.change_owner.idlist.value;
+ var view = document.change_owner.view.value;
+ var day = document.change_owner.day.value;
+ var month = document.change_owner.month.value;
+ var year = document.change_owner.year.value;
+ var hour = document.change_owner.hour.value;
+ var subtab = document.change_owner.subtab.value;
+
+ //var checked = document.change_owner.user_lead_owner[0].checked;
+ if($("user_checkbox").checked)
+ {
+ var user_id = document.getElementById('lead_owner').options[document.getElementById('lead_owner').options.selectedIndex].value;
+ var url = 'module=Users&action=updateLeadDBStatus&return_module=Calendar&return_action=ActivityAjax&owner_id='+user_id+'&idlist='+idlist+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=change_owner&owner_type=User';
+ }
+ else
+ {
+ var group_id = document.getElementById('lead_group_owner').options[document.getElementById('lead_group_owner').options.selectedIndex].value;
+ var url = 'module=Users&action=updateLeadDBStatus&return_module=Calendar&return_action=ActivityAjax&owner_id='+group_id+'&idlist='+idlist+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=change_owner&owner_type=Group';
+ }
+
+ if(subtab == 'event')
+ {
+ var OptionData = $('view_Option').options[$('view_Option').selectedIndex].value;
+ var eventurl = url+'&viewOption='+OptionData+'&subtab=event&ajax=true';
+
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody: eventurl,
+ onComplete: function(response) {
+ if(OptionData == 'listview')
+ {
+ result = response.responseText.split('####');
+ $("total_activities").innerHTML = result[1];
+ $("listView").innerHTML=result[0];
+ document.EventViewOption.action.value = "index";
+ window.document.EventViewOption.submit();
+ }
+ if(OptionData == 'hourview')
+ {
+ result = response.responseText.split('####');
+ $("total_activities").innerHTML = result[1];
+ $("hrView").innerHTML=result[0];
+ document.EventViewOption.action.value = "index";
+ window.document.EventViewOption.submit();
+ }
+ }
+ }
+ );
+ }
+ if(subtab == 'todo')
+ {
+
+ var todourl = url+'&subtab=todo&ajax=true';
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody: todourl,
+ onComplete: function(response) {
+ result = response.responseText.split('####');
+ $("total_activities").innerHTML = result[1];
+ $("mnuTab2").innerHTML=result[0];
+ }
+ }
+ );
+ }
+}
+
+function delActivity(id,view,hour,day,month,year,subtab)
+{
+ if(subtab == 'event')
+ {
+ var OptionData = $('view_Option').options[$('view_Option').selectedIndex].value;
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody: 'module=Users&action=massdelete&return_module=Calendar&return_action=ActivityAjax&idlist='+id+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=activity_delete&viewOption='+OptionData+'&subtab=event&ajax=true',
+ onComplete: function(response) {
+ if(OptionData == 'listview')
+ {
+ result = response.responseText.split('####');
+ $("total_activities").innerHTML = result[1];
+ $("listView").innerHTML=result[0];
+ }
+ if(OptionData == 'hourview')
+ {
+ result = response.responseText.split('####');
+ $("total_activities").innerHTML = result[1];
+ $("hrView").innerHTML=result[0];
+ }
+ }
+ }
+ );
+ }
+ if(subtab == 'todo')
+ {
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody: 'module=Users&action=massdelete&return_module=Calendar&return_action=ActivityAjax&idlist='+id+'&view='+view+'&hour='+hour+'&day='+day+'&month='+month+'&year='+year+'&type=activity_delete&subtab=todo&ajax=true',
+ onComplete: function(response) {
+ result = response.responseText.split('####');
+ $("total_activities").innerHTML = result[1];
+ $("mnuTab2").innerHTML=result[0];
+ }
+ }
+ );
+ }
+}
+
+
+/*
+* javascript function to display the div tag
+* @param divId :: div tag ID
+*/
+function cal_show(divId)
+
+{
+
+ var id = document.getElementById(divId);
+
+ id.style.visibility = 'visible';
+
+}
+
+function fnAssignTo(){
+ var option_Box = document.getElementById('parent_type');
+ var option_select = option_Box.options[option_Box.selectedIndex].value;
+ if(option_select == "Leads" || option_select == "Leads&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "Accounts" || option_select == "Accounts&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "Potentials" || option_select == "Potentials&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "Quotes&action=Popup" || option_select == "Quotes&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "PurchaseOrder" || option_select == "PurchaseOrder&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "SalesOrder" || option_select == "SalesOrder&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "Invoice" || option_select == "Invoice&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else if(option_select == "Campaigns" || option_select == "Campaigns&action=Popup")
+ {
+ document.getElementById('leadLay').style.visibility = 'visible';
+ }
+ else{
+ document.getElementById('leadLay').style.visibility = 'hidden';
+ }
+ }
+
+function fnShowPopup(){
+ document.getElementById('popupLay').style.display = 'block';
+}
+
+function fnHidePopup(){
+ document.getElementById('popupLay').style.display = 'none';
+}
+
+function getValidationarr(id,activity_mode,opmode,subtab,viewOption)
+{
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody: 'module=Calendar&action=ActivityAjax&record='+id+'&activity_mode='+activity_mode+'&ajax=true&type=view&file=DetailView',
+ onComplete: function(response) {
+ $("dataArray").innerHTML=response.responseText;
+ setFieldvalues(opmode,subtab,viewOption);
+ }
+ }
+ );
+
+}
+
+function setFieldvalues(opmode,subtab,viewOption)
+{
+ var st = document.getElementById('activity_cont');
+ eval(st.innerHTML);
+ if(activity_type == 'Events')
+ {
+ document.EditView.viewOption.value = viewOption;
+ document.EditView.subtab.value = subtab;
+ for(x=0;x is a contact id
+ ltext ==> is a contact name
+**/
+function addOption(lvalue,ltext)
+{
+ var optObj = document.createElement('OPTION')
+ if (browser_ie) optObj.innerText = ltext;
+ else if(browser_nn4 || browser_nn6) optObj.text = ltext;
+ else optObj.text = ltext;
+ optObj.value = lvalue;
+ document.getElementById('parentid').appendChild(optObj);
+}
+
+function getdispDate(tempDate)
+{
+ var datefmt = document.EditView.dateformat.value;
+ var dd = _2digit(parseInt(tempDate.getDate(),10));
+ var mm = _2digit(parseInt(tempDate.getMonth(),10)+1);
+ var yy = tempDate.getFullYear();
+ if(datefmt == '%d-%m-%Y') return dd+'-'+mm+'-'+yy;
+ else if(datefmt == '%m-%d-%Y') return mm+'-'+dd+'-'+yy;
+ else return yy+'-'+mm+'-'+dd;
+}
diff --git a/oss/vtiger/trunk/modules/Calendar/updateCalendarSharing.php b/oss/vtiger/trunk/modules/Calendar/updateCalendarSharing.php
new file mode 100644
index 00000000..a1c09e71
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/updateCalendarSharing.php
@@ -0,0 +1,45 @@
+pquery($delquery, array($_REQUEST["current_userid"]));
+
+$selectedid = $_REQUEST['shar_userid'];
+$sharedid = explode (";",$selectedid);
+if(isset($sharedid) && $sharedid != null)
+{
+ foreach($sharedid as $sid)
+ {
+ if($sid != '')
+ {
+ $sql = "insert into vtiger_sharedcalendar values (?,?)";
+ $adb->pquery($sql, array($_REQUEST["current_userid"], $sid));
+ }
+ }
+}
+if(isset($_REQUEST['start_hour']) && $_REQUEST['start_hour'] != '')
+{
+ $sql = "update vtiger_users set start_hour=? where id=?";
+ $adb->pquery($sql, array($_REQUEST['start_hour'], $current_user->id));
+}
+
+$sql = "update vtiger_users set hour_format=? where id=?";
+$adb->pquery($sql, array($hour_format, $current_user->id));
+RecalculateSharingRules();
+header("Location: index.php?action=index&module=Calendar&view=".vtlib_purify($_REQUEST['view'])."&hour=".vtlib_purify($_REQUEST['hour'])."&day=".vtlib_purify($_REQUEST['day'])."&month=".vtlib_purify($_REQUEST['month'])."&year=".vtlib_purify($_REQUEST['year'])."&viewOption=".vtlib_purify($_REQUEST['viewOption'])."&subtab=".vtlib_purify($_REQUEST['subtab'])."&parenttab=".getParentTab());
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Calendar/updateRelations.php b/oss/vtiger/trunk/modules/Calendar/updateRelations.php
new file mode 100644
index 00000000..b6e17de7
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calendar/updateRelations.php
@@ -0,0 +1,64 @@
+pquery($sql, array($id, $_REQUEST["parentid"]));
+ }
+ }
+ header("Location: index.php?action=CallRelatedList&module=Calendar&activity_mode=Events&record=".$record);
+
+}
+elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '' && $_REQUEST['destination_module'] == 'Contacts')
+{
+ $record = vtlib_purify($_REQUEST["parentid"]);
+ $sql = "insert into vtiger_cntactivityrel values (?,?)";
+ $adb->pquery($sql, array($_REQUEST["entityid"], $_REQUEST["parentid"]));
+ header("Location: index.php?action=DetailView&module=Calendar&activity_mode=Events&record=".$record);
+}
+
+//This if for adding the vtiger_users
+if(isset($_REQUEST['idlist']) && $_REQUEST['idlist'] != '' && $_REQUEST['destination_module'] == 'Users')
+{
+ //split the string and store in an array
+ $storearray = explode (";",$idlist);
+ foreach($storearray as $id)
+ {
+ if($id != '')
+ {
+ $record = vtlib_purify($_REQUEST['parentid']);
+ $sql = "insert into vtiger_salesmanactivityrel values (?,?)";
+ $adb->pquery($sql, array($id, $_REQUEST["parentid"]));
+ }
+ }
+ header("Location: index.php?action=DetailView&module=Calendar&activity_mode=Events&record=".$record);
+}
+elseif(isset($_REQUEST['entityid']) && $_REQUEST['entityid'] != '' && $_REQUEST['destination_module'] == 'Users')
+{
+ $record = vtlib_purify($_REQUEST['parentid']);
+ $sql = "insert into vtiger_salesmanactivityrel values (?,?)";
+ $adb->pquery($sql, array($_REQUEST["entityid"], $_REQUEST["parentid"]));
+ header("Location: index.php?action=DetailView&module=Calendar&activity_mode=Events&record=".$record);
+
+}
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Calls/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Calls/language/zh_cn.lang.php
new file mode 100644
index 00000000..4cd0de56
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Calls/language/zh_cn.lang.php
@@ -0,0 +1,45 @@
+ '电话',
+ 'LBL_MODULE_TITLE' => '电话: 首页',
+ 'LBL_SEARCH_FORM_TITLE' => '查找电话',
+ 'LBL_LIST_FORM_TITLE' => '电话列表',
+ 'LBL_NEW_FORM_TITLE' => '计划客户电话',
+ 'LBL_LIST_CLOSE' => '完成',
+ 'LBL_LIST_SUBJECT' => '主题',
+ 'LBL_LIST_CONTACT' => '联系人',
+ 'LBL_LIST_RELATED_TO' => '相关对象',
+ 'LBL_LIST_DATE' => '开始日期',
+ 'LBL_LIST_TIME' => '开始时间',
+ 'LBL_LIST_DURATION' => '时间',
+ 'LBL_SUBJECT' => '主题:',
+ 'LBL_CONTACT_NAME' => '联系人:',
+ 'LBL_DESCRIPTION_INFORMATION' => '描述信息:',
+ 'LBL_DESCRIPTION' => '描述:',
+ 'LBL_STATUS' => '状态:',
+ 'LBL_DATE' => '开始日期:',
+ 'LBL_DURATION' => '时间:',
+ 'LBL_HOURS_MINUTES' => '(小时/分钟)',
+ 'LBL_CALL' => '电话:',
+ 'LBL_DATE_TIME' => '开始日期与时间:',
+ 'LBL_TIME' => '开始时间:',
+ 'LBL_HOURS_ABBREV' => '时',
+ 'LBL_MINSS_ABBREV' => '分',
+ 'LBL_COLON' => ':',
+ 'LBL_DEFAULT_STATUS' => '已计划',
+ 'LNK_NEW_LEAD' => '新增线索',
+ 'LNK_NEW_CONTACT' => '新增联系人',
+ 'LNK_NEW_ACCOUNT' => '新增客户',
+ 'LNK_NEW_OPPORTUNITY' => '新增商机',
+ 'LNK_NEW_CASE' => '新增拜访',
+ 'LNK_NEW_NOTE' => '新增备忘录',
+ 'LNK_NEW_CALL' => '新增电话',
+ 'LNK_NEW_EMAIL' => '新增Email',
+ 'LNK_NEW_MEETING' => '新增会议',
+ 'LNK_NEW_TASK' => '新增任务',
+ 'ERR_DELETE_RECORD' => '必须指定纪录编号才能删除客户.',
+ 'NTC_REMOVE_INVITEE' => '您确定要删除这个电话邀请吗?',
+ 'LBL_INVITEE' => '*受邀者',
+
+);
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/CallRelatedList.php b/oss/vtiger/trunk/modules/Campaigns/CallRelatedList.php
new file mode 100644
index 00000000..b9633ed4
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/CallRelatedList.php
@@ -0,0 +1,104 @@
+retrieve_entity_info($RECORD,$currentmodule);
+ $focus->id = $RECORD;
+ $focus->name=$focus->column_fields['campaignname'];
+ $log->debug("id is ".$focus->id);
+ $log->debug("name is ".$focus->name);
+ }
+
+ global $mod_strings;
+ global $app_strings,$adb;
+ global $theme;
+ global $currentModule;
+ $theme_path="themes/".$theme."/";
+ $image_path=$theme_path."images/";
+
+ $smarty = new vtigerCRM_Smarty;
+
+ if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
+ $focus->id = "";
+ }
+ if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
+ $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode']));
+ }
+ if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
+ $related_array=getRelatedLists($currentModule,$focus);
+
+ // vtlib customization: Related module could be disabled, check it
+ if(isset($related_array)) {
+ foreach($related_array as $mod_key=>$mod_val) {
+ if($mod_key == "Contacts" || $mod_key == "Leads") {
+ $rel_checked=$_REQUEST[$mod_key.'_all'];
+ $rel_check_split=explode(";",$rel_checked);
+ if (is_array($mod_val)) {
+ $mod_val["checked"]=array();
+ if (isset($mod_val['entries'])) {
+ foreach($mod_val['entries'] as $key=>$val) {
+ if(in_array($key,$rel_check_split))
+ $related_array[$mod_key]["checked"][$key] = 'checked';
+ else
+ $related_array[$mod_key]["checked"][$key] = '';
+ }
+ }
+ }
+ }
+ }
+ }
+ // END
+ $smarty->assign("RELATEDLISTS", $related_array);
+
+ require_once('modules/CustomView/CustomView.php');
+
+ // Module Sequence Numbering
+ $mod_seq_field = getModuleSequenceField($currentModule);
+ if ($mod_seq_field != null) {
+ $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
+ } else {
+ $mod_seq_id = $focus->id;
+ }
+ $smarty->assign('MOD_SEQ_ID', $mod_seq_id);
+ // END
+
+ $smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
+ $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
+ $smarty->assign("CATEGORY",$category);
+ $smarty->assign("UPDATEINFO",updateInfo($focus->id));
+ $smarty->assign("ID",$focus->id);
+ $smarty->assign("MODULE",$currentmodule);
+ $smarty->assign("SINGLE_MOD",$app_strings['Campaign']);
+ $smarty->assign("MOD",$mod_strings);
+ $smarty->assign("APP",$app_strings);
+ $smarty->assign("THEME", $theme);
+ $smarty->assign("IMAGE_PATH", $image_path);
+
+ $check_button = Button_Check($module);
+ $smarty->assign("CHECK", $check_button);
+
+ if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
+ $smarty->display("RelatedListContents.tpl");
+ else
+ $smarty->display("RelatedLists.tpl");
+}
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/Campaigns.js b/oss/vtiger/trunk/modules/Campaigns/Campaigns.js
new file mode 100644
index 00000000..d2d4935a
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/Campaigns.js
@@ -0,0 +1,42 @@
+/*********************************************************************************
+
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is: vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ********************************************************************************/
+
+
+
+function set_return_specific_campaign(campaign_id, campaign_name) {
+ if(document.getElementById('from_link').value != '') {
+ window.opener.document.QcEditView.campaignname.value = campaign_name;
+ window.opener.document.QcEditView.campaignid.value = campaign_id;
+ } else {
+ window.opener.document.EditView.campaignname.value = campaign_name;
+ window.opener.document.EditView.campaignid.value = campaign_id;
+}
+}
+
+function set_return(product_id, product_name) {
+ if(document.getElementById('from_link').value != '') {
+ window.opener.document.QcEditView.parent_name.value = product_name;
+ window.opener.document.QcEditView.parent_id.value = product_id;
+ } else {
+ window.opener.document.EditView.parent_name.value = product_name;
+ window.opener.document.EditView.parent_id.value = product_id;
+}
+}
+
+function set_return_todo(product_id, product_name) {
+ if(document.getElementById('from_link').value != '') {
+ window.opener.document.QcEditView.task_parent_name.value = product_name;
+ window.opener.document.QcEditView.task_parent_id.value = product_id;
+ } else {
+ window.opener.document.createTodo.task_parent_name.value = product_name;
+ window.opener.document.createTodo.task_parent_id.value = product_id;
+}
+}
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/Campaigns.php b/oss/vtiger/trunk/modules/Campaigns/Campaigns.php
new file mode 100644
index 00000000..26f2367f
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/Campaigns.php
@@ -0,0 +1,466 @@
+'crmid','vtiger_campaign'=>'campaignid','vtiger_campaignscf'=>'campaignid');
+ /**
+ * Mandatory table for supporting custom fields.
+ */
+ var $customFieldTable = Array('vtiger_campaignscf', 'campaignid');
+ var $column_fields = Array();
+
+ var $sortby_fields = Array('campaignname','smownerid','campaigntype','productname','expectedrevenue','closingdate','campaignstatus','expectedresponse','targetaudience','expectedcost');
+
+ var $list_fields = Array(
+ 'Campaign Name'=>Array('campaign'=>'campaignname'),
+ 'Campaign Type'=>Array('campaign'=>'campaigntype'),
+ 'Campaign Status'=>Array('campaign'=>'campaignstatus'),
+ 'Expected Revenue'=>Array('campaign'=>'expectedrevenue'),
+ 'Expected Close Date'=>Array('campaign'=>'closingdate'),
+ 'Assigned To' => Array('crmentity'=>'smownerid')
+ );
+
+ var $list_fields_name = Array(
+ 'Campaign Name'=>'campaignname',
+ 'Campaign Type'=>'campaigntype',
+ 'Campaign Status'=>'campaignstatus',
+ 'Expected Revenue'=>'expectedrevenue',
+ 'Expected Close Date'=>'closingdate',
+ 'Assigned To'=>'assigned_user_id'
+ );
+
+ var $list_link_field= 'campaignname';
+ //Added these variables which are used as default order by and sortorder in ListView
+ var $default_order_by = 'crmid';
+ var $default_sort_order = 'DESC';
+
+ //var $groupTable = Array('vtiger_campaigngrouprelation','campaignid');
+
+ var $search_fields = Array(
+ 'Campaign Name'=>Array('vtiger_campaign'=>'campaignname'),
+ 'Campaign Type'=>Array('vtiger_campaign'=>'campaigntype'),
+ );
+
+ var $search_fields_name = Array(
+ 'Campaign Name'=>'campaignname',
+ 'Campaign Type'=>'campaigntype',
+ );
+ // Used when enabling/disabling the mandatory fields for the module.
+ // Refers to vtiger_field.fieldname values.
+ var $mandatory_fields = Array('campaignname','createdtime' ,'modifiedtime','assigned_user_id');
+
+ function Campaigns()
+ {
+ $this->log =LoggerManager::getLogger('campaign');
+ $this->db = PearDatabase::getInstance();
+ $this->column_fields = getColumnFields('Campaigns');
+ }
+
+ /** Function to handle module specific operations when saving a entity
+ */
+ function save_module($module)
+ {
+ }
+
+ // Mike Crowe Mod --------------------------------------------------------Default ordering for us
+ /**
+ * Function to get sort order
+ * return string $sorder - sortorder string either 'ASC' or 'DESC'
+ */
+ function getSortOrder()
+ {
+ global $log;
+ $log->debug("Entering getSortOrder() method ...");
+ if(isset($_REQUEST['sorder']))
+ $sorder = $this->db->sql_escape_string($_REQUEST['sorder']);
+ else
+ $sorder = (($_SESSION['CAMPAIGN_SORT_ORDER'] != '')?($_SESSION['CAMPAIGN_SORT_ORDER']):($this->default_sort_order));
+
+ $log->debug("Exiting getSortOrder method ...");
+ return $sorder;
+ }
+
+ /**
+ * Function to get order by
+ * return string $order_by - fieldname(eg: 'campaignname')
+ */
+ function getOrderBy()
+ {
+ global $log;
+ $log->debug("Entering getOrderBy() method ...");
+
+ $use_default_order_by = '';
+ if(PerformancePrefs::getBoolean('LISTVIEW_DEFAULT_SORTING', true)) {
+ $use_default_order_by = $this->default_order_by;
+ }
+
+ if (isset($_REQUEST['order_by']))
+ $order_by = $this->db->sql_escape_string($_REQUEST['order_by']);
+ else
+ $order_by = (($_SESSION['CAMPAIGN_ORDER_BY'] != '')?($_SESSION['CAMPAIGN_ORDER_BY']):($use_default_order_by));
+
+ $log->debug("Exiting getOrderBy method ...");
+ return $order_by;
+ }
+ // Mike Crowe Mod --------------------------------------------------------
+
+ /**
+ * Function to get Campaign related Contacts
+ * @param integer $id - campaignid
+ * returns related Contacts record in array format
+ */
+ function get_contacts($id, $cur_tab_id, $rel_tab_id, $actions=false) {
+ global $log, $singlepane_view,$currentModule;
+ $log->debug("Entering get_contacts(".$id.") method ...");
+ $this_module = $currentModule;
+
+ $related_module = vtlib_getModuleNameById($rel_tab_id);
+ require_once("modules/$related_module/$related_module.php");
+ $other = new $related_module();
+ vtlib_setup_modulevars($related_module, $other);
+ $singular_modname = vtlib_toSingular($related_module);
+
+ $parenttab = getParentTab();
+
+ if($singlepane_view == 'true')
+ $returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
+ else
+ $returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
+
+ $button = '';
+
+ // Send mail button for selected Leads
+ $button .= "";
+ $button .= '  ';
+
+ /* To get Leads CustomView -START */
+ require_once('modules/CustomView/CustomView.php');
+ $lhtml = "";
+ /* To get Leads CustomView -END */
+
+ $button .= $lhtml."";
+ $button .= '  ';
+
+ if($actions) {
+ if(is_string($actions)) $actions = explode(',', strtoupper($actions));
+ if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
+ $button .= " ";
+ }
+ if(in_array('ADD', $actions) && isPermitted($related_module,1, '') == 'yes') {
+ $button .= " ";
+ }
+ }
+
+ $query = "SELECT vtiger_contactdetails.accountid, vtiger_account.accountname,
+ CASE when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name ,
+ vtiger_contactdetails.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname, vtiger_contactdetails.title,
+ vtiger_contactdetails.department, vtiger_contactdetails.email, vtiger_contactdetails.phone, vtiger_crmentity.crmid,
+ vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime
+ FROM vtiger_contactdetails
+ INNER JOIN vtiger_campaigncontrel ON vtiger_campaigncontrel.contactid = vtiger_contactdetails.contactid
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid
+ LEFT JOIN vtiger_groups ON vtiger_groups.groupid=vtiger_crmentity.smownerid
+ LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid=vtiger_users.id
+ LEFT JOIN vtiger_account ON vtiger_account.accountid = vtiger_contactdetails.accountid
+ WHERE vtiger_campaigncontrel.campaignid = ".$id." AND vtiger_crmentity.deleted=0";
+
+ $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
+
+ if($return_value == null) $return_value = Array();
+ $return_value['CUSTOM_BUTTON'] = $button;
+
+ $log->debug("Exiting get_contacts method ...");
+ return $return_value;
+ }
+
+ /**
+ * Function to get Campaign related Leads
+ * @param integer $id - campaignid
+ * returns related Leads record in array format
+ */
+ function get_leads($id, $cur_tab_id, $rel_tab_id, $actions=false) {
+ global $log, $singlepane_view, $currentModule;
+ $log->debug("Entering get_leads(".$id.") method ...");
+ $this_module = $currentModule;
+
+ $related_module = vtlib_getModuleNameById($rel_tab_id);
+ require_once("modules/$related_module/$related_module.php");
+ $other = new $related_module();
+ vtlib_setup_modulevars($related_module, $other);
+ $singular_modname = vtlib_toSingular($related_module);
+
+ $parenttab = getParentTab();
+
+ if($singlepane_view == 'true')
+ $returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
+ else
+ $returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
+
+ $button = '';
+
+ // Send mail button for selected Leads
+ $button .= "";
+ $button .= '  ';
+
+ /* To get Leads CustomView -START */
+ require_once('modules/CustomView/CustomView.php');
+ $lhtml = "";
+ /* To get Leads CustomView -END */
+
+ $button .= $lhtml."";
+ $button .= '  ';
+
+ if($actions) {
+ if(is_string($actions)) $actions = explode(',', strtoupper($actions));
+ if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
+ $button .= " ";
+ }
+ if(in_array('ADD', $actions) && isPermitted($related_module,1, '') == 'yes') {
+ $button .= " ";
+ }
+ }
+
+ $query = "SELECT vtiger_leaddetails.*, vtiger_crmentity.crmid,vtiger_leadaddress.phone,vtiger_leadsubdetails.website,
+ CASE when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name,
+ vtiger_crmentity.smownerid FROM vtiger_leaddetails
+ INNER JOIN vtiger_campaignleadrel ON vtiger_campaignleadrel.leadid=vtiger_leaddetails.leadid
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_leaddetails.leadid
+ INNER JOIN vtiger_leadsubdetails ON vtiger_leadsubdetails.leadsubscriptionid = vtiger_leaddetails.leadid
+ INNER JOIN vtiger_leadaddress ON vtiger_leadaddress.leadaddressid = vtiger_leadsubdetails.leadsubscriptionid
+ LEFT JOIN vtiger_users ON vtiger_crmentity.smownerid = vtiger_users.id
+ LEFT JOIN vtiger_groups ON vtiger_groups.groupid=vtiger_crmentity.smownerid
+ WHERE vtiger_crmentity.deleted=0 AND vtiger_campaignleadrel.campaignid = ".$id;
+
+ $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
+
+ if($return_value == null) $return_value = Array();
+ $return_value['CUSTOM_BUTTON'] = $button;
+
+ $log->debug("Exiting get_leads method ...");
+ return $return_value;
+ }
+
+ /**
+ * Function to get Campaign related Potentials
+ * @param integer $id - campaignid
+ * returns related potentials record in array format
+ */
+ function get_opportunities($id, $cur_tab_id, $rel_tab_id, $actions=false) {
+ global $log, $singlepane_view,$currentModule,$current_user;
+ $log->debug("Entering get_opportunities(".$id.") method ...");
+ $this_module = $currentModule;
+
+ $related_module = vtlib_getModuleNameById($rel_tab_id);
+ require_once("modules/$related_module/$related_module.php");
+ $other = new $related_module();
+ vtlib_setup_modulevars($related_module, $other);
+ $singular_modname = vtlib_toSingular($related_module);
+
+ $parenttab = getParentTab();
+
+ if($singlepane_view == 'true')
+ $returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
+ else
+ $returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
+
+ $button = '';
+
+ if($actions && getFieldVisibilityPermission($related_module,$current_user->id,'campaignid') == '0') {
+ if(is_string($actions)) $actions = explode(',', strtoupper($actions));
+ if(in_array('SELECT', $actions) && isPermitted($related_module,4, '') == 'yes') {
+ $button .= " ";
+ }
+ if(in_array('ADD', $actions) && isPermitted($related_module,1, '') == 'yes') {
+ $button .= " ";
+ }
+ }
+
+ $query = "SELECT CASE when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name,
+ vtiger_potential.related_to, vtiger_account.accountname, vtiger_potential.potentialid, vtiger_potential.potentialname,
+ vtiger_potential.potentialtype, vtiger_potential.sales_stage, vtiger_potential.amount, vtiger_potential.closingdate,
+ vtiger_crmentity.crmid, vtiger_crmentity.smownerid FROM vtiger_campaign
+ INNER JOIN vtiger_potential ON vtiger_campaign.campaignid = vtiger_potential.campaignid
+ INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_potential.potentialid
+ LEFT JOIN vtiger_groups ON vtiger_groups.groupid=vtiger_crmentity.smownerid
+ LEFT JOIN vtiger_users ON vtiger_users.id=vtiger_crmentity.smownerid
+ LEFT JOIN vtiger_account ON vtiger_account.accountid = vtiger_potential.related_to
+ WHERE vtiger_campaign.campaignid = ".$id." AND vtiger_crmentity.deleted=0";
+
+ $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
+
+ if($return_value == null) $return_value = Array();
+ $return_value['CUSTOM_BUTTON'] = $button;
+
+ $log->debug("Exiting get_opportunities method ...");
+ return $return_value;
+ }
+
+ /**
+ * Function to get Campaign related Activities
+ * @param integer $id - campaignid
+ * returns related activities record in array format
+ */
+ function get_activities($id, $cur_tab_id, $rel_tab_id, $actions=false) {
+ global $log, $singlepane_view,$currentModule,$current_user;
+ $log->debug("Entering get_activities(".$id.") method ...");
+ $this_module = $currentModule;
+
+ $related_module = vtlib_getModuleNameById($rel_tab_id);
+ require_once("modules/$related_module/Activity.php");
+ $other = new Activity();
+ vtlib_setup_modulevars($related_module, $other);
+ $singular_modname = vtlib_toSingular($related_module);
+
+ $parenttab = getParentTab();
+
+ if($singlepane_view == 'true')
+ $returnset = '&return_module='.$this_module.'&return_action=DetailView&return_id='.$id;
+ else
+ $returnset = '&return_module='.$this_module.'&return_action=CallRelatedList&return_id='.$id;
+
+ $button = '';
+
+ $button .= '';
+
+ if($actions) {
+ if(is_string($actions)) $actions = explode(',', strtoupper($actions));
+ if(in_array('ADD', $actions) && isPermitted($related_module,1, '') == 'yes') {
+ $button .= " ";
+ }
+ }
+
+ $query = "SELECT vtiger_contactdetails.lastname,
+ vtiger_contactdetails.firstname,
+ vtiger_contactdetails.contactid,
+ vtiger_activity.*,
+ vtiger_seactivityrel.*,
+ vtiger_crmentity.crmid, vtiger_crmentity.smownerid,
+ vtiger_crmentity.modifiedtime,
+ CASE when (vtiger_users.user_name not like '') then vtiger_users.user_name else vtiger_groups.groupname end as user_name,
+ vtiger_recurringevents.recurringtype
+ FROM vtiger_activity
+ INNER JOIN vtiger_seactivityrel
+ ON vtiger_seactivityrel.activityid = vtiger_activity.activityid
+ INNER JOIN vtiger_crmentity
+ ON vtiger_crmentity.crmid=vtiger_activity.activityid
+ LEFT JOIN vtiger_cntactivityrel
+ ON vtiger_cntactivityrel.activityid = vtiger_activity.activityid
+ LEFT JOIN vtiger_contactdetails
+ ON vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid
+ LEFT JOIN vtiger_users
+ ON vtiger_users.id = vtiger_crmentity.smownerid
+ LEFT OUTER JOIN vtiger_recurringevents
+ ON vtiger_recurringevents.activityid = vtiger_activity.activityid
+ LEFT JOIN vtiger_groups
+ ON vtiger_groups.groupid = vtiger_crmentity.smownerid
+ WHERE vtiger_seactivityrel.crmid=".$id."
+ AND vtiger_crmentity.deleted = 0
+ AND (activitytype = 'Task'
+ OR activitytype !='Emails')";
+
+ $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
+
+ if($return_value == null) $return_value = Array();
+ $return_value['CUSTOM_BUTTON'] = $button;
+
+ $log->debug("Exiting get_activities method ...");
+ return $return_value;
+
+ }
+
+ /*
+ * Function to get the secondary query part of a report
+ * @param - $module primary module name
+ * @param - $secmodule secondary module name
+ * returns the query string formed on fetching the related data for report for secondary module
+ */
+ function generateReportsSecQuery($module,$secmodule){
+ $query = $this->getRelationQuery($module,$secmodule,"vtiger_campaign","campaignid");
+ $query .=" left join vtiger_crmentity as vtiger_crmentityCampaigns on vtiger_crmentityCampaigns.crmid=vtiger_campaign.campaignid and vtiger_crmentityCampaigns.deleted=0
+ left join vtiger_products as vtiger_productsCampaigns on vtiger_campaign.product_id = vtiger_productsCampaigns.productid
+ left join vtiger_campaignscf on vtiger_campaignscf.campaignid = vtiger_crmentityCampaigns.crmid
+ left join vtiger_groups as vtiger_groupsCampaigns on vtiger_groupsCampaigns.groupid = vtiger_crmentityCampaigns.smownerid
+ left join vtiger_users as vtiger_usersCampaigns on vtiger_usersCampaigns.id = vtiger_crmentityCampaigns.smownerid";
+
+ return $query;
+ }
+
+ /*
+ * Function to get the relation tables for related modules
+ * @param - $secmodule secondary module name
+ * returns the array with table names and fieldnames storing relations between module and this module
+ */
+ function setRelationTables($secmodule){
+ $rel_tables = array (
+ "Contacts" => array("vtiger_campaigncontrel"=>array("campaignid","contactid"),"vtiger_campaign"=>"campaignid"),
+ "Leads" => array("vtiger_campaignleadrel"=>array("campaignid","leadid"),"vtiger_campaign"=>"campaignid"),
+ "Potentials" => array("vtiger_potential"=>array("campaignid","potentialid"),"vtiger_campaign"=>"campaignid"),
+ "Calendar" => array("vtiger_seactivityrel"=>array("crmid","activityid"),"vtiger_campaign"=>"campaignid"),
+ "Products" => array("vtiger_campaign"=>array("campaignid","product_id")),
+ );
+ return $rel_tables[$secmodule];
+ }
+
+ // Function to unlink an entity with given Id from another entity
+ function unlinkRelationship($id, $return_module, $return_id) {
+ global $log;
+ if(empty($return_module) || empty($return_id)) return;
+
+ if($return_module == 'Leads') {
+ $sql = 'DELETE FROM vtiger_campaignleadrel WHERE campaignid=? AND leadid=?';
+ $this->db->pquery($sql, array($id, $return_id));
+ } elseif($return_module == 'Contacts') {
+ $sql = 'DELETE FROM vtiger_campaigncontrel WHERE campaignid=? AND contactid=?';
+ $this->db->pquery($sql, array($id, $return_id));
+ } else {
+ $sql = 'DELETE FROM vtiger_crmentityrel WHERE (crmid=? AND relmodule=? AND relcrmid=?) OR (relcrmid=? AND module=? AND crmid=?)';
+ $params = array($id, $return_module, $return_id, $id, $return_module, $return_id);
+ $this->db->pquery($sql, $params);
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/CampaignsAjax.php b/oss/vtiger/trunk/modules/Campaigns/CampaignsAjax.php
new file mode 100644
index 00000000..e2d11f6b
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/CampaignsAjax.php
@@ -0,0 +1,13 @@
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/CustomView.php b/oss/vtiger/trunk/modules/Campaigns/CustomView.php
new file mode 100644
index 00000000..93231ed6
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/CustomView.php
@@ -0,0 +1,14 @@
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/Delete.php b/oss/vtiger/trunk/modules/Campaigns/Delete.php
new file mode 100644
index 00000000..9dddc075
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/Delete.php
@@ -0,0 +1,39 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/DetailView.php b/oss/vtiger/trunk/modules/Campaigns/DetailView.php
new file mode 100644
index 00000000..cd82717d
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/DetailView.php
@@ -0,0 +1,107 @@
+retrieve_entity_info($_REQUEST['record'],"Campaigns");
+ $focus->name=$focus->column_fields['campaignname'];
+ $focus->id = $_REQUEST['record'];
+}
+
+if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
+{
+ $focus->id = "";
+}
+global $app_strings,$mod_strings,$theme,$currentModule,$default_module_view,$adb;
+
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+
+$smarty = new vtigerCRM_Smarty;
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("THEME", $theme);
+
+if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
+else $smarty->assign("NAME", "");
+$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
+
+$smarty->assign("CUSTOMFIELD", $cust_fld);
+$smarty->assign("SINGLE_MOD",'Campaign');
+$category = getParentTab();
+$smarty->assign("CATEGORY",$category);
+
+if(isPermitted("Campaigns","EditView",$_REQUEST['record']) == 'yes')
+ $smarty->assign("EDIT_DUPLICATE","permitted");
+
+if(isPermitted("Campaigns","Delete",$_REQUEST['record']) == 'yes')
+ $smarty->assign("DELETE","permitted");
+
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
+$smarty->assign("UPDATEINFO",updateInfo($focus->id));
+$smarty->assign("ID", vtlib_purify($_REQUEST['record']));
+
+// Module Sequence Numbering
+$mod_seq_field = getModuleSequenceField($currentModule);
+if ($mod_seq_field != null) {
+ $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
+} else {
+ $mod_seq_id = $focus->id;
+}
+$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
+// END
+
+$tabid = getTabid("Campaigns");
+$validationData = getDBValidationData($focus->tab_name,$tabid);
+$data = split_validationdataArray($validationData);
+
+$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
+$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
+$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
+
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule));
+
+if($singlepane_view == 'true')
+{
+ $related_array = getRelatedLists($currentModule,$focus);
+ $smarty->assign("RELATEDLISTS", $related_array);
+}
+
+$smarty->assign("SinglePane_View", $singlepane_view);
+$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
+$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record']));
+
+if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){
+ $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
+ VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id);
+}
+
+// Record Change Notification
+$focus->markAsViewed($current_user->id);
+// END
+
+$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
+
+$smarty->display("DetailView.tpl");
+
+$focus->id = $_REQUEST['record'];
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/DetailViewAjax.php b/oss/vtiger/trunk/modules/Campaigns/DetailViewAjax.php
new file mode 100644
index 00000000..31f31673
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/DetailViewAjax.php
@@ -0,0 +1,45 @@
+retrieve_entity_info($crmid,"Campaigns");
+ $modObj->column_fields[$fieldname] = $fieldvalue;
+ $modObj->id = $crmid;
+ $modObj->mode = "edit";
+ $modObj->save("Campaigns");
+ if($modObj->id != "")
+ {
+ echo ":#:SUCCESS";
+ }else
+ {
+ echo ":#:FAILURE";
+ }
+ }else
+ {
+ echo ":#:FAILURE";
+ }
+}
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/EditView.php b/oss/vtiger/trunk/modules/Campaigns/EditView.php
new file mode 100644
index 00000000..fb88c563
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/EditView.php
@@ -0,0 +1,131 @@
+assign("SEARCH", $searchurl);
+//4600 ends
+
+
+if(isset($_REQUEST['record']) && $_REQUEST['record'] !='')
+{
+ $focus->id = $_REQUEST['record'];
+ $focus->mode = 'edit';
+ $focus->retrieve_entity_info($_REQUEST['record'],"Campaigns");
+ $focus->name=$focus->column_fields['campaignname'];
+}
+if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
+{
+ $focus->id = "";
+ $focus->mode = '';
+}
+if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
+ setObjectValuesFromRequest($focus);
+}
+
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+
+$disp_view = getView($focus->mode);
+if($disp_view == 'edit_view')
+ $smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
+else
+{
+ $smarty->assign("BASBLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS'));
+}
+
+$smarty->assign("OP_MODE",$disp_view);
+
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("SINGLE_MOD",'Campaign');
+
+
+$category = getParentTab();
+$smarty->assign("CATEGORY",$category);
+
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
+
+if (isset($focus->name))
+$smarty->assign("NAME", $focus->name);
+else
+$smarty->assign("NAME", "");
+
+if(isset($cust_fld))
+{
+ $smarty->assign("CUSTOMFIELD", $cust_fld);
+}
+$smarty->assign("ID", $focus->id);
+if($focus->mode == 'edit')
+{
+ $smarty->assign("MODE", $focus->mode);
+ $smarty->assign("OLDSMOWNERID", $focus->column_fields['assigned_user_id']);
+ $smarty->assign("UPDATEINFO",updateInfo($focus->id));
+}
+
+if(isset($_REQUEST['return_module']))
+$smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
+if(isset($_REQUEST['return_action']))
+$smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
+if(isset($_REQUEST['return_id']))
+$smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
+if(isset($_REQUEST['product_id']))
+$smarty->assign("PRODUCTID", vtlib_purify($_REQUEST['product_id']));
+if (isset($_REQUEST['return_viewname']))
+$smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname']));
+
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
+
+$tabid = getTabid("Campaigns");
+$validationData = getDBValidationData($focus->tab_name,$tabid);
+$data = split_validationdataArray($validationData);
+
+$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
+$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
+$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
+
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate']));
+
+global $adb;
+// Module Sequence Numbering
+$mod_seq_field = getModuleSequenceField($currentModule);
+if($focus->mode != 'edit' && $mod_seq_field != null) {
+ $autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE');
+ $mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1",array($currentModule));
+ $mod_seq_prefix = $adb->query_result($mod_seq_string,0,'prefix');
+ $mod_seq_no = $adb->query_result($mod_seq_string,0,'cur_id');
+ if($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix.$mod_seq_no))
+ echo ' '. getTranslatedString('LBL_DUPLICATE'). ' '. getTranslatedString($mod_seq_field['label'])
+ .' - '. getTranslatedString('LBL_CLICK') .' '.getTranslatedString('LBL_HERE').' '
+ . getTranslatedString('LBL_TO_CONFIGURE'). ' '. getTranslatedString($mod_seq_field['label']) .'';
+ else
+ $smarty->assign("MOD_SEQ_ID",$autostr);
+} else {
+ $smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
+}
+// END
+
+if($focus->mode == 'edit')
+ $smarty->display("salesEditView.tpl");
+else
+ $smarty->display("CreateView.tpl");
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/ListView.php b/oss/vtiger/trunk/modules/Campaigns/ListView.php
new file mode 100644
index 00000000..c5d65dab
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/ListView.php
@@ -0,0 +1,262 @@
+initSortbyField('Campaigns');
+// END
+$category = getParentTab();
+$smarty = new vtigerCRM_Smarty;
+$other_text = Array();
+$url_string = ''; // assigning http url string
+
+if(!$_SESSION['lvs'][$currentModule])
+{
+ unset($_SESSION['lvs']);
+ $modObj = new ListViewSession();
+ $modObj->sorder = $sorder;
+ $modObj->sortby = $order_by;
+ $_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
+}
+
+if($_REQUEST['errormsg'] != '')
+{
+ $errormsg = vtlib_purify($_REQUEST['errormsg']);
+ $smarty->assign("ERROR","The User does not have permission to Change/Delete ".$errormsg." ".$currentModule);
+}else
+{
+ $smarty->assign("ERROR","");
+}
+
+//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
+$sorder = $focus->getSortOrder();
+$order_by = $focus->getOrderBy();
+
+$_SESSION['CAMPAIGN_ORDER_BY'] = $order_by;
+$_SESSION['CAMPAIGN_SORT_ORDER'] = $sorder;
+//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
+
+
+
+if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
+{
+ list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
+ // we have a query
+ $url_string .="&query=true".$ustring;
+ $log->info("Here is the where clause for the list view: $where");
+ $smarty->assign("SEARCH_URL",$url_string);
+}
+
+//<<<>>>>>>
+$oCustomView = new CustomView("Campaigns");
+$viewid = $oCustomView->getViewId($currentModule);
+$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
+$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
+
+//Added to handle approving or denying status-public by the admin in CustomView
+$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']);
+$smarty->assign("CUSTOMVIEW_PERMISSION",$statusdetails);
+
+//To check if a user is able to edit/delete a customview
+$edit_permit = $oCustomView->isPermittedCustomView($viewid,'EditView',$currentModule);
+$delete_permit = $oCustomView->isPermittedCustomView($viewid,'Delete',$currentModule);
+$smarty->assign("CV_EDIT_PERMIT",$edit_permit);
+$smarty->assign("CV_DELETE_PERMIT",$delete_permit);
+
+$smarty->assign("CHANGE_OWNER",getUserslist());
+$smarty->assign("CHANGE_GROUP_OWNER",getGroupslist());
+//<<<<>>>>
+
+if($viewid != 0)
+{
+ $CActionDtls = $oCustomView->getCustomActionDetails($viewid);
+}
+elseif($viewid ==0)
+{
+ echo "";
+ exit;
+}
+// Buttons and View options
+if(isPermitted('Campaigns','Delete','') == 'yes')
+{
+ $other_text ['del']=$app_strings[LBL_MASS_DELETE];
+}
+if(isPermitted('Campaigns','EditView','') == 'yes')
+{
+ $other_text['mass_edit'] = $app_strings[LBL_MASS_EDIT];
+ $other_text['c_owner'] = $app_strings[LBL_CHANGE_OWNER];
+}
+if($viewnamedesc['viewname'] == 'All')
+{
+ $smarty->assign("ALL", 'All');
+}
+
+$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
+$smarty->assign("VIEWID", $viewid);
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH",$image_path);
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("BUTTONS",$other_text);
+$smarty->assign("CATEGORY",$category);
+$smarty->assign("SINGLE_MOD",'Campaign');
+
+//Retreive the list from Database
+//<<<<<<<<>>>>>>>>
+if($viewid != "0")
+{
+ $listquery = getListQuery("Campaigns");
+ $list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"Campaigns");
+}
+else
+{
+ $list_query = getListQuery("Campaigns");
+}
+//<<<<<<<>>>>>>>>
+
+if(isset($where) && $where != '')
+{
+ $list_query .= ' and '.$where;
+}
+
+//sort by "assignedto" and default sort by "ticketid"(DESC)
+if(isset($order_by) && $order_by != '')
+{
+ if($order_by == 'smownerid')
+ {
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY user_name';
+ $list_query .= ' ORDER BY user_name '.$sorder;
+ }
+ else
+ {
+ $tablename = getTableNameForField('Campaigns',$order_by);
+ $tablename = (($tablename != '')?($tablename."."):'');
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY '.$tablename.$order_by;
+
+ $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
+ }
+}
+else
+{
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY vtiger_campaign.campaignid';
+ $list_query .= ' ORDER BY vtiger_campaign.campaignid DESC';
+}
+
+//Postgres 8 fixes
+if( $adb->dbType == "pgsql")
+ $list_query = fixPostgresQuery( $list_query, $log, 0);
+
+
+if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
+ $count_result = $adb->query( mkCountQuery( $list_query));
+ $noofrows = $adb->query_result($count_result,0,"count");
+}else{
+ $noofrows = null;
+}
+
+$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true');
+$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
+
+$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows);
+
+$limit_start_rec = ($start-1) * $list_max_entries_per_page;
+
+if( $adb->dbType == "pgsql")
+ $list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array());
+else
+ $list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array());
+
+$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec);
+$smarty->assign('recordListRange',$recordListRangeMsg);
+
+//mass merge for word templates -- *Raj*17/11
+while($row = $adb->fetch_array($list_result))
+{
+ $ids[] = $row["crmid"];
+}
+if(isset($ids))
+{
+ $smarty->assign("ALLIDS", implode($ids,";"));
+}
+
+//Retreive the List View Table Header
+if($viewid !='')
+ $url_string .="&viewname=".$viewid;
+
+$listview_header = getListViewHeader($focus,"Campaigns",$url_string,$sorder,$order_by,"",$oCustomView);
+$smarty->assign("LISTHEADER", $listview_header);
+
+$listview_header_search = getSearchListHeaderValues($focus,"Campaigns",$url_string,$sorder,$order_by,"",$oCustomView);
+$smarty->assign("SEARCHLISTHEADER",$listview_header_search);
+
+$listview_entries = getListViewEntries($focus,"Campaigns",$list_result,$navigation_array,"","","EditView","Delete",$oCustomView);
+
+$smarty->assign("LISTENTITY", $listview_entries);
+$smarty->assign("SELECT_SCRIPT", $view_script);
+//Added to select Multiple records in multiple pages
+$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
+$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
+$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";"));
+
+$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"Campaigns","index",$viewid);
+$alphabetical = AlphabeticalSearch($currentModule,'index','campaignname','true','basic',"","","","",$viewid);
+$fieldnames = getAdvSearchfields($module);
+$criteria = getcriteria_options();
+$smarty->assign("CRITERIA", $criteria);
+$smarty->assign("FIELDNAMES", $fieldnames);
+$smarty->assign("ALPHABETICAL", $alphabetical);
+
+$smarty->assign("NAVIGATION", $navigationOutput);
+
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+
+$_SESSION[$currentModule.'_listquery'] = $list_query;
+
+if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
+ $smarty->display("ListViewEntries.tpl");
+else
+ $smarty->display("ListView.tpl");
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/ListViewPagging.php b/oss/vtiger/trunk/modules/Campaigns/ListViewPagging.php
new file mode 100644
index 00000000..333f1768
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/ListViewPagging.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/LoadList.php b/oss/vtiger/trunk/modules/Campaigns/LoadList.php
new file mode 100644
index 00000000..9a18b28c
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/LoadList.php
@@ -0,0 +1,38 @@
+query($cvObj->getModifiedCvListQuery(vtlib_purify($_REQUEST["cvid"]),$listquery,vtlib_purify($_REQUEST["list_type"])));
+
+if($_REQUEST["list_type"] == "Leads"){
+ $reltable = "vtiger_campaignleadrel";
+ $relid = "leadid";
+}
+elseif($_REQUEST["list_type"] == "Contacts"){
+ $reltable = "vtiger_campaigncontrel";
+ $relid = "contactid";
+}
+
+while($row=$adb->fetch_array($rs)) {
+ $sql = "delete from $reltable where $relid = ? and campaignid = ?";
+ $adb->pquery($sql, array($row["crmid"], $_REQUEST['return_id']));
+ $adb->pquery("INSERT INTO ".$reltable." VALUES(?,?)", array($_REQUEST["return_id"], $row["crmid"]));
+}
+
+header("Location: index.php?module=Campaigns&action=CampaignsAjax&file=CallRelatedList&ajax=true&record=".vtlib_purify($_REQUEST['return_id']));
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/MassEdit.php b/oss/vtiger/trunk/modules/Campaigns/MassEdit.php
new file mode 100644
index 00000000..348dab37
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/MassEdit.php
@@ -0,0 +1,45 @@
+mode = '';
+$mode = 'mass_edit';
+$disp_view = getView($focus->mode);
+
+$smarty = new vtigerCRM_Smarty;
+$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
+$smarty->assign("IDS",$_REQUEST['idstring']);
+$smarty->assign("MASS_EDIT","1");
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("APP",$app_strings);
+$smarty->assign("CATEGORY",getParentTab());
+
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+
+// Field Validation Information
+$tabid = getTabid($currentModule);
+$validationData = getDBValidationData($focus->tab_name,$tabid);
+$validationArray = split_validationdataArray($validationData);
+
+$smarty->assign("VALIDATION_DATA_FIELDNAME",$validationArray['fieldname']);
+$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$validationArray['datatype']);
+$smarty->assign("VALIDATION_DATA_FIELDLABEL",$validationArray['fieldlabel']);
+
+$smarty->display('MassEditForm.tpl');
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/MassEditSave.php b/oss/vtiger/trunk/modules/Campaigns/MassEditSave.php
new file mode 100644
index 00000000..0e1f2a6f
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/MassEditSave.php
@@ -0,0 +1,67 @@
+retrieve_entity_info($recordid, $currentModule);
+ $focus->mode = 'edit';
+ $focus->id = $recordid;
+ foreach($focus->column_fields as $fieldname => $val)
+ {
+ if(isset($_REQUEST[$fieldname."_mass_edit_check"]))
+ {
+ if($fieldname == 'assigned_user_id'){
+ if($_REQUEST['assigntype'] == 'U') {
+ $value = $_REQUEST['assigned_user_id'];
+ } elseif($_REQUEST['assigntype'] == 'T') {
+ $value = $_REQUEST['assigned_group_id'];
+ }
+ } else {
+ if(is_array($_REQUEST[$fieldname]))
+ $value = $_REQUEST[$fieldname];
+ else
+ $value = trim($_REQUEST[$fieldname]);
+ }
+ $focus->column_fields[$fieldname] = $value;
+ }
+ else{
+ $focus->column_fields[$fieldname] = decode_html($focus->column_fields[$fieldname]);
+ }
+ }
+ $focus->save($currentModule);
+ }
+ }
+}
+
+$parenttab = getParentTab();
+header("Location: index.php?module=$return_module&action=$return_action&parenttab=$parenttab$rstart");
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/Popup.php b/oss/vtiger/trunk/modules/Campaigns/Popup.php
new file mode 100644
index 00000000..98ea8ece
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/Popup.php
@@ -0,0 +1,23 @@
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/QuickCreate.php b/oss/vtiger/trunk/modules/Campaigns/QuickCreate.php
new file mode 100644
index 00000000..8d5998b8
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/QuickCreate.php
@@ -0,0 +1,12 @@
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/Save.php b/oss/vtiger/trunk/modules/Campaigns/Save.php
new file mode 100644
index 00000000..b9a717f7
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/Save.php
@@ -0,0 +1,80 @@
+id);
+ $rate_symbol = getCurrencySymbolandCRate($currencyid);
+ $rate = $rate_symbol['rate'];
+//added to fix 4600
+$search=vtlib_purify($_REQUEST['search_url']);
+setObjectValuesFromRequest($focus);
+
+if(isset($_REQUEST['expectedrevenue']))
+{
+ $value = convertToDollar($_REQUEST['expectedrevenue'],$rate);
+ $focus->column_fields['expectedrevenue'] = $value;
+}
+if(isset($_REQUEST['budgetcost']))
+{
+ $value = convertToDollar($_REQUEST['budgetcost'],$rate);
+ $focus->column_fields['budgetcost'] = $value;
+}
+if(isset($_REQUEST['actualcost']))
+{
+ $value = convertToDollar($_REQUEST['actualcost'],$rate);
+ $focus->column_fields['actualcost'] = $value;
+}
+if(isset($_REQUEST['actualroi']))
+{
+ $value = convertToDollar($_REQUEST['actualroi'],$rate);
+ $focus->column_fields['actualroi'] = $value;
+}
+if(isset($_REQUEST['expectedroi']))
+{
+ $value = convertToDollar($_REQUEST['expectedroi'],$rate);
+ $focus->column_fields['expectedroi'] = $value;
+}
+
+if($_REQUEST['assigntype'] == 'U') {
+ $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
+} elseif($_REQUEST['assigntype'] == 'T') {
+ $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
+}
+
+$focus->save("Campaigns");
+$return_id = $focus->id;
+
+$parenttab = getParentTab();
+if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']);
+else $return_module = "Campaigns";
+if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = vtlib_purify($_REQUEST['return_action']);
+else $return_action = "DetailView";
+if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = vtlib_purify($_REQUEST['return_id']);
+
+header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&parenttab=$parenttab&start=".vtlib_purify($_REQUEST['pagenumber']).$search);
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/Settings.php b/oss/vtiger/trunk/modules/Campaigns/Settings.php
new file mode 100644
index 00000000..48a80c0b
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/Settings.php
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/TagCloud.php b/oss/vtiger/trunk/modules/Campaigns/TagCloud.php
new file mode 100644
index 00000000..859b11ff
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/TagCloud.php
@@ -0,0 +1,12 @@
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/UnifiedSearch.php b/oss/vtiger/trunk/modules/Campaigns/UnifiedSearch.php
new file mode 100644
index 00000000..9a37320c
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/UnifiedSearch.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Campaigns/index.php b/oss/vtiger/trunk/modules/Campaigns/index.php
new file mode 100644
index 00000000..da92b36b
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/index.php
@@ -0,0 +1,17 @@
+
diff --git a/oss/vtiger/trunk/modules/Campaigns/language/en_us.lang.php b/oss/vtiger/trunk/modules/Campaigns/language/en_us.lang.php
new file mode 100644
index 00000000..349b78e9
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/language/en_us.lang.php
@@ -0,0 +1,91 @@
+'Campaign Information',
+'LBL_CUSTOM_INFORMATION'=>'Custom Information',
+'LBL_DESCRIPTION_INFORMATION'=>'Description Information',
+'LBL_EXPECTATIONS_AND_ACTUALS'=>'Expectations & Actuals',
+
+'Campaign Name'=>'Campaign Name',
+'Campaign Type'=>'Campaign Type',
+'Campaign Status'=>'Campaign Status',
+'Campaign ID'=>'Campaign ID',
+'Expected Close Date'=>'Expected Close Date',
+'Expected Revenue'=>'Expected Revenue',
+'Budget Cost'=>'Budget Cost',
+'Actual Cost'=>'Actual Cost',
+'Expected Response'=>'Expected Response',
+'Assigned To'=>'Assigned To',
+'Num Sent'=>'Num Sent',
+'Created Time'=>'Created Time',
+'Modified Time'=>'Modified Time',
+'Description'=>'Description',
+'Product'=>'Product',
+'Target Audience'=>'Target Audience',
+'TargetSize'=>'Target Size',
+'Sponsor'=>'Sponsor',
+
+'Expected Sales Count'=>'Expected Sales Count',
+'Expected Response Count'=>'Expected Response Count',
+'Expected ROI'=>'Expected ROI',
+
+'Actual Sales Count'=>'Actual Sales Count',
+'Actual Response Count'=>'Actual Response Count',
+'Actual ROI'=>'Actual ROI',
+'Select One'=>'Select One',
+'LBL_LOAD_LIST'=>'Load List',
+
+//Added for existing Picklist Entries
+
+'Conference'=>'Conference',
+'Webinar'=>'Webinar',
+'Trade Show'=>'Trade Show',
+'Public Relations'=>'Public Relations',
+'Partners'=>'Partners',
+'Referral Program'=>'Referral Program',
+'Advertisement'=>'Advertisement',
+'Banner Ads'=>'Banner Ads',
+'Direct Mail'=>'Direct Mail',
+'Email'=>'Email',
+'Telemarketing'=>'Telemarketing',
+'Others'=>'Others',
+
+'Planning'=>'Planning',
+'Active'=>'Active',
+'Inactive'=>'Inactive',
+'Complete'=>'Complete',
+'Cancelled'=>'Cancelled',
+
+'Excellent'=>'Excellent',
+'Good'=>'Good',
+'Average'=>'Average',
+'Poor'=>'Poor',
+
+//Module Sequence Numbering
+'Campaign No'=>'Campaign No',
+// END
+
+);
+
+?>
diff --git a/oss/vtiger/trunk/modules/Campaigns/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Campaigns/language/zh_cn.lang.php
new file mode 100644
index 00000000..90bc7553
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/language/zh_cn.lang.php
@@ -0,0 +1,92 @@
+ '活动信息',
+ 'LBL_CUSTOM_INFORMATION' => '自订信息',
+ 'LBL_DESCRIPTION_INFORMATION' => '说明信息',
+ 'LBL_EXPECTATIONS_AND_ACTUALS' => '预估与实际',
+
+ 'Campaign Name' => '活动名称',
+ 'Campaign Type' => '活动类型',
+ 'Campaign Status' => '活动状态',
+ 'Campaign ID' => '活动编号',
+ 'Expected Close Date' => '预期结束日期',
+ 'Expected Revenue' => '预期收益',
+ 'Budget Cost' => '估计成本',
+ 'Actual Cost' => '实际成本',
+ 'Expected Response' => '预期反应',
+ 'Assigned To' => '负责人',
+ 'Num Sent' => '寄送数量',
+ 'Created Time' => '建立时间',
+ 'Modified Time' => '修改时间',
+ 'Description' => '说明',
+ 'Product' => '产品',
+ 'Target Audience' => '目标族群',
+ 'TargetSize' => '目标规模',
+ 'Sponsor' => '赞助商',
+
+
+ 'Expected Sales Count' => '预期销售数量',
+'Expected Response Count' => '预期回应数量',
+ 'Expected ROI' => '预期收益',
+
+ 'Actual Sales Count' => '实际销售数量',
+ 'Actual Response Count' => '实际回应数量',
+ 'Actual ROI' => '实际收益',
+ 'Select One' => '选择一个',
+ 'LBL_LOAD_LIST' => '读取清单',
+
+//Added for existing Picklist Entries
+
+ 'Conference' => '研讨会',
+ 'Webinar' => '网络发表会',
+ 'Trade Show' => '贸易展览',
+ 'Public Relations' => '公众关系',
+ 'Partners' => '伙伴',
+ 'Referral Program' => '介绍活动',
+ 'Advertisement' => '广告',
+ 'Banner Ads' => '网站广告',
+ 'Direct Mail' => '邮件营销',
+ 'Email' => '电子邮件',
+ 'Telemarketing' => '电话营销',
+ 'Others' => '其它',
+
+'Planning' => '规划中',
+ 'Active' => '启用',
+ 'Inactive' => '停用',
+ 'Complete' => '完成',
+ 'Cancelled' => '取消',
+
+ 'Excellent' => '极佳',
+ 'Good' => '好',
+ 'Average' => '平均',
+ 'Poor' => '差',
+
+//Module Sequence Numbering
+'Campaign No'=>'Campaign No',
+// END
+
+);
+
+?>
diff --git a/oss/vtiger/trunk/modules/Campaigns/updateRelations.php b/oss/vtiger/trunk/modules/Campaigns/updateRelations.php
new file mode 100644
index 00000000..1f9f4cf3
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Campaigns/updateRelations.php
@@ -0,0 +1,57 @@
+pquery($sql, array($forCRMRecord, $id));
+ } else {
+ $focus->save_related_module($currentModule, $forCRMRecord, $update_mod, $id);
+ }
+ }
+}
+
+header("Location: index.php?action=$action&module=$currentModule&record=".$forCRMRecord."&parenttab=".$parenttab);
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Cases/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Cases/language/zh_cn.lang.php
new file mode 100644
index 00000000..fbf596e9
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Cases/language/zh_cn.lang.php
@@ -0,0 +1,39 @@
+ '拜访',
+ 'LBL_MODULE_TITLE' => '拜访:首页',
+ 'LBL_SEARCH_FORM_TITLE' => '查找拜访',
+ 'LBL_LIST_FORM_TITLE' => '拜访列表',
+ 'LBL_NEW_FORM_TITLE' => '新增拜访',
+ 'LBL_CONTACT_CASE_TITLE' => '拜访联系人:',
+ 'LBL_SUBJECT' => '主题:',
+ 'LBL_CASE' => '拜访:',
+ 'LBL_CASE_NUMBER' => '拜访编号:',
+ 'LBL_NUMBER' => '编号:',
+ 'LBL_STATUS' => '状态:',
+ 'LBL_ACCOUNT_NAME' => '客户名称:',
+ 'LBL_DESCRIPTION' => '描述:',
+ 'LBL_CONTACT_NAME' => '联系人姓名:',
+ 'LBL_CASE_SUBJECT' => '事件主题:',
+ 'LBL_CONTACT_ROLE' => '角色:',
+ 'LBL_LIST_NUMBER' => '编号',
+ 'LBL_LIST_SUBJECT' => '主题',
+ 'LBL_LIST_ACCOUNT_NAME' => '客户名称',
+ 'LBL_LIST_STATUS' => '状态',
+ 'LBL_LIST_LAST_MODIFIED' => '最新修改',
+ 'LBL_INVITEE' => '*受邀者',
+ 'LNK_NEW_CONTACT' => '新增联系人',
+ 'LNK_NEW_LEAD' => '新增线索',
+ 'LNK_NEW_ACCOUNT' => '新增客户',
+ 'LNK_NEW_OPPORTUNITY' => '新增商机',
+ 'LNK_NEW_CASE' => '新增拜访',
+ 'LNK_NEW_NOTE' => '新增备忘录',
+ 'LNK_NEW_CALL' => '新增电话',
+ 'LNK_NEW_EMAIL' => '新增Email',
+ 'LNK_NEW_MEETING' => '新增会议',
+ 'LNK_NEW_TASK' => '新增任务',
+ 'NTC_REMOVE_INVITEE' => '*您确定要从拜访中移除这个联系人?',
+ 'ERR_DELETE_RECORD' => '必须指定记录编号才能删除客户.',
+
+);
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Contacts/CallRelatedList.php b/oss/vtiger/trunk/modules/Contacts/CallRelatedList.php
new file mode 100644
index 00000000..8c8b9ef6
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Contacts/CallRelatedList.php
@@ -0,0 +1,101 @@
+retrieve_entity_info($RECORD,$currentmodule);
+ $focus->id = $RECORD;
+ $focus->name=$focus->column_fields['firstname'].' '.$focus->column_fields['lastname'];
+ $log->debug("id is ".$focus->id);
+ $log->debug("name is ".$focus->name);
+ }
+
+ global $adb;
+ $sql = $adb->pquery('select accountid from vtiger_contactdetails where contactid=?', array($focus->id));
+ $accountid = $adb->query_result($sql,0,'accountid');
+ if($accountid == 0) $accountid='';
+
+ global $mod_strings;
+ global $app_strings;
+ global $theme;
+ global $currentModule;
+ global $current_user;
+ $theme_path="themes/".$theme."/";
+ $image_path=$theme_path."images/";
+
+ $smarty = new vtigerCRM_Smarty;
+ $smarty->assign("accountid",$accountid);
+
+
+ if(isset($_request['isduplicate']) && $_request['isduplicate'] == 'true') {
+ $focus->id = "";
+ }
+ if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
+ $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode']));
+ }
+ $parent_email = getEmailParentsList('Contacts',$_REQUEST['record'], $focus);
+ $smarty->assign("HIDDEN_PARENTS_LIST",$parent_email);
+
+ if(isset($_REQUEST['record']) && $_REQUEST['record']!='') {
+ $userid = $current_user->id;
+ $sql = "select fieldname from vtiger_field where uitype = '13' and tabid = 4 and vtiger_field.presence in (0,2)";
+ $result = $adb->pquery($sql, array());
+ $num_fieldnames = $adb->num_rows($result);
+ for($i = 0; $i < $num_fieldnames; $i++) {
+ $fieldname = $adb->query_result($result,$i,"fieldname");
+ $permit= getFieldVisibilityPermission("Contacts",$userid,$fieldname);
+ }
+ }
+ $smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
+ $smarty->assign("CONTACT_PERMISSION",CheckFieldPermission('contact_id','Calendar'));
+ $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
+ $smarty->assign("CATEGORY",$category);
+ $smarty->assign("ID",$focus->id);
+ $smarty->assign("NAME",$focus->name);
+ $smarty->assign("EMAIL",$focus->column_fields['email']);
+ $smarty->assign("YAHOO",$focus->column_fields['yahooid']);
+
+ // Module Sequence Numbering
+ $mod_seq_field = getModuleSequenceField($currentModule);
+ if ($mod_seq_field != null) {
+ $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
+ } else {
+ $mod_seq_id = $focus->id;
+ }
+ $smarty->assign('MOD_SEQ_ID', $mod_seq_id);
+ // END
+
+ $related_array = getRelatedLists($currentModule,$focus);
+ $smarty->assign("RELATEDLISTS", $related_array);
+ $smarty->assign("MODULE",$currentmodule);
+ $smarty->assign("SINGLE_MOD",$app_strings['Contact']);
+ $smarty->assign("UPDATEINFO",updateInfo($focus->id));
+ $smarty->assign("MOD",$mod_strings);
+ $smarty->assign("APP",$app_strings);
+ $smarty->assign("THEME", $theme);
+ $smarty->assign("IMAGE_PATH", $image_path);
+
+ $check_button = Button_Check($module);
+ $smarty->assign("CHECK", $check_button);
+ $smarty->display("RelatedLists.tpl");
+}
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Contacts/Contacts.js b/oss/vtiger/trunk/modules/Contacts/Contacts.js
new file mode 100644
index 00000000..de29b5d9
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Contacts/Contacts.js
@@ -0,0 +1,250 @@
+/*********************************************************************************
+
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is: vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+ ********************************************************************************/
+
+document.write("
+pquery($sql, array($templateid));
+$temparray = $adb->fetch_array($result);
+
+$fileContent = $temparray['data'];
+$filename=html_entity_decode($temparray['filename'], ENT_QUOTES, $default_charset);
+// Fix For: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/2107
+$filename= $randomfilename . "_word.doc";
+
+$filesize=$temparray['filesize'];
+$wordtemplatedownloadpath =$root_directory ."/test/wordtemplatedownload/";
+
+$handle = fopen($wordtemplatedownloadpath .$filename,"wb");
+fwrite($handle,base64_decode($fileContent),$filesize);
+fclose($handle);
+
+
+//<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
+$mass_merge = $_REQUEST['allselectedboxes'];
+$single_record = $_REQUEST['record'];
+
+if($mass_merge != "")
+{
+ $mass_merge = explode(";",$mass_merge);
+ $temp_mass_merge = $mass_merge;
+ if(array_pop($temp_mass_merge)=="")
+ array_pop($mass_merge);
+ //$mass_merge = implode(",",$mass_merge);
+}else if($single_record != "")
+{
+ $mass_merge = $single_record;
+}else
+{
+ die("Record Id is not found, cannot merge the document");
+}
+
+//<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
+
+global $current_user;
+require('user_privileges/user_privileges_'.$current_user->id.'.php');
+if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0 || $module == "Users" || $module == "Emails")
+{
+ $query1="select vtiger_tab.name,vtiger_field.tablename,vtiger_field.columnname,vtiger_field.fieldlabel from vtiger_field inner join vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid where vtiger_field.tabid in (4,6) and vtiger_field.block <> 75 order by vtiger_field.tablename and vtiger_field.presence in (0,2)";
+ $params1 = array();
+}
+else
+{
+ $profileList = getCurrentUserProfileList();
+ $query1="select vtiger_tab.name,vtiger_field.tablename,vtiger_field.columnname,vtiger_field.fieldlabel from vtiger_field inner join vtiger_tab on vtiger_tab.tabid = vtiger_field.tabid INNER JOIN vtiger_profile2field ON vtiger_profile2field.fieldid=vtiger_field.fieldid INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid=vtiger_field.fieldid where vtiger_field.tabid in (4,6) and vtiger_field.block <> 75 AND vtiger_profile2field.visible=0 AND vtiger_def_org_field.visible=0 AND vtiger_profile2field.profileid IN (". generateQuestionMarks($profileList) .") and vtiger_field.presence in (0,2) GROUP BY vtiger_field.fieldid order by vtiger_field.tablename";
+ $params1 = array($profileList);
+ //Postgres 8 fixes
+ if( $adb->dbType == "pgsql")
+ $query1 = fixPostgresQuery( $query1, $log, 0);
+}
+$result = $adb->pquery($query1, $params1);
+$y=$adb->num_rows($result);
+
+for ($x=0; $x<$y; $x++)
+{
+ $tablename = $adb->query_result($result,$x,"tablename");
+ $columnname = $adb->query_result($result,$x,"columnname");
+ $modulename = $adb->query_result($result,$x,"name");
+
+ if($tablename == "crmentity")
+ {
+ if($modulename == "Accounts")
+ {
+ $tablename = "crmentityAccounts";
+ }
+ }
+ $querycolumns[$x] = $tablename.".".$columnname;
+ if($columnname == "smownerid")
+ {
+ if($modulename == "Accounts")
+ {
+ $querycolumns[$x]="case when (usersAccounts.user_name not like '') then concat(usersAccounts.last_name,' ',usersAccounts.first_name) else groupsAccounts.groupname end as username";
+ }
+ if($modulename == "Contacts")
+ {
+ $querycolumns[$x]="case when (vtiger_users.user_name not like '') then concat(vtiger_users.last_name,' ',vtiger_users.first_name) else vtiger_groups.groupname end as usercname,vtiger_users.first_name,vtiger_users.last_name,vtiger_users.user_name,vtiger_users.yahoo_id,vtiger_users.title,vtiger_users.phone_work,vtiger_users.department,vtiger_users.phone_mobile,vtiger_users.phone_other,vtiger_users.phone_fax,vtiger_users.email1,vtiger_users.phone_home,vtiger_users.email2,vtiger_users.address_street,vtiger_users.address_city,vtiger_users.address_state,vtiger_users.address_postalcode,vtiger_users.address_country";
+ }
+ }
+ if($columnname == "parentid")
+ {
+ $querycolumns[$x] = "accountAccounts.accountname";
+ }
+ if($columnname == "accountid")
+ {
+ $querycolumns[$x] = "accountContacts.accountname";
+ }
+ if($columnname == "reportsto")
+ {
+ $querycolumns[$x] = "contactdetailsContacts.lastname";
+ }
+
+
+ if($modulename == "Accounts")
+ {
+ $field_label[$x] = "ACCOUNT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
+ }
+
+ if($modulename == "Contacts")
+ {
+ $field_label[$x] = "CONTACT_".strtoupper(str_replace(" ","",$adb->query_result($result,$x,"fieldlabel")));
+ if($columnname == "smownerid")
+ {
+ $field_label[$x] = $field_label[$x].",USER_FIRSTNAME,USER_LASTNAME,USER_USERNAME,USER_YAHOOID,USER_TITLE,USER_OFFICEPHONE,USER_DEPARTMENT,USER_MOBILE,USER_OTHERPHONE,USER_FAX,USER_EMAIL,USER_HOMEPHONE,USER_OTHEREMAIL,USER_PRIMARYADDRESS,USER_CITY,USER_STATE,USER_POSTALCODE,USER_COUNTRY";
+ }
+ }
+
+
+}
+$csvheader = implode(",",$field_label);
+//echo $csvheader;
+//<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>
+
+if(count($querycolumns) > 0)
+{
+ $selectcolumns = implode($querycolumns,",");
+
+
+ $query = "select $selectcolumns from vtiger_contactdetails
+ inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_contactdetails.contactid
+ inner join vtiger_contactaddress on vtiger_contactdetails.contactid = vtiger_contactaddress.contactaddressid
+ inner join vtiger_contactsubdetails on vtiger_contactdetails.contactid = vtiger_contactsubdetails.contactsubscriptionid
+ inner join vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid
+ inner join vtiger_customerdetails on vtiger_contactdetails.contactid = vtiger_customerdetails.customerid
+ left join vtiger_contactdetails as contactdetailsContacts on contactdetailsContacts.contactid = vtiger_contactdetails.reportsto
+ left join vtiger_account as accountContacts on accountContacts.accountid = vtiger_contactdetails.accountid
+ left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid
+ LEFT JOIN vtiger_groups
+ ON vtiger_groups.groupid = vtiger_crmentity.smownerid
+ left join vtiger_account on vtiger_account.accountid = vtiger_contactdetails.accountid
+ left join vtiger_crmentity as crmentityAccounts on crmentityAccounts.crmid=vtiger_account.accountid
+ left join vtiger_accountbillads on vtiger_account.accountid=vtiger_accountbillads.accountaddressid
+ left join vtiger_accountshipads on vtiger_account.accountid=vtiger_accountshipads.accountaddressid
+ left join vtiger_accountscf on vtiger_account.accountid = vtiger_accountscf.accountid
+ left join vtiger_account as accountAccounts on accountAccounts.accountid = vtiger_account.parentid
+ left join vtiger_users as usersAccounts on usersAccounts.id = crmentityAccounts.smownerid
+ LEFT JOIN vtiger_groups as groupsAccounts
+ ON groupsAccounts.groupid = vtiger_crmentity.smownerid
+ where vtiger_crmentity.deleted=0 and (crmentityAccounts.deleted is NULL or crmentityAccounts.deleted <> 1) and vtiger_contactdetails.contactid in(". generateQuestionMarks($mass_merge) .")";
+
+
+ $result = $adb->pquery($query, array($mass_merge));
+ $avail_pick_arr = getAccessPickListValues('Contacts');
+while($columnValues = $adb->fetch_array($result))
+{
+ $y=$adb->num_fields($result);
+ for($x=0; $x<$y; $x++)
+ {
+ $value = $columnValues[$x];
+ foreach($columnValues as $key=>$val)
+ {
+ if($val == $value && $value != '')
+ {
+ if(array_key_exists($key,$avail_pick_arr))
+ {
+ if(!in_array($val,$avail_pick_arr[$key]))
+ {
+ $value = "Not Accessible";
+ }
+ }
+ }
+ }
+ //<<<<<<<<<<<<<<< For blank Fields >>>>>>>>>>>>>>>>>>>>>>>>>>>>
+ if(trim($value) == "--None--" || trim($value) == "--none--")
+ {
+ $value = "";
+ }
+ //<<<<<<<<<<<<<<< End >>>>>>>>>>>>>>>>>>>>>>>>>>>>
+ $actual_values[$x] = $value;
+ $actual_values[$x] = str_replace('"'," ",$actual_values[$x]);
+ //if value contains any line feed or carriage return replace the value with ".value."
+ if (preg_match ("/(\r\n)/", $actual_values[$x]))
+ {
+ $actual_values[$x] = '"'.$actual_values[$x].'"';
+ }
+ $actual_values[$x] = decode_html(str_replace(","," ",$actual_values[$x]));
+ }
+ $mergevalue[] = implode($actual_values,",");
+}
+$csvdata = implode($mergevalue,"###");
+}else
+{
+ die("No fields to do Merge");
+}
+// Fix for: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/2107
+$datafilename = $randomfilename . "_data.csv";
+
+$handle = fopen($wordtemplatedownloadpath.$datafilename,"wb");
+fwrite($handle,$csvheader."\r\n");
+fwrite($handle,str_replace("###","\r\n",$csvdata));
+fclose($handle);
+
+?>
+
+ | | |