Results 1 to 4 of 4

Thread: Popup and panel issues

  1. #1
    bingomanatee is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    10

    Default Popup and panel issues

    I'm trying to create a panel for "songs" within the "Account" detail view.

    I have created all the associations I can see in the documentation; I get a panel, but ALL the songs are listed despite the fact that there is no associations in the linkage table I've created ('songs_accounts' with song_id, account_id).

    The linkage table is:



    CREATE TABLE `accounts_songs` (
    `id` varchar(36) NOT NULL default '',
    `account` varchar(36) NOT NULL default '',
    `song` varchar(36) NOT NULL default '',
    `deleted` tinyint(4) NOT NULL default '0',
    PRIMARY KEY (`id`),
    KEY `account` (`account`,`song`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


    I've created a vardef reference in Accounts/

    in Accounts/vardefs.php:

    'songs' => array(
    'order' => 5,
    'sort_order' => 'desc',
    'sort_by' => 'title',
    'module' => 'Songs',
    'subpanel_name' => 'ForAccounts',
    'get_subpanel_data' => 'songs',
    'add_subpanel_data' => 'song_id',
    'title_key' => 'LBL_SONGS_SUBPANEL_TITLE',
    'top_buttons' => array(
    array('widget_class' => 'SubPanelTopButtonQuickCreate'),
    array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect')
    ),


    in the "metadata" directory:

    $dictionary['accounts_songs'] = array ( 'table' => 'accounts_songs'
    , 'fields' => array (
    array('name' =>'id', 'type' =>'varchar', 'len'=>'36')
    , array('name' =>'song_id', 'type' =>'varchar', 'len'=>'36')
    , array('name' =>'account_id', 'type' =>'varchar', 'len'=>'36')
    , array ('name' => 'date_modified','type' => 'datetime')
    , array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'required'=>true, 'default'=>'0')
    ) , 'indices' => array (
    array('name' =>'PRIMARY', 'type' =>'primary', 'fields'=>array('id'))
    )

    , 'relationships' => array ('accounts_contacts' => array('lhs_module'=> 'Accounts', 'lhs_table'=> 'accounts', 'lhs_key' => 'id',
    'rhs_module'=> 'Contacts', 'rhs_table'=> 'contacts', 'rhs_key' => 'id',
    'relationship_type'=>'many-to-many',
    'join_table'=> 'accounts_songs', 'join_key_lhs'=>'account_id', 'join_key_rhs'=>'contact_id'))
    ),


    Also, in the "select" popup on the "Songs" panel on the "Account" detail page, the following errror displays:

    Warning: popup_picker(modules/Songs/Account.php): failed to open stream: No such file or directory in F:\apps\xampp\xampp\htdocs\sugar\include\Popups\Po pup_picker.php on line 59


    What do I need to do to make the popup look for the account class within the Account directory?
    • Sugar 4.5.1d
    • PHP 4.4.0
    • MySQL 4.1.13
    • Win/XAMPP stack

  2. #2
    jli
    jli is offline Junior Member
    Join Date
    May 2005
    Posts
    109

    Default Re: Popup and panel issues

    your entry in the accounts/vardefs.php file is incorrect.

    what you've typed looks like the entry that should be in the layout_defs.php file.
    in vardefs.php, you'll need the entry to reference the relationship:

    ie:

    songs => array(
    'name' => 'songs',
    'relationship' => 'accounts_songs',
    ...
    ...
    ),

  3. #3
    bingomanatee is offline Sugar Community Member
    Join Date
    Mar 2006
    Posts
    10

    Default Re: Popup and panel issues

    Thanks. I had mislabeled my code snippets.

    In attempting to call "repair database" from the admin section I get an odd error:


    Code:
    Error creating table: repair_table: Query Failed:CREATE TABLE repair_table (id varchar(36) DEFAULT '' NOT NULL ,song_id varchar(36) DEFAULT '' NULL ,account_id varchar(36) DEFAULT '' NULL ,deleted bool DEFAULT '0' NOT NULL , NULL , NULL ) CHARACTER SET utf8 COLLATE utf8_general_ci::MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL , NULL ) CHARACTER SET utf8 COLLATE utf8_general_ci' at line 1
    I have looked over my metadata and vardefs code carefully and I can't see why the repair directive wouldn't recognize the table name correctly.

    Code:
    $dictionary['accounts_songs'] = array ( 
    	'table' => 'accounts_songs'
        , 
    	'fields' => array (
           array('name' =>'id',       'type' => 'varchar', 'default' => '', 'len'=>'36')
          , array('name' =>'song_id',    'type' => 'varchar', 'default' => '', 'len'=>'36')
          , array('name' =>'account_id', 'type' => 'varchar', 'default' => '', 'len'=>'36')
          , array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'required'=>true, 'default'=>'0')
          , 'indices' => array (
    	       array('name' =>'primary', 'type' =>'primary', 'fields'=>array('id'))
    	      )
     	  , 'relationships' => array(
    	 	  'accounts_songs' => array(
    		 	  'lhs_module'=> 'Accounts', 
    		 	  'lhs_table'=> 'accounts', 
    		 	  'lhs_key' => 'id',
    		 	  
    			  'rhs_module'=> 'Songs', 
    			  'rhs_table'=> 'songs',
    			  'rhs_key' => 'id',
    			  
    			  'join_table'=> 'accounts_songs', 
    			  'join_key_lhs'=>'account_id', 
    			  'join_key_rhs'=>'song_id',
    			  
    			  'relationship_type'=>'many-to-many'
    			)
    		 )
    	)
    )
    Thanks, Dave
    Attached Files Attached Files

  4. #4
    mapm's Avatar
    mapm is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    Portugal
    Posts
    239

    Default Re: Popup and panel issues

    I think you are missing a ) near the last array :
    , array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'required'=>true, 'default'=>'0') )

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 2007-04-26, 07:43 PM
  2. Create in Contacts Popup
    By webnetin in forum Help
    Replies: 0
    Last Post: 2006-03-10, 05:52 AM

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
  •