PLEASE UPDATE YOUR BROWSER

1 Reason Insurance (715)598-9924

Leadership Through Service

  • About
    • Meet the Insurance Agents of 1 Reason Insurance
    • Partner Insurance Companies
  • Personal Insurance
    • Car Insurance Quote for Personal Auto
    • Boat Insurance
    • Home Owners Insurance Application
    • Life Insurance Quotes
    • Motorcycle Insurance
    • Personal Umbrella Insurance
    • Renters Insurance
    • RV Camper Insurance
    • Snowmobile Insurance
  • Business Insurance
    • Commercial Auto Insurance
    • What is General Liability Insurance
    • Rental or Vacant Properties
    • Workers Compensation in Wisconsin
  • Blog
  • Contact 1 Reason Insurance
    • Contribute As Guest Author
Home > SuiteCRM Insurance CRM > SuiteCRM Reports TimeZone Problem because of the default DATE instead of a DATETIME Datafield

SuiteCRM Reports TimeZone Problem because of the default DATE instead of a DATETIME Datafield

Posted on: January 7, 2018 By: robert

SuiteCRM wants to report sales outside of the parameters condition. I think this is because the machine was allowed to be set to UTC time (not happy about that, albeit it's been changed).

"Effective date" in SuiteCRM uses the original starting date of the contract module and the DB field is a date format, not datetime. on AOR_Report.php I changed line 1540-ish that reads the following:

  case 'Value':
                             $utc = new DateTimeZone("UTC");
                            $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $condition->value, $utc);

 

To the following:

 case 'Value':
                            // Changed to central time zone on 1/7/18 in an attempt to get reports to produce based on the time entered
                         //   $utc = new DateTimeZone("UTC");
                            $utc = new DateTimeZone("America/Chicago");
                            $dateTime = DateTime::createFromFormat('Y-m-d H:i:s', $condition->value, $utc);

 

Starting at line 1677ish

                    if (!$where_set) {
                        if ($condition->value_type == "Period") {
                            if (array_key_exists($condition->value, $app_list_strings[‘date_time_period_list’])) {
                                $params = $condition->value;
                            } else {
                                $params = base64_decode($condition->value);
                            }
                            $date = getPeriodEndDate($params)->format('Y-m-d H:i:s');
                            $value = '"' . getPeriodDate($params)->format('Y-m-d H:i:s') . '"';

                            $query[‘where’][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND '));
                            $tiltLogicOp = false;

                            switch ($aor_sql_operator_list[$condition->operator]) {
                                case "=":
                                    $query[‘where’][] = $field . ' BETWEEN ' . $value . ' AND ' . '"' . $date . '"';
                                    break;
                                case "!=":
                                    $query[‘where’][] = $field . ' NOT BETWEEN ' . $value . ' AND ' . '"' . $date . '"';
                                    break;
                                case ">":
                                case "<":
                                case ">=":
                                case "<=":
                                    $query[‘where’][] = $field . ‘ ‘ . $aor_sql_operator_list[$condition->operator] . ' ' . $value;
                                    break;
                            }
                        } else {
                            if (!$where_set) {
                                $query[‘where’][] = ($tiltLogicOp ? ” : ($condition->logic_op ? $condition->logic_op . ‘ ‘ : ‘AND ‘)) . $field . ‘ ‘ . $aor_sql_operator_list[$condition->operator] . ' ' . $value;
                            }
                        }
                    }
                    $tiltLogicOp = false;
                } else {
                    if ($condition->parenthesis) {
                        if ($condition->parenthesis == 'START') {
                            $query[‘where’][] = ($tiltLogicOp ? '' : ($condition->logic_op ? $condition->logic_op . ' ' : 'AND ')) . '(';
                            $tiltLogicOp = true;
                        } else {
                            $query[‘where’][] = ')';
                            $tiltLogicOp = false;
                        }
                    } else {
                        $GLOBALS[‘log’]->debug('illegal condition');
                    }
                }

            }
 

