In SuiteCRM 7.1.4 ,I have code that updates the Opportunity bean that was working and suddenly stopped working.
At first I thought the problem was in the data I was providing for the update.
Then, I commented out the section that provided the new data and just saved back the bean I had retrieved, and I got the same error.
The SugarCRM error log shows the SQL contains a value at the end of the Update statement of: ,=NULL
Here’s the full log error message:
Tue Nov 4 07:27:06 2014 [2191][b644b41e-8804-ff9e-7022-544a4eca6c4f][FATAL] Error updating table: opportunities: Query Failed:
UPDATE opportunities
SET name=‘cascru20141101656’
,date_modified=‘2014-11-04 13:27:04’
,modified_user_id=‘b644b41e-8804-ff9e-7022-544a4eca6c4f’
,created_by=‘1’
,description=‘Just spent too much money’
,assigned_user_id=’’
,opportunity_type=NULL
,campaign_id=’’
,lead_source=NULL
,amount=1
,amount_usdollar=1
,currency_id=’-99’
,date_closed=‘0000-00-00’
,next_step=NULL
,sales_stage=‘New’,probability=NULL
,=NULL
WHERE opportunities.id = ‘a7af6325-52d4-dd02-f6cf-54556662bdc8’ AND deleted=0
: MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘=NULL
WHERE opportunities.id = ‘a7af6325-52d4-dd02-f6cf-54556662bdc8’ AND’ at line 2
Here’s the pertinent section of code:
// Get Hot Lead (Opportunity) bean
$hotlead = BeanFactory::newBean('Opportunities');
// $hotlead->retrieve($_GET['id']);
$hotlead->retrieve($opp_id);
$firephp->log($hotlead->id, 'Retrieved Hot Lead ID');
// Get lead corresponding to this opportunity (Hot Lead)
$lead = BeanFactory::getBean('Leads')->retrieve_by_string_fields(array('opportunity_id'=>$opp_id));
$lead_id = $lead->id;
$firephp->log($lead_id,'Lead ID for the Opportunity');
// Update sales stage
// $hotlead->sales_stage="Claimed";
// $hotlead->claimed_by_c=$user_name;
$hotlead->save();
Any idea what’s going on here?
Glenn