Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Schizophrenic detailviewdefs page

  1. #1
    n3fih is offline Sugar Community Member
    Join Date
    Oct 2011
    Location
    Philadelphia, PA
    Posts
    12

    Default Schizophrenic detailviewdefs page

    I've inherited a project where my predecessor handled the situation where Accounts/listview displays different information for different types of accounts, by wrapping the declarations in a giant "if/then/else",
    This has the problem of (1) breaking Studio, and (2) forcing us to run in debugging mode to prevent caching, since the cache 'freezes' the result on the first account type displayed.

    My question: What is the "Right" way to handle this situation? Is there a mechanism in Sugar CE that can obtain the desired effect, w/out causing the side effects mentioned?

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Schizophrenic detailviewdefs page

    The "right" way is debatable as there are often many ways to accomplish the same. So long as the approach is upgrade safe, you are usually fine.

    I've done something similar to what you are referring to, for which I would assume you have a custom view.detail.php. If you don't, then I am not sure how to help you as the view.detail.php approach would allow you to forcibly reset the cache every time, thus eliminating the problem.

    Assuming you did it that way, insert this line of code before the line that begins with $this->dv->setup...

    Code:
    TemplateHandler::clearCache($this->module,'DetailView.tpl');
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  3. #3
    n3fih is offline Sugar Community Member
    Join Date
    Oct 2011
    Location
    Philadelphia, PA
    Posts
    12

    Default Re: Schizophrenic detailviewdefs page

    That sounds like what I need, but if you mean modules\Accounts\views\view.detail.php, I do not see a line "$this->dv->setup...". I *do* see that line in /include\MVC\View\views\view.detail.php, but I suspectthat putting the line you recommend there would force the change on all templates, not just Accounts. Can you advise?

  4. #4
    agcopley is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Santiago, Chile
    Posts
    204

    Default Re: Schizophrenic detailviewdefs page

    Quote Originally Posted by n3fih View Post
    I've inherited a project where my predecessor handled the situation where Accounts/listview displays different information for different types of accounts, by wrapping the declarations in a giant "if/then/else",
    This has the problem of (1) breaking Studio, and (2) forcing us to run in debugging mode to prevent caching, since the cache 'freezes' the result on the first account type displayed.

    My question: What is the "Right" way to handle this situation? Is there a mechanism in Sugar CE that can obtain the desired effect, w/out causing the side effects mentioned?
    It depends how you do this, but generally you need to modify the TemplateHandler.php file to cope with different DetailView/EditView layouts...you can set a session variable in view.detail.php and the use this in modified TemplateHandler.php. Clearing the cache will not allow you to take advantage of the performance benefits, which are significant.

  5. #5
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Schizophrenic detailviewdefs page

    Quote Originally Posted by n3fih View Post
    That sounds like what I need, but if you mean modules\Accounts\views\view.detail.php, I do not see a line "$this->dv->setup...". I *do* see that line in /include\MVC\View\views\view.detail.php, but I suspectthat putting the line you recommend there would force the change on all templates, not just Accounts. Can you advise?
    Normally you would have made a custom version of view.detail.php under custom/modules/Accounts/views, which is just a clone of the one in the MVC directory, with your modifications. That's the version of the file you would want to modify.

    Again, I am basing my comments off of how I did it. It may not necessary reflect what you have in place, but take a look at the directory I mention.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  6. #6
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: Schizophrenic detailviewdefs page

    I'm having a similar design decision and this thread seems the most pertinent:

    http://www.sugarcrm.com/forums/f148/...de-safe-47769/

    As for the caching issue (I had similar using the 'devtoolkit' add-on) you can call the cache clear for particular modules in the custom view. For v6:

    Code:
    $modules = Array($this->bean->module_dir);
    $RepairAndClear = new RepairAndClear();
    $RepairAndClear->module_list = $modules;
    $RepairAndClear->show_output = false;
    $RepairAndClear->execute = true;
    $RepairAndClear->clearTpls;
    It would also be worth looking at the devtoolkit package to see if that can help:

    SugarForge: Development Tool Kit: Project Info

    http://www.sugarcrm.com/forums/f19/d...eleased-47031/

  7. #7
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Schizophrenic detailviewdefs page

    I think you are doing a full repair for the module in that case, which I would expect to take longer than simply clearing out the cache as it pertains to the view in question.

    The line I reference in my prior reply does just that, clears out the cache file for the specific view one has customized, in this case DetailView.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  8. #8
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: Schizophrenic detailviewdefs page

    More than one way to skin a cat Like you said
    The "right" way is debatable as there are often many ways to accomplish the same.
    The part of the code:
    Code:
    $RepairAndClear->clearTpls;
    Just calls the the clear template code for the defined modules (in this case, the module you are working with).

  9. #9
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Schizophrenic detailviewdefs page

    Gotcha. That's part of what I was saying. It clears out more than it needs to. For example, in this case all we need to do is clear out the DetailView.tpl.

    The only reason why I stress it is because if it clears out all the tpl every time the view is accessed, it is a performance hit, specially when compared to just clearing out the DetailView.tpl, which is already a performance hit on its own.
    Regards,

    Angel Magaña
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  10. #10
    stevec is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,100

    Default Re: Schizophrenic detailviewdefs page

    Aha - good point, it's clearing all the module's templates.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extend detailviewdefs.php file
    By sarunas.lazauskas@gmail.com in forum Developer Help
    Replies: 5
    Last Post: 2011-05-09, 03:27 PM
  2. detailviewdefs.php and javascript
    By robertbmirth in forum Developer Help
    Replies: 1
    Last Post: 2010-10-13, 05:42 AM
  3. iNETGoogleMap - detailviewdefs.php error
    By basquiat in forum Help
    Replies: 0
    Last Post: 2009-08-21, 08:22 PM
  4. Problem detailviewdefs dynamique
    By synoveo in forum Français
    Replies: 1
    Last Post: 2009-07-07, 07:16 AM
  5. Replies: 6
    Last Post: 2008-04-30, 10:19 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •