本文整理汇总了PHP中Relationship::get_other_module方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::get_other_module方法的具体用法?PHP Relationship::get_other_module怎么用?PHP Relationship::get_other_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::get_other_module方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testget_other_module
public function testget_other_module()
{
//unset and reconnect Db to resolve mysqli fetch exeception
global $db;
unset($db->database);
$db->checkConnection();
$relationship = new Relationship();
//test with invalid relationship
$result = $relationship->get_other_module('test_test', 'test', $db);
$this->assertEquals(false, $result);
//test with valid relationship
$result = $relationship->get_other_module('roles_users', 'Roles', $db);
$this->assertEquals('Users', $result);
}
示例2: processEventCriteria
/**
* That method decode the event criteria string and insert into an array when
* the expType is MODULE for evaluate purpose.
* @param string eventCriteria
* @param object event
* @return array
* @codeCoverageIgnore
*/
private function processEventCriteria($eventCriteria, $event)
{
$criteria = json_decode($eventCriteria);
$resultArray = array();
if (is_array($criteria)) {
foreach ($criteria as $token) {
if ($token->expType == 'MODULE') {
$tmpObj = new stdClass();
$tmpObj->pro_id = $event->pro_id;
$tmpBean = BeanFactory::getBean('pmse_BpmProcessDefinition');
//$this->beanFactory->getBean('BpmProcessDefinition');
$tmpBean->retrieve_by_string_fields(array('id' => $tmpObj->pro_id));
$tmpObj->rel_process_module = $tmpBean->pro_module;
$tmpObj->rel_element_id = $event->evn_id;
$tmpObj->rel_element_type = $event->evn_type . '_EVENT';
$tmpObj->rel_element_relationship = $token->expModule;
if ($tmpObj->rel_process_module == $token->expModule) {
$tmpObj->rel_element_module = $token->expModule;
} else {
// @codeCoverageIgnoreStart
$relBean = new Relationship();
$tmpObj->rel_element_module = $relBean->get_other_module($token->expModule, $tmpObj->rel_process_module, $this->db);
// @codeCoverageIgnoreEnd
}
$resultArray[] = $tmpObj;
}
}
}
return $resultArray;
}
示例3: inherit_parent
function inherit_parent(&$focus, $isUpdate)
{
global $sugar_config;
//new record or if update from soap api for cases or bugs
//TEST FOR PORTAL NOTES
//if((!$isUpdate || ($isUpdate && !empty($focus->note_id) && ($focus->object_name == "Case" || $focus->object_name == "Bug")))
if (!$isUpdate && isset($sugar_config['securitysuite_inherit_parent']) && $sugar_config['securitysuite_inherit_parent'] == true) {
$focus_module_dir = $focus->module_dir;
$focus_id = $focus->id;
//inherit only for those that support Security Groups
$groupFocus = new SecurityGroup();
$security_modules = $groupFocus->getSecurityModules();
//if(!in_array($focus_module_dir,$security_modules)) {
if (!in_array($focus_module_dir, array_keys($security_modules))) {
//rost fix2
return;
//don't inherit for this module
}
//from subpanel
//PHP Notice error fix
$parent_type = "";
$parent_id = "";
if (isset($_REQUEST['relate_to']) && isset($_REQUEST['relate_id'])) {
//relate_to is not guaranteed to be a module name anymore.
//if it isn't load the relationship and find the module name that way
if (!in_array($_REQUEST['relate_to'], array_keys($security_modules))) {
//check to see if relate_to is the relationship name
require_once 'modules/Relationships/Relationship.php';
$rel_module = Relationship::get_other_module($_REQUEST['relate_to'], $focus_module_dir, $focus->db);
if (isset($rel)) {
$parent_type = $rel_module;
$parent_id = $_REQUEST['relate_id'];
}
} else {
$parent_type = $_REQUEST['relate_to'];
$parent_id = $_REQUEST['relate_id'];
}
}
if (isset($_SESSION['portal_id'])) {
$parent_id = $_SESSION['user_id'];
//soap stores contact id in user_id field
$parent_type = "Contacts";
}
//from activity type creation
if ((empty($parent_type) || empty($parent_id)) && isset($_REQUEST['parent_type']) && isset($_REQUEST['parent_id'])) {
$parent_type = $_REQUEST['parent_type'];
$parent_id = $_REQUEST['parent_id'];
}
//full form from subpanel
if ((empty($parent_type) || empty($parent_id)) && isset($_REQUEST['return_module']) && isset($_REQUEST['return_id'])) {
$parent_type = $_REQUEST['return_module'];
$parent_id = $_REQUEST['return_id'];
}
/** need to find relate fields...for example for Cases look to see if account_id is set */
//allow inheritance for all relate field types....iterate through and inherit each related field
//if(empty($parent_type) || empty($parent_id)) {
foreach ($focus->field_name_map as $name => $def) {
if ($def['type'] == 'relate' && isset($def['id_name']) && isset($def['module']) && strtolower($def['module']) != "users") {
if (isset($_REQUEST[$def['id_name']])) {
$relate_parent_id = $_REQUEST[$def['id_name']];
$relate_parent_type = $def['module'];
SecurityGroup::inherit_parentQuery($focus, $relate_parent_type, $relate_parent_id, $focus_id, $focus_module_dir);
} else {
if (isset($_SESSION['portal_id']) && isset($_SESSION[$def['id_name']])) {
//catch soap account
$relate_parent_id = $_SESSION[$def['id_name']];
$relate_parent_type = $def['module'];
SecurityGroup::inherit_parentQuery($focus, $relate_parent_type, $relate_parent_id, $focus_id, $focus_module_dir);
}
}
}
}
//}
if (!empty($parent_type) && !empty($parent_id)) {
// && $parent_type != "Emails" && $parent_type != "Meetings") {
SecurityGroup::inherit_parentQuery($focus, $parent_type, $parent_id, $focus_id, $focus_module_dir);
}
//end if parent type/id
}
//end if new record
}