Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9108303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:46:38+00:00 2026-06-17T02:46:38+00:00

In SugarCRM (program management) module called projects by default does not come with the

  • 0

In SugarCRM (program management) module called “projects” by default does not come with the “import”, it added eh following programming steps:

http://forums.sugarcrm.com/f148/how-add-importación-opción-custom-modules-45612/

Now I throw the error when I Import Next:

Fatal error: Llamada a una función miembro get_importable_fields () en un no-objeto en C: \ Archivos de programa \ Apache Software Foundation \ Apache2.2 \ htdocs \ Azúcar \ modules \ Import \ v iews \ view.step3.php en línea 217

Please somebody help me … if necessary … I will upload the file so they can help view.step3.php

Here is the line 217:

        $fields  = $this->bean->get_importable_fields();
        $options = array();
        $defaultField = '';
        global $current_language;
        $moduleStrings = return_module_language($current_language, $this->bean->module_dir);

Here I publish the above lines:

class ImportViewStep3 extends ImportView

{

protected $pageTitleKey = 'LBL_STEP_3_TITLE';
protected $currentFormID = 'importstep3';
protected $previousAction = 'Confirm';
protected $nextAction = 'dupcheck';

/**
 * @see SugarView::display()
 */
public function display()
{
    global $mod_strings, $app_strings, $current_user, $sugar_config, $app_list_strings, $locale;

    $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
    $has_header = ( isset( $_REQUEST['has_header']) ? 1 : 0 );
    $sugar_config['import_max_records_per_file'] = ( empty($sugar_config['import_max_records_per_file']) ? 1000 : $sugar_config['import_max_records_per_file'] );
    $this->ss->assign("CURRENT_STEP", $this->currentStep);
    // attempt to lookup a preexisting field map
    // use the custom one if specfied to do so in step 1
    $mapping_file = new ImportMap();
    $field_map = $mapping_file->set_get_import_wizard_fields();
    $default_values = array();
    $ignored_fields = array();

    if ( !empty( $_REQUEST['source_id']))
    {
        $GLOBALS['log']->fatal("Loading import map properties.");
        $mapping_file = new ImportMap();
        $mapping_file->retrieve( $_REQUEST['source_id'],false);
        $_REQUEST['source'] = $mapping_file->source;
        $has_header = $mapping_file->has_header;
        if (isset($mapping_file->delimiter))
            $_REQUEST['custom_delimiter'] = $mapping_file->delimiter;
        if (isset($mapping_file->enclosure))
            $_REQUEST['custom_enclosure'] = htmlentities($mapping_file->enclosure);
        $field_map = $mapping_file->getMapping();
        //print_r($field_map);die();
        $default_values = $mapping_file->getDefaultValues();
        $this->ss->assign("MAPNAME",$mapping_file->name);
        $this->ss->assign("CHECKMAP",'checked="checked" value="on"');
    }
    else
    {
        $classname = $this->getMappingClassName(ucfirst($_REQUEST['source']));

        //Set the $_REQUEST['source'] to be 'other' for ImportMapOther special case
        if($classname == 'ImportMapOther')
        {
            $_REQUEST['source'] = 'other';
        }

        if (class_exists($classname))
        {
            $mapping_file = new $classname;
            $ignored_fields = $mapping_file->getIgnoredFields($_REQUEST['import_module']);
            $field_map2 = $mapping_file->getMapping($_REQUEST['import_module']);
            $field_map = array_merge($field_map,$field_map2);
        }
    }

    $delimiter = $this->getRequestDelimiter();

    $this->ss->assign("CUSTOM_DELIMITER", $delimiter);
    $this->ss->assign("CUSTOM_ENCLOSURE", ( !empty($_REQUEST['custom_enclosure']) ? $_REQUEST['custom_enclosure'] : "" ));

   //populate import locale  values from import mapping if available, these values will be used througout the rest of the code path

    $uploadFileName = $_REQUEST['file_name'];

    // Now parse the file and look for errors
    $importFile = new ImportFile( $uploadFileName, $delimiter, html_entity_decode($_REQUEST['custom_enclosure'],ENT_QUOTES), FALSE);

    if ( !$importFile->fileExists() ) {
        $this->_showImportError($mod_strings['LBL_CANNOT_OPEN'],$_REQUEST['import_module'],'Step2');
        return;
    }

    $charset = $importFile->autoDetectCharacterSet();

    // retrieve first 3 rows
    $rows = array();

    //Keep track of the largest row count found.
    $maxFieldCount = 0;
    for ( $i = 0; $i < 3; $i++ )
    {
        $rows[] = $importFile->getNextRow();
        $maxFieldCount = $importFile->getFieldCount() > $maxFieldCount ?  $importFile->getFieldCount() : $maxFieldCount;
    }
    $ret_field_count = $maxFieldCount;

    // Bug 14689 - Parse the first data row to make sure it has non-empty data in it
    $isempty = true;
    if ( $rows[(int)$has_header] != false ) {
        foreach ( $rows[(int)$has_header] as $value ) {
            if ( strlen(trim($value)) > 0 ) {
                $isempty = false;
                break;
            }
        }
    }

    if ($isempty || $rows[(int)$has_header] == false) {
        $this->_showImportError($mod_strings['LBL_NO_LINES'],$_REQUEST['import_module'],'Step2');
        return;
    }

    // save first row to send to step 4
    $this->ss->assign("FIRSTROW", base64_encode(serialize($rows[0])));

    // Now build template
    $this->ss->assign("TMP_FILE", $uploadFileName );
    $this->ss->assign("SOURCE", $_REQUEST['source'] );
    $this->ss->assign("TYPE", $_REQUEST['type'] );
    $this->ss->assign("DELETE_INLINE_PNG",  SugarThemeRegistry::current()->getImage('basic_search','align="absmiddle" alt="'.$app_strings['LNK_DELETE'].'" border="0"'));
    $this->ss->assign("PUBLISH_INLINE_PNG",  SugarThemeRegistry::current()->getImage('advanced_search','align="absmiddle" alt="'.$mod_strings['LBL_PUBLISH'].'" border="0"'));

    $this->instruction = 'LBL_SELECT_MAPPING_INSTRUCTION';
    $this->ss->assign('INSTRUCTION', $this->getInstruction());

    $this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false));
    $this->ss->assign("STEP4_TITLE",
        strip_tags(str_replace("\n","",getClassicModuleTitle(
            $mod_strings['LBL_MODULE_NAME'],
            array($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_STEP_4_TITLE']),
            false
            )))
        );
    $this->ss->assign("HEADER", $app_strings['LBL_IMPORT']." ". $mod_strings['LBL_MODULE_NAME']);

    // we export it as email_address, but import as email1
    $field_map['email_address'] = 'email1';

    // build each row; row count is determined by the the number of fields in the import file
    $columns = array();
    $mappedFields = array();

    // this should be populated if the request comes from a 'Back' button click
    $importColumns = $this->getImportColumns();
    $column_sel_from_req = false;
    if (!empty($importColumns)) {
        $column_sel_from_req = true;
    }

    for($field_count = 0; $field_count < $ret_field_count; $field_count++) {
        // See if we have any field map matches
        $defaultValue = "";
        // Bug 31260 - If the data rows have more columns than the header row, then just add a new header column
        if ( !isset($rows[0][$field_count]) )
            $rows[0][$field_count] = '';
        // See if we can match the import row to a field in the list of fields to import
        $firstrow_name = trim(str_replace(":","",$rows[0][$field_count]));
        if ($has_header && isset( $field_map[$firstrow_name] ) ) {
            $defaultValue = $field_map[$firstrow_name];
        }
        elseif (isset($field_map[$field_count])) {
            $defaultValue = $field_map[$field_count];
        }
        elseif (empty( $_REQUEST['source_id'])) {
            $defaultValue = trim($rows[0][$field_count]);
        }

        // build string of options
        $fields  = $this->bean->get_importable_fields();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:46:39+00:00Added an answer on June 17, 2026 at 2:46 am

    this is my coding project.php:

    class Project extends SugarBean {
    // database table columns

    var $id;
    var $date_entered;
    var $date_modified;
    var $assigned_user_id;
    var $modified_user_id;
    var $created_by;
    var $name;
    var $description;
    var $deleted;
    
    
    // related information
    var $assigned_user_name;
    var $modified_by_name;
    var $created_by_name;
    
    var $account_id;
    var $contact_id;
    var $opportunity_id;
    var $email_id;
    var $estimated_start_date;
    
    // calculated information
    var $total_estimated_effort;
    var $total_actual_effort;
    
    var $object_name = 'Project';
    var $module_dir = 'Project';
    var $new_schema = true;
    var $table_name = 'project';
    var $importable = true;
    
    // This is used to retrieve related fields from form posts.
    var $additional_column_fields = array(
        'account_id',
        'contact_id',
        'opportunity_id',
    );
    
    var $relationship_fields = array(
        'account_id' => 'accounts',
        'contact_id'=>'contacts',
        'opportunity_id'=>'opportunities',
        'email_id' => 'emails',
    );
    
    //////////////////////////////////////////////////////////////////
    // METHODS
    //////////////////////////////////////////////////////////////////
    
    /**
     *
     */
    function Project()
    {
        parent::SugarBean();
    }
    
    /**
     * overriding the base class function to do a join with users table
     */
    
    /**
     *
     */
    function fill_in_additional_detail_fields()
    {
        parent::fill_in_additional_detail_fields();
    
        $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
        //$this->total_estimated_effort = $this->_get_total_estimated_effort($this->id);
        //$this->total_actual_effort = $this->_get_total_actual_effort($this->id);
    }
    
    /**
     *
     */
    function fill_in_additional_list_fields()
    {
        parent::fill_in_additional_list_fields();
        $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id);
        //$this->total_estimated_effort = $this->_get_total_estimated_effort($this->id);
        //$this->total_actual_effort = $this->_get_total_actual_effort($this->id);
    }
    
    /**
    * Save changes that have been made to a relationship.
    *
    * @param $is_update true if this save is an update.
    */
    function save_relationship_changes($is_update, $exclude=array())
    {
        parent::save_relationship_changes($is_update, $exclude);
        $new_rel_id = false;
        $new_rel_link = false;
        //this allows us to dynamically relate modules without adding it to the relationship_fields array
        if(!empty($_REQUEST['relate_id']) && !in_array($_REQUEST['relate_to'], $exclude) && $_REQUEST['relate_id'] != $this->id){
            $new_rel_id = $_REQUEST['relate_id'];
            $new_rel_relname = $_REQUEST['relate_to'];
            if(!empty($this->in_workflow) && !empty($this->not_use_rel_in_req)) {
                $new_rel_id = $this->new_rel_id;
                $new_rel_relname = $this->new_rel_relname;
            }
            $new_rel_link = $new_rel_relname;
            //Try to find the link in this bean based on the relationship
            foreach ( $this->field_defs as $key => $def ) {
                if (isset($def['type']) && $def['type'] == 'link'
                && isset($def['relationship']) && $def['relationship'] == $new_rel_relname) {
                    $new_rel_link = $key;
                }
            }
            if ($new_rel_link == 'contacts') {
                $accountId = $this->db->getOne('SELECT account_id FROM accounts_contacts WHERE contact_id=' . $this->db->quoted($new_rel_id));
                if ($accountId !== false) {
                    if($this->load_relationship('accounts')){
                        $this->accounts->add($accountId);
                    }
                }
            }
        }
    }
    /**
     *
     */
    function _get_total_estimated_effort($project_id)
    {
        $return_value = '';
    
        $query = 'SELECT SUM('.$this->db->convert('estimated_effort', "IFNULL", 0).') total_estimated_effort';
        $query.= ' FROM project_task';
        $query.= " WHERE parent_id='{$project_id}' AND deleted=0";
    
        $result = $this->db->query($query,true," Error filling in additional detail fields: ");
        $row = $this->db->fetchByAssoc($result);
        if($row != null)
        {
            $return_value = $row['total_estimated_effort'];
        }
    
        return $return_value;
    }
    
    /**
     *
     */
    function _get_total_actual_effort($project_id)
    {
        $return_value = '';
    
        $query = 'SELECT SUM('.$this->db->convert('actual_effort', "IFNULL", 0).') total_actual_effort';
        $query.=  ' FROM project_task';
        $query.=  " WHERE parent_id='{$project_id}' AND deleted=0";
    
        $result = $this->db->query($query,true," Error filling in additional detail fields: ");
        $row = $this->db->fetchByAssoc($result);
        if($row != null)
        {
            $return_value = $row['total_actual_effort'];
        }
    
        return $return_value;
    }
    
    /**
     *
     */
    function get_summary_text()
    {
        return $this->name;
    }
    
    /**
     *
     */
    function build_generic_where_clause ($the_query_string)
    {
        $where_clauses = array();
        $the_query_string = $GLOBALS['db']->quote($the_query_string);
        array_push($where_clauses, "project.name LIKE '%$the_query_string%'");
    
        $the_where = '';
        foreach($where_clauses as $clause)
        {
            if($the_where != '') $the_where .= " OR ";
            $the_where .= $clause;
        }
    
        return $the_where;
    }
    
    function get_list_view_data()
    {
        $field_list = $this->get_list_view_array();
        $field_list['USER_NAME'] = empty($this->user_name) ? '' : $this->user_name;
        $field_list['ASSIGNED_USER_NAME'] = $this->assigned_user_name;
        return $field_list;
    }
      function bean_implements($interface){
        switch($interface){
            case 'ACL':return true;
        }
        return false;
    }
    
    function create_export_query(&$order_by, &$where, $relate_link_join='')
    {
        $custom_join = $this->custom_fields->getJOIN(true, true,$where);
        if($custom_join)
                $custom_join['join'] .= $relate_link_join;
        $query = "SELECT
                project.*,
                users.user_name as assigned_user_name ";
        if($custom_join){
            $query .=  $custom_join['select'];
        }
        $query .= " FROM project ";
    
        if($custom_join){
            $query .=  $custom_join['join'];
        }
        $query .= " LEFT JOIN users
                    ON project.assigned_user_id=users.id ";
    
        $where_auto = " project.deleted=0 ";
    
        if($where != "")
            $query .= "where ($where) AND ".$where_auto;
        else
            $query .= "where ".$where_auto;
    
        if(!empty($order_by)){
            //check to see if order by variable already has table name by looking for dot "."
            $table_defined_already = strpos($order_by, ".");
    
            if($table_defined_already === false){
                //table not defined yet, define accounts to avoid "ambigous column" SQL error
                $query .= " ORDER BY $order_by";
            }else{
                //table already defined, just add it to end of query
                $query .= " ORDER BY $order_by";
            }
        }
        return $query;
    }
    function getAllProjectTasks(){
        $projectTasks = array();
    
        $query = "SELECT * FROM project_task WHERE project_id = '" . $this->id. "' AND deleted = 0 ORDER BY project_task_id";
        $result = $this->db->query($query,true,"Error retrieving project tasks");
        $row = $this->db->fetchByAssoc($result);
    
        while ($row != null){
            $projectTaskBean = new ProjectTask();
            $projectTaskBean->id = $row['id'];
            $projectTaskBean->retrieve();
            array_push($projectTasks, $projectTaskBean);
    
            $row = $this->db->fetchByAssoc($result);
        }
    
        return $projectTasks;
    }
    

    }
    ?>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using SugarCRM. I want to have a users page that does
I have created a delphi 7 program and connected to sugarcrm with soap wsdl.
SugarCRM has by default, inbuilt GUID having a format, aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee and the field name
I have upgraded my SugarCRM 5.1 to 6.5.2. Now i want add Zukars_Hierarchy module
I want to import data from java web application to sugarCRM. I created client
Which Report module is suitable for making reports in sugarcrm 6.2 . I had
I want to create a dropdown list in sugarcrm custom module and auto populate
I want to create a link in sugarcrm module and on clicking this link
I need some help with a custom module for sugarCRM 6.5 CE. Here is
I am new to sugarCRM, I had created a custom module using module builder.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.