AnsweredAssumed Answered

Installable package failed - "unable to load bean"

Question asked by Manuel Rubio on Apr 24, 2017
Latest reply on Apr 27, 2017 by Manuel Rubio

Hi.

 

I'm trying to install a custom package that turns "Opportunity Name" field required in the Quotes module but I get an error in the Log:

 

Mon Apr 24 21:36:22 2017 [3491][01d5bbea-1fa2-11e7-afde-063b661e1dc5][FATAL] Unable to load bean 
Mon Apr 24 21:37:15 2017 [21657][01d5bbea-1fa2-11e7-afde-063b661e1dc5][FATAL] Exception in Controller: exception 'SugarApiExceptionInvalidParameter' with message 'An opportunity must be selected' in /mnt/sugar/shadowed/development.demo.sugarcrm.com/custom/modules/Quotes/qts_opp_req.php:11

 

the code I'm trying to put is:

 

manifest.php

 

<?php

 

    $manifest =array(
        'acceptable_sugar_flavors' => array('CE','PRO','CORP','ENT','ULT'),
        'acceptable_sugar_versions' => array(
            'exact_matches' => array(),
            'regex_matches' => array('(.*?)\\.(.*?)\\.(.*?)$'),
        ),
        'author' => 'Manuel',
        'description' => '',
        'icon' => '',
        'is_uninstallable' => true,
        'name' => '',
        'published_date' => '2016-06-12 12:00:00',
        'type' => 'module',
        'version' => '1.2',
    );
    
    $installdefs =array(
        'id' => '001',
        'copy' => array(
            0 => array(
                'from' => '<basepath>/Files/custom/modules/Quotes/qts_opp_req.php',
                'to' => 'custom/modules/Quotes/qts_opp_req.php',
            ),
        ),
        'logic_hooks' => array(
            array(
                'module' => 'Quotes',
                'hook' => 'before_save',
                'order' => 1,
                'description' => '',
                'file' => 'custom/modules/Quotes/qts_opp_req.php',
                'class' => 'Null_Opport',
                'function' => 'requr_opp',
            ),
        ),
    );

 

?>

 

qts_opp_req.php

 

<?php

 

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

 

    class Null_Opport
    {
        function requr_opp($bean, $event, $arguments)
        {
            if($bean->opportunity_id == null){
                require_once 'include/api/SugarApiException.php';   
                throw new SugarApiExceptionInvalidParameter("An opportunity must be selected");
            }
        }
    }

 

?>

 

I'm using an On-Demand instance. Why I'm getting this error?

Outcomes