/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name']; $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name']; $user_name = empty($_REQUEST['user_name']) ? '' : $_REQUEST['user_name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Employees/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('FIRST_NAME', $first_name); $form->assign('LAST_NAME', $last_name); $form->assign('USER_NAME', $user_name); $form->assign('request_data', $request_data); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = BeanFactory::getBean('Employees'); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', 'user_name', 'EMPLOYEE'); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'EMPLOYEE'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
public function testinsert_popup_header() { //execute the method and test if it returns html/JS //with includeJS true, generates more html ob_start(); insert_popup_header(); $renderedContent1 = ob_get_contents(); ob_end_clean(); $this->assertGreaterThan(0, strlen($renderedContent1)); //with includeJS false, generates less html ob_start(); insert_popup_header('', false); $renderedContent2 = ob_get_contents(); ob_end_clean(); $this->assertGreaterThan(0, strlen($renderedContent2)); $this->assertGreaterThan(strlen($renderedContent2), strlen($renderedContent1)); }
function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $current_language; global $current_module_strings; if (!is_file(sugar_cached('jsLanguage/WorkFlow/') . $GLOBALS['current_language'] . '.js')) { require_once 'include/language/jsLanguage.php'; jsLanguage::createModuleStringsCache('WorkFlow', $GLOBALS['current_language']); } $javascript_language_files = getVersionedScript("cache/jsLanguage/WorkFlow/{$GLOBALS['current_language']}.js", $GLOBALS['sugar_config']['js_lang_version']); $current_module_strings = return_module_language($current_language, 'WorkFlowAlertShells'); $ListView = new ListView(); $header_text = ''; if (isset($_REQUEST['workflow_id'])) { $workflow = BeanFactory::getBean('WorkFlow', $_REQUEST['workflow_id']); //TODO GET ALL ALERTS HERE //$focus_alerts_list = $workflow->get_linked_beans('wf_alerts','WorkFlowAlertShell'); $alerts = BeanFactory::getBean('WorkFlowAlertShells'); $current_module_strings = return_module_language($current_language, $alerts->module_dir); insert_popup_header($theme); $ListView->initNewXTemplate('modules/WorkFlowAlertShells/Popup_picker.html', $current_module_strings); $ListView->xTemplateAssign("WORKFLOW_ID", $workflow->id); $ListView->xTemplateAssign("JAVASCRIPT_LANGUAGE_FILES", $javascript_language_files); $ListView->xTemplateAssign("RETURN_URL", "&return_module=" . $currentModule . "&return_action=DetailView&return_id={$workflow->id}"); $ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_EDIT'])); $ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_REMOVE'])); $ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME_COMBO'] . $header_text); //$ListView->setHeaderText($button); //$ListView->setQuery("workflow_alertshells.alert_type = 'Email'","","", "ALERT"); $list = $alerts->get_list("", "workflow_alertshells.alert_type = 'Email'"); $display_list = $this->cullFromList($list['list'], $workflow->base_module, $workflow->type); $ListView->processListViewTwo($display_list, "main", "ALERT"); insert_popup_footer(); } }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $audit; global $current_language; $audit_list = Audit::get_audit_list(); $xtpl = new XTemplate('modules/Audit/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; $mod_strings = return_module_language($current_language, $focus->module_dir); $printImageURL = SugarThemeRegistry::current()->getImageURL('print.gif'); $titleExtra = <<<EOHTML <a href="javascript:void window.open('index.php?{$GLOBALS['request_string']}','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')" class='utilsLink'> <!--not_in_theme!--><img src="{$printImageURL}" alt="{$GLOBALS['app_strings']['LNK_PRINT']}"></a> <a href="javascript:void window.open('index.php?{$GLOBALS['request_string']}','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')" class='utilsLink'> {$GLOBALS['app_strings']['LNK_PRINT']} </a> EOHTML; $params = array(); $params[] = translate('LBL_MODULE_NAME', $focus->module_dir); $params[] = $focus->get_summary_text(); $params[] = translate('LBL_CHANGE_LOG', 'Audit'); echo str_replace('</div>', "<span class='utils'>{$titleExtra}</span></div>", getClassicModuleTitle($focus->module_dir, $params, false)); $oddRow = true; $audited_fields = $focus->getAuditEnabledFieldDefinitions(); asort($audited_fields); $fields = ''; $field_count = count($audited_fields); $start_tag = "<table><tr><td >"; $end_tag = "</td></tr></table>"; if ($field_count > 0) { $index = 0; foreach ($audited_fields as $key => $value) { $index++; $vname = ''; if (isset($value['vname'])) { $vname = $value['vname']; } else { if (isset($value['label'])) { $vname = $value['label']; } } $fields .= str_replace(':', '', translate($vname, $focus->module_dir)); if ($index < $field_count) { $fields .= ", "; } } echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $fields . $end_tag; } else { echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $end_tag; } foreach ($audit_list as $audit) { if (empty($audit['before_value_string']) && empty($audit['after_value_string'])) { $before_value = $audit['before_value_text']; $after_value = $audit['after_value_text']; } else { $before_value = $audit['before_value_string']; $after_value = $audit['after_value_string']; } // Let's run the audit data through the sugar field system if (isset($audit['data_type'])) { require_once 'include/SugarFields/SugarFieldHandler.php'; $vardef = array('name' => 'audit_field', 'type' => $audit['data_type']); $field = SugarFieldHandler::getSugarField($audit['data_type']); $before_value = $field->getChangeLogSmarty(array($vardef['name'] => $before_value), $vardef, array(), $vardef['name']); $after_value = $field->getChangeLogSmarty(array($vardef['name'] => $after_value), $vardef, array(), $vardef['name']); } $activity_fields = array('ID' => $audit['id'], 'NAME' => $audit['field_name'], 'BEFORE_VALUE' => $before_value, 'AFTER_VALUE' => $after_value, 'CREATED_BY' => $audit['created_by'], 'DATE_CREATED' => $audit['date_created']); $xtpl->assign("ACTIVITY", $activity_fields); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("audit.row"); // Put the rows in. } //end foreach $xtpl->parse("audit"); $xtpl->out("audit"); insert_popup_footer(); }
/** * */ function process_page() { global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $timedate; $history_list = array(); if (!empty($_REQUEST['record'])) { $result = $focus->retrieve($_REQUEST['record']); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } } $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note'); //Setup the arrays to store the linked records. foreach ($activitiesRels as $relMod => $beanName) { $varname = "focus_" . $relMod . "_list"; ${$varname} = array(); } foreach ($focus->get_linked_fields() as $field => $def) { if ($focus->load_relationship($field)) { $relTable = $focus->{$field}->getRelatedTableName(); if (in_array($relTable, array_keys($activitiesRels))) { $varname = "focus_" . $relTable . "_list"; ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable])); } } } foreach ($focus_tasks_list as $task) { $sort_date_time = ''; if (empty($task->date_due) || $task->date_due == '0000-00-00') { $date_due = ''; } else { $date_due = $task->date_due; } if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => strtotime($task->fetched_row['date_due'] . ' GMT')); } else { $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']); } } // end Tasks foreach ($focus_meetings_list as $meeting) { if (empty($meeting->contact_id) && empty($meeting->contact_name)) { $meeting_contacts = $meeting->get_linked_beans('contacts', 'Contact'); if (!empty($meeting_contacts[0]->id) && !empty($meeting_contacts[0]->name)) { $meeting->contact_id = $meeting_contacts[0]->id; $meeting->contact_name = $meeting_contacts[0]->name; } } if ($meeting->status != "Planned") { $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($meeting->fetched_row['date_start'] . ' GMT')); } else { $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Meetings foreach ($focus_calls_list as $call) { if (empty($call->contact_id) && empty($call->contact_name)) { $call_contacts = $call->get_linked_beans('contacts', 'Contact'); if (!empty($call_contacts[0]->id) && !empty($call_contacts[0]->name)) { $call->contact_id = $call_contacts[0]->id; $call->contact_name = $call_contacts[0]->name; } } if ($call->status != "Planned") { $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => strtotime($call->fetched_row['date_start'] . ' GMT')); } else { $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Calls foreach ($focus_emails_list as $email) { if (empty($email->contact_id) && empty($email->contact_name)) { $email_contacts = $email->get_linked_beans('contacts', 'Contact'); if (!empty($email_contacts[0]->id) && !empty($email_contacts[0]->name)) { $email->contact_id = $email_contacts[0]->id; $email->contact_name = $email_contacts[0]->name; } } $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT')); } //end Emails // Bug 46439 'No email archived when clicking on View Summary' (All condition) if (method_exists($focus, 'get_unlinked_email_query')) { $queryArray = $focus->get_unlinked_email_query(array('return_as_array' => 'true')); $query = $queryArray['select']; $query .= $queryArray['from']; if (!empty($queryArray['join_tables'])) { foreach ($queryArray['join_tables'] as $join_table) { if ($join_table != '') { $query .= ', ' . $join_table . ' '; } } } $query .= $queryArray['join']; $query .= $queryArray['where']; $emails = new Email(); $focus_unlinked_emails_list = $emails->process_list_query($query, 0); $focus_unlinked_emails_list = $focus_unlinked_emails_list['list']; foreach ($focus_unlinked_emails_list as $email) { $email->retrieve($email->id); $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => strtotime($email->fetched_row['date_sent'] . ' GMT')); } } //end Unlinked Emails foreach ($focus_notes_list as $note) { $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => strtotime($note->fetched_row['date_modified'] . ' GMT')); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id); } } // end Notes $xtpl = new XTemplate('modules/Activities/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header(); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; echo getClassicModuleTitle($focus->module_dir, array(translate('LBL_MODULE_NAME', $focus->module_dir), $focus->name), false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; if (count($history_list) > 0) { $history_list = array_csort($history_list, 'sort_value', SORT_DESC); } foreach ($history_list as $activity) { $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) { $activity_fields['LOCATION'] = $activity['location']; } if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>"; } if (isset($activity['parent_type'])) { $activity_fields['PARENT_MODULE'] = $activity['parent_type']; } $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"')); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; if (!empty($activity_fields['DESCRIPTION'])) { $xtpl->parse("history.row.description"); } $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); insert_popup_footer(); }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $app_list_strings, $sugar_version, $sugar_config; $output_html = "<script type=\"text/javascript\" src=\"" . getJSPath('include/javascript/sugar_3.js') . "\"></script>"; $where = ''; if (empty($_REQUEST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'])) { $_POST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'] = ''; } if (empty($_REQUEST['saved_associated_data'])) { $_POST['saved_associated_data'] = ''; } $where = $this->_get_where_clause(); // CREATE STUFF if ($this->_create) { $formBase = new $this->_popupMeta['create']['formBaseClass'](); if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') { $formBase->handleSave('', false, true); } $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE']; $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY']; $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL']; // TODO: cleanup the construction of $addform $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0]; $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1]; $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2]; $getFormMethod = empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod']; $formbody = $formBase->{$getFormMethod}($prefix, $mod, $formBody); $addform = '<table><tr><td nowrap="nowrap" valign="top">' . str_replace('<br>', '</td><td nowrap="nowrap" valign="top"> ', $formbody) . '</td></tr></table>' . '<input type="hidden" name="action" value="Popup" />'; $formSave = <<<EOQ \t\t\t<input type="hidden" name="create" value="true"> \t\t\t<input type="hidden" name="popup" value="true"> \t\t\t<input type="hidden" name="to_pdf" value="true"> \t\t\t<input type="hidden" name="return_module" value="{$currentModule}"> \t\t\t<input type="hidden" name="return_action" value="Popup"> \t\t\t<input type="submit" name="button" class="button" title="{$lbl_save_button_title}" value=" {$lbl_save_button_label} " /> \t\t\t<input type="button" name="button" class="button" title="{$app_strings['LBL_CANCEL_BUTTON_TITLE']}" accesskey="{$app_strings['LBL_CANCEL_BUTTON_KEY']}" value="{$app_strings['LBL_CANCEL_BUTTON_LABEL']}" onclick="toggleDisplay('addform');" /> EOQ; // if metadata contains custom inputs for the quickcreate if (!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) { foreach ($this->_popupMeta['customInput'] as $key => $value) { $formSave .= '<input type="hidden" name="' . $key . '" value="' . $value . '">\\n'; } } $createButtonTranslation = translate($this->_popupMeta['create']['createButton']); $createButton = <<<EOQ \t\t\t<input type="button" id="showAdd" name="showAdd" class="button" value="{$createButtonTranslation}" onclick="toggleDisplay('addform');" /> EOQ; $addformheader = get_form_header($createButtonTranslation, $formSave, false); } // END CREATE STUFF // search request inputs $searchInputs = array(); foreach ($this->_popupMeta['searchInputs'] as $input) { $searchInputs[$input] = empty($_REQUEST[$input]) ? '' : $_REQUEST[$input]; } $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) && empty($this->_hide_clear_button) ? false : true; $button = '<script>eval("var request_data = " + window.document.forms[\'popup_query_form\'].request_data.value);</script>'; if (isset($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $button .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='hidden' name='mode' value='MultiSelect'>"; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; if (isset($this->_popupMeta['templateForm'])) { $form = new XTemplate($this->_popupMeta['templateForm']); } else { $form = new XTemplate('modules/' . $currentModule . '/Popup_picker.html'); } $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('request_data', $request_data); // CREATE STUFF if ($this->_create) { $form->assign('CREATEBUTTON', $createButton); $form->assign('ADDFORMHEADER', $addformheader); $form->assign('ADDFORM', $addform); } // CREATE STUFF if (isset($this->_popupMeta['className'])) { $seed_bean = new $this->_popupMeta['className'](); } else { $seed_bean = new $this->_popupMeta['moduleMain'](); } // assign search inputs to xtemplates foreach (array_keys($searchInputs) as $key) { if (!empty($_REQUEST[$key]) && (isset($seed_bean->field_name_map[$key]['type']) && $seed_bean->field_name_map[$key]['type'] == 'bool')) { $form->assign(strtoupper($key), ' checked '); } else { $form->assign(strtoupper($key), $searchInputs[$key]); } } if ($this->_create) { $form->assign('CREATE', 'true'); } else { $form->assign('CREATE', 'false'); } // fill any doms if (isset($this->_popupMeta['selectDoms'])) { foreach ($this->_popupMeta['selectDoms'] as $key => $value) { $form->assign($key, get_select_options_with_id($app_list_strings[$value['dom']], $value['searchInput'])); } } $form->assign('MULTI_SELECT', !empty($_REQUEST['mode']) ? strtoupper($_REQUEST['mode']) : ''); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); $ListView = new ListView(); $ListView->show_select_menu = false; $ListView->show_delete_button = false; $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; $ListView->xTemplate->assign('TAG_TYPE', 'A'); if (isset($this->_popupMeta['listTitle'])) { $ListView->setHeaderTitle($this->_popupMeta['listTitle']); } else { $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); } $ListView->setHeaderText($button); $ListView->setQuery($where, '', $this->_popupMeta['orderBy'], $this->_popupMeta['varName']); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', $this->_popupMeta['varName']); $output_html .= ob_get_contents(); ob_end_clean(); $json = getJSONobj(); // decode then encode to escape "'s $output_html .= "</form>\n\t\t<script type=\"text/javascript\">\n\t\tfunction save_checks(offset) {\n\t\t\tchecked_ids = Array();\n\t\t\tfor (i = 0; i < document.MassUpdate.elements.length; i++){\n\t\t\t\tif(document.MassUpdate.elements[i].name == 'mass[]' && document.MassUpdate.elements[i].checked) {\n\t\t\t\t\ttemp_string = '';\n\t\t\t\t\ttemp_string += '\"' + document.MassUpdate.elements[i].value + '\": {';\n\t\t\t\t\tfor(the_key in associated_javascript_data[document.MassUpdate.elements[i].value]) {\n\t\t\t\t\t\ttemp_string += '\"' + the_key + '\":\"' + associated_javascript_data[document.MassUpdate.elements[i].value][the_key] + '\",'; \n\t\t\t\t\t}\n\t\t\t\t\ttemp_string = temp_string.substring(0,temp_string.length - 1);\n\t\t\t\t\ttemp_string += '}';\n\t\t\t\t\tchecked_ids.push(temp_string);\n\t\t\t\t}\t\t\t\t \n\t\t\t}\n\t\t\tdocument.MassUpdate.saved_associated_data.value = escape('{' + checked_ids.join(',') + '}');\n\n\t\t\tdocument.MassUpdate.action.value = \"Popup\";\n\t\t\tdocument.MassUpdate.{$currentModule}" . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset.value = offset; document.MassUpdate.submit(); } // reassigned the saved data from the saved checks if(typeof(document.MassUpdate) != \'undefined\' && document.MassUpdate.saved_associated_data.value != \'\') { temp_array = ' . (!empty($_REQUEST['saved_associated_data']) ? $json->encode($json->decode(urldecode($_REQUEST['saved_associated_data']))) : '\'\'') . '; for(the_key in temp_array) { associated_javascript_data[the_key] = temp_array[the_key]; } } // save checks across pages for multiselects if(typeof(document.MassUpdate) != "undefined") { checked_items = Array(); inputs_array = document.MassUpdate.elements; for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].style.display == "none") { checked_items.push(inputs_array[wp].value); } } for(i in checked_items) { for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].value == checked_items[i]) { inputs_array[wp].checked = true; } } } } </script>'; $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page_for_address() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $image_path = 'themes/' . $theme . '/images/'; $formBase = new ContactFormBase(); if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') { $formBase->handleSave('', false, true); } $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name']; $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name']; $account_name = empty($_REQUEST['account_name']) ? '' : $_REQUEST['account_name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE']; $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY']; $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL']; // TODO: cleanup the construction of $addform $formbody = $formBase->getFormBody('', '', 'EmailEditView'); $addform = '<table><tr><td nowrap="nowrap" valign="top">' . str_replace('<br>', '</td><td nowrap="nowrap" valign="top"> ', $formbody) . '</td></tr></table>' . '<input type="hidden" name="action" value="Popup" />'; $formSave = <<<EOQ \t\t<input type="submit" name="button" class="button" title="{$lbl_save_button_title}" accesskey="{$lbl_save_button_key}" value=" {$lbl_save_button_label} " /> \t\t<input type="button" name="button" class="button" title="{$app_strings['LBL_CANCEL_BUTTON_TITLE']}" accesskey="{$app_strings['LBL_CANCEL_BUTTON_KEY']}" value="{$app_strings['LBL_CANCEL_BUTTON_LABEL']}" onclick="toggleDisplay('addform');" /> EOQ; $createContact = <<<EOQ \t\t<input type="button" name="showAdd" class="button" value="{$mod_strings['LNK_NEW_CONTACT']}" onclick="toggleDisplay('addform');" /> EOQ; $addformheader = get_form_header($mod_strings['LNK_NEW_CONTACT'], $formSave, false); $button = "<form action='index.php' method='post' name='form' id='form'>\n"; if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Contacts/Address_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); //$form->assign('CREATECONTACT', $createContact); $form->assign('ADDFORMHEADER', $addformheader); $form->assign('ADDFORM', $addform); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('FIRST_NAME', $first_name); $form->assign('LAST_NAME', $last_name); $form->assign('ACCOUNT_NAME', $account_name); $form->assign('request_data', $request_data); // fill in for mass update $button = "<input type='hidden' name='module' value='Contacts'><input type='hidden' id='form_action' name='action' value='index'><input type='hidden' name='massupdate' value='true'><input type='hidden' name='delete' value='false'><input type='hidden' name='mass' value='Array'><input type='hidden' name='Update' value='Update'>"; if (isset($_REQUEST['mass']) && is_array($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $button .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } $button .= "<input type='hidden' name='saved_associated_data' value=''>"; $button .= "<input type='hidden' name='query' value='true'>"; $button .= "<input type='hidden' name='close_window' value='true'>"; $button .= "<input type='hidden' name='html' value='change_address'>"; $button .= "<input type='hidden' name='account_name' value='{$account_name}'>"; $button .= "<span style='display: none'><textarea name='primary_address_street'>" . str_replace("<br>", "\n", $_REQUEST["primary_address_street"]) . "</textarea></span>"; $button .= "<input type='hidden' name='primary_address_city' value='" . $_REQUEST["primary_address_city"] . "'>"; $button .= "<input type='hidden' name='primary_address_state' value='" . $_REQUEST["primary_address_state"] . "'>"; $button .= "<input type='hidden' name='primary_address_postalcode' value='" . $_REQUEST["primary_address_postalcode"] . "'>"; $button .= "<input type='hidden' name='primary_address_country' value='" . $_REQUEST["primary_address_country"] . "'>"; $button .= "<input type='hidden' name='Contacts_CONTACT_offset' value=''>"; $button .= "<input title='" . $mod_strings['LBL_COPY_ADDRESS_CHECKED'] . "' class='button' LANGUAGE=javascript type='submit' name='button' value=' " . $mod_strings['LBL_COPY_ADDRESS_CHECKED'] . " '>\n"; $button .= "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " '>\n"; ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); //$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); //$form->parse('main.SearchHeader'); //$output_html .= $form->text('main.SearchHeader'); $output_html .= get_form_footer(); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Contact(); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', '', 'CONTACT'); $ListView->setModStrings($mod_strings); // Added $ListView->process_for_popups = true; ob_start(); $ListView->processListViewMulti($seed_bean, 'main', 'CONTACT'); $output_html .= ob_get_contents(); ob_end_clean(); // The following is a regular expression filter that will convert the nested <a>...</a> tags // for the Next and Previous button links. The regular expression has 7 placeholder fields // Given sample HTML as follows /* ------------------------------------- <a href="/maint_4_5_0/index.php?module=Contacts&action=Popup&query=true&account_name=360 Vacations 723351&html=change_address&primary_address_street=111 Silicon Valley Road&primary_address_city=Ohio&primary_address_state=CA&primary_address_postalcode=53430&primary_address_country=USA&mode=undefined&create=undefined&metadata=undefined&Contacts_CONTACT_offset=20" onclick="javascript:return sListView.save_checks(20, \'Contacts_CONTACT_offset\')" class="listViewPaginationLinkS1">Next <img src=\'themes/GoldenGate/images/next.gif\' width=\'8\' height=\'11\' alt=\'Next\' border=\'0\' align=\'absmiddle\'></a> <a href="/maint_4_5_0/index.php?module=Contacts&action=Popup&query=true&account_name=360 Vacations 723351&html=change_address&primary_address_street=111 Silicon Valley Road&primary_address_city=Ohio&primary_address_state=CA&primary_address_postalcode=53430&primary_address_country=USA&mode=undefined&create=undefined&metadata=undefined&Contacts_CONTACT_offset=-100" onclick="javascript:return sListView.save_checks(980, \'Contacts_CONTACT_offset\')" class="listViewPaginationLinkS1">End <img src=\'themes/GoldenGate/images/end.gif\' width=\'13\' height=\'11\' alt=\'End\' border=\'0\' align=\'absmiddle\'> </a> -------------------------------------- The resulting preg_replace call should create Array of matches: [1] => Array ( [0] => 20 ) [2] => Array ( [0] => Next ) [3] => Array ( [0] => <img src='themes/GoldenGate/images/next.gif' width='8' height='11' alt='Next' border='0' align='absmiddle'> ) [4] => Array ( [0] => ) [5] => Array ( [0] => 980 ) [6] => Array ( [0] => End ) [7] => Array ( [0] => <img src='themes/GoldenGate/images/end.gif' width='13' height='11' alt='End' border='0' align='absmiddle'> ) */ $exp = '/<a.*?checks\\((\\d+),.*?>(.*?)(<img.*>).*<\\/a>(.*?)<a.*?checks\\((\\d+),.*?>(.*?)(<img.*>).*<\\/a>/Ui'; $change = '<a class="listViewPaginationLinkS1" onclick="javascript:save_checks(${1}, \'Contacts_CONTACT_offset\');" href="#"> ${2}${3}</a>${4}<a class="listViewPaginationLinkS1" onclick="javascript:save_checks(${5}, \'Contacts_CONTACT_offset\');" href="#">${6}${7}</a>'; $output_html = preg_replace(array($exp), array($change), $output_html); $output_html .= '<script> checked_items = Array(); inputs_array = document.MassUpdate.elements; for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].style.display == "none") { checked_items.push(inputs_array[wp].value); } } for(i in checked_items) { for(wp = 0 ; wp < inputs_array.length; wp++) { if(inputs_array[wp].name == "mass[]" && inputs_array[wp].value == checked_items[i]) { inputs_array[wp].checked = true; } } } </script>'; $output_html .= get_form_footer(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $status = empty($_REQUEST['status']) ? '' : $_REQUEST['status']; $campaign_type = empty($_REQUEST['campaign_type']) ? '' : $_REQUEST['campaign_type']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Prospects',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Campaigns/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('request_data', $request_data); $form->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['campaign_type_dom'], "")); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Campaign(); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; //FOR MULTI-SELECT $ListView->xTemplate->assign("TAG_TYPE", "A"); //FOR MULTI-SELECT $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); //FOR MULTI-SELECT $ListView->setHeaderText($button); //FOR MULTI-SELECT $ListView->setQuery($where, '', 'name', 'CAMPAIGN'); $ListView->setModStrings($mod_strings); ob_start(); //$output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT $ListView->processListView($seed_bean, 'main', 'CAMPAIGN'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
function display() { global $popupMeta, $mod_strings; if ($this->bean instanceof SugarBean && !$this->bean->ACLAccess('list')) { ACLController::displayNoAccess(); sugar_cleanup(true); } if (isset($_REQUEST['metadata']) && strpos($_REQUEST['metadata'], "..") !== false) { die("Directory navigation attack denied."); } if (!empty($_REQUEST['metadata']) && $_REQUEST['metadata'] != 'undefined' && file_exists('custom/modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php')) { require 'custom/modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php'; } elseif (!empty($_REQUEST['metadata']) && $_REQUEST['metadata'] != 'undefined' && file_exists('modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php')) { require 'modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php'; } elseif (file_exists('custom/modules/' . $this->module . '/metadata/popupdefs.php')) { require 'custom/modules/' . $this->module . '/metadata/popupdefs.php'; } elseif (file_exists('modules/' . $this->module . '/metadata/popupdefs.php')) { require 'modules/' . $this->module . '/metadata/popupdefs.php'; } if (!empty($popupMeta) && !empty($popupMeta['listviewdefs'])) { if (is_array($popupMeta['listviewdefs'])) { //if we have an array, then we are not going to include a file, but rather the //listviewdefs will be defined directly in the popupdefs file $listViewDefs[$this->module] = $popupMeta['listviewdefs']; } else { //otherwise include the file require_once $popupMeta['listviewdefs']; } } elseif (file_exists('custom/modules/' . $this->module . '/metadata/listviewdefs.php')) { require_once 'custom/modules/' . $this->module . '/metadata/listviewdefs.php'; } elseif (file_exists('modules/' . $this->module . '/metadata/listviewdefs.php')) { require_once 'modules/' . $this->module . '/metadata/listviewdefs.php'; } //check for searchdefs as well if (!empty($popupMeta) && !empty($popupMeta['searchdefs'])) { if (is_array($popupMeta['searchdefs'])) { //if we have an array, then we are not going to include a file, but rather the //searchdefs will be defined directly in the popupdefs file $searchdefs[$this->module]['layout']['advanced_search'] = $popupMeta['searchdefs']; } else { //otherwise include the file require_once $popupMeta['searchdefs']; } } else { if (empty($searchdefs) && file_exists('custom/modules/' . $this->module . '/metadata/searchdefs.php')) { require_once 'custom/modules/' . $this->module . '/metadata/searchdefs.php'; } else { if (empty($searchdefs) && file_exists('modules/' . $this->module . '/metadata/searchdefs.php')) { require_once 'modules/' . $this->module . '/metadata/searchdefs.php'; } } } //if you click the pagination button, it will populate the search criteria here if (!empty($this->bean) && isset($_REQUEST[$this->module . '2_' . strtoupper($this->bean->object_name) . '_offset'])) { if (!empty($_REQUEST['current_query_by_page'])) { $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); $current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page'])); foreach ($current_query_by_page as $search_key => $search_value) { if ($search_key != $this->module . '2_' . strtoupper($this->bean->object_name) . '_offset' && !in_array($search_key, $blockVariables)) { if (!is_array($search_value)) { $_REQUEST[$search_key] = securexss($search_value); } else { foreach ($search_value as $key => &$val) { $val = securexss($val); } $_REQUEST[$search_key] = $search_value; } } } } } if (!empty($listViewDefs) && !empty($searchdefs)) { require_once 'include/Popups/PopupSmarty.php'; $displayColumns = array(); $filter_fields = array(); $popup = new PopupSmarty($this->bean, $this->module); foreach ($listViewDefs[$this->module] as $col => $params) { $filter_fields[strtolower($col)] = true; if (!empty($params['related_fields'])) { foreach ($params['related_fields'] as $field) { //id column is added by query construction function. This addition creates duplicates //and causes issues in oracle. #10165 if ($field != 'id') { $filter_fields[$field] = true; } } } if (!empty($params['default']) && $params['default']) { $displayColumns[$col] = $params; } } $popup->displayColumns = $displayColumns; $popup->filter_fields = $filter_fields; $popup->mergeDisplayColumns = true; //check to see if popupdefs contains searchdefs $popup->_popupMeta = $popupMeta; $popup->listviewdefs = $listViewDefs; $popup->searchdefs = $searchdefs; if (isset($_REQUEST['query'])) { $popup->searchForm->populateFromRequest(); } $massUpdateData = ''; if (isset($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $massUpdateData .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } $popup->massUpdateData = $massUpdateData; $tpl = 'include/Popups/tpls/PopupGeneric.tpl'; if (file_exists($this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupGeneric.tpl"))) { $tpl = $this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupGeneric.tpl"); } if (file_exists($this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupHeader.tpl"))) { $popup->headerTpl = $this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupHeader.tpl"); } if (file_exists($this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupFooter.tpl"))) { $popup->footerTpl = $this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupFooter.tpl"); } $popup->setup($tpl); //We should at this point show the header and javascript even if to_pdf is true. //The insert_popup_header javascript is incomplete and shouldn't be relied on. if (isset($this->options['show_all']) && $this->options['show_all'] == false) { unset($this->options['show_all']); $this->options['show_javascript'] = true; $this->options['show_header'] = true; $this->_displayJavascript(); } insert_popup_header(null, false); if (isset($this->override_popup['template_data']) && is_array($this->override_popup['template_data'])) { $popup->th->ss->assign($this->override_popup['template_data']); } echo $popup->display(); } else { if (file_exists('modules/' . $this->module . '/Popup_picker.php')) { require_once 'modules/' . $this->module . '/Popup_picker.php'; } else { require_once 'include/Popups/Popup_picker.php'; } $popup = new Popup_Picker(); $popup->_hide_clear_button = true; echo $popup->process_page(); } }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; global $app_list_strings; global $sugar_config; $b_from_documents = false; if (isset($_REQUEST['caller']) && $_REQUEST['caller'] == 'Documents') { $b_from_documents = true; } //initalize template $form = new XTemplate('modules/Documents/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); //tree header. $doctree = new Tree('doctree'); $doctree->set_param('module', 'Documents'); if ($b_from_documents) { $doctree->set_param('caller', 'Documents'); $href_string = "javascript:populate_parent_search('doctree')"; } else { $href_string = "javascript:populate_search('doctree')"; } $nodes = get_category_nodes($href_string); foreach ($nodes as $node) { $doctree->add_node($node); } $form->assign("TREEHEADER", $doctree->generate_header()); $form->assign("TREEINSTANCE", $doctree->generate_nodes_array()); $site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n"; $form->assign("SITEURL", $site_data); $form->parse('main.SearchHeader.TreeView'); $treehtml = $form->text('main.SearchHeader.TreeView'); $form->reset('main.SearchHeader.TreeView'); //end tree if (isset($_REQUEST['caller']) && $_REQUEST['caller'] == 'Documents') { ///process treeview and return. return insert_popup_header($theme) . $treehtml . insert_popup_footer(); } ////////////////////////process full search form and list view.////////////////////////////// $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $document_name = empty($_REQUEST['document_name']) ? '' : $_REQUEST['document_name']; $category_id = empty($_REQUEST['category_id']) ? '' : $_REQUEST['category_id']; $subcategory_id = empty($_REQUEST['subcategory_id']) ? '' : $_REQUEST['subcategory_id']; $template_type = empty($_REQUEST['template_type']) ? '' : $_REQUEST['template_type']; $is_template = empty($_REQUEST['is_template']) ? '' : $_REQUEST['is_template']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form->assign('NAME', $name); $form->assign('DOCUMENT_NAME', $document_name); $form->assign('request_data', $request_data); $form->assign("CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_category_dom'], $category_id)); $form->assign("SUB_CATEGORY_OPTIONS", get_select_options_with_id($app_list_strings['document_subcategory_dom'], $subcategory_id)); $form->assign("IS_TEMPLATE_OPTIONS", get_select_options_with_id($app_list_strings['checkbox_dom'], $is_template)); $form->assign("TEMPLATE_TYPE_OPTIONS", get_select_options_with_id($app_list_strings['document_template_type_dom'], $template_type)); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); //add tree view to output_html. $output_html .= $treehtml; // create the listview $seed_bean = new Document(); $ListView = new ListView(); $ListView->show_select_menu = false; $ListView->show_delete_button = false; $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setHeaderText($button); $ListView->setQuery($where, '', 'document_name', 'DOCUMENT'); $ListView->setModStrings($mod_strings); ob_start(); $ListView->processListView($seed_bean, 'main', 'DOCUMENT'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $audit; global $current_language; $audit_list = Audit::get_audit_list(); $xtpl = new XTemplate('modules/Audit/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; $focus_mod_strings = return_module_language($current_language, $focus->module_dir); echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; $audited_fields = $focus->getAuditEnabledFieldDefinitions(); asort($audited_fields); $fields = ''; $field_count = count($audited_fields); $start_tag = "<table><tr><td >"; $end_tag = "</td></tr></table>"; if ($field_count > 0) { $index = 0; foreach ($audited_fields as $key => $value) { $index++; $vname = ''; if (isset($value['vname'])) { $vname = $value['vname']; } else { if (isset($value['label'])) { $vname = $value['label']; } } $fields .= str_replace(':', '', translate($vname, $focus->module_dir)); if ($index < $field_count) { $fields .= ", "; } } echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $fields . $end_tag; } else { echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $end_tag; } foreach ($audit_list as $audit) { if (empty($audit['before_value_string']) && empty($audit['after_value_string'])) { $before_value = $audit['before_value_text']; $after_value = $audit['after_value_text']; } else { $before_value = $audit['before_value_string']; $after_value = $audit['after_value_string']; } $activity_fields = array('ID' => $audit['id'], 'NAME' => $audit['field_name'], 'BEFORE_VALUE' => $before_value, 'AFTER_VALUE' => $after_value, 'CREATED_BY' => $audit['created_by'], 'DATE_CREATED' => $audit['date_created']); $xtpl->assign("ACTIVITY", $activity_fields); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("audit.row"); // Put the rows in. } //end foreach $xtpl->parse("audit"); $xtpl->out("audit"); insert_popup_footer(); }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $image_path; $theme_path = "themes/" . $theme . "/"; $image_path = 'themes/' . $theme . '/images/'; require_once $theme_path . 'layout_utils.php'; $history_list = array(); if (!empty($_REQUEST['record'])) { $result = $focus->retrieve($_REQUEST['record']); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } } if ($focus->object_name == "ProjectTask" || $focus->object_name == "Project") { $focus_tasks_list = array(); } else { $focus_tasks_list = $focus->get_linked_beans('tasks', 'Task'); } $focus_meetings_list = $focus->get_linked_beans('meetings', 'Meeting'); $focus_calls_list = $focus->get_linked_beans('calls', 'Call'); $focus_emails_list = $focus->get_linked_beans('emails', 'Email'); $focus_notes_list = $focus->get_linked_beans('notes', 'Note'); foreach ($focus_tasks_list as $task) { if ($task->date_due == '0000-00-00') { $date_due = ''; } else { $date_due = $task->date_due; } if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:'); } else { $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => 'Due:'); } } // end Tasks foreach ($focus_meetings_list as $meeting) { if ($meeting->status != "Planned") { $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:'); } else { $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => 'Start:'); } } // end Meetings foreach ($focus_calls_list as $call) { if ($call->status != "Planned") { $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:'); } else { $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => 'Start:'); } } // end Calls foreach ($focus_emails_list as $email) { $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => 'Sent:'); } //end Emails foreach ($focus_notes_list as $note) { $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => 'Modified:'); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id); } } // end Notes $xtpl = new XTemplate('modules/Activities/Popup_picker.html'); $xtpl->assign('THEME', $theme); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; echo get_module_title($focus->module_dir, $focus->module_dir . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . $image_path . "print.gif' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; if (count($history_list) > 0) { $history_list = array_csort($history_list, 'date_modified', SORT_DESC); } foreach ($history_list as $activity) { $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) { $activity_fields['LOCATION'] = $activity['location']; } if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "<a href='" . $activity['fileurl'] . "' target='_blank'>" . get_image($image_path . "attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>"; } if (isset($activity['parent_type'])) { $activity_fields['PARENT_MODULE'] = $activity['parent_type']; } $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", get_image($image_path . $activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"')); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); insert_popup_footer(); }
/** * */ function process_page() { global $theme; global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $image_path; global $audit; global $current_language; global $sugar_version; $theme_path = "themes/" . $theme . "/"; $image_path = 'themes/' . $theme . '/images/'; if (floatval(substr($sugar_version, 0, 3)) < 6.0) { require_once $theme_path . 'layout_utils.php'; } else { require_once 'include/utils/layout_utils.php'; } $audit_list = Audit::get_audit_list(); $xtpl = new XTemplate('modules/Audit/Popup_picker.html'); $xtpl->assign('THEME', $theme); $xtpl->assign('MOD', return_module_language($current_language, 'Audit')); $xtpl->assign('APP', $app_strings); insert_popup_header($theme); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; $focus_mod_strings = return_module_language($current_language, $focus->module_dir); echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . $image_path . "print.gif' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; $audited_fields = $focus->getAuditEnabledFieldDefinitions(); asort($audited_fields); $fields = ''; $field_count = count($audited_fields); $start_tag = "<table><tr><td class=\"listViewPaginationLinkS1\">"; $end_tag = "</td></tr></table>"; if ($field_count > 0) { $index = 0; foreach ($audited_fields as $key => $value) { $index++; $vname = ''; if (isset($value['vname'])) { $vname = $value['vname']; } else { if (isset($value['label'])) { $vname = $value['label']; } } $fields .= str_replace(':', '', translate($vname, $focus->module_dir)); if ($index < $field_count) { $fields .= ", "; } } echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $fields . $end_tag; } else { echo $start_tag . translate('LBL_AUDITED_FIELDS', 'Audit') . $end_tag; } foreach ($audit_list as $audit) { if (isset($audit['before_value_string']) || isset($audit['after_value_string'])) { $before_value = $audit['before_value_string']; $after_value = $audit['after_value_string']; } else { // show textblocks correctly formatted. // TODO: be careful of security implications $before_value = from_html($audit['before_value_text']); $after_value = from_html($audit['after_value_text']); } $activity_fields = array('ID' => $audit['id'], 'NAME' => $audit['field_name'], 'BEFORE_VALUE' => $before_value, 'AFTER_VALUE' => $after_value, 'CREATED_BY' => $audit['created_by'], 'DATE_CREATED' => $audit['date_created']); $xtpl->assign("ACTIVITY", $activity_fields); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("audit.row"); // Put the rows in. } //end foreach $xtpl->parse("audit"); $xtpl->out("audit"); insert_popup_footer(); }
function process_page() { global $mod_strings, $app_strings, $currentModule, $seed_object, $sugar_version, $sugar_config; $focus = BeanFactory::getBean('ProductCategories'); if (!isset($_REQUEST['html'])) { $xtpl = new XTemplate('modules/ProductCategories/Popup_picker.html'); $GLOBALS['log']->debug("using file modules/ProductCategories/Popup_picker1.html"); } else { $_REQUEST['html'] = preg_replace("/[^a-zA-Z0-9_]/", "", $_REQUEST['html']); $GLOBALS['log']->debug("_REQUEST['html'] is " . $_REQUEST['html']); $xtpl = new XTemplate('modules/ProductCategories/' . $_REQUEST['html'] . '.html'); $GLOBALS['log']->debug("using file modules/ProductCategories/" . $_REQUEST['html'] . '.html'); } insert_popup_header(); //tree header. $prodcattree = new Tree('productcategories'); $prodcattree->set_param('module', 'ProductCategories'); $parents = array(); if (!empty($_REQUEST['parent_category_id'])) { $parents = $this->find_parents($_REQUEST['parent_category_id']); } $nodes = get_product_categories(null, $parents); foreach ($nodes as $node) { $prodcattree->add_node($node); } $xtpl->assign("TREEHEADER", $prodcattree->generate_header()); $xtpl->assign("TREEINSTANCE", $prodcattree->generate_nodes_array()); $xtpl->assign("MODULE_NAME", $currentModule); global $sugar_config; $site_data = "<script> var site_url= {\"site_url\":\"" . getJavascriptSiteURL() . "\"};</script>\n"; $xtpl->assign("SITEURL", $site_data); if (!empty($_REQUEST['form']) && $_REQUEST['form'] == 'EditView') { $the_javascript = "<script type='text/javascript' language='JavaScript'>\n"; $the_javascript .= "function set_return(treeid) { \n"; $the_javascript .= " node=YAHOO.namespace(treeid).selectednode;"; $the_javascript .= " window.opener.document.EditView.parent_id.value = node.data.id;\n"; $the_javascript .= " window.opener.document.EditView.parent_name.value = node.label;\n"; $the_javascript .= " window.close();\n"; $the_javascript .= "}\n"; $the_javascript .= "</script>\n"; $clear_button = "<input title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"window.opener.document.EditView.parent_id.value = '';window.opener.document.EditView.parent_name.value = ''; window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " '>\n"; $cancel_button = "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accessKey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " '>\n"; } if (empty($_REQUEST['form']) || $_REQUEST['form'] == 'EditView' && $_REQUEST['tree'] == 'ProdCat') { $seed_object->show_products = FALSE; $the_javascript = <<<END <script type='text/javascript' language='JavaScript'> var field_id = null; var field_name = null; function set_return(treeid) { if(typeof treeid != 'undefined') { node=YAHOO.namespace(treeid).selectednode; } else { node = {'data': {'id': ''}, 'label': ''}; } if (typeof window.opener.document.forms.search_form != 'undefined' || window.opener.document.forms.popup_query_form != 'undefined') { // Search var form = (typeof window.opener.document.forms.search_form != 'undefined') ? window.opener.document.forms.search_form : window.opener.document.forms.popup_query_form; var searchType = (typeof form.searchFormTab != 'undefined' && form.searchFormTab.value == 'basic_search') ? 'basic' : 'advanced'; field_id = form['category_id_' + searchType]; field_name = form['category_name_' + searchType]; } else if(typeof window.opener.document.ReportsWizardForm != 'undefined') { // reports field_id = window.opener.document.ReportsWizardForm['ProductCategories:name:id:1']; field_name = window.opener.document.ReportsWizardForm['ProductCategories:name:name:1']; } else if(typeof window.opener.document.EditView != 'undefined') { field_id = window.opener.document.EditView.category_id; field_name = window.opener.document.EditView.category_name; } if(field_id != null && field_name != null) { field_id.value = node.data.id; field_name.value = node.label; } window.close(); } </script> END; $clear_button = "<input title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"set_return()\" type='submit' name='button' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " '>\n"; $cancel_button = "<input title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' class='button' LANGUAGE=javascript onclick=\"window.close()\" type='submit' name='button' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " '>\n"; } $xtpl->assign("SET_RETURN_JS", $the_javascript); $xtpl->assign("CLEAR_BUTTON", $clear_button); $xtpl->assign("CANCEL_BUTTON", $cancel_button); $xtpl->parse('main'); $xtpl->out('main'); }
function display() { global $popupMeta, $mod_strings; if (isset($_REQUEST['metadata']) && strpos($_REQUEST['metadata'], "..") !== false) { die("Directory navigation attack denied."); } if (!empty($_REQUEST['metadata']) && $_REQUEST['metadata'] != 'undefined' && file_exists('modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php')) { // if custom metadata is requested require_once 'modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php'; } elseif (file_exists('custom/modules/' . $this->module . '/metadata/popupdefs.php')) { require_once 'custom/modules/' . $this->module . '/metadata/popupdefs.php'; } elseif (file_exists('modules/' . $this->module . '/metadata/popupdefs.php')) { require_once 'modules/' . $this->module . '/metadata/popupdefs.php'; } if (!empty($popupMeta) && !empty($popupMeta['listviewdefs'])) { if (is_array($popupMeta['listviewdefs'])) { //if we have an array, then we are not going to include a file, but rather the //listviewdefs will be defined directly in the popupdefs file $listViewDefs[$this->module] = $popupMeta['listviewdefs']; } else { //otherwise include the file require_once $popupMeta['listviewdefs']; } } elseif (file_exists('custom/modules/' . $this->module . '/metadata/listviewdefs.php')) { require_once 'custom/modules/' . $this->module . '/metadata/listviewdefs.php'; } elseif (file_exists('modules/' . $this->module . '/metadata/listviewdefs.php')) { require_once 'modules/' . $this->module . '/metadata/listviewdefs.php'; } //check for searchdefs as well if (!empty($popupMeta) && !empty($popupMeta['searchdefs'])) { if (is_array($popupMeta['searchdefs'])) { //if we have an array, then we are not going to include a file, but rather the //searchdefs will be defined directly in the popupdefs file $searchdefs[$this->module]['layout']['advanced_search'] = $popupMeta['searchdefs']; } else { //otherwise include the file require_once $popupMeta['searchdefs']; } } else { if (empty($searchdefs) && file_exists('modules/' . $this->module . '/metadata/searchdefs.php')) { require_once 'modules/' . $this->module . '/metadata/searchdefs.php'; } } if (!empty($this->bean) && isset($_REQUEST[$this->module . '2_' . strtoupper($this->bean->object_name) . '_offset'])) { //if you click the pagination button, it will poplate the search criteria here if (!empty($_REQUEST['current_query_by_page'])) { $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); $current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page'])); foreach ($current_query_by_page as $search_key => $search_value) { if ($search_key != $this->module . '2_' . strtoupper($this->bean->object_name) . '_offset' && !in_array($search_key, $blockVariables)) { $_REQUEST[$search_key] = $search_value; } } } } if (!empty($listViewDefs) && !empty($searchdefs)) { require_once 'include/Popups/PopupSmarty.php'; $displayColumns = array(); $filter_fields = array(); $popup = new PopupSmarty($this->bean, $this->module); foreach ($listViewDefs[$this->module] as $col => $params) { $filter_fields[strtolower($col)] = true; if (!empty($params['related_fields'])) { foreach ($params['related_fields'] as $field) { //id column is added by query construction function. This addition creates duplicates //and causes issues in oracle. #10165 if ($field != 'id') { $filter_fields[$field] = true; } } } if (!empty($params['default']) && $params['default'] && $col != 'TEAM_NAME') { $displayColumns[$col] = $params; } } $popup->displayColumns = $displayColumns; $popup->filter_fields = $filter_fields; //check to see if popupdes contains searchdefs $popup->_popupMeta = $popupMeta; $popup->listviewdefs = $listViewDefs; $popup->searchdefs = $searchdefs; if (isset($_REQUEST['query'])) { $popup->searchForm->populateFromRequest(); } $massUpdateData = ''; if (isset($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $massUpdateData .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } $popup->massUpdateData = $massUpdateData; $popup->setup('include/Popups/tpls/PopupGeneric.tpl'); insert_popup_header(); echo $popup->display(); } else { if (file_exists('modules/' . $this->module . '/Popup_picker.php')) { require_once 'modules/' . $this->module . '/Popup_picker.php'; } else { require_once 'include/Popups/Popup_picker.php'; } $popup = new Popup_Picker(); $popup->_hide_clear_button = true; echo $popup->process_page(); } }
public function display() { global $mod_strings; if (isset($_REQUEST['name_basic'])) { $file_search = trim($_REQUEST['name_basic']); } else { $file_search = ''; } if (!isset($_REQUEST['apiName'])) { $apiName = 'IBMSmartCloud'; } else { $tmpApi = ExternalAPIFactory::loadAPI($_REQUEST['apiName'], true); if ($tmpApi === false) { Log::error(string_format($mod_strings['ERR_INVALID_EXTERNAL_API_ACCESS'], [$_REQUEST['apiName']])); return; } $apiName = $_REQUEST['apiName']; } // See if we are running as a popup window if (isset($_REQUEST['isPopup']) && $_REQUEST['isPopup'] == 1 && !empty($_REQUEST['elemBaseName'])) { $isPopup = true; } else { $isPopup = false; } // bug50952 - must actually make sure we can log in, not just that we've got a EAPM record // getLoginInfo only checks to see if user has logged in correctly ONCE to ExternalAPI // Need to manually attempt to fetch the EAPM record, we don't want to give them the signup screen when they just have a deactivated account. $eapmBean = EAPM::getLoginInfo($apiName, true); $api = ExternalAPIFactory::loadAPI($apiName, true); $validSession = true; if (!empty($eapmBean)) { try { $api->loadEAPM($eapmBean); // $api->checkLogin() does the same thing as quickCheckLogin plus actually makes sure the user CAN log in to the API currently $loginCheck = $api->checkLogin($eapmBean); if (isset($loginCheck['success']) && !$loginCheck['success']) { $validSession = false; } } catch (Exception $ex) { $validSession = false; Log::error(string_format($mod_strings['ERR_INVALID_EXTERNAL_API_LOGIN'], [$apiName])); } } if (!$validSession || empty($eapmBean)) { // Bug #49987 : Documents view.extdoc.php doesn't allow custom override $tpl_file = get_custom_file_if_exists('include/externalAPI/' . $apiName . '/' . $apiName . 'Signup.' . $GLOBALS['current_language'] . '.tpl'); if (file_exists($tpl_file)) { $smarty = new Sugar_Smarty(); echo $smarty->fetch($tpl_file); } else { $output = string_format(translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'), [$apiName]); $output .= '<form method="POST" target="_EAPM_CHECK" action="index.php">'; $output .= '<input type="hidden" name="module" value="EAPM">'; $output .= '<input type="hidden" name="action" value="Save">'; $output .= '<input type="hidden" name="record" value="' . $eapmBean->id . '">'; $output .= '<input type="hidden" name="active" value="1">'; $output .= '<input type="hidden" name="closeWhenDone" value="1">'; $output .= '<input type="hidden" name="refreshParentWindow" value="1">'; $output .= '<br><input type="submit" value="' . $GLOBALS['app_strings']['LBL_EMAIL_OK'] . '"> '; $output .= '<input type="button" onclick="lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" value="' . $GLOBALS['app_strings']['LBL_CANCEL_BUTTON_LABEL'] . '">'; $output .= '</form>'; echo $output; } return; } $searchDataLower = $api->searchDoc($file_search, true); // In order to emulate the list views for the SugarFields, I need to uppercase all of the key names. $searchData = []; if (is_array($searchDataLower)) { foreach ($searchDataLower as $row) { $newRow = []; foreach ($row as $key => $value) { $newRow[strtoupper($key)] = $value; } if ($isPopup) { // We are running as a popup window, we need to replace the direct url with some javascript $newRow['DOC_URL'] = "javascript:window.opener.SUGAR.field.file.populateFromPopup('" . addslashes($_REQUEST['elemBaseName']) . "','" . addslashes($newRow['ID']) . "','" . addslashes($newRow['NAME']) . "','" . addslashes($newRow['URL']) . "','" . addslashes($newRow['URL']) . "'); window.close();"; } else { $newRow['DOC_URL'] = $newRow['URL']; } $searchData[] = $newRow; } } $displayColumns = ['NAME' => ['label' => 'LBL_LIST_EXT_DOCUMENT_NAME', 'type' => 'varchar', 'link' => true], 'DATE_MODIFIED' => ['label' => 'LBL_DATE', 'type' => 'date']]; $ss = new Sugar_Smarty(); $ss->assign('searchFieldLabel', translate('LBL_SEARCH_EXTERNAL_DOCUMENT', 'Documents')); $ss->assign('displayedNote', translate('LBL_EXTERNAL_DOCUMENT_NOTE', 'Documents')); $ss->assign('APP', $GLOBALS['app_strings']); $ss->assign('MOD', $GLOBALS['mod_strings']); $ss->assign('data', $searchData); $ss->assign('displayColumns', $displayColumns); $ss->assign('imgPath', SugarThemeRegistry::current()->getImageURL($apiName . '_image_inline.png')); if ($isPopup) { $ss->assign('linkTarget', ''); $ss->assign('isPopup', 1); $ss->assign('elemBaseName', $_REQUEST['elemBaseName']); } else { $ss->assign('linkTarget', '_new'); $ss->assign('isPopup', 0); $ss->assign('elemBaseName', ''); } $ss->assign('apiName', $apiName); $ss->assign('DCSEARCH', $file_search); if ($isPopup) { // Need the popup header... I feel so dirty. ob_start(); echo '<div class="dccontent">'; insert_popup_header($GLOBALS['theme'], false); $output_html = ob_get_contents(); ob_end_clean(); $output_html .= get_form_header(translate('LBL_SEARCH_FORM_TITLE', 'Documents'), '', false); echo $output_html; } $ss->display('modules/Documents/tpls/view.extdoc.tpl'); if ($isPopup) { // Close the dccontent div echo '</div>'; } }
/** * */ function process_page() { global $theme; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $name = empty($_REQUEST['name']) ? '' : $_REQUEST['name']; $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='button' name='button' id='selectButton' class='button' onclick=\"send_back_selected('SavedReports',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' id='clearButton' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' id='selectButton' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Reports/Popup_picker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('request_data', $request_data); if (!empty($_REQUEST['module_name'])) { $form->assign('FILTER_MODULE_NAME', $_REQUEST['module_name']); } $form->assign('NAME', $name); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = BeanFactory::getBean('Reports'); $ListView = new ListView(); $ListView->show_export_button = false; $ListView->process_for_popups = true; // Bug 50020 // If the popup mode is SINGLE, don't show select dropdown or delete button $mode = empty($_REQUEST['mode']) ? '' : strtoupper($_REQUEST['mode']); if ($mode == "SINGLE") { $ListView->show_select_menu = false; $ListView->show_delete_button = false; } $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; //FOR MULTI-SELECT if ($multi_select) { $ListView->xTemplate->assign("TAG_TYPE", "SPAN"); } else { $ListView->xTemplate->assign("TAG_TYPE", "A"); } //FOR MULTI-SELECT //$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); //FOR MULTI-SELECT //$ListView->setHeaderText($button); //FOR MULTI-SELECT $ListView->setQuery($where, '', 'name', 'SAVEDREPORT'); $ListView->setModStrings($mod_strings); ob_start(); $output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //FOR MULTI-SELECT $ListView->processListView($seed_bean, 'main', 'SAVEDREPORT'); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
/** * */ function process_page() { global $focus; global $mod_strings; global $app_strings; global $app_list_strings; global $currentModule; global $odd_bg; global $even_bg; global $timedate; $history_list = array(); if (!empty($_REQUEST['record'])) { $result = $focus->retrieve($_REQUEST['record']); if ($result == null) { sugar_die($app_strings['ERROR_NO_RECORD']); } } $activitiesRels = array('tasks' => 'Task', 'meetings' => 'Meeting', 'calls' => 'Call', 'emails' => 'Email', 'notes' => 'Note'); //Setup the arrays to store the linked records. foreach ($activitiesRels as $relMod => $beanName) { $varname = "focus_" . $relMod . "_list"; ${$varname} = array(); } foreach ($focus->get_linked_fields() as $field => $def) { if ($focus->load_relationship($field)) { $relTable = $focus->{$field}->getRelatedTableName(); if (in_array($relTable, array_keys($activitiesRels))) { $varname = "focus_" . $relTable . "_list"; ${$varname} = sugarArrayMerge(${$varname}, $focus->get_linked_beans($field, $activitiesRels[$relTable])); } } } foreach ($focus_tasks_list as $task) { $sort_date_time = ''; if ($task->date_due == '0000-00-00') { $date_due = ''; } else { $date_due = $task->date_due; } if (!empty($task->date_due) and !empty($task->time_due)) { $sort_date_time = $timedate->to_db_date_time($task->date_due, $task->time_due); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } if ($task->status != "Not Started" && $task->status != "In Progress" && $task->status != "Pending Input") { $history_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_modified' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE'], 'sort_value' => $sort_date_time); } else { $open_activity_list[] = array('name' => $task->name, 'id' => $task->id, 'type' => "Task", 'direction' => '', 'module' => "Tasks", 'status' => $task->status, 'parent_id' => $task->parent_id, 'parent_type' => $task->parent_type, 'parent_name' => $task->parent_name, 'contact_id' => $task->contact_id, 'contact_name' => $task->contact_name, 'date_due' => $date_due, 'description' => $this->getTaskDetails($task), 'date_type' => $app_strings['DATA_TYPE_DUE']); } } // end Tasks foreach ($focus_meetings_list as $meeting) { if ($meeting->status != "Planned") { $sort_date_time = ''; if (!empty($meeting->date_start) and !empty($meeting->time_start)) { $sort_date_time = $timedate->to_db_date_time($meeting->date_start, $meeting->time_start); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } $history_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_modified' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time); } else { $open_activity_list[] = array('name' => $meeting->name, 'id' => $meeting->id, 'type' => "Meeting", 'direction' => '', 'module' => "Meetings", 'status' => $meeting->status, 'parent_id' => $meeting->parent_id, 'parent_type' => $meeting->parent_type, 'parent_name' => $meeting->parent_name, 'contact_id' => $meeting->contact_id, 'contact_name' => $meeting->contact_name, 'date_due' => $meeting->date_start, 'description' => $this->formatDescription($meeting->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Meetings foreach ($focus_calls_list as $call) { if ($call->status != "Planned") { $sort_date_time = ''; if (!empty($call->date_start) and !empty($call->time_start)) { $sort_date_time = $timedate->to_db_date_time($call->date_start, $call->time_start); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } elseif (!empty($call->date_start) && empty($call->time_start)) { //jc - Bug#19862 //for some reason the calls module does not populate the time_start variable in //this case, so the date_start attribute contains the information we need //to determine where in the history this call belongs. //using swap_formats to get from the format '03/31/2008 09:45pm' to the format //'2008-03-31 09:45:00' $sort_date_time = $timedate->swap_formats($call->date_start, $timedate->get_date_time_format(), $timedate->get_db_date_time_format()); } $history_list[] = array('name' => $call->name, 'id' => $call->id, 'type' => "Call", 'direction' => $call->direction, 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_modified' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START'], 'sort_value' => $sort_date_time); } else { $open_activity_list[] = array('name' => $call->name, 'id' => $call->id, 'direction' => $call->direction, 'type' => "Call", 'module' => "Calls", 'status' => $call->status, 'parent_id' => $call->parent_id, 'parent_type' => $call->parent_type, 'parent_name' => $call->parent_name, 'contact_id' => $call->contact_id, 'contact_name' => $call->contact_name, 'date_due' => $call->date_start, 'description' => $this->formatDescription($call->description), 'date_type' => $app_strings['DATA_TYPE_START']); } } // end Calls foreach ($focus_emails_list as $email) { $sort_date_time = ''; if (!empty($email->date_start) and !empty($email->time_start)) { $sort_date_time = $timedate->to_db_date_time($email->date_start, $email->time_start); $sort_date_time = implode(' ', $sort_date_time); // kbrill - Bug #16714 //$sort_date_time=$timedate->handle_offset($sort_date_time,'Y-m-d H:i:s',true); } $history_list[] = array('name' => $email->name, 'id' => $email->id, 'type' => "Email", 'direction' => '', 'module' => "Emails", 'status' => '', 'parent_id' => $email->parent_id, 'parent_type' => $email->parent_type, 'parent_name' => $email->parent_name, 'contact_id' => $email->contact_id, 'contact_name' => $email->contact_name, 'date_modified' => $email->date_start . " " . $email->time_start, 'description' => $this->getEmailDetails($email), 'date_type' => $app_strings['DATA_TYPE_SENT'], 'sort_value' => $sort_date_time); } //end Emails foreach ($focus_notes_list as $note) { if (!empty($note->date_modified)) { $sort_date_time = $timedate->swap_formats($note->date_modified, $timedate->get_date_time_format(), $timedate->get_db_date_time_format()); } $history_list[] = array('name' => $note->name, 'id' => $note->id, 'type' => "Note", 'direction' => '', 'module' => "Notes", 'status' => '', 'parent_id' => $note->parent_id, 'parent_type' => $note->parent_type, 'parent_name' => $note->parent_name, 'contact_id' => $note->contact_id, 'contact_name' => $note->contact_name, 'date_modified' => $note->date_modified, 'description' => $this->formatDescription($note->description), 'date_type' => $app_strings['DATA_TYPE_MODIFIED'], 'sort_value' => $sort_date_time); if (!empty($note->filename)) { $count = count($history_list); $count--; $history_list[$count]['filename'] = $note->filename; $history_list[$count]['fileurl'] = UploadFile::get_url($note->filename, $note->id); } } // end Notes $xtpl = new XTemplate('modules/Activities/Popup_picker.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); insert_popup_header(); //output header echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td>"; echo get_module_title($focus->module_dir, translate('LBL_MODULE_NAME', $focus->module_dir) . ": " . $focus->name, false); echo "</td><td align='right' class='moduleTitle'>"; echo "<A href='javascript:print();' class='utilsLink'><img src='" . SugarThemeRegistry::current()->getImageURL("print.gif") . "' width='13' height='13' alt='" . $app_strings['LNK_PRINT'] . "' border='0' align='absmiddle'></a> <A href='javascript:print();' class='utilsLink'>" . $app_strings['LNK_PRINT'] . "</A>\n"; echo "</td></tr></table>"; $oddRow = true; if (count($history_list) > 0) { $history_list = array_csort($history_list, 'sort_value', SORT_DESC); } foreach ($history_list as $activity) { $activity_fields = array('ID' => $activity['id'], 'NAME' => $activity['name'], 'MODULE' => $activity['module'], 'CONTACT_NAME' => $activity['contact_name'], 'CONTACT_ID' => $activity['contact_id'], 'PARENT_TYPE' => $activity['parent_type'], 'PARENT_NAME' => $activity['parent_name'], 'PARENT_ID' => $activity['parent_id'], 'DATE' => $activity['date_modified'], 'DESCRIPTION' => $activity['description'], 'DATE_TYPE' => $activity['date_type']); if (empty($activity['direction'])) { $activity_fields['TYPE'] = $app_list_strings['activity_dom'][$activity['type']]; } else { $activity_fields['TYPE'] = $app_list_strings['call_direction_dom'][$activity['direction']] . ' ' . $app_list_strings['activity_dom'][$activity['type']]; } switch ($activity['type']) { case 'Call': $activity_fields['STATUS'] = $app_list_strings['call_status_dom'][$activity['status']]; break; case 'Meeting': $activity_fields['STATUS'] = $app_list_strings['meeting_status_dom'][$activity['status']]; break; case 'Task': $activity_fields['STATUS'] = $app_list_strings['task_status_dom'][$activity['status']]; break; } if (isset($activity['location'])) { $activity_fields['LOCATION'] = $activity['location']; } if (isset($activity['filename'])) { $activity_fields['ATTACHMENT'] = "<a href='index.php?entryPoint=download&id=" . $activity['id'] . "&type=Notes' target='_blank'>" . SugarThemeRegistry::current()->getImage("attachment", "alt='" . $activity['filename'] . "' border='0' align='absmiddle'") . "</a>"; } if (isset($activity['parent_type'])) { $activity_fields['PARENT_MODULE'] = $activity['parent_type']; } $xtpl->assign("ACTIVITY", $activity_fields); $xtpl->assign("ACTIVITY_MODULE_PNG", SugarThemeRegistry::current()->getImage($activity_fields['MODULE'] . '', 'border="0" alt="' . $activity_fields['NAME'] . '"')); if ($oddRow) { //todo move to themes $xtpl->assign("ROW_COLOR", 'oddListRow'); $xtpl->assign("BG_COLOR", $odd_bg); } else { //todo move to themes $xtpl->assign("ROW_COLOR", 'evenListRow'); $xtpl->assign("BG_COLOR", $even_bg); } $oddRow = !$oddRow; $xtpl->parse("history.row"); // Put the rows in. } $xtpl->parse("history"); $xtpl->out("history"); insert_popup_footer(); }
public function display() { if (isset($_REQUEST['name_basic'])) { $file_search = trim($_REQUEST['name_basic']); } else { $file_search = ''; } if (!isset($_REQUEST['apiName'])) { $apiName = 'LotusLive'; } else { $tmpApi = ExternalAPIFactory::loadAPI($_REQUEST['apiName'], true); if ($tmpApi === false) { $GLOBALS['log']->error('The user attempted to access an invalid external API (' . $_REQUEST['apiName'] . ')'); return; } $apiName = $_REQUEST['apiName']; } // See if we are running as a popup window if (isset($_REQUEST['isPopup']) && $_REQUEST['isPopup'] == 1 && !empty($_REQUEST['elemBaseName'])) { $isPopup = true; } else { $isPopup = false; } // Need to manually attempt to fetch the EAPM record, we don't want to give them the signup screen when they just have a deactivated account. if (!($eapmBean = EAPM::getLoginInfo($apiName, true))) { $smarty = new Sugar_Smarty(); echo $smarty->fetch('include/externalAPI/' . $apiName . '/' . $apiName . 'Signup.' . $GLOBALS['current_language'] . '.tpl'); return; } $api = ExternalAPIFactory::loadAPI($apiName, true); $api->loadEAPM($eapmBean); $quickCheck = $api->quickCheckLogin(); if (!$quickCheck['success']) { $errorMessage = string_format(translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'), array($apiName)); $errorMessage .= '<form method="POST" target="_EAPM_CHECK" action="index.php">'; $errorMessage .= '<input type="hidden" name="module" value="EAPM">'; $errorMessage .= '<input type="hidden" name="action" value="Save">'; $errorMessage .= '<input type="hidden" name="record" value="' . $eapmBean->id . '">'; $errorMessage .= '<input type="hidden" name="active" value="1">'; $errorMessage .= '<input type="hidden" name="closeWhenDone" value="1">'; $errorMessage .= '<input type="hidden" name="refreshParentWindow" value="1">'; $errorMessage .= '<br><input type="submit" value="' . $GLOBALS['app_strings']['LBL_EMAIL_OK'] . '"> '; $errorMessage .= '<input type="button" onclick="lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" value="' . $GLOBALS['app_strings']['LBL_CANCEL_BUTTON_LABEL'] . '">'; $errorMessage .= '</form>'; echo $errorMessage; return; } $searchDataLower = $api->searchDoc($file_search, true); // In order to emulate the list views for the SugarFields, I need to uppercase all of the key names. $searchData = array(); if (is_array($searchDataLower)) { foreach ($searchDataLower as $row) { $newRow = array(); foreach ($row as $key => $value) { $newRow[strtoupper($key)] = $value; } if ($isPopup) { // We are running as a popup window, we need to replace the direct url with some javascript $newRow['DOC_URL'] = "javascript:window.opener.SUGAR.field.file.populateFromPopup('" . addslashes($_REQUEST['elemBaseName']) . "','" . addslashes($newRow['ID']) . "','" . addslashes($newRow['NAME']) . "','" . addslashes($newRow['URL']) . "','" . addslashes($newRow['URL']) . "'); window.close();"; } else { $newRow['DOC_URL'] = $newRow['URL']; } $searchData[] = $newRow; } } $displayColumns = array('NAME' => array('label' => 'LBL_LIST_EXT_DOCUMENT_NAME', 'type' => 'varchar', 'link' => true), 'DATE_MODIFIED' => array('label' => 'LBL_DATE', 'type' => 'date')); $ss = new Sugar_Smarty(); $ss->assign('searchFieldLabel', translate('LBL_SEARCH_EXTERNAL_DOCUMENT', 'Documents')); $ss->assign('displayedNote', translate('LBL_EXTERNAL_DOCUMENT_NOTE', 'Documents')); $ss->assign('APP', $GLOBALS['app_strings']); $ss->assign('MOD', $GLOBALS['mod_strings']); $ss->assign('data', $searchData); $ss->assign('displayColumns', $displayColumns); $ss->assign('imgPath', SugarThemeRegistry::current()->getImageURL($apiName . '_image_inline.png')); if ($isPopup) { $ss->assign('linkTarget', ''); $ss->assign('isPopup', 1); $ss->assign('elemBaseName', $_REQUEST['elemBaseName']); } else { $ss->assign('linkTarget', '_new'); $ss->assign('isPopup', 0); $ss->assign('elemBaseName', ''); } $ss->assign('apiName', $apiName); $ss->assign('DCSEARCH', $file_search); if ($isPopup) { // Need the popup header... I feel so dirty. ob_start(); echo '<div class="dccontent">'; insert_popup_header($GLOBALS['theme']); $output_html = ob_get_contents(); ob_end_clean(); $output_html .= get_form_header(translate('LBL_SEARCH_FORM_TITLE', 'Documents'), '', false); echo $output_html; } $ss->display('modules/Documents/tpls/view.extdoc.tpl'); if ($isPopup) { // Close the dccontent div echo '</div>'; } }
require_once 'modules/Users/UserSignature.php'; global $app_strings; global $app_list_strings; global $curent_language; $mod_strings = return_module_language($current_language, $currentModule); $focus = new UserSignature(); if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) { $focus->retrieve($_REQUEST['record']); } if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { $focus->id = ""; } $GLOBALS['log']->info('EmailTemplate detail view'); /////////////////////////////////////////////////////////////////////////////// //// OUTPUT echo insert_popup_header(); echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_SIGNATURE'] . ' ' . $focus->name, true); $xtpl = new XTemplate('modules/Users/UserSignatureEditView.html'); $xtpl->assign('MOD', $mod_strings); $xtpl->assign('APP', $app_strings); $xtpl->assign('CANCEL_SCRIPT', 'window.close()'); if (isset($_REQUEST['return_module'])) { $xtpl->assign('RETURN_MODULE', $_REQUEST['return_module']); } if (isset($_REQUEST['return_action'])) { $xtpl->assign('RETURN_ACTION', $_REQUEST['return_action']); } if (isset($_REQUEST['return_id'])) { $xtpl->assign('RETURN_ID', $_REQUEST['return_id']); } // handle Create $module then Cancel
function process_page_for_merge() { global $theme; global $mod_strings; global $app_strings; global $currentModule; global $sugar_version, $sugar_config; $output_html = ''; $where = ''; $where = $this->_get_where_clause(); $first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name']; $last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name']; $account_name = empty($_REQUEST['account_name']) ? '' : $_REQUEST['account_name']; $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true; $button = "<form action='index.php' method='post' name='form' id='form'>\n"; //START:FOR MULTI-SELECT $multi_select = false; if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') { $multi_select = true; $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('Contacts',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "');\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_SELECT_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . " ' />\n"; } //END:FOR MULTI-SELECT if (!$hide_clear_button) { $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CLEAR_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . " ' />\n"; } $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' accesskey='" . $app_strings['LBL_CANCEL_BUTTON_KEY'] . "' value=' " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . " ' />\n"; $button .= "</form>\n"; $form = new XTemplate('modules/Contacts/MailMergePicker.html'); $form->assign('MOD', $mod_strings); $form->assign('APP', $app_strings); $form->assign('THEME', $theme); $form->assign('MODULE_NAME', $currentModule); $form->assign('FIRST_NAME', $first_name); $form->assign('LAST_NAME', $last_name); $form->assign('ACCOUNT_NAME', $account_name); $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data']; $form->assign('request_data', $request_data); ob_start(); insert_popup_header($theme); $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false); $form->parse('main.SearchHeader'); $output_html .= $form->text('main.SearchHeader'); // Reset the sections that are already in the page so that they do not print again later. $form->reset('main.SearchHeader'); // create the listview $seed_bean = new Contact(); $ListView = new ListView(); $ListView->display_header_and_footer = false; $ListView->show_export_button = false; $ListView->process_for_popups = true; $ListView->setXTemplate($form); $ListView->multi_select_popup = $multi_select; if ($multi_select) { $ListView->xTemplate->assign("TAG_TYPE", "SPAN"); } else { $ListView->xTemplate->assign("TAG_TYPE", "A"); } $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']); $ListView->setQuery($where, '', 'contacts.last_name, contacts.first_name', 'CONTACT'); $ListView->setModStrings($mod_strings); ob_start(); $output_html .= get_form_header($mod_strings['LBL_LIST_FORM_TITLE'], $button, false); //BEGIN ATHENA CUSTOMIZATION - rsmith $query = $_REQUEST['select'] . ' WHERE ' . $_REQUEST['where'] . "'" . $_REQUEST['id'] . "'"; //$response = $seed_bean->process_list_query($_REQUEST['select'], 0, -1, -1, $_REQUEST['where']."'".$_REQUEST['id']."'"); $result = $seed_bean->db->query($query, true, "Error retrieving {$seed_bean->object_name} list: "); $list = array(); while (($row = $seed_bean->db->fetchByAssoc($result)) != null) { $seed_bean = new Contact(); foreach ($seed_bean->field_defs as $field => $value) { if (isset($row[$field])) { $seed_bean->{$field} = $row[$field]; } else { if (isset($row[$seed_bean->table_name . '.' . $field])) { $seed_bean->{$field} = $row[$seed_bean->table_name . '.' . $field]; } else { $seed_bean->{$field} = ""; } } } $seed_bean->fill_in_additional_list_fields(); $list[] = $seed_bean; } $ListView->processListViewTwo($list, 'main', 'CONTACT'); //END ATHENA CUSTOMIZATION - rsmith $output_html .= ob_get_contents(); ob_end_clean(); $output_html .= insert_popup_footer(); return $output_html; }
* install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ /********************************************************************************* * Header: /cvsroot/sugarcrm/sugarcrm/modules/Products/ListView.html,v 1.4 2004/07/02 07:02:27 sugarclint Exp {APP.LBL_LIST_CURRENCY_SYM} ********************************************************************************/ --> <body style="margin: 0px;"> <?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } global $theme, $mod_strings; insert_popup_header($theme); $sugarteam = array('Julian Ostrow', 'Lam Huynh', 'Majed Itani', 'Joey Parsons', 'Ajay Gupta', 'Jason Nassi', 'Andy Dreisch', 'Roger Smith', 'Liliya Bederov', 'Sadek Baroudi', 'Franklin Liu', 'Jennifer Yim', 'Sujata Pamidi', 'Eddy Ramirez', 'Jenny Gonsalves', 'Collin Lee', 'David Wheeler', 'John Mertic', 'Ran Zhou', 'Shine Ye', 'Emily Gan', 'Randy Lee', 'Eric Yang', 'Oliver Yang', 'Andreas Sandberg'); switch ($_REQUEST['style']) { case 'rev': $sugarteam = array_map('strrev', $sugarteam); break; case 'rand': shuffle($sugarteam); break; case 'dec': $sugarteam = array_reverse($sugarteam); break; case 'sort': sort($sugarteam); break; case 'rsort':
function display() { // this is a copy of ViewPopup::display() except the marked region at the bottom. have fun reading it :) ////////////////////////////////////////////////////////////////////////////////////////////////// global $popupMeta, $mod_strings, $sugar_version; if (isset($_REQUEST['metadata']) && strpos($_REQUEST['metadata'], "..") !== false) { die("Directory navigation attack denied."); } if (!empty($_REQUEST['metadata']) && $_REQUEST['metadata'] != 'undefined' && file_exists('modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php')) { // if custom metadata is requested require_once 'modules/' . $this->module . '/metadata/' . $_REQUEST['metadata'] . '.php'; } elseif (file_exists('custom/modules/' . $this->module . '/metadata/popupdefs.php')) { require_once 'custom/modules/' . $this->module . '/metadata/popupdefs.php'; } elseif (file_exists('modules/' . $this->module . '/metadata/popupdefs.php')) { require_once 'modules/' . $this->module . '/metadata/popupdefs.php'; } if (!empty($popupMeta) && !empty($popupMeta['listviewdefs'])) { if (is_array($popupMeta['listviewdefs'])) { //if we have an array, then we are not going to include a file, but rather the //listviewdefs will be defined directly in the popupdefs file $listViewDefs[$this->module] = $popupMeta['listviewdefs']; } else { //otherwise include the file require_once $popupMeta['listviewdefs']; } } elseif (file_exists('custom/modules/' . $this->module . '/metadata/listviewdefs.php')) { require_once 'custom/modules/' . $this->module . '/metadata/listviewdefs.php'; } elseif (file_exists('modules/' . $this->module . '/metadata/listviewdefs.php')) { require_once 'modules/' . $this->module . '/metadata/listviewdefs.php'; } //check for searchdefs as well if (!empty($popupMeta) && !empty($popupMeta['searchdefs'])) { if (is_array($popupMeta['searchdefs'])) { //if we have an array, then we are not going to include a file, but rather the //searchdefs will be defined directly in the popupdefs file $searchdefs[$this->module]['layout']['advanced_search'] = $popupMeta['searchdefs']; } else { //otherwise include the file require_once $popupMeta['searchdefs']; } } else { if (empty($searchdefs) && file_exists('modules/' . $this->module . '/metadata/searchdefs.php')) { require_once 'modules/' . $this->module . '/metadata/searchdefs.php'; } } if (!empty($this->bean) && isset($_REQUEST[$this->module . '2_' . strtoupper($this->bean->object_name) . '_offset'])) { //if you click the pagination button, it will poplate the search criteria here if (!empty($_REQUEST['current_query_by_page'])) { $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); $current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page'])); foreach ($current_query_by_page as $search_key => $search_value) { if ($search_key != $this->module . '2_' . strtoupper($this->bean->object_name) . '_offset' && !in_array($search_key, $blockVariables)) { $_REQUEST[$search_key] = $search_value; } } } } if (!empty($listViewDefs) && !empty($searchdefs)) { // require_once('include/Popups/PopupSmarty.php'); $displayColumns = array(); $filter_fields = array(); $whereClauses = array(); $initialFilterClauses = array(); $popup = new oqc_ProductPopupSmarty($this->bean, $this->module); // exclude product with given id and products that contain other products (packages) ////////////////////////////////////////////////////////////////////////////////////////////////// $formFields = array(); if (isset($_REQUEST['not_this_product_id']) && !empty($_REQUEST['not_this_product_id'])) { $formFields['not_this_product_id'] = $_REQUEST['not_this_product_id']; $whereClauses = array($this->bean->table_name . ".id != '{$_REQUEST['not_this_product_id']}'", $this->bean->table_name . ".active != '0'", $this->bean->table_name . ".is_latest != '0'"); } else { $formFields['not_this_product_id'] = ''; $whereClauses = array($this->bean->table_name . ".active != '0'", $this->bean->table_name . ".is_latest != '0'"); } if (isset($_REQUEST['is_option']) && $_REQUEST['is_option'] != '') { $formFields['is_option'] = $_REQUEST['is_option']; //if isset product_id found all options that are associated with this product 2.0 if (isset($_REQUEST['product_id']) && !empty($_REQUEST['product_id'])) { $product = new oqc_Product(); if ($product->retrieve($_REQUEST['product_id'])) { $formFields['product_id'] = $_REQUEST['product_id']; if (!empty($product->optionssequence)) { $optionsIds = explode(' ', $product->optionssequence); $productClauses = array(); foreach ($optionsIds as $optionId) { // $option = new oqc_Product(); $latestOptionId = $product->getLatestRevisionFromId($optionId); $productClauses[] = $this->bean->table_name . ".id = '{$latestOptionId}'"; } $productClause = implode(' or ', $productClauses); $whereClauses[] = '(' . $productClause . ')'; } else { $whereClauses[] = $this->bean->table_name . ".id = ''"; } } else { $whereClauses[] = $this->bean->table_name . ".id = ''"; } } $whereClauses[] = $this->bean->table_name . ".is_option = '{$_REQUEST['is_option']}'"; } else { // 2.0 If user push Clear button then no Products will be displayed ! Its is real Clear Button! :-) // $whereClauses[] = $this->bean->table_name.".id = ''"; $whereClauses[] = $this->bean->table_name . ".is_option = '0'"; $formFields['is_option'] = 0; } if (isset($_REQUEST['is_recurring']) && $_REQUEST['is_recurring'] != '') { $formFields['is_recurring'] = $_REQUEST['is_recurring']; if ($_REQUEST['is_recurring'] == '0') { $whereClauses[] = $this->bean->table_name . ".is_recurring = '0'"; } else { $whereClauses[] = $this->bean->table_name . ".is_recurring = '1'"; } } if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) { $formFields['status'] = $_REQUEST['status']; $initialFilterClauses = array($this->bean->table_name . ".status = '{$_REQUEST['status']}'"); } $finalwhereClauses = array_merge($whereClauses, $initialFilterClauses); //$GLOBALS['log']->error('Popup where clauses: '. var_export($finalwhereClauses,true)); $popup->searchForm = new ProductSearchForm($this->bean, $this->module, "index", $finalwhereClauses); ////////////////////////////////////////////////////////////////////////////////////////////////// foreach ($listViewDefs[$this->module] as $col => $params) { $filter_fields[strtolower($col)] = true; if (!empty($params['related_fields'])) { foreach ($params['related_fields'] as $field) { //id column is added by query construction function. This addition creates duplicates //and causes issues in oracle. #10165 if ($field != 'id') { $filter_fields[$field] = true; } } } if (!empty($params['default']) && $params['default'] && $col != 'TEAM_NAME') { $displayColumns[$col] = $params; } } $popup->displayColumns = $displayColumns; $popup->filter_fields = $filter_fields; //check to see if popupdes contains searchdefs $popup->_popupMeta = $popupMeta; $popup->listviewdefs = $listViewDefs; $popup->searchdefs = $searchdefs; if (isset($_REQUEST['query'])) { //2.2RC1 we unset Request fields for which we already produced sql query foreach ($formFields as $field => $value) { unset($_REQUEST[$field]); } $popup->searchForm->populateFromRequest(); } $massUpdateData = ''; if (isset($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $massUpdateData .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } $popup->massUpdateData = $massUpdateData; global $theme, $image_path; // 2.2RC1 PopupGeneric does not handle currency field properly- currency is always formatted with default currency symbol if (floatval(substr($sugar_version, 0, 3)) > 6.4) { $popup->setup('modules/oqc_Product/views/oqcProductPopup65.tpl'); } elseif (floatval(substr($sugar_version, 0, 3)) > 6.3) { $popup->setup('modules/oqc_Product/views/oqcProductPopup64.tpl'); } elseif (floatval(substr($sugar_version, 0, 3)) >= 6.0 && floatval(substr($sugar_version, 0, 3)) <= 6.3) { $popup->setup('modules/oqc_Product/views/oqcProductPopup62.tpl'); } else { $popup->setup('include/Popups/tpls/PopupGeneric.tpl'); } //$popup->setup('include/Popups/tpls/PopupGeneric.tpl'); insert_popup_header($theme); //Quick Search support $sqsJavascript = '<script type="text/javascript" src="include/oqc/QuickSearch/oqcQS.js"></script>'; echo $sqsJavascript; echo $popup->display(true, $formFields); } else { if (file_exists('modules/' . $this->module . '/Popup_picker.php')) { require_once 'modules/' . $this->module . '/Popup_picker.php'; } else { require_once 'include/Popups/Popup_picker.php'; } $popup = new Popup_Picker(); $popup->_hide_clear_button = true; echo $popup->process_page(); } }