vtiger Forum Index vtiger
The Honest Open Source CRM
 

Fix for Calendar View action button not updating event prope
Click here to go to the original topic

 
       vtiger Forum Index -> Code Contributions - 5.0.2
Previous topic :: Next topic  
Author Message
dartagnanlaf



Joined: 21 Sep 2006
Posts: 12

Posted: Fri Sep 22, 2006 2:24 pm    Post subject: Fix for Calendar View action button not updating event prope  

Bug:Calendar view Action button (the one that appears when mousing over an event and lets you mark as held, not held, etc...) wasn't updating the event when you selected "mark held" or "mark not held". If you refresh the page, however, the data is correct. Also, it is correct when you use the action button on another item, but then the change for that item isn't updated.
Reason:Pretty deep in the code, the calendar event data is added to the table before the SQL change is made each time you select something from the Action button. So each time you select "Mark Held" or "Mark Not Held" the page is created via an Ajax request, but the SQL change is made after.
Solution:On page that creates the table, if we have performed this change via Action button, delay putting event data into table until after SQL changes are made. This requires code changes in two locations in Calendar/ActivityAjax.php:

First Change:(approx. line: 82)

We add an extra condition to an if statement that, when evaluated true will add event data to the table.

Original Code: if ($mysel == 'day' || $mysel == 'week' || $mysel == 'month' || $mysel == 'year')
{
   $calendar_arr['calendar']->add_Activities($current_user);
}

Edited Code: if (($mysel == 'day' || $mysel == 'week' || $mysel == 'month' || $mysel == 'year') && $type != 'change_status')
{
   $calendar_arr['calendar']->add_Activities($current_user);
}

This delays putting event data into table, but now we have to make sure to do this after the SQL changes. SQL changes are made via a call to ChangeStatus() function, at approx line 128 of the same file.

Second Change:(approx. line 128)

We now make sure to add the event data to the table after the SQL changes have been made.

After Code: ChangeStatus($status,$return_id,$activity_type);

Add:
Code: $calendar_arr['calendar']->add_Activities($current_user);

Make sure that this addition occurs within the same if bracket that the call to ChangeStatus() is in.

Now selecting "Mark Held" or "Mark Not Held" will update the page properly. [/b]
Back to top  
dartagnanlaf



Joined: 21 Sep 2006
Posts: 12

Posted: Fri Sep 22, 2006 2:33 pm    Post subject: Re: Fix for Calendar View action button not updating event p  

I just noticed the title of this post may be confused with my other post for fixing the display of the Action button in the calendar view. These are two separate issues, with two separate fixes.

The other post / fix can be viewed at
http://forums.vtiger.com/viewtopic.php?t=10273
Back to top  
Lukas



Joined: 22 Sep 2006
Posts: 404
Location: Czech rep.

Posted: Fri Sep 22, 2006 3:59 pm    Post subject: Re: Fix for Calendar View action button not updating event p  

Hallo, thank you for your solution.

I have one more problem with Action button: because it si hardcoded i can't translate values as "mark held" or "mark not held".
My mean that is "cool" feature, with many problems.

I'm very enjoy for final solutin of this feature.

Thans&Regard

Lukas N
Back to top  
 
       vtiger Forum Index -> Code Contributions - 5.0.2
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group