0){
foreach($_REQUEST['assigned_user_id'] as $au){
$where_clauses[]="contacts.assigned_user_id='".$au."'";
}
}
if(count($_REQUEST['assigned_user_id_advanced'])>0){
foreach($_REQUEST['assigned_user_id_advanced'] as $au){
$where_clauses[]="contacts.assigned_user_id='".$au."'";
}
}
if($_REQUEST['only_my_items'])$where_clauses[]="contacts.assigned_user_id='".$_SESSION['authenticated_user_id']."'";
/*append_where_clause($where_clauses, "address_postalcode", "contacts.alt_address_postalcode");
append_where_clause($where_clauses, "address_street", "contacts.alt_address_street");
append_where_clause($where_clauses, "address_city", "contacts.alt_address_city");
append_where_clause($where_clauses, "address_country", "contacts.alt_address_country");
append_where_clause($where_clauses, "address_state", "contacts.alt_address_state");*/
//append_where_clause($where_clauses, "assigned_user_advanced", "contacts.assigned_user_id");
$where = generate_where_statement($where_clauses);
}
return $where;
}
/**
*
*/
function process_page_for_email()
{
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 = '
'
.str_replace(' ', ' | ', $formbody)
. ' |
'
. '';
$formSave = <<
EOQ;
$createContact = <<
EOQ;
$addformheader = get_form_header($mod_strings['LNK_NEW_CONTACT'], $formSave, false);
$button = "\n";
$first_name = empty($_REQUEST['first_name']) ? '' : $_REQUEST['first_name'];
$last_name = empty($_REQUEST['last_name']) ? '' : $_REQUEST['last_name'];
$form->assign('FIRST_NAME', $first_name);
$form->assign('LAST_NAME', $last_name);
$fields=array("first_name","last_name","address_postalcode","address_street","address_state","address_city","address_country","phone","account_id","account_name","assistant","assigned_user_id");
foreach($fields as $f){
if($_REQUEST[$f])$form->assign(strtoupper($f),$_REQUEST[$f]);
else $form->assign(strtoupper($f),$_REQUEST[$f."_advanced"]);
}
$w=mysql_query("select id,first_name,last_name from users where status='Active' and deleted='0' order by first_name asc, last_name asc");
while($r=mysql_fetch_array($w)){
$atr.='';
}
if($_REQUEST['tab'])$form->assign("TABB",$_REQUEST['tab']);
else $form->assign("TABB","basic");
$form = new XTemplate('modules/Contacts/Email_picker.html');
$form->assign('ASSIGNED_TO_LIST',$atr);
$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);
$form->assign('DIV',$_REQUEST['div']);
$form->assign('PRE',$_REQUEST['pre']);
if($_REQUEST['only_my_items'])$form->assign("OMI_CHECKED","checked");
$dnc.='';
$dnc.='';
$dnc.='assign('DO_NOT_CALL_LIST',$dnc);
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->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', '', 'CONTACT');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'CONTACT');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_footer();
$output_html .= insert_popup_footer();
return $output_html;
}
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();
$image_path = 'themes/'.$theme.'/images/';
$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 = "\n";
$form = new XTemplate('modules/Contacts/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('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');
$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->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();
if(empty($rows_found))
{
$rows_found = $seed_bean->db->getRowCount($result);
}
$row_offset = 0;
global $sugar_config;
$max_per_page = $sugar_config['list_max_entries_per_page'];
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 .= get_form_footer();
$output_html .= insert_popup_footer();
return $output_html;
}
/**
*
*/
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();
$image_path = 'themes/'.$theme.'/images/';
$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 = "\n";
$form = new XTemplate('modules/Contacts/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('ACCOUNT_NAME', $account_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');
$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->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);
$ListView->processListView($seed_bean, 'main', 'CONTACT');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_footer();
$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 = ''
.str_replace(' ', ' | ', $formbody)
. ' |
'
. '';
$formSave = <<
EOQ;
$createContact = <<
EOQ;
$addformheader = get_form_header($mod_strings['LNK_NEW_CONTACT'], $formSave, false);
$button = "\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 = "";
if(isset($_REQUEST['mass']) && is_array($_REQUEST['mass'])) {
foreach(array_unique($_REQUEST['mass']) as $record) {
$button .= "\n";
}
}
$button .= "";
$button .= "";
$button .= "";
$button .= "";
$button .= "";
$button .= "";
$button .= "";
$button .= "";
$button .= "";
$button .= "";
//$button .= "";
$button .= "\n";
$button .= "\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();
// Regular Expression to override sListView
$exp = '/sListView.save_checks/si';
$change = 'save_checks';
$output_html = preg_replace(array($exp), array($change), $output_html);
$output_html .= '';
$output_html .= get_form_footer();
$output_html .= insert_popup_footer();
return $output_html;
}
}
?>