Go Back   SugarCRM Forums > Community Forums > Developer Tutorials
 Create an account

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2009-03-25, 12:24 PM
crmsiva's Avatar
crmsiva crmsiva is offline
A Sugar Hero
 
Join Date: Jan 2009
Location: Bangalore, India
Posts: 1,130
Default How to add Import option to custom modules?

Hi All

Follow the below steps to add Import option to custom modules. This steps can also be used to enable import option in standard modules like projects.

Add the below line in modules/<Module Name>/<Module Name>.php file.

Code:
var $importable = true;
Create the file menu.ext.php in "custom\modules\<Module Name>\Ext\Menus" with below code.

Code:
<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 

if(ACLController::checkAccess('<Module Name>', 'import', true)) $module_menu[]=Array("index.php?module=Import&action=Step1&import_module=<Module Name>&return_module=<Module Name>&return_action=index", "Import","Import", '<Module Name>');

?>
This will add import menu item in the shortcut menu.

Last edited by crmsiva; 2009-03-25 at 12:33 PM.
Reply With Quote
  #2  
Old 2009-03-25, 12:31 PM
amrutha amrutha is offline
Senior Member
 
Join Date: Mar 2009
Posts: 65
Default Re: How to add Import option to custom modules?

Thanks for the replies... import is working now for my new module
Reply With Quote
  #3  
Old 2009-04-20, 12:47 PM
Qamrun Qamrun is offline
Senior Member
 
Join Date: Mar 2009
Location: New Delhi
Posts: 46
Smile Re: How to add Import option to custom modules?

It's very helpful.... thanks a lot
Reply With Quote
  #4  
Old 2009-04-23, 11:00 AM
gsrikanth's Avatar
gsrikanth gsrikanth is offline
Senior Member
 
Join Date: Dec 2008
Location: INDIA
Posts: 41
Send a message via Skype™ to gsrikanth
Default Re: How to add Import option to custom modules?

I have done the same procedure and i got this error "There is no action by that name."
The url is like this :index.php?module=Import&action=Step1&import_modul e=Project&return_module=Project&return_action=inde x
please help...

Last edited by gsrikanth; 2009-07-10 at 12:34 PM.
Reply With Quote
  #5  
Old 2009-04-23, 02:11 PM
crmsiva's Avatar
crmsiva crmsiva is offline
A Sugar Hero
 
Join Date: Jan 2009
Location: Bangalore, India
Posts: 1,130
Default Re: How to add Import option to custom modules?

There is a space between "import_module" & "=Project" in the URL. Remove that space.

Code:
import_module =Project
BTW, Which version of sugar you are using?
Reply With Quote
  #6  
Old 2009-04-24, 07:32 AM
gsrikanth's Avatar
gsrikanth gsrikanth is offline
Senior Member
 
Join Date: Dec 2008
Location: INDIA
Posts: 41
Send a message via Skype™ to gsrikanth
Default Re: How to add Import option to custom modules?

Hi crmsiva

Thanks for your reply.It's very helpful....

Last edited by gsrikanth; 2009-07-10 at 06:50 AM.
Reply With Quote
  #7  
Old 2009-05-06, 09:40 AM
galgo galgo is offline
Junior Member
 
Join Date: Apr 2008
Posts: 3
Default Re: How to add Import option to custom modules?

crmsiva, thank you very much for these instructions.
I drove myself nuts looking for the import option when I knew I'd made the fields importable Your instructions were clear and spot-on and now I have my import shortcut. Thank you again.
Reply With Quote
  #8  
Old 2009-06-11, 05:29 PM
smguenther smguenther is offline
Member
 
Join Date: May 2009
Posts: 6
Default Re: How to add Import option to custom modules?

Hi,

I tried to use your explanation to add the import function to the ModuleBuilder, but I don't get the import option. Maybe you see what I did wrong:

Quote:
Originally Posted by crmsiva View Post
Hi All
Add the below line in modules/<Module Name>/<Module Name>.php file.

Code:
var $importable = true;
the file modules/ModuleBuilder/ModuleBuilder.php does not exist, instead there is a subdirectory called MB where this file is located.

Here is how this file now looks like:

