Results 1 to 7 of 7

Thread: customize import dropdown boxes (add fields from another table)

  1. #1
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default customize import dropdown boxes (add fields from another table)

    Hi,

    I do have a module which has two bean files:
    from custom/Extension/application/Ext/include/Expense.php
    Code:
    $beanList['Expenses'] = 'Expense';
    $beanFiles['Expense'] = 'modules/Expenses/Expense.php';
    $moduleList[] = 'Expenses';
    $beanList['Receipts'] = 'Receipt';
    $beanFiles['Receipt'] = 'modules/Expenses/Receipt.php';
    $modInvisList[] = 'Receipts';
    Expenses has its own table.
    Receipts has its own table.

    Import into Expenses table is working fine.
    Now I need to import data into receipts table, but the upgrade wizard shows in the dropdown boxes only fields from the expenses table.

    How/Where can I customize the dropdownboxes in the upgradeWizrad to be able to import data in receipts table?

    Thanks for help.
    Andi

  2. #2
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: customize import dropdown boxes (add fields from another table)

    What info is missing getting help?
    Please show me the right point to start solving the problem.

    Andi

  3. #3
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: customize import dropdown boxes (add fields from another table)

    I can't imagine that this is such a specific problem isn't it?

    I figured out that there is the attribut "Importable" for the fields in the $dictonary['Module'].
    In the vardefs.php of my Module there are defined two $dictonary arrays
    Code:
    $dictionary['Expense']
    and
    $dictionary['Receipt']
    I can set a field to "Importable = false" and then the field is not avaliable in the dropdown box of import step 3

    In parse_utils.php of the Import Module there is the function
    Code:
    //This function will return a list of import enabled fields, and another array of importable fields label translated into logged in
    //user's locale specific string.
    //all fields in a module's vardefs file are importable , unless they meet this criteria,
    //             Importable is set to false or type is link.
    function get_importable_fields(&$bean, &$importable_fields, &$labels) {...}
    But this function only gets the fields of the $dictionary['Expense'] Array

    How do I "enable" the $dictionary['Receipt'] Array also for the get_importable_fields() function to customize the dropdownboxes for the import?

    Andi

  4. #4
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: customize import dropdown boxes (add fields from another table)

    No hints or tips? I can't imagine that nobody can give me a hint what to do or that at least someone says it is impossible...

    Where are the pros?

    Andi

  5. #5
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: customize import dropdown boxes (add fields from another table)

    When you mention the UpgradeWizard above... you mean the Import Wizard correct? I need to confirm that you're using the Import Wizard to import records into the Receipts module.

    As far as setting 'importable' to true... it appears that unless you explicitly set 'importable' to false for a field, it will default to true. Maybe you can post some screenshots of the import screen-- that'll help.

    Thanks!
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

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

    Default Re: customize import dropdown boxes (add fields from another table)

    Do you want to have one dropdown with fields from one table from another module?
    To do this you can have something like this described in this thread:
    http://www.sugarcrm.com/forums/showthread.php?t=23765

  7. #7
    lilewian is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Berlin
    Posts
    19

    Default Re: customize import dropdown boxes (add fields from another table)

    Hi,

    @julian
    you are right, I mean the ImportWizard - my fault.

    Here is a pic from the ImportWizard Step 3:


    And this is the content of the dropdownboxes in the ImportWizard Step 3:

    <option value="-1">-- Do not map this field --</option>
    <option value="aim">Aim:</option>
    <option value="amount">Amount:</option>
    <option value="assigned_user_id">Assigned To:</option>
    <option value="country">Country:</option>
    <option value="created_by">Created By:</option>
    <option value="date_entered">Date Entered:</option>
    <option value="date_modified">Date Modified:</option>
    <option value="date_start">Date from:</option>
    <option value="date_end">Date to:</option>
    <option value="deleted">Deleted:</option>
    <option value="description">Description:</option>
    <option value="destination">Destination:</option>
    <option value="id">Id: *</option>
    <option value="assigned_user_name">LBL_ASSIGNED_USER_NAME</option>
    <option value="modified_user_id">Modified User Id:</option>
    <option value="name">Name:</option>
    <option value="number">No:</option>
    <option value="project_id">Project Id:</option>
    <option value="project_name">Project:</option>
    <option value="team_id">Team:</option>
    <option value="time_start">Time from:</option>
    <option value="time_end">Time to:</option>

    Only fields from the expenses table are listed.
    Here is no field from the receipt table available and this is what I want to have.
    The last 5 fields of the import file are fields from the receipt table receipts_* and these I want to import too.

    As I mentioned in a previous post, in my vardef.php there are two $dictionary arrays:

    Code:
    $dictionary['Expense'] = array (
    	'table' => 'expenses',
    	'audited' => true,
    	'fields' => array (
    		'id' => array (
    			'name' => 'id',
    			'vname' => 'LBL_ID',
    			'required' => true,
    			'type' => 'id',
    			'reportable' => false,
    		),
    		'date_entered' => array (
    			'name' => 'date_entered',
    			'vname' => 'LBL_DATE_ENTERED',
    			'type' => 'datetime',
    			'required' => true,
    		),
    ...
    ...
    and
    $dictionary['Receipt'] = array (
    	'table' => 'receipts',
    	'audited' => true,
    	'fields' => array (
    		'id' => array (
    			'name' => 'id',
    			'vname' => 'LBL_ID',
    			'required' => true,
    			'type' => 'id',
    			'reportable' => false,
    
    		),
    		'date_entered' => array (
    			'name' => 'date_entered',
    			'vname' => 'LBL_DATE_ENTERED',
    			'type' => 'datetime',
    			'required' => true,
    ...
    ...
    but only the fields from $dictionary['Expense'] are available in the dropdownboxes of the ImportWizard.
    This fields I can control with importable = false, but as you said if importable is not explicit set to false, importable is true. But it affects only $dictionary['Expense'].

    For better understanding:
    One Expense can have more than one Receipt, but I think this can be handled somehow in the ImportExpenses.php - if I do get the receipt data to this point

    Hope the problem is more clear now.
    Thanks for help
    Andi

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. HELP - Act import (field mapping)
    By smelamed in forum Help
    Replies: 32
    Last Post: 2010-12-15, 05:39 PM
  2. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  3. Fatal error: Max
    By spokes2k4 in forum Help
    Replies: 3
    Last Post: 2006-01-15, 03:50 PM
  4. php 5.0.4 + MySQL 5.0.9
    By sergiogu in forum Help
    Replies: 0
    Last Post: 2005-08-30, 04:38 PM
  5. Empty config.php at the end of install
    By aemadrid in forum Help
    Replies: 2
    Last Post: 2005-08-01, 06:29 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
  •