/** * Allow edit org-person relation of an contact * * @param integer $org_id Organization Id that want to be edited. * @param integer $person_id Person Id that want to be edited. * @param array $data Information for contact * @param integer $action PHPGW_SQL_RETURN_SQL | PHPGW_SQL_RUN_SQL depending what we want * @return string SQL update string */ function edit_org_person_relation($org_id = '', $person_id = '', $data = array(), $action = PHPGW_SQL_RETURN_SQL) { $criteria = array(); $relation = createObject('phpgwapi.contact_org_person'); if ($org_id && $person_id) { $criteria = phpgwapi_sql_criteria::and_(phpgwapi_sql_criteria::equal('org_id', phpgwapi_sql::integer($org_id)), phpgwapi_sql_criteria::equal('person_id', phpgwapi_sql::integer($person_id))); } elseif ($org_id) { $criteria = phpgwapi_sql_criteria::equal('org_id', phpgwapi_sql::integer($org_id)); } elseif ($person_id) { $criteria = phpgwapi_sql_criteria::equal('person_id', phpgwapi_sql::integer($person_id)); } return $relation->update($data, $criteria, $action); }