In the end, I added a new data field that is DATETIME instead of using the DATE data field. It was the easiest way, and then I used a mysql update command to move all the dates from the DATE field to the DATETIME field.

Update crmnew.aos_contracts, crmnew.aos_contracts_cstm

Set crmnew.aos_contracts_cstm.effectivedatetime_c = crmnew.aos_contracts.start_date + INTERVAL 6 hour + Interval 1 minute

where crmnew.aos_contracts.id =  crmnew.aos_contracts_cstm.id_c;

Sure enough, the date and time was "wrong" in the CRM, so I used another SQL update to add time "INTERVAL 6 hour + Interval 1 minute"

I would prefer to fix it via programming (php), albeit I may cause more issues than I'm solving as some staff works in other timezones.

 

Github has a solution that might be viable, I'll have to try it –> https://github.com/ChangezKhan/SuiteCRM/commit/249ba82a7245926aac3c40629792d60536009580

Comments

comments

Categories: SuiteCRM Insurance CRM Tags: suitecrm Timezone

1Reason Agencies

What clients have to say:

Mike T. "I started a business last year and Robert responded to my inquiries immediately, and was extremely helpful and knowledgeable as to the type of insurance coverages I would need to get started. Now its been a year and he now carries All of my coverages! Absolutely the most hands on agent I've ever worked with but hands down the friendliest! I can call him anytime and never feel rushed and not only that but he responded while on a family vacation. I believe in relationships in business and so does Robert by the way he treats his customers. I have a true friend in the business, thank you Robert!"


Lynn R. "Bob is very knowledgeable and has always done a great job explaining different aspects of coverage. He is very accessible and looks out for what is best for the consumer. We highly recommend him!


Justin T. "Excellent agent, always available for answers to insurance related questions. Bob, is the person most people strive to become. Without a doubt, a great person!"


Sebastian T. "I can not begin to tell you how pleased I am with 1 Reason Insurance ! Their responding services is friendly and complete. For the services my company offers to the public it is sure nice to know that we are covered for a reasonable fee. Just having (1 R I ) 1 Reason Insurance there is such piece of mind ! Their insurance plans are strait to the point and easy to understand.
Thanks for the great service 1 Reason Insurance !"


Jeff H. "Very nice and cares about the customer! He was literally the reason why i chose him over other companies for my insurance"

Categories

  • Bonds
    • Performance Bond
  • Bookkeeping
    • Business Taxes
  • Business Marketing
    • Webhosting
  • Car Insurance
  • Commercial Auto
  • Commercial Insurance
  • Court Cases
  • Cyber Liability Insurance
  • Employment Opportunities
  • Employment Practices
  • Flood Insurance
  • Home Ownership
  • Homeowner's Insurance
  • Insurance Companies
    • Insurance News
  • Insurance Terms
  • Investing
    • Finance & Insurance News
  • Life Insurance
  • Non Emergency Medical Transportation
  • Payroll
  • Pinewood Derby
  • Professional Liability / E&O
  • Real Estate News
  • Rental Property Insurance
  • Retirement & Estate Planning
  • RV Insurance
  • Starting A Business
  • Stock Dividends
  • SuiteCRM Insurance CRM
  • Taxes
  • Tips & Advice
  • Travel
  • Uncategorized
  • Worker's Compensation

Recent Posts

  • Construction Begins on Maison’s Village II, Bringing 189 New Affordable Homes to Palmdale
  • Trupanion to Host 2025 Annual Investor Day on September 17
  • Reliance Global Group Highlights Strong Q1 Results from Spetner Associates
  • Palomar and Neptune Partner to Accelerate Growth in U.S. Flood Insurance Market
  • Kite Realty Group Publishes Annual Corporate Responsibility Report
  • Alpine Income Property Trust Announces second Quarter 2025 Earnings Release and Conference Call Information
  • CTO Realty Growth Announces Second Quarter 2025 Earnings Release and Conference Call Information
  • Resurgent Realty Trust Issue Position Statement Regarding Generation Income Properties, Inc. (“GIPR”)