Results 1 to 4 of 4

Thread: add new subpanel to detail view

  1. #1
    zubator is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    15

    Default add new subpanel to detail view

    (sorry for my english)
    Hi all!

    I created new module, then installed it. Then I want to add subpanel (like History and so on), to detailview of my Accounts. For this purpose I added

    'finance' => array(
    'order' => 120,
    'sort_order' => 'asc',
    'sort_by' => 'name',
    'module' => 'Acc_Finance',
    'subpanel_name' => 'default',
    'get_subpanel_data' => 'acc_finance',
    'add_subpanel_data' => 'acc_finance_id',
    'title_key' => 'LBL_ACC_FINANCE_SUBPANEL_TITLE',
    'top_buttons' => array(
    array('widget_class' => 'SubPanelTopButtonQuickCreate'),
    ),
    ),

    to subpaneldefs.php of Accounts. But when I try view detail of any Account, I can see:

    Fatal error: Call to a member function getQuery() on a non-object in /home/zubator/programming/work/sugarcrm/SugarCE-Full-5.0.0b/data/SugarBean.php on line 2536

    but if I change for example to

    'get_subpanel_data' => 'project',
    ^^^^^^^^
    'add_subpanel_data' => 'project_id',
    ^^^^^^^^^^^^^

    I can see
    Error running count query for Account List: Query Failed SELECT count(*) c FROM acc_finance INNER JOIN projects_accounts ON (project.id=projects_accounts.project_id AND projects_accounts.account_id= 'd874bc99-cd84-2001-ae83-47cc0ebd1682') where ( projects_accounts.deleted=0 AND project.deleted=0) AND acc_finance.deleted=0 )::MySQL error 1054: Unknown column 'project.deleted' in 'where clause'

    so, I think that my mistake in table name, but where? And may be all my work is mistake)))

  2. #2
    ptemplin7 is offline Sugar Community Member
    Join Date
    Jun 2007
    Location
    Puget Sound Washington
    Posts
    380

    Default Re: add new subpanel to detail view

    Make sure you have all the files modified. Suggest you take a look at the Wiki,developers area or creating custom links between modules. Its a bit more involved than I think you did.

    Just a guess, Let us know any more info if possible,
    Thanks Paris

  3. #3
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: add new subpanel to detail view

    I haven't dealt with new modules, but there are some obvious problems with the query, so maybe noting them will help you see what to change in your module.

    Quote Originally Posted by zubator
    Error running count query for Account List: Query Failed SELECT count(*) c FROM acc_finance INNER JOIN projects_accounts ON (project.id=projects_accounts.project_id AND projects_accounts.account_id= 'd874bc99-cd84-2001-ae83-47cc0ebd1682') where ( projects_accounts.deleted=0 AND project.deleted=0) AND acc_finance.deleted=0 )::MySQL error 1054: Unknown column 'project.deleted' in 'where clause'

    so, I think that my mistake in table name, but where? And may be all my work is mistake)))
    The query joins the two tables `acc_finance` and `projects_accounts`, but then refers to 'project.deleted' when the table `project` was not joined into the query. `projects_accounts` relates the `project` table to the accounts table and contains the fields `project_id` and `account_id`. To include the table project you would need to add it to the join something like:

    SELECT count(*) c FROM (acc_finance INNER JOIN projects_accounts ON (project.id=projects_accounts.project_id AND projects_accounts.account_id= 'd874bc99-cd84-2001-ae83-47cc0ebd1682')) INNER JOIN project ON projects_accounts.project_id = project.id where ( projects_accounts.deleted=0 AND project.deleted=0) AND acc_finance.deleted=0;

    Also, the join on a literal string is something I haven't seen before, but it may be valid. It would normally appear in the where clause.

    You can simply paste the query into a mysql session and run it to see if it reports an error.

    Based on this (but ignorant of new modules) I suspect you have a problem in your definition of your relationships that causes the query to be malformed.

    Phil

  4. #4
    zubator is offline Sugar Community Member
    Join Date
    Mar 2008
    Posts
    15

    Default Re: add new subpanel to detail view

    thanks a lot) I missed relationship with accounts

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Missing subpanel in parent detail view
    By purplewave in forum Developer Help
    Replies: 0
    Last Post: 2008-02-18, 04:46 PM
  2. Trying to add Opportunities subpanel to Leads Detail View
    By lowJack01 in forum Developer Help
    Replies: 0
    Last Post: 2008-02-07, 06:00 PM
  3. Replies: 0
    Last Post: 2007-08-09, 06:34 PM
  4. Add a new view instead of a subpanel
    By Arpan_Biswas in forum Developer Help
    Replies: 1
    Last Post: 2006-01-12, 05:02 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
  •