Code:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
require_once ('include/utils/file_utils.php') ;
define ( 'MB_PACKAGE_PATH', 'custom/modulebuilder/packages' ) ;
define ( 'MB_PACKAGE_BUILD', 'custom/modulebuilder/builds' ) ;
require_once ('modules/ModuleBuilder/MB/MBPackage.php') ;

class ModuleBuilder
{
    var $packages = array ( ) ;
    var $importable = true;
    function getPackageList ()
....
Quote:
Originally Posted by crmsiva View Post
Create the file menu.ext.php in "custom\modules\<Module Name>\Ext\Menus" with below code.
Here is my code:

Code:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
if(ACLController::checkAccess('ModuleBuilder', 'import', true)) $module_menu[]=Array("index.php?module=Import&action=Step1&import_module=ModuleBuilder&return_module=ModuleBuilder&return_action=index", "Import","Import", 'ModuleBuilder');
?>
Any idea what I did wrong?

Thanks for your help.

Stefan
Reply With Quote
  #9  
Old 2009-06-12, 04:50 AM
crmsiva's Avatar
crmsiva crmsiva is offline
A Sugar Hero
 
Join Date: Jan 2009
Location: Bangalore, India
Posts: 1,130
Smile Re: How to add Import option to custom modules?

Hi

This solution will not work for Module Builder. This solution is for importing data and not modules. Use module loader to install a module.
Reply With Quote
  #10  
Old 2009-07-02, 10:07 AM
dekleinemedia dekleinemedia is offline
A Prolific Poster
 
Join Date: May 2009
Location: Netherlands
Posts: 241
Question Re: How to add Import option to custom modules?

Quote:
Originally Posted by crmsiva View Post
Hi All

Follow the below steps to add Import option to custom modules. This steps can also be used to enable import option in standard modules like projects.

Add the below line in modules/<Module Name>/<Module Name>.php file.

Code:
var $importable = true;
Create the file menu.ext.php in "custom\modules\<Module Name>\Ext\Menus" with below code.

Code:
<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 

if(ACLController::checkAccess('<Module Name>', 'import', true)) $module_menu[]=Array("index.php?module=Import&action=Step1&import_module=<Module Name>&return_module=<Module Name>&return_action=index", "Import","Import", '<Module Name>');

?>
This will add import menu item in the shortcut menu.
Hi,

I am having in problem with creating an Import option in module "Project".

I followed both steps, but when I am rebuildig this module "Project" my file menu.ext.php will be automatically delete out of my "custom\modules\Project\Ext\Menus" directory

See scripts;

Script: menu.ext.php (custom\modules\Project\Ext\Menus)
PHP Code:
<?php

if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); 

if(
ACLController::checkAccess('Project''import'true)) 
$module_menu[]=Array("index.php?module=Import&action=Step1&import_module=Project&return_module=Project&return_action=index""Import","Import"'Project');

?>
Script: Project.php (modules\Project)
PHP Code:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class 
Project extends SugarBean {

    var 
$object_name 'Project';
    var 
$module_dir 'Project';
    var 
$new_schema true;
    var 
$table_name 'project';
    var 
$importable true;
}
?>
Can someone please tell me what i did wrong, and why the created menu.ext.php is auto deleted when I rebuild the "Project" Module.

Thanksssss
__________________
Kind regards,

De Kleine Media


SugarCRM CE v.5.2.0h
Windows platform
MySQL v.5.1
phpMyAdmin - 2.11.2.2
Apache Server v.2.0
Reply With Quote
Reply

Bookmarks

Tags
custom module, import


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set import option in custom modules jmcalderond General Discussion 7 2009-03-25 12:46 PM
How to add Import option to new modules? amrutha Developer Help 2 2009-03-25 12:27 PM
import for custom fields and custom modules waverider Developer Help 2 2008-03-14 09:44 AM
link contacts with custom modules at import juancarlos.delrio Developer Help 0 2007-11-13 01:15 AM
Import Function in Custom Modules simpsond Developer Help 7 2007-07-06 04:41 PM


All times are GMT. The time now is 06:00 PM.


Powered by: vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SourceForge.net Logo