$OrgfieldName->appendChild($OrgfieldNameText); $Orgfield->appendChild($OrgfieldName); $OrgfieldID = $xml->createElement("OrgfieldID"); $OrgfieldIDText = $xml->createTextNode($fld[4]); $OrgfieldID->appendChild($OrgfieldIDText); $Orgfield->appendChild($OrgfieldID); $Orgfields->appendChild($Orgfield); } } $del = $xml->createElement("delimiter"); $delText = $xml->createTextNode($delimArr[$i]); $del->appendChild($delText); $Orgfields->appendChild($del); // } $fields->appendChild($field); $strTarField = implode($delimArr[$i], $fldnamearr); $strTarFldId = implode(",", $fldidarr); } //$root->appendChild($name); $root->appendChild($target); $root->appendChild($origin); $root->appendChild($fields); $xml->formatOutput = true; echo $xml->saveXML(); include_once 'modules/cbMap/cbMap.php'; $map_focus = new cbMap(); $map_focus->id = $mapid; $map_focus->retrieve_entity_info($mapid, "cbMap"); $map_focus->column_fields['content'] = $xml->saveXML(); $map_focus->mode = "edit"; $map_focus->save("cbMap");
function getMap2Use($map2use) { if (!empty($map2use['condition']['cmapid'])) { $focus = new cbMap(); $focus->id = $map2use['condition']['cmapid']; $focus->mode = ''; $focus->retrieve_entity_info($focus->id, 'cbMap'); $contentok = processcbMap::isXML(htmlspecialchars_decode($focus->column_fields['content'])); if ($contentok) { if ($focus->column_fields['maptype'] == 'Condition Query') { $condition = $focus->ConditionQuery($this->relatedid); } elseif ($focus->column_fields['maptype'] == 'Condition Expression') { global $adb; $setype = getSalesEntityType($this->relatedid); $wsrs = $adb->pquery('select id from vtiger_ws_entity where name=?', array($setype)); if ($wsrs and $adb->num_rows($wsrs) == 1) { $eid = $adb->query_result($wsrs, 0, 0) . 'x' . $this->relatedid; } else { return $map2use; } $condition = $focus->ConditionExpression($eid); } else { $condition = false; } if ($condition === true or strtolower($condition) == 'true' or strtolower($condition) == 'yes' or is_numeric($condition) and $condition > 0) { return $map2use['condition']; } else { return $map2use; } } else { return $map2use; } } else { return $map2use; } }
public static function getMapByName($name, $type = '') { global $adb; $sql = 'select cbmapid from vtiger_cbmap inner join vtiger_crmentity on crmid=cbmapid where deleted=0 and mapname=?'; $prm = array($name); if ($type != '') { $sql .= ' and maptype=?'; $prm[] = $type; } $mrs = $adb->pquery($sql, $prm); if ($mrs and $adb->num_rows($mrs) > 0) { $cbmapid = $adb->query_result($mrs, 0, 0); $cbmap = new cbMap(); $cbmap->retrieve_entity_info($cbmapid, 'cbMap'); return $cbmap; } else { return null; } }
$smarty->assign('MODULE', $currentModule); // TODO: Update Single Module Instance name here. $smarty->assign('SINGLE_MOD', 'SINGLE_' . $currentModule); $smarty->assign('CATEGORY', $category); $smarty->assign('IMAGE_PATH', "themes/{$theme}/images/"); $smarty->assign('THEME', $theme); if (empty($_REQUEST['record'])) { $smarty->assign('ERROR_MESSAGE', 'Missing Map ID (record)'); $smarty->display('modules/cbMap/testMap.tpl'); die; } $mapid = vtlib_purify($_REQUEST['record']); $focus = new cbMap(); $focus->id = $mapid; $focus->mode = ''; $focus->retrieve_entity_info($mapid, $currentModule); $contentok = processcbMap::isXML(htmlspecialchars_decode($focus->column_fields['content'])); if ($contentok !== true) { $smarty->assign('ERROR_MESSAGE', '<b>Incorrect Content</b><br>' . $contentok); $smarty->display('modules/cbMap/testMap.tpl'); die; } $smarty->assign('ID', $focus->id); $smarty->assign('MODE', $focus->mode); $recordName = array_values(getEntityName($currentModule, $focus->id)); $recordName = $recordName[0]; $smarty->assign('NAME', $recordName); $smarty->assign('UPDATEINFO', updateInfo($focus->id)); $smarty->assign('MAPTYPE', $focus->column_fields['maptype']); $mapinfo = array(); switch ($focus->column_fields['maptype']) {
if (stristr($update_expectedvalue, ':') != '') { $update_expectedvalue_arr = explode(':', $update_expectedvalue); $update_value = $update_expectedvalue_arr[0] . '.' . $update_expectedvalue_arr[1]; } else { $update_value = $update_data[$i]->expectedvalue; } $update_text_expectedvalue = $xml->createTextNode($update_value); $update_expectedvalue_node->appendChild($update_text_expectedvalue); } include_once 'modules/cbMap/cbMap.php'; echo 'teszt'; $map_focus = new cbMap(); $xml->formatOutput = true; echo $xml->saveXML(); $map_focus->id = $mapid; $map_focus->retrieve_entity_info($mapid, 'cbMap'); $map_focus->column_fields['content'] = $xml->saveXML(); $map_focus->mode = "edit"; $map_focus->save('cbMap'); /* //Default parameters $defaultDelimiter = $_POST['delimiterVal']; $rec = $_POST['accid']; if(isset($_POST['orgmodH'])) $orgmod = explode("$$",$_POST['orgmodH']); else $orgmod = explode("$$",$_POST['orgmod']); $orgmodID = $orgmod[0]; //$name = $xml->createElement("name"); $target = $xml->createElement("originmodule");