[Vtigercrm-developers] [PATCH 4.2.3] Order pending activities by date and time
Mike Fedyk
mfedyk at mikefedyk.com
Sun Feb 19 01:57:11 PST 2006
Committed.
Mike Fedyk wrote:
>diff -dr -U2 -x config.php -x connection.php
>vtiger_crm-4.2.3/modules/Activities/OpenListView.php
>vtiger-4.2.3-testing/modules/Activities/OpenListView.php
>--- vtiger_crm-4.2.3/modules/Activities/OpenListView.php 2005-12-23
>03:17:24.000000000 -0800
>+++ vtiger-4.2.3-testing/modules/Activities/OpenListView.php
> 2006-02-04 21:44:00.000000000 -0800
>@@ -40,9 +40,37 @@
>
> $today = date("Y-m-d", time());
>+#Keep this to a minimum of 3 days to show monday's activities when
>today is friday
> $later = date("Y-m-d", strtotime("$today + 7 days"));
>
> //$activity = new Activity();
> //change made as requested by community by shaw
>- $list_query = " select
>crmentity.crmid,crmentity.smownerid,crmentity.setype, activity.*,
>contactdetails.lastname, contactdetails.firstname,
>contactdetails.contactid, account.accountid, account.accountname,
>recurringevents.recurringtype,recurringevents.recurringdate from
>activity inner join crmentity on crmentity.crmid=activity.activityid
>left join cntactivityrel on cntactivityrel.activityid=
>activity.activityid left join contactdetails on
>contactdetails.contactid= cntactivityrel.contactid left join
>seactivityrel on seactivityrel.activityid = activity.activityid left
>outer join account on account.accountid = contactdetails.accountid left
>outer join recurringevents on
>recurringevents.activityid=activity.activityid inner join
>salesmanactivityrel on
>salesmanactivityrel.activityid=activity.activityid WHERE
>crmentity.deleted=0 and (activity.activitytype = 'Meeting' or
>activity.activitytype='Call' or activity.activitytype='Task') AND (
>activity.status is NULL || activity.status != 'Completed' ) and (
>activity.eventstatus is NULL || activity.eventstatus != 'Held') and (
>activity.eventstatus is NULL || activity.eventstatus != 'Not Held' )
>AND (((date_start >= '$today' AND date_start < '$later') OR (date_start
>< '$today')) OR (recurringevents.recurringdate between '$today' and
>'$later') ) AND salesmanactivityrel.smid ='{$current_user->id}'";
>+ $list_query = "SELECT
>+ crmentity.crmid,
>+ crmentity.smownerid,
>+ crmentity.setype,
>+ activity.*,
>+ contactdetails.lastname,
>+ contactdetails.firstname,
>+ contactdetails.contactid,
>+ account.accountid,
>+ account.accountname,
>+ recurringevents.recurringtype,
>+ recurringevents.recurringdate,
>+ GREATEST(recurringevents.recurringdate,activity.date_start) as
>sort_date
>+ FROM activity
>+ INNER JOIN crmentity ON crmentity.crmid = activity.activityid
>+ LEFT JOIN cntactivityrel ON cntactivityrel.activityid =
>activity.activityid
>+ LEFT JOIN contactdetails ON contactdetails.contactid =
>cntactivityrel.contactid
>+ LEFT JOIN seactivityrel ON seactivityrel.activityid =
>activity.activityid
>+ LEFT OUTER JOIN account ON account.accountid =
>contactdetails.accountid
>+ LEFT OUTER JOIN recurringevents ON recurringevents.activityid
>= activity.activityid
>+ INNER JOIN salesmanactivityrel ON
>salesmanactivityrel.activityid = activity.activityid
>+ WHERE crmentity.deleted=0
>+ AND ( activity.status is NULL || activity.status != 'Completed' )
>+ AND ( activity.eventstatus is NULL || activity.eventstatus !=
>'Held')
>+ AND ( activity.eventstatus is NULL || activity.eventstatus !=
>'Not Held' )
>+ AND ( date_start <= '$later' OR recurringevents.recurringdate
><= '$later' )
>+ AND salesmanactivityrel.smid ='{$current_user->id}'
>+ ORDER BY sort_date, activity.time_start";
>
> //$list_query = getListQuery("Activities",$where);
>@@ -65,5 +93,6 @@
> 'accountid' => $adb->query_result($list_result,
>$i, 'accountid'),
> 'contactid' =>
>$adb->query_result($list_result,$i,'contactid'),
>- 'date_start' =>
>getDisplayDate($adb->query_result($list_result,$i,'date_start')),
>+ 'date_start' =>
>getDisplayDate($adb->query_result($list_result,$i,'date_start')),
>+ 'time_start' =>
>$adb->query_result($list_result,$i,'time_start'),
> 'due_date' =>
>getDisplayDate($adb->query_result($list_result,$i,'due_date')),
> 'recurringtype' =>
>getDisplayDate($adb->query_result($list_result,$i,'recurringtype')),
>@@ -79,5 +108,5 @@
>
> // Stick the form header out there.
>-$later_day = getDisplayDate(date("Y-m-d", strtotime("$today + 7 days")));
>+$later_day = getDisplayDate(date("Y-m-d", strtotime($later)));
> //echo get_form_header($current_module_strings['LBL_UPCOMING'],
>"<table><tr><td
>nowrap>".$current_module_strings['LBL_TODAY'].$later_day."</td></tr></table>",
>false);
>
>@@ -114,4 +144,5 @@
> $end_date=$event['due_date']; //included for getting the OverDue
>Activities in the Upcoming Activities
> $start_date=$event['date_start'];
>+ $time_start=$event['time_start'];
>
> switch ($event['type']) {
>@@ -149,8 +180,10 @@
> $end=explode("-",$end_date);
> }
>+ $end_time=explode(":",$time_start);
>
>- $current_date=date("Y-m-d",mktime(date("m"),date("d"),date("Y")));
>+
> $current_date=date("Y-m-d-H-i",mktime(date("H"),date("i"),0,date("m"),date("d"),date("Y")));
> $curr=explode("-",$current_date);
>- $date_diff=
>mktime(0,0,0,date("$curr[1]"),date("$curr[2]"),date("$curr[0]")) -
>mktime(0,0,0,date("$end[1]"),date("$end[2]"),date("$end[0]"));
>+ $date_diff=
>mktime(date("$curr[3]"),date("$curr[4]"),0,date("$curr[1]"),date("$curr[2]"),date("$curr[0]"))
>+ -
>mktime(date("$end_time[0]"),date("$end_time[1]"),0,date("$end[1]"),date("$end[2]"),date("$end[0]"));
>
> if($date_diff>0)
>
>_______________________________________________
>vtigercrm-developers mailing list
>vtigercrm-developers at lists.vtigercrm.com
>http://lists.vtigercrm.com/mailman/listinfo/vtigercrm-developers
>
>
>
More information about the vtigercrm-developers
mailing list