Exemplo n.º 1
0
 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;
     }
 }
Exemplo n.º 2
0
// 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']) {
    case 'Condition Query':