AnsweredAssumed Answered

one to many relationship php Sugar Professional 7.7

Question asked by István Lukács on May 4, 2016
Latest reply on May 5, 2016 by István Lukács

I have a customizaton convert Opportunity to Project, and have to create one-to-many relation to other custom module Project Code.

This was working on 6.5, but now I have updated to 7.7 and it doesn't work.

 

$opp = new Opportunity();

$proj = new Project();

$myBean = new SugarBean(); 

 

...

 

//PROJECT CODE relationship

    //

    $opp_id=$opp->id;

    $query = "SELECT ccp_projec8b3ddetable_ida as projectcode_id FROM ccp_projectpportunities_c WHERE ccp_projec21a3unities_idb='{$opp_id}'";

    $result = $GLOBALS['db']->query($query);

    $row=$GLOBALS['db']->fetchByAssoc($result);

    $projectcode_id=$row['projectcode_id'];

   

    //echo ("<script>alert('pdjid: $projectcode_id');</script>");

    // uj relationship letrehozasa

    $r = new Relationship;

    $r->retrieve_by_name('ccp_projectcodetable_project');

    $relate_values = array(

        $r->join_key_lhs    => $projectcode_id,

        $r->join_key_rhs    => $proj->id,

    );

    $myBean->set_relationship($r->join_table, $relate_values, false); 

  

How can I update it?

Outcomes