SugarCRM 7 Hide Completed Activities in Calendar

Early on when my company started with SugarCRM CE there was no option to hide completed activities in the Calendar so I followed this tutorial to change Calls/Meetings with status = Held and Tasks with status = Complete to background color = white. A later upgrade, I beleive 6.5.13, made this unnecessary with an added checkbox for hiding these items.

This worked well on our instance because we controlled the upgrades and I knew to update the files because the tutorial is not upgrade safe. We recently upgraded from SugarCRM CE 6.5.xx to Enterprise 7.6.  During our launch week I realized that the hide completed activities setting no longer existed. Additionally, we are on an On-Demand environment so the upgrades are controlled by SugarCRM so I wanted a different way.

Doing an inspect element in Chrome I noticed the div of an item, a Task in this case,  on the Calendar had this format:

 <div id="c51fbfab-5017-a40e-c307-55ef7dccc23b" class="act_item task_item" record="c51fbfab-5017-a40e-c307-55ef7dccc23b" module_name="Tasks" status="Not Started" detail="1" edit="1" duration_coef="1" style="border-color: rgb(1, 89, 0); height: 14px; top: -1px; left: -2px; width: 46%; background-color: rgb(177, 245, 174);"><div class="head"><div class="adicon" id="div_c51fbfab-5017-a40e-c307-55ef7dccc23b"></div><div>Expenses Update</div></div><div class="content" style="display: none;">Not Started</div><div class="content" style="display: none;"></div></div> 

Attempt 1 – Failed:

Noticing the ‘status’ attribute in the div this seemed like a pretty straight forward issue perhaps with some jQuery like:

 
 $('div[status="Held"]').css('display', 'none');
 

would do the trick but the activities weren’t affected. Just modifying a general <div> worked but not with referencing the status attribute.

Attempt 2 – Failed:

Next I tried adding some css by creating a file /custom/themes/custom.less with:

 
 div[status="Held"], div[status="Completed"] {
 display: none;
 }

I saw the file in the browser editor with the syntax I wanted but still nothing was happening. I changed the file to:

 
 div {
 background-color: red;
 }
 

This only changed the navigation bar and the footer to have background color of red. I don’t know why this was the case. Perhaps the order of page load?

Attempt 3 – Success: 

I knew the css worked as I had tested it in the editor. So I used a after_ui_footer global logic hook to include the css file when on the Calender page.

/custom/modules/logic_hooks.php

if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class CalendarLogic
 {
 function displayCalendarCss ($event, $arguments)
 {if (!isset($_REQUEST["to_pdf"]) && $_REQUEST['module'] == 'Calendar') {echo 'link rel="stylesheet" href="custom/modules/Calendar/Cal.css"/';}}
 }

Please note the opending < and closing > for the link tags were removed in this post.

Finally

/custom/modules/Calendar/Cal.css:

div[status="Held"], div[status="Completed"] {
 display: none;
}

This worked in testing but it took me a bit to get this packaged properly for testing but I finally got it.

Download the package below.

Hide Completed Activities Calendar Package

Perhaps a better way would be to override the calendar get activities to prevent the completed tasks from being included in the first place but I wasn’t having any luck overriding the base calendar functions.

 

Painting Contractors Website

Painter’s Website Demo

It is difficult to stand out as a small contractor on the web. Lead generators and listings like Yellow Pages, Angie’s List and Porch.com offer free listings but your company is one of dozens. There is no better way to stand out of the crowd than owning your own web presence with your own website. If a potential customer does find you on a listing most likely they will do a Google search for you to see if you are
legitimate.

Why You Should Have Your Own Website

Having your own website will allow you to get your own web traffic instead of depending on the several listing companies and hoping they rank you higher than your competitors or paying for a top listing. Additionally you can gain credibility with your current customers, referrals,
and prospects by directing them to a well designed professional website.

I want to make it easy for small painting contractors to have their own website without having to learn coding or how to deploy it on their own without breaking their bank. Some of the features are:

Your Own Domain

I will help you get your own domain if you do not have one. This will make it easier for people to find you on the internet and increase your business and display more credibility to your customers.

View Sample Page

Responsive Design

All websites I build look great no matter if they are being viewed on a desktop, tablet,
or phone. Google now ranks websites lower if they are not mobile responive.

View Sample Page

Gallery of Work

Every site will have a gallery of images featuring your best work. Optionally I will configure the
site to pull images directly from Instagram so you don’t have to upload them or have me upload
them for you to your website.

View Sample Gallery

Contact Form

A contact form makes it easy for people to reach out to you for quotes. Some people also prefer
email communication over phone so by not having an easy to use contact form you may be missing
business.

View Contact Form

Local Search

Search is becoming more and more localized. If someone is searching for a painter in your area
having your website properly configured will help them find you. I will help you get listed on
Google Business pages which now often show up at the top of search results.

View Sample Site

Take Online Payments

Make it easy for people to pay you with a credit card (or even BitCoin) online with an optional
payment form. Payments are handled by a third party service called Stripe. I can help set up the online payments and walk you
through getting your account setup.

View Sample Payments

Costs

Because they are customized each site will vary on the actual cost to build. Typically the development will
cost between $700 and $1500. Some other potential costs for having your own website are:

  • Domain Registration – Typically around $15 / year this is purchased from a domain registrar like Hover.com
  • Website Hosting – I can host your website for $20 / month or if you want to have your own I can help set it up and deploy the site for you.
  • Custom email – This is completely optional but if you want your an email address tied to your company domain (ie ken@xyzpainting.com) I can help you
    set that up.
  • CRM – Another option I can assist with is Customer Management software can help you organize your customers and job scheduling to increase your productivity.

About Me

I worked in the paint industry for 15 years serving contractors and understand how difficult it can be. My step-father was a painter and I remember the boom and bust of how contracts came and went. For over 5 years now I have built and integrated web technologies and designed websites. I wanted to combine my knowledge of the paint industry and web design to make it easy for small contractors to look as professional in the internet as their work on the job site.

If you are interested in a custom website please contact me here or phone at 702-883-2719.