Results 1 to 6 of 6

Thread: logic_hooks - How to tell whether I am in Edit or DetailView...

  1. #1
    vavalos is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    13

    Default logic_hooks - How to tell whether I am in Edit or DetailView...

    I have some fields that I have related to other modules and therefore need to customize how they show (as links) when in DetailVIew and as a ListBox when in EditView.

    In other words I have a field in project additional_contact_c that relates to a contact from the list of contacts associated with this project.

    When I am in DetailView, I would like a hyperlink to the contact (I've gotten this to work by creating an 'after_retrieve' event - the unwanted side effect is that the field is also altered when going into "Edit" mode.

    In edit mode, I will populate this field with a combo box showing all people listed as related to the project, with the entered related contact already selected (I think that I can create this piece)

    How do I know whether I am in Edit or Detail mode.

    I have printed the list of elements in the $bean (using echo print_r($bean->get_list($order_by = "", $where = "", $row_offset = 0, $limit=-1, $max=-1, $show_deleted = 0)), but I can not find an immediate indicator in any of these elements retrieved.

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: logic_hooks - How to tell whether I am in Edit or DetailView...

    Hi, vavalos.

    If you are using 5.0 version then you can define a 'type' => 'Link' into detailviewdefs.php and 'type' => 'relate' into editviewdefs.php
    You can use the views (view.detail.php and view.edit.php) for changing the behavior of the field into specific views.

    Cheers.
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    anna is offline Sugar Community Member
    Join Date
    Jan 2007
    Location
    USA
    Posts
    81

    Default Re: logic_hooks - How to tell whether I am in Edit or DetailView...

    You can check for $_REQUEST['action'] == 'EditView' or $_REQUEST['action'] == 'DetailView' in the hook.

  4. #4
    vavalos is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    13

    Default Re: logic_hooks - How to tell whether I am in Edit or DetailView...

    Anna,

    Your suggestion works, thank you very much!

    andopes,

    Modifying the: view.detail.php and view.edit.php, is this upgrade and Studio safe? I may use this solution for another purpose/

    BTW - I only found a view.detail.php in the Views folder for this Module. What creates these files?

  5. #5
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: logic_hooks - How to tell whether I am in Edit or DetailView...

    Hi, vavalos.

    The SugarCRM views are upgrade safe strategies.
    I'm just worry about modify views previously defined, but the SugarCRM developers can tell us if we can override these views.
    You can use for other purpose, any purpose related to how to render fields in the layouts and change its behavior.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  6. #6
    vavalos is offline Sugar Community Member
    Join Date
    Aug 2006
    Posts
    13

    Default Re: logic_hooks - How to tell whether I am in Edit or DetailView...

    I will look out for future updates that modify these files: view.detail.php and view.edit.php

    Thanks

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Edit Layout Problems
    By phoban in forum Help
    Replies: 11
    Last Post: 2008-01-08, 04:55 PM
  2. Edit Contact DetailView
    By mcharudatta in forum Help
    Replies: 0
    Last Post: 2006-03-22, 05:57 PM

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
  •