@@ -6,9 +6,9 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | //execute the contructor and check for the Object type and attributes |
| 8 | 8 | $contact = new Contact(); |
| 9 | - $this->assertInstanceOf('Contact',$contact); |
|
| 10 | - $this->assertInstanceOf('Person',$contact); |
|
| 11 | - $this->assertInstanceOf('SugarBean',$contact); |
|
| 9 | + $this->assertInstanceOf('Contact', $contact); |
|
| 10 | + $this->assertInstanceOf('Person', $contact); |
|
| 11 | + $this->assertInstanceOf('SugarBean', $contact); |
|
| 12 | 12 | |
| 13 | 13 | $this->assertAttributeEquals('Contacts', 'module_dir', $contact); |
| 14 | 14 | $this->assertAttributeEquals('Contact', 'object_name', $contact); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | //test with empty strings |
| 30 | 30 | $query = ""; |
| 31 | 31 | $contact->add_list_count_joins($query, ''); |
| 32 | - $this->assertEquals(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query); |
|
| 32 | + $this->assertEquals(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ", $query); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | //test with valid string |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | $expected = "\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id\n LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c "; |
| 38 | 38 | $contact->add_list_count_joins($query, 'accounts.name'); |
| 39 | 39 | $query = preg_replace('/\s+/', '', $query); |
| 40 | - $expected =preg_replace('/\s+/', '', $expected); |
|
| 41 | - $this->assertSame($expected,$query); |
|
| 40 | + $expected = preg_replace('/\s+/', '', $expected); |
|
| 41 | + $this->assertSame($expected, $query); |
|
| 42 | 42 | |
| 43 | 43 | //test with valid string |
| 44 | 44 | $query = ""; |
| 45 | 45 | $expected = "\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id\n LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c "; |
| 46 | 46 | $contact->add_list_count_joins($query, 'contacts.name'); |
| 47 | - $this->assertSame(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ",$query); |
|
| 47 | + $this->assertSame(" LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c ", $query); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $contact = new Contact(); |
| 55 | 55 | |
| 56 | - $expected = array( "MAIN"=>"a", "ACCOUNT"=>"a"); |
|
| 56 | + $expected = array("MAIN"=>"a", "ACCOUNT"=>"a"); |
|
| 57 | 57 | $actual = $contact->listviewACLHelper(); |
| 58 | - $this->assertSame($expected,$actual); |
|
| 58 | + $this->assertSame($expected, $actual); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | //test with empty string params |
| 91 | 91 | $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n contacts.*,\n accounts.name as account_name,\n accounts.id as account_id,\n accounts.assigned_user_id account_id_owner,\n users.user_name as assigned_user_name ,contacts_cstm.*\n FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where contacts.deleted=0 "; |
| 92 | - $actual = $contact->address_popup_create_new_list_query('',''); |
|
| 93 | - $this->assertSame($expected,$actual); |
|
| 92 | + $actual = $contact->address_popup_create_new_list_query('', ''); |
|
| 93 | + $this->assertSame($expected, $actual); |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | //test with valid string params |
| 97 | 97 | $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n contacts.*,\n accounts.name as account_name,\n accounts.id as account_id,\n accounts.assigned_user_id account_id_owner,\n users.user_name as assigned_user_name ,contacts_cstm.*\n FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND contacts.deleted=0 "; |
| 98 | - $actual = $contact->address_popup_create_new_list_query('contacts.id','contacts.name=""'); |
|
| 99 | - $this->assertSame($expected,$actual); |
|
| 98 | + $actual = $contact->address_popup_create_new_list_query('contacts.id', 'contacts.name=""'); |
|
| 99 | + $this->assertSame($expected, $actual); |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | //test with empty string params |
| 108 | 108 | $expected = "SELECT\n contacts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id LEFT JOIN email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where ( accounts.deleted IS NULL OR accounts.deleted=0 )\n AND contacts.deleted=0 "; |
| 109 | - $actual = $contact->create_export_query('',''); |
|
| 110 | - $this->assertSame($expected,$actual); |
|
| 109 | + $actual = $contact->create_export_query('', ''); |
|
| 110 | + $this->assertSame($expected, $actual); |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | 113 | //test with valid string params |
| 114 | 114 | $expected = "SELECT\n contacts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name ,contacts_cstm.jjwg_maps_lng_c,contacts_cstm.jjwg_maps_lat_c,contacts_cstm.jjwg_maps_geocode_status_c,contacts_cstm.jjwg_maps_address_c FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id LEFT JOIN email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id LEFT JOIN contacts_cstm ON contacts.id = contacts_cstm.id_c where (contacts.name=\"\") AND ( accounts.deleted IS NULL OR accounts.deleted=0 )\n AND contacts.deleted=0 "; |
| 115 | - $actual = $contact->create_export_query('contacts.id','contacts.name=""'); |
|
| 116 | - $this->assertSame($expected,$actual); |
|
| 115 | + $actual = $contact->create_export_query('contacts.id', 'contacts.name=""'); |
|
| 116 | + $this->assertSame($expected, $actual); |
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | $contact->fill_in_additional_list_fields(); |
| 132 | 132 | |
| 133 | - $this->assertEquals("firstn lastn",$contact->full_name); |
|
| 134 | - $this->assertEquals("firstn lastn <[email protected]>",$contact->email_and_name1); |
|
| 135 | - $this->assertEquals("firstn lastn <[email protected]>",$contact->email_and_name2); |
|
| 133 | + $this->assertEquals("firstn lastn", $contact->full_name); |
|
| 134 | + $this->assertEquals("firstn lastn <[email protected]>", $contact->email_and_name1); |
|
| 135 | + $this->assertEquals("firstn lastn <[email protected]>", $contact->email_and_name2); |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | |
@@ -145,14 +145,14 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $contact->fill_in_additional_detail_fields(); |
| 147 | 147 | |
| 148 | - $this->assertEquals("",$contact->account_name); |
|
| 149 | - $this->assertEquals("",$contact->account_id); |
|
| 150 | - $this->assertEquals("",$contact->report_to_name); |
|
| 148 | + $this->assertEquals("", $contact->account_name); |
|
| 149 | + $this->assertEquals("", $contact->account_id); |
|
| 150 | + $this->assertEquals("", $contact->report_to_name); |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
| 155 | - public function testload_contacts_users_relationship(){ |
|
| 155 | + public function testload_contacts_users_relationship() { |
|
| 156 | 156 | |
| 157 | 157 | $contact = new Contact(); |
| 158 | 158 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $contact->first_name = "first"; |
| 176 | 176 | $contact->last_name = "last"; |
| 177 | 177 | |
| 178 | - $expected = array ( |
|
| 178 | + $expected = array( |
|
| 179 | 179 | 'NAME' => 'first last', |
| 180 | 180 | 'DELETED' => 0, |
| 181 | 181 | 'FIRST_NAME' => 'first', |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
| 204 | - public function testbuild_generic_where_clause () |
|
| 204 | + public function testbuild_generic_where_clause() |
|
| 205 | 205 | { |
| 206 | 206 | |
| 207 | 207 | $contact = new Contact(); |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | //test with string |
| 210 | 210 | $expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'"; |
| 211 | 211 | $actual = $contact->build_generic_where_clause('test'); |
| 212 | - $this->assertSame($expected,$actual); |
|
| 212 | + $this->assertSame($expected, $actual); |
|
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | //test with number |
| 216 | 216 | $expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'"; |
| 217 | 217 | $actual = $contact->build_generic_where_clause(1); |
| 218 | - $this->assertSame($expected,$actual); |
|
| 218 | + $this->assertSame($expected, $actual); |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $result = $contact->set_notification_body(new Sugar_Smarty(), $contact); |
| 233 | 233 | |
| 234 | - $this->assertEquals($contact->full_name ,$result->_tpl_vars['CONTACT_NAME']); |
|
| 235 | - $this->assertEquals($contact->description ,$result->_tpl_vars['CONTACT_DESCRIPTION']); |
|
| 234 | + $this->assertEquals($contact->full_name, $result->_tpl_vars['CONTACT_NAME']); |
|
| 235 | + $this->assertEquals($contact->description, $result->_tpl_vars['CONTACT_DESCRIPTION']); |
|
| 236 | 236 | |
| 237 | 237 | } |
| 238 | 238 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $contact = new Contact(); |
| 242 | 242 | |
| 243 | 243 | $result = $contact->get_contact_id_by_email(""); |
| 244 | - $this->assertEquals(null,$result); |
|
| 244 | + $this->assertEquals(null, $result); |
|
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | //$result = $contact->get_contact_id_by_email("[email protected]"); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | //execute the method and verify that it retunrs expected results |
| 283 | 283 | $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Contacts' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Contacts' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
| 284 | 284 | $actual = $contact->get_unlinked_email_query(); |
| 285 | - $this->assertSame($expected,$actual); |
|
| 285 | + $this->assertSame($expected, $actual); |
|
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | $output = $me->jsParser(); |
| 36 | 36 | |
| 37 | 37 | return $output; |
| 38 | - } catch (Exception $e) { |
|
| 38 | + }catch (Exception $e) { |
|
| 39 | 39 | // Exception handling is left up to the implementer. |
| 40 | 40 | throw $e; |
| 41 | 41 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | global $current_user; |
| 41 | 41 | $module_name = "Tasks"; |
| 42 | 42 | $searchFields['Tasks'] = |
| 43 | - array ( |
|
| 44 | - 'name' => array( 'query_type'=>'default'), |
|
| 43 | + array( |
|
| 44 | + 'name' => array('query_type'=>'default'), |
|
| 45 | 45 | 'contact_name' => array('query_type' => 'default', 'db_field' => array('contacts.first_name', 'contacts.last_name'), 'force_unifiedsearch' => true), |
| 46 | - 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), |
|
| 46 | + 'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), |
|
| 47 | 47 | 'assigned_user_id'=> array('query_type'=>'default'), |
| 48 | 48 | 'status'=> array('query_type'=>'default', 'options' => 'task_status_dom', 'template_var' => 'STATUS_FILTER'), |
| 49 | 49 | |
@@ -60,22 +60,22 @@ discard block |
||
| 60 | 60 | 'subquery' => "SELECT favorites.parent_id FROM favorites |
| 61 | 61 | WHERE favorites.deleted = 0 |
| 62 | 62 | and favorites.parent_type = '".$module_name."' |
| 63 | - and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}", |
|
| 63 | + and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}", |
|
| 64 | 64 | 'db_field'=>array('id')), |
| 65 | 65 | //Range Search Support |
| 66 | - 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 67 | - 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 68 | - 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 69 | - 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 70 | - 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 71 | - 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 66 | + 'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 67 | + 'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 68 | + 'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 69 | + 'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 70 | + 'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 71 | + 'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 72 | 72 | |
| 73 | - 'range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 74 | - 'start_range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 75 | - 'end_range_date_start' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 76 | - 'range_date_due' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 77 | - 'start_range_date_due' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 78 | - 'end_range_date_due' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 73 | + 'range_date_start' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 74 | + 'start_range_date_start' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 75 | + 'end_range_date_start' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 76 | + 'range_date_due' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 77 | + 'start_range_date_due' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 78 | + 'end_range_date_due' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 79 | 79 | //Range Search Support |
| 80 | 80 | ); |
| 81 | 81 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,33 +39,33 @@ discard block |
||
| 39 | 39 | ********************************************************************************/ |
| 40 | 40 | global $current_user; |
| 41 | 41 | $module_name = "Calls"; |
| 42 | -$searchFields['Calls'] = array ( |
|
| 42 | +$searchFields['Calls'] = array( |
|
| 43 | 43 | 'name' => |
| 44 | - array ( |
|
| 44 | + array( |
|
| 45 | 45 | 'query_type' => 'default', |
| 46 | 46 | ), |
| 47 | 47 | 'contact_name' => |
| 48 | - array ( |
|
| 48 | + array( |
|
| 49 | 49 | 'query_type' => 'default', |
| 50 | 50 | 'db_field' => |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | 0 => 'contacts.first_name', |
| 53 | 53 | 1 => 'contacts.last_name', |
| 54 | 54 | ), |
| 55 | 55 | ), |
| 56 | 56 | 'date_start' => |
| 57 | - array ( |
|
| 57 | + array( |
|
| 58 | 58 | 'query_type' => 'default', |
| 59 | 59 | ), |
| 60 | 60 | 'location' => |
| 61 | - array ( |
|
| 61 | + array( |
|
| 62 | 62 | 'query_type' => 'default', |
| 63 | 63 | ), |
| 64 | 64 | 'current_user_only' => |
| 65 | - array ( |
|
| 65 | + array( |
|
| 66 | 66 | 'query_type' => 'default', |
| 67 | 67 | 'db_field' => |
| 68 | - array ( |
|
| 68 | + array( |
|
| 69 | 69 | 0 => 'assigned_user_id', |
| 70 | 70 | ), |
| 71 | 71 | 'my_items' => true, |
@@ -73,98 +73,98 @@ discard block |
||
| 73 | 73 | 'type' => 'bool', |
| 74 | 74 | ), |
| 75 | 75 | 'assigned_user_id' => |
| 76 | - array ( |
|
| 76 | + array( |
|
| 77 | 77 | 'query_type' => 'default', |
| 78 | 78 | ), |
| 79 | 79 | 'status' => |
| 80 | - array ( |
|
| 80 | + array( |
|
| 81 | 81 | 'query_type' => 'default', |
| 82 | 82 | 'options' => 'call_status_dom', |
| 83 | 83 | 'template_var' => 'STATUS_FILTER', |
| 84 | 84 | ), |
| 85 | 85 | 'open_only' => |
| 86 | - array ( |
|
| 86 | + array( |
|
| 87 | 87 | 'query_type' => 'default', |
| 88 | 88 | 'db_field' => |
| 89 | - array ( |
|
| 89 | + array( |
|
| 90 | 90 | 0 => 'status', |
| 91 | 91 | ), |
| 92 | 92 | 'operator' => 'not in', |
| 93 | 93 | 'closed_values' => |
| 94 | - array ( |
|
| 94 | + array( |
|
| 95 | 95 | 0 => 'Held', |
| 96 | 96 | 1 => 'Not Held', |
| 97 | 97 | ), |
| 98 | 98 | 'type' => 'bool', |
| 99 | 99 | ), |
| 100 | 100 | 'range_date_entered' => |
| 101 | - array ( |
|
| 101 | + array( |
|
| 102 | 102 | 'query_type' => 'default', |
| 103 | 103 | 'enable_range_search' => true, |
| 104 | 104 | 'is_date_field' => true, |
| 105 | 105 | ), |
| 106 | 106 | 'start_range_date_entered' => |
| 107 | - array ( |
|
| 107 | + array( |
|
| 108 | 108 | 'query_type' => 'default', |
| 109 | 109 | 'enable_range_search' => true, |
| 110 | 110 | 'is_date_field' => true, |
| 111 | 111 | ), |
| 112 | 112 | 'end_range_date_entered' => |
| 113 | - array ( |
|
| 113 | + array( |
|
| 114 | 114 | 'query_type' => 'default', |
| 115 | 115 | 'enable_range_search' => true, |
| 116 | 116 | 'is_date_field' => true, |
| 117 | 117 | ), |
| 118 | 118 | 'range_date_modified' => |
| 119 | - array ( |
|
| 119 | + array( |
|
| 120 | 120 | 'query_type' => 'default', |
| 121 | 121 | 'enable_range_search' => true, |
| 122 | 122 | 'is_date_field' => true, |
| 123 | 123 | ), |
| 124 | 124 | 'start_range_date_modified' => |
| 125 | - array ( |
|
| 125 | + array( |
|
| 126 | 126 | 'query_type' => 'default', |
| 127 | 127 | 'enable_range_search' => true, |
| 128 | 128 | 'is_date_field' => true, |
| 129 | 129 | ), |
| 130 | 130 | 'end_range_date_modified' => |
| 131 | - array ( |
|
| 131 | + array( |
|
| 132 | 132 | 'query_type' => 'default', |
| 133 | 133 | 'enable_range_search' => true, |
| 134 | 134 | 'is_date_field' => true, |
| 135 | 135 | ), |
| 136 | 136 | 'range_date_start' => |
| 137 | - array ( |
|
| 137 | + array( |
|
| 138 | 138 | 'query_type' => 'default', |
| 139 | 139 | 'enable_range_search' => true, |
| 140 | 140 | 'is_date_field' => true, |
| 141 | 141 | ), |
| 142 | 142 | 'start_range_date_start' => |
| 143 | - array ( |
|
| 143 | + array( |
|
| 144 | 144 | 'query_type' => 'default', |
| 145 | 145 | 'enable_range_search' => true, |
| 146 | 146 | 'is_date_field' => true, |
| 147 | 147 | ), |
| 148 | 148 | 'end_range_date_start' => |
| 149 | - array ( |
|
| 149 | + array( |
|
| 150 | 150 | 'query_type' => 'default', |
| 151 | 151 | 'enable_range_search' => true, |
| 152 | 152 | 'is_date_field' => true, |
| 153 | 153 | ), |
| 154 | 154 | 'range_date_end' => |
| 155 | - array ( |
|
| 155 | + array( |
|
| 156 | 156 | 'query_type' => 'default', |
| 157 | 157 | 'enable_range_search' => true, |
| 158 | 158 | 'is_date_field' => true, |
| 159 | 159 | ), |
| 160 | 160 | 'start_range_date_end' => |
| 161 | - array ( |
|
| 161 | + array( |
|
| 162 | 162 | 'query_type' => 'default', |
| 163 | 163 | 'enable_range_search' => true, |
| 164 | 164 | 'is_date_field' => true, |
| 165 | 165 | ), |
| 166 | 166 | 'end_range_date_end' => |
| 167 | - array ( |
|
| 167 | + array( |
|
| 168 | 168 | 'query_type' => 'default', |
| 169 | 169 | 'enable_range_search' => true, |
| 170 | 170 | 'is_date_field' => true, |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | 'subquery' => "SELECT favorites.parent_id FROM favorites |
| 176 | 176 | WHERE favorites.deleted = 0 |
| 177 | 177 | and favorites.parent_type = '".$module_name."' |
| 178 | - and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}", |
|
| 178 | + and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}", |
|
| 179 | 179 | 'db_field'=>array('id')), |
| 180 | 180 | ); |
| 181 | 181 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -39,42 +39,42 @@ discard block |
||
| 39 | 39 | ********************************************************************************/ |
| 40 | 40 | global $current_user; |
| 41 | 41 | $module_name = "Cases"; |
| 42 | -$searchFields['Cases'] = array ( |
|
| 42 | +$searchFields['Cases'] = array( |
|
| 43 | 43 | 'name' => |
| 44 | - array ( |
|
| 44 | + array( |
|
| 45 | 45 | 'query_type' => 'default', |
| 46 | 46 | ), |
| 47 | 47 | 'account_name' => |
| 48 | - array ( |
|
| 48 | + array( |
|
| 49 | 49 | 'query_type' => 'default', |
| 50 | 50 | 'db_field' => |
| 51 | - array ( |
|
| 51 | + array( |
|
| 52 | 52 | 0 => 'accounts.name', |
| 53 | 53 | ), |
| 54 | 54 | ), |
| 55 | 55 | 'status' => |
| 56 | - array ( |
|
| 56 | + array( |
|
| 57 | 57 | 'query_type' => 'default', |
| 58 | 58 | 'options' => 'case_status_dom', |
| 59 | 59 | 'template_var' => 'STATUS_OPTIONS', |
| 60 | 60 | ), |
| 61 | 61 | 'priority' => |
| 62 | - array ( |
|
| 62 | + array( |
|
| 63 | 63 | 'query_type' => 'default', |
| 64 | 64 | 'options' => 'case_priority_dom', |
| 65 | 65 | 'template_var' => 'PRIORITY_OPTIONS', |
| 66 | 66 | 'options_add_blank' => true, |
| 67 | 67 | ), |
| 68 | 68 | 'case_number' => |
| 69 | - array ( |
|
| 69 | + array( |
|
| 70 | 70 | 'query_type' => 'default', |
| 71 | 71 | 'operator' => 'in', |
| 72 | 72 | ), |
| 73 | 73 | 'current_user_only' => |
| 74 | - array ( |
|
| 74 | + array( |
|
| 75 | 75 | 'query_type' => 'default', |
| 76 | 76 | 'db_field' => |
| 77 | - array ( |
|
| 77 | + array( |
|
| 78 | 78 | 0 => 'assigned_user_id', |
| 79 | 79 | ), |
| 80 | 80 | 'my_items' => true, |
@@ -82,19 +82,19 @@ discard block |
||
| 82 | 82 | 'type' => 'bool', |
| 83 | 83 | ), |
| 84 | 84 | 'assigned_user_id' => |
| 85 | - array ( |
|
| 85 | + array( |
|
| 86 | 86 | 'query_type' => 'default', |
| 87 | 87 | ), |
| 88 | 88 | 'open_only' => |
| 89 | - array ( |
|
| 89 | + array( |
|
| 90 | 90 | 'query_type' => 'default', |
| 91 | 91 | 'db_field' => |
| 92 | - array ( |
|
| 92 | + array( |
|
| 93 | 93 | 0 => 'status', |
| 94 | 94 | ), |
| 95 | 95 | 'operator' => 'not in', |
| 96 | 96 | 'closed_values' => |
| 97 | - array ( |
|
| 97 | + array( |
|
| 98 | 98 | 0 => 'Closed', |
| 99 | 99 | 1 => 'Rejected', |
| 100 | 100 | 2 => 'Duplicate', |
@@ -105,43 +105,43 @@ discard block |
||
| 105 | 105 | 'type' => 'bool', |
| 106 | 106 | ), |
| 107 | 107 | 'range_date_entered' => |
| 108 | - array ( |
|
| 108 | + array( |
|
| 109 | 109 | 'query_type' => 'default', |
| 110 | 110 | 'enable_range_search' => true, |
| 111 | 111 | 'is_date_field' => true, |
| 112 | 112 | ), |
| 113 | 113 | 'start_range_date_entered' => |
| 114 | - array ( |
|
| 114 | + array( |
|
| 115 | 115 | 'query_type' => 'default', |
| 116 | 116 | 'enable_range_search' => true, |
| 117 | 117 | 'is_date_field' => true, |
| 118 | 118 | ), |
| 119 | 119 | 'end_range_date_entered' => |
| 120 | - array ( |
|
| 120 | + array( |
|
| 121 | 121 | 'query_type' => 'default', |
| 122 | 122 | 'enable_range_search' => true, |
| 123 | 123 | 'is_date_field' => true, |
| 124 | 124 | ), |
| 125 | 125 | 'range_date_modified' => |
| 126 | - array ( |
|
| 126 | + array( |
|
| 127 | 127 | 'query_type' => 'default', |
| 128 | 128 | 'enable_range_search' => true, |
| 129 | 129 | 'is_date_field' => true, |
| 130 | 130 | ), |
| 131 | 131 | 'start_range_date_modified' => |
| 132 | - array ( |
|
| 132 | + array( |
|
| 133 | 133 | 'query_type' => 'default', |
| 134 | 134 | 'enable_range_search' => true, |
| 135 | 135 | 'is_date_field' => true, |
| 136 | 136 | ), |
| 137 | 137 | 'end_range_date_modified' => |
| 138 | - array ( |
|
| 138 | + array( |
|
| 139 | 139 | 'query_type' => 'default', |
| 140 | 140 | 'enable_range_search' => true, |
| 141 | 141 | 'is_date_field' => true, |
| 142 | 142 | ), |
| 143 | 143 | 'state' => |
| 144 | - array ( |
|
| 144 | + array( |
|
| 145 | 145 | 'query_type' => 'default', |
| 146 | 146 | ), |
| 147 | 147 | 'favorites_only' => array( |
@@ -150,6 +150,6 @@ discard block |
||
| 150 | 150 | 'subquery' => "SELECT favorites.parent_id FROM favorites |
| 151 | 151 | WHERE favorites.deleted = 0 |
| 152 | 152 | and favorites.parent_type = '".$module_name."' |
| 153 | - and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}", |
|
| 153 | + and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}", |
|
| 154 | 154 | 'db_field'=>array('id')), |
| 155 | 155 | ); |
| 156 | 156 | \ No newline at end of file |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 123 | 123 | */ |
| 124 | - public function EmailTemplate(){ |
|
| 124 | + public function EmailTemplate() { |
|
| 125 | 125 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 126 | - if(isset($GLOBALS['log'])) { |
|
| 126 | + if (isset($GLOBALS['log'])) { |
|
| 127 | 127 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 128 | 128 | } |
| 129 | 129 | else { |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | } |
| 369 | 369 | if (!empty($tracker_url) && !empty($template_text) && !empty($matches[0][$i][0]) && !empty($tracked_urls[$matches[0][$i][0]])) { |
| 370 | 370 | $template_text = substr_replace($template_text, $tracker_url, $matches[0][$i][1], strlen($matches[0][$i][0])); |
| 371 | - $template_text = str_replace($sugar_config['site_url'] . '/' . $sugar_config['site_url'], $sugar_config['site_url'], $template_text); |
|
| 371 | + $template_text = str_replace($sugar_config['site_url'].'/'.$sugar_config['site_url'], $sugar_config['site_url'], $template_text); |
|
| 372 | 372 | } |
| 373 | 373 | } |
| 374 | 374 | } |
@@ -420,10 +420,10 @@ discard block |
||
| 420 | 420 | if ($beanList[$focus_name] == 'User') { |
| 421 | 421 | $pattern_prefix = '$contact_user_'; |
| 422 | 422 | } else { |
| 423 | - $pattern_prefix = '$' . strtolower($beanList[$focus_name]) . '_'; |
|
| 423 | + $pattern_prefix = '$'.strtolower($beanList[$focus_name]).'_'; |
|
| 424 | 424 | } |
| 425 | 425 | $pattern_prefix_length = strlen($pattern_prefix); |
| 426 | - $pattern = '/\\' . $pattern_prefix . '[A-Za-z_0-9]*/'; |
|
| 426 | + $pattern = '/\\'.$pattern_prefix.'[A-Za-z_0-9]*/'; |
|
| 427 | 427 | |
| 428 | 428 | $return_array = array(); |
| 429 | 429 | foreach ($template_text_array as $key => $template_text) { |
@@ -521,16 +521,16 @@ discard block |
||
| 521 | 521 | $translated = translate($field_def['options'], 'Users', $user->$fieldName); |
| 522 | 522 | |
| 523 | 523 | if (isset($translated) && !is_array($translated)) { |
| 524 | - $repl_arr["contact_user_" . $fieldName] = $translated; |
|
| 524 | + $repl_arr["contact_user_".$fieldName] = $translated; |
|
| 525 | 525 | } else { // unset enum field, make sure we have a match string to replace with "" |
| 526 | - $repl_arr["contact_user_" . $fieldName] = ''; |
|
| 526 | + $repl_arr["contact_user_".$fieldName] = ''; |
|
| 527 | 527 | } |
| 528 | 528 | } else { |
| 529 | 529 | if (isset($user->$fieldName)) { |
| 530 | 530 | // bug 47647 - allow for fields to translate before adding to template |
| 531 | - $repl_arr["contact_user_" . $fieldName] = self::_convertToType($field_def['type'], $user->$fieldName); |
|
| 531 | + $repl_arr["contact_user_".$fieldName] = self::_convertToType($field_def['type'], $user->$fieldName); |
|
| 532 | 532 | } else { |
| 533 | - $repl_arr["contact_user_" . $fieldName] = ""; |
|
| 533 | + $repl_arr["contact_user_".$fieldName] = ""; |
|
| 534 | 534 | } |
| 535 | 535 | } |
| 536 | 536 | } |
@@ -556,8 +556,8 @@ discard block |
||
| 556 | 556 | continue; |
| 557 | 557 | } |
| 558 | 558 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 559 | - 'contact_' . $field_def['name'] => '', |
|
| 560 | - 'contact_account_' . $field_def['name'] => '', |
|
| 559 | + 'contact_'.$field_def['name'] => '', |
|
| 560 | + 'contact_account_'.$field_def['name'] => '', |
|
| 561 | 561 | )); |
| 562 | 562 | } |
| 563 | 563 | foreach ($prospect->field_defs as $field_def) { |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | continue; |
| 566 | 566 | } |
| 567 | 567 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 568 | - 'contact_' . $field_def['name'] => '', |
|
| 569 | - 'contact_account_' . $field_def['name'] => '', |
|
| 568 | + 'contact_'.$field_def['name'] => '', |
|
| 569 | + 'contact_account_'.$field_def['name'] => '', |
|
| 570 | 570 | )); |
| 571 | 571 | } |
| 572 | 572 | foreach ($contact->field_defs as $field_def) { |
@@ -574,8 +574,8 @@ discard block |
||
| 574 | 574 | continue; |
| 575 | 575 | } |
| 576 | 576 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 577 | - 'contact_' . $field_def['name'] => '', |
|
| 578 | - 'contact_account_' . $field_def['name'] => '', |
|
| 577 | + 'contact_'.$field_def['name'] => '', |
|
| 578 | + 'contact_account_'.$field_def['name'] => '', |
|
| 579 | 579 | )); |
| 580 | 580 | } |
| 581 | 581 | foreach ($acct->field_defs as $field_def) { |
@@ -583,8 +583,8 @@ discard block |
||
| 583 | 583 | continue; |
| 584 | 584 | } |
| 585 | 585 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 586 | - 'account_' . $field_def['name'] => '', |
|
| 587 | - 'account_contact_' . $field_def['name'] => '', |
|
| 586 | + 'account_'.$field_def['name'] => '', |
|
| 587 | + 'account_contact_'.$field_def['name'] => '', |
|
| 588 | 588 | )); |
| 589 | 589 | } |
| 590 | 590 | // cn: end bug 9277 fix |
@@ -609,21 +609,21 @@ discard block |
||
| 609 | 609 | |
| 610 | 610 | if (isset($translated) && !is_array($translated)) { |
| 611 | 611 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 612 | - 'account_' . $fieldName => $translated, |
|
| 613 | - 'contact_account_' . $fieldName => $translated, |
|
| 612 | + 'account_'.$fieldName => $translated, |
|
| 613 | + 'contact_account_'.$fieldName => $translated, |
|
| 614 | 614 | )); |
| 615 | 615 | } else { // unset enum field, make sure we have a match string to replace with "" |
| 616 | 616 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 617 | - 'account_' . $fieldName => '', |
|
| 618 | - 'contact_account_' . $fieldName => '', |
|
| 617 | + 'account_'.$fieldName => '', |
|
| 618 | + 'contact_account_'.$fieldName => '', |
|
| 619 | 619 | )); |
| 620 | 620 | } |
| 621 | 621 | } else { |
| 622 | 622 | // bug 47647 - allow for fields to translate before adding to template |
| 623 | 623 | $translated = self::_convertToType($field_def['type'], $acct->$fieldName); |
| 624 | 624 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 625 | - 'account_' . $fieldName => $translated, |
|
| 626 | - 'contact_account_' . $fieldName => $translated, |
|
| 625 | + 'account_'.$fieldName => $translated, |
|
| 626 | + 'contact_account_'.$fieldName => $translated, |
|
| 627 | 627 | )); |
| 628 | 628 | } |
| 629 | 629 | } |
@@ -654,13 +654,13 @@ discard block |
||
| 654 | 654 | |
| 655 | 655 | if (isset($translated) && !is_array($translated)) { |
| 656 | 656 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 657 | - 'contact_' . $fieldName => $translated, |
|
| 658 | - 'contact_account_' . $fieldName => $translated, |
|
| 657 | + 'contact_'.$fieldName => $translated, |
|
| 658 | + 'contact_account_'.$fieldName => $translated, |
|
| 659 | 659 | )); |
| 660 | 660 | } else { // unset enum field, make sure we have a match string to replace with "" |
| 661 | 661 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 662 | - 'contact_' . $fieldName => '', |
|
| 663 | - 'contact_account_' . $fieldName => '', |
|
| 662 | + 'contact_'.$fieldName => '', |
|
| 663 | + 'contact_account_'.$fieldName => '', |
|
| 664 | 664 | )); |
| 665 | 665 | } |
| 666 | 666 | } else { |
@@ -668,8 +668,8 @@ discard block |
||
| 668 | 668 | // bug 47647 - allow for fields to translate before adding to template |
| 669 | 669 | $translated = self::_convertToType($field_def['type'], $contact->$fieldName); |
| 670 | 670 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 671 | - 'contact_' . $fieldName => $translated, |
|
| 672 | - 'contact_account_' . $fieldName => $translated, |
|
| 671 | + 'contact_'.$fieldName => $translated, |
|
| 672 | + 'contact_account_'.$fieldName => $translated, |
|
| 673 | 673 | )); |
| 674 | 674 | } // if |
| 675 | 675 | } |
@@ -690,27 +690,27 @@ discard block |
||
| 690 | 690 | |
| 691 | 691 | if (isset($translated) && !is_array($translated)) { |
| 692 | 692 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 693 | - strtolower($beanList[$bean_name]) . "_" . $fieldName => $translated, |
|
| 693 | + strtolower($beanList[$bean_name])."_".$fieldName => $translated, |
|
| 694 | 694 | )); |
| 695 | 695 | } else { // unset enum field, make sure we have a match string to replace with "" |
| 696 | 696 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 697 | - strtolower($beanList[$bean_name]) . "_" . $fieldName => '', |
|
| 697 | + strtolower($beanList[$bean_name])."_".$fieldName => '', |
|
| 698 | 698 | )); |
| 699 | 699 | } |
| 700 | 700 | } else { |
| 701 | 701 | // bug 47647 - translate currencies to appropriate values |
| 702 | 702 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 703 | - strtolower($beanList[$bean_name]) . "_" . $fieldName => self::_convertToType($field_def['type'], $focus->$fieldName), |
|
| 703 | + strtolower($beanList[$bean_name])."_".$fieldName => self::_convertToType($field_def['type'], $focus->$fieldName), |
|
| 704 | 704 | )); |
| 705 | 705 | } |
| 706 | 706 | } else { |
| 707 | 707 | if ($fieldName == 'full_name') { |
| 708 | 708 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 709 | - strtolower($beanList[$bean_name]) . '_full_name' => $focus->get_summary_text(), |
|
| 709 | + strtolower($beanList[$bean_name]).'_full_name' => $focus->get_summary_text(), |
|
| 710 | 710 | )); |
| 711 | 711 | } else { |
| 712 | 712 | $repl_arr = EmailTemplate::add_replacement($repl_arr, $field_def, array( |
| 713 | - strtolower($beanList[$bean_name]) . "_" . $fieldName => '', |
|
| 713 | + strtolower($beanList[$bean_name])."_".$fieldName => '', |
|
| 714 | 714 | )); |
| 715 | 715 | } |
| 716 | 716 | } |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | { |
| 762 | 762 | foreach ($bean_arr as $bean_name => $bean_id) { |
| 763 | 763 | |
| 764 | - $focus = BeanFactory::getBean($bean_name,$bean_id); |
|
| 764 | + $focus = BeanFactory::getBean($bean_name, $bean_id); |
|
| 765 | 765 | |
| 766 | 766 | if ($bean_name == 'Leads' || $bean_name == 'Prospects') { |
| 767 | 767 | $bean_name = 'Contacts'; |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $this->repairMozaikClears(); |
| 844 | 844 | $this->imageLinkReplaced = false; |
| 845 | 845 | $this->repairEntryPointImages(); |
| 846 | - if($this->imageLinkReplaced) { |
|
| 846 | + if ($this->imageLinkReplaced) { |
|
| 847 | 847 | $this->save(); |
| 848 | 848 | } |
| 849 | 849 | return $ret; |
@@ -862,13 +862,13 @@ discard block |
||
| 862 | 862 | // repair the images url at entry points, change to a public direct link for remote email clients.. |
| 863 | 863 | |
| 864 | 864 | $siteUrlQuoted = str_replace(array(':', '/'), array('\:', '\/'), $sugar_config['site_url']); |
| 865 | - $regex = '/<img src="(' . $siteUrlQuoted . '\/index\.php\?entryPoint=download&type=Notes&id=([a-f0-9]{8}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{12})&filename=[^&]+)"/'; |
|
| 865 | + $regex = '/<img src="('.$siteUrlQuoted.'\/index\.php\?entryPoint=download&type=Notes&id=([a-f0-9]{8}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{12})&filename=[^&]+)"/'; |
|
| 866 | 866 | |
| 867 | - if(preg_match($regex, $this->body_html, $match)) { |
|
| 867 | + if (preg_match($regex, $this->body_html, $match)) { |
|
| 868 | 868 | $splits = explode('.', $match[1]); |
| 869 | 869 | $fileExtension = end($splits); |
| 870 | 870 | $this->makePublicImage($match[2]); |
| 871 | - $directLink = '<img src="' . $sugar_config['site_url'] . '/public/' . $match[2] . '.' . $fileExtension . '"'; |
|
| 871 | + $directLink = '<img src="'.$sugar_config['site_url'].'/public/'.$match[2].'.'.$fileExtension.'"'; |
|
| 872 | 872 | $this->body_html = str_replace($match[0], $directLink, $this->body_html); |
| 873 | 873 | $this->imageLinkReplaced = true; |
| 874 | 874 | $this->repairEntryPointImages(); |
@@ -877,25 +877,25 @@ discard block |
||
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | private function makePublicImage($id) { |
| 880 | - $toFile = 'public/' . $id . '.jpg'; |
|
| 881 | - if(file_exists($toFile)) { |
|
| 880 | + $toFile = 'public/'.$id.'.jpg'; |
|
| 881 | + if (file_exists($toFile)) { |
|
| 882 | 882 | return; |
| 883 | 883 | } |
| 884 | - $fromFile = 'upload://' . $id; |
|
| 885 | - if(!file_exists($fromFile)) { |
|
| 884 | + $fromFile = 'upload://'.$id; |
|
| 885 | + if (!file_exists($fromFile)) { |
|
| 886 | 886 | throw new Exceptin('file not found'); |
| 887 | 887 | } |
| 888 | - if(!file_exists('public')) { |
|
| 888 | + if (!file_exists('public')) { |
|
| 889 | 889 | sugar_mkdir('public', 777); |
| 890 | 890 | } |
| 891 | 891 | $fdata = file_get_contents($fromFile); |
| 892 | - if(!file_put_contents($toFile, $fdata)) { |
|
| 892 | + if (!file_put_contents($toFile, $fdata)) { |
|
| 893 | 893 | throw new Exception('file write error'); |
| 894 | 894 | } |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | 897 | public function getAttachments() { |
| 898 | - return BeanFactory::getBean('Notes')->get_full_list('', "parent_id = '" . $this->id . "'"); |
|
| 898 | + return BeanFactory::getBean('Notes')->get_full_list('', "parent_id = '".$this->id."'"); |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | } |
@@ -2,9 +2,9 @@ discard block |
||
| 2 | 2 | if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
| 3 | 3 | |
| 4 | 4 | function handleAttachmentForRemove() { |
| 5 | - if(!empty($_REQUEST['attachmentsRemove'])) { |
|
| 6 | - foreach($_REQUEST['attachmentsRemove'] as $attachmentIdForRemove) { |
|
| 7 | - if($bean = BeanFactory::getBean('Notes', $attachmentIdForRemove)) { |
|
| 5 | + if (!empty($_REQUEST['attachmentsRemove'])) { |
|
| 6 | + foreach ($_REQUEST['attachmentsRemove'] as $attachmentIdForRemove) { |
|
| 7 | + if ($bean = BeanFactory::getBean('Notes', $attachmentIdForRemove)) { |
|
| 8 | 8 | $bean->mark_deleted($bean->id); |
| 9 | 9 | } |
| 10 | 10 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $emailTemplateId = isset($_REQUEST['emailTemplateId']) && $_REQUEST['emailTemplateId'] ? $_REQUEST['emailTemplateId'] : null; |
| 19 | 19 | $_SESSION['campaignWizard'][$_REQUEST['campaignId']]['defaultSelectedTemplateId'] = $emailTemplateId; |
| 20 | 20 | |
| 21 | -if(preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/', $emailTemplateId) || !$emailTemplateId) { |
|
| 21 | +if (preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/', $emailTemplateId) || !$emailTemplateId) { |
|
| 22 | 22 | |
| 23 | 23 | $func = isset($_REQUEST['func']) ? $_REQUEST['func'] : null; |
| 24 | 24 | |
@@ -28,18 +28,18 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | include_once 'modules/EmailTemplates/EmailTemplateFormBase.php'; |
| 30 | 30 | |
| 31 | - switch($func) { |
|
| 31 | + switch ($func) { |
|
| 32 | 32 | |
| 33 | 33 | case 'update': |
| 34 | 34 | $bean = BeanFactory::getBean('EmailTemplates', $emailTemplateId); |
| 35 | - foreach($bean as $key => $value) { |
|
| 36 | - if(in_array($key, $fields)) { |
|
| 35 | + foreach ($bean as $key => $value) { |
|
| 36 | + if (in_array($key, $fields)) { |
|
| 37 | 37 | $bean->$key = $_POST[$key]; |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | $formBase = new EmailTemplateFormBase(); |
| 41 | 41 | $bean = $formBase->handleAttachmentsProcessImages($bean, false, true, 'download', true); |
| 42 | - if($bean->save()) { |
|
| 42 | + if ($bean->save()) { |
|
| 43 | 43 | $msgs[] = 'LBL_TEMPLATE_SAVED'; |
| 44 | 44 | } |
| 45 | 45 | //$formBase = new EmailTemplateFormBase(); |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | handleAttachmentForRemove(); |
| 50 | 50 | |
| 51 | 51 | // update marketing->template_id if we have a selected marketing.. |
| 52 | - if(!empty($_SESSION['campaignWizard'][$_REQUEST['campaignId']]['defaultSelectedMarketingId']) && !empty($_REQUEST['campaignId'])) { |
|
| 52 | + if (!empty($_SESSION['campaignWizard'][$_REQUEST['campaignId']]['defaultSelectedMarketingId']) && !empty($_REQUEST['campaignId'])) { |
|
| 53 | 53 | $marketingId = $_SESSION['campaignWizard'][$_REQUEST['campaignId']]['defaultSelectedMarketingId']; |
| 54 | 54 | |
| 55 | 55 | $campaign = BeanFactory::getBean('Campaigns', $_REQUEST['campaignId']); |
| 56 | 56 | $campaign->load_relationship('emailmarketing'); |
| 57 | 57 | $marketings = $campaign->emailmarketing->get(); |
| 58 | 58 | // just a double check for campaign->marketing relation correct is for e.g the user deleted the marketing record or something may could happened.. |
| 59 | - if(in_array($marketingId, $marketings)) { |
|
| 59 | + if (in_array($marketingId, $marketings)) { |
|
| 60 | 60 | $marketing = BeanFactory::getBean('EmailMarketing', $marketingId); |
| 61 | 61 | $marketing->template_id = $emailTemplateId; |
| 62 | 62 | $marketing->save(); |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | $bean = BeanFactory::getBean('EmailTemplates', $emailTemplateId); |
| 73 | 73 | $newBean = new EmailTemplate(); |
| 74 | 74 | $fieldsForCopy = array('type', 'description'); |
| 75 | - foreach($bean as $key => $value) { |
|
| 76 | - if(in_array($key, $fields)) { |
|
| 75 | + foreach ($bean as $key => $value) { |
|
| 76 | + if (in_array($key, $fields)) { |
|
| 77 | 77 | $newBean->$key = $_POST[$key]; |
| 78 | 78 | } |
| 79 | - else if(in_array($key, $fieldsForCopy)) { |
|
| 79 | + else if (in_array($key, $fieldsForCopy)) { |
|
| 80 | 80 | $newBean->$key = $bean->$key; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - if($newBean->save()) { |
|
| 83 | + if ($newBean->save()) { |
|
| 84 | 84 | $msgs[] = 'LBL_TEMPLATE_SAVED'; |
| 85 | 85 | } |
| 86 | 86 | //$formBase = new EmailTemplateFormBase(); |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | $focus = BeanFactory::getBean('EmailTemplates', $_REQUEST['attach_to_template_id']); |
| 95 | 95 | //$data = $formBase->handleAttachments($focus, false, null); |
| 96 | 96 | $data = $formBase->handleAttachmentsProcessImages($focus, false, true, 'download', true); |
| 97 | - $redirectUrl = 'index.php?module=Campaigns&action=WizardMarketing&campaign_id=' . $_REQUEST['campaign_id'] . "&jump=2&template_id=" . $_REQUEST['attach_to_template_id']; // . '&marketing_id=' . $_REQUEST['attach_to_marketing_id'] . '&record=' . $_REQUEST['attach_to_marketing_id']; |
|
| 98 | - header('Location: ' . $redirectUrl); |
|
| 97 | + $redirectUrl = 'index.php?module=Campaigns&action=WizardMarketing&campaign_id='.$_REQUEST['campaign_id']."&jump=2&template_id=".$_REQUEST['attach_to_template_id']; // . '&marketing_id=' . $_REQUEST['attach_to_marketing_id'] . '&record=' . $_REQUEST['attach_to_marketing_id']; |
|
| 98 | + header('Location: '.$redirectUrl); |
|
| 99 | 99 | die(); |
| 100 | 100 | break; |
| 101 | 101 | |
| 102 | 102 | default: case 'get': |
| 103 | - if($bean = BeanFactory::getBean('EmailTemplates', $emailTemplateId)) { |
|
| 103 | + if ($bean = BeanFactory::getBean('EmailTemplates', $emailTemplateId)) { |
|
| 104 | 104 | $fields = array('id', 'name', 'body', 'body_html', 'subject'); |
| 105 | 105 | foreach ($bean as $key => $value) { |
| 106 | 106 | if (in_array($key, $fields)) { |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $data['body_from_html'] = from_html($bean->body_html); |
| 112 | 112 | $attachmentBeans = $bean->getAttachments(); |
| 113 | - if($attachmentBeans) { |
|
| 113 | + if ($attachmentBeans) { |
|
| 114 | 114 | $attachments = array(); |
| 115 | - foreach($attachmentBeans as $attachmentBean) { |
|
| 115 | + foreach ($attachmentBeans as $attachmentBean) { |
|
| 116 | 116 | $attachments[] = array( |
| 117 | 117 | 'id' => $attachmentBean->id, |
| 118 | 118 | 'name' => $attachmentBean->name, |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | $results = json_encode($results); |
| 148 | -if(!$results) { |
|
| 149 | - if(json_last_error()) { |
|
| 148 | +if (!$results) { |
|
| 149 | + if (json_last_error()) { |
|
| 150 | 150 | $results = array( |
| 151 | 151 | 'error' => 'json_encode error: '.json_last_error_msg() |
| 152 | 152 | ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - function getFormBody($prefix, $mod='',$formname='', $size='30') { |
|
| 57 | + function getFormBody($prefix, $mod = '', $formname = '', $size = '30') { |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | global $mod_strings; |
| 61 | 61 | |
| 62 | 62 | $temp_strings = $mod_strings; |
| 63 | 63 | |
| 64 | - if(!empty($mod)) { |
|
| 64 | + if (!empty($mod)) { |
|
| 65 | 65 | global $current_language; |
| 66 | 66 | $mod_strings = return_module_language($current_language, $mod); |
| 67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL']; |
| 72 | 72 | $lbl_subject = $mod_strings['LBL_NOTE_SUBJECT']; |
| 73 | 73 | $lbl_description = $mod_strings['LBL_NOTE']; |
| 74 | - $default_parent_type= $app_list_strings['record_type_default_key']; |
|
| 74 | + $default_parent_type = $app_list_strings['record_type_default_key']; |
|
| 75 | 75 | |
| 76 | 76 | $form = <<<EOF |
| 77 | 77 | <input type="hidden" name="${prefix}record" value=""> |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | $javascript->setFormName($formname); |
| 98 | 98 | $javascript->setSugarBean(new EmailTemplate()); |
| 99 | 99 | $javascript->addRequiredFields($prefix); |
| 100 | - $form .=$javascript->getScript(); |
|
| 100 | + $form .= $javascript->getScript(); |
|
| 101 | 101 | $mod_strings = $temp_strings; |
| 102 | 102 | return $form; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - function getForm($prefix, $mod='') { |
|
| 106 | - if(!empty($mod)) { |
|
| 105 | + function getForm($prefix, $mod = '') { |
|
| 106 | + if (!empty($mod)) { |
|
| 107 | 107 | global $current_language; |
| 108 | 108 | $mod_strings = return_module_language($current_language, $mod); |
| 109 | - }else global $mod_strings; |
|
| 109 | + } else global $mod_strings; |
|
| 110 | 110 | global $app_strings; |
| 111 | 111 | global $app_list_strings; |
| 112 | 112 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | |
| 140 | - function handleSave($prefix,$redirect=true, $useRequired=false, $useSiteURL = false, $entryPoint = 'download', $useUploadFolder = false) |
|
| 140 | + function handleSave($prefix, $redirect = true, $useRequired = false, $useSiteURL = false, $entryPoint = 'download', $useUploadFolder = false) |
|
| 141 | 141 | { |
| 142 | 142 | require_once('include/formbase.php'); |
| 143 | 143 | require_once('include/upload_file.php'); |
@@ -199,18 +199,18 @@ discard block |
||
| 199 | 199 | if (!copy($file_location, $newFileLocation)) { |
| 200 | 200 | $GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation"); |
| 201 | 201 | } else { |
| 202 | - if($useUploadFolder) { |
|
| 203 | - $secureLink = ($useSiteURL ? $sugar_config['site_url'] . '/' : '') . "public/{$id}"; |
|
| 202 | + if ($useUploadFolder) { |
|
| 203 | + $secureLink = ($useSiteURL ? $sugar_config['site_url'].'/' : '')."public/{$id}"; |
|
| 204 | 204 | // create a copy with correct extension by mime type |
| 205 | - if(!file_exists('public')) { |
|
| 205 | + if (!file_exists('public')) { |
|
| 206 | 206 | sugar_mkdir('public', 777); |
| 207 | 207 | } |
| 208 | - if(copy($file_location, "public/{$id}.{$mime_type}")) { |
|
| 208 | + if (copy($file_location, "public/{$id}.{$mime_type}")) { |
|
| 209 | 209 | $secureLink .= ".{$mime_type}"; |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | else { |
| 213 | - $secureLink = ($useSiteURL ? $sugar_config['site_url'] . '/' : '') . "index.php?entryPoint=" . $entryPoint . "&type=Notes&id={$id}&filename=" . $match; |
|
| 213 | + $secureLink = ($useSiteURL ? $sugar_config['site_url'].'/' : '')."index.php?entryPoint=".$entryPoint."&type=Notes&id={$id}&filename=".$match; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } else { |
| 226 | 226 | $check_notify = FALSE; |
| 227 | 227 | } |
| 228 | - if($preProcessedImages) { |
|
| 228 | + if ($preProcessedImages) { |
|
| 229 | 229 | $focus->body_html = $emailTemplateBodyHtml; |
| 230 | 230 | } |
| 231 | 231 | $return_id = $focus->save($check_notify); |
@@ -243,20 +243,20 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | $max_files_upload = count($_FILES); |
| 245 | 245 | |
| 246 | - if(!empty($focus->id)) { |
|
| 246 | + if (!empty($focus->id)) { |
|
| 247 | 247 | $note = new Note(); |
| 248 | 248 | $where = "notes.parent_id='{$focus->id}'"; |
| 249 | - if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates |
|
| 249 | + if (!empty($_REQUEST['old_id'])) { // to support duplication of email templates |
|
| 250 | 250 | $where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'"; |
| 251 | 251 | } |
| 252 | 252 | $notes_list = $note->get_full_list("", $where, true); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if(!isset($notes_list)) { |
|
| 255 | + if (!isset($notes_list)) { |
|
| 256 | 256 | $notes_list = array(); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here. |
|
| 259 | + if (!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here. |
|
| 260 | 260 | $focus->attachments = array(); |
| 261 | 261 | } |
| 262 | 262 | $focus->attachments = array_merge($focus->attachments, $notes_list); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $note = new Note(); |
| 271 | 271 | |
| 272 | 272 | //Images are presaved above so we need to prevent duplicate files from being created. |
| 273 | - if( isset($preProcessedImages[$file['name']]) ) |
|
| 273 | + if (isset($preProcessedImages[$file['name']])) |
|
| 274 | 274 | { |
| 275 | 275 | $oldId = $preProcessedImages[$file['name']]; |
| 276 | 276 | $note->id = $oldId; |
@@ -278,19 +278,19 @@ discard block |
||
| 278 | 278 | $GLOBALS['log']->debug("Image {$file['name']} has already been processed."); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - $i=preg_replace("/email_attachment(.+)/",'$1',$key); |
|
| 281 | + $i = preg_replace("/email_attachment(.+)/", '$1', $key); |
|
| 282 | 282 | $upload_file = new UploadFile($key); |
| 283 | 283 | |
| 284 | - if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) { |
|
| 284 | + if (isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/", $key)) { |
|
| 285 | 285 | $note->filename = $upload_file->get_stored_file_name(); |
| 286 | 286 | $note->file = $upload_file; |
| 287 | 287 | $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name; |
| 288 | - if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){ |
|
| 289 | - if($_REQUEST['embedded'.$i]=='true'){ |
|
| 290 | - $note->embed_flag =true; |
|
| 288 | + if (isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])) { |
|
| 289 | + if ($_REQUEST['embedded'.$i] == 'true') { |
|
| 290 | + $note->embed_flag = true; |
|
| 291 | 291 | } |
| 292 | - else{ |
|
| 293 | - $note->embed_flag =false; |
|
| 292 | + else { |
|
| 293 | + $note->embed_flag = false; |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | array_push($focus->attachments, $note); |
@@ -299,11 +299,11 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | $focus->saved_attachments = array(); |
| 302 | - foreach($focus->attachments as $note) |
|
| 302 | + foreach ($focus->attachments as $note) |
|
| 303 | 303 | { |
| 304 | - if( !empty($note->id) && $note->new_with_id === FALSE) |
|
| 304 | + if (!empty($note->id) && $note->new_with_id === FALSE) |
|
| 305 | 305 | { |
| 306 | - if(empty($_REQUEST['old_id'])) |
|
| 306 | + if (empty($_REQUEST['old_id'])) |
|
| 307 | 307 | array_push($focus->saved_attachments, $note); // to support duplication of email templates |
| 308 | 308 | else |
| 309 | 309 | { |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | array_push($focus->saved_attachments, $note); |
| 340 | 340 | $note->id = $note_id; |
| 341 | 341 | |
| 342 | - if($note->new_with_id === FALSE) |
|
| 342 | + if ($note->new_with_id === FALSE) |
|
| 343 | 343 | $note->file->final_move($note->id); |
| 344 | 344 | else |
| 345 | 345 | $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed"); |
@@ -350,18 +350,18 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | /////////////////////////////////////////////////////////////////////////// |
| 352 | 352 | //// ATTACHMENTS FROM DOCUMENTS |
| 353 | - $count=''; |
|
| 353 | + $count = ''; |
|
| 354 | 354 | //_pp($_REQUEST); |
| 355 | 355 | //_ppd(count($_REQUEST['document'])); |
| 356 | - if(!empty($_REQUEST['document'])){ |
|
| 356 | + if (!empty($_REQUEST['document'])) { |
|
| 357 | 357 | $count = count($_REQUEST['document']); |
| 358 | 358 | } |
| 359 | - else{ |
|
| 360 | - $count=10; |
|
| 359 | + else { |
|
| 360 | + $count = 10; |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - for($i=0; $i<$count; $i++) { |
|
| 364 | - if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) { |
|
| 363 | + for ($i = 0; $i < $count; $i++) { |
|
| 364 | + if (isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) { |
|
| 365 | 365 | $doc = new Document(); |
| 366 | 366 | $docRev = new DocumentRevision(); |
| 367 | 367 | $docNote = new Note(); |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | /////////////////////////////////////////////////////////////////////////// |
| 391 | 391 | //// REMOVE ATTACHMENTS |
| 392 | 392 | |
| 393 | - if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) { |
|
| 394 | - foreach($_REQUEST['remove_attachment'] as $noteId) { |
|
| 393 | + if (isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) { |
|
| 394 | + foreach ($_REQUEST['remove_attachment'] as $noteId) { |
|
| 395 | 395 | $q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\''; |
| 396 | 396 | $focus->db->query($q); |
| 397 | 397 | } |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | |
| 406 | 406 | clear_register_value('select_array', $focus->object_name); |
| 407 | 407 | |
| 408 | - if($redirect) { |
|
| 408 | + if ($redirect) { |
|
| 409 | 409 | $GLOBALS['log']->debug("Saved record with id of ".$return_id); |
| 410 | 410 | handleRedirect($return_id, "EmailTemplates"); |
| 411 | - }else{ |
|
| 411 | + } else { |
|
| 412 | 412 | return $focus; |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | 3 | /********************************************************************************* |
| 4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | global $current_user; |
| 41 | 41 | $module_name = "Contacts"; |
| 42 | 42 | $searchFields['Contacts'] = |
| 43 | - array ( |
|
| 44 | - 'first_name' => array( 'query_type'=>'default'), |
|
| 43 | + array( |
|
| 44 | + 'first_name' => array('query_type'=>'default'), |
|
| 45 | 45 | 'last_name'=> array('query_type'=>'default'), |
| 46 | - 'search_name'=> array('query_type'=>'default','db_field'=>array('first_name','last_name'),'force_unifiedsearch'=>true), |
|
| 47 | - 'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')), |
|
| 48 | - 'lead_source'=> array('query_type'=>'default','operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'), |
|
| 46 | + 'search_name'=> array('query_type'=>'default', 'db_field'=>array('first_name', 'last_name'), 'force_unifiedsearch'=>true), |
|
| 47 | + 'account_name'=> array('query_type'=>'default', 'db_field'=>array('accounts.name')), |
|
| 48 | + 'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'), |
|
| 49 | 49 | 'do_not_call'=> array('query_type'=>'default', 'input_type' => 'checkbox', 'operator'=>'='), |
| 50 | - 'phone'=> array('query_type'=>'default','db_field'=>array('phone_mobile','phone_work','phone_other','phone_fax','assistant_phone')), |
|
| 50 | + 'phone'=> array('query_type'=>'default', 'db_field'=>array('phone_mobile', 'phone_work', 'phone_other', 'phone_fax', 'assistant_phone')), |
|
| 51 | 51 | 'email'=> array( |
| 52 | 52 | 'query_type' => 'default', |
| 53 | 53 | 'operator' => 'subquery', |
@@ -62,25 +62,25 @@ discard block |
||
| 62 | 62 | 'subquery' => "SELECT favorites.parent_id FROM favorites |
| 63 | 63 | WHERE favorites.deleted = 0 |
| 64 | 64 | and favorites.parent_type = '".$module_name."' |
| 65 | - and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}", |
|
| 65 | + and favorites.assigned_user_id = '" .$current_user->id."') OR NOT ({0}", |
|
| 66 | 66 | 'db_field'=>array('id')), |
| 67 | 67 | 'assistant'=> array('query_type'=>'default'), |
| 68 | - 'address_street'=> array('query_type'=>'default','db_field'=>array('primary_address_street','alt_address_street')), |
|
| 69 | - 'address_city'=> array('query_type'=>'default','db_field'=>array('primary_address_city','alt_address_city')), |
|
| 70 | - 'address_state'=> array('query_type'=>'default','db_field'=>array('primary_address_state','alt_address_state')), |
|
| 71 | - 'address_postalcode'=> array('query_type'=>'default','db_field'=>array('primary_address_postalcode','alt_address_postalcode')), |
|
| 72 | - 'address_country'=> array('query_type'=>'default','db_field'=>array('primary_address_country','alt_address_country')), |
|
| 73 | - 'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), |
|
| 68 | + 'address_street'=> array('query_type'=>'default', 'db_field'=>array('primary_address_street', 'alt_address_street')), |
|
| 69 | + 'address_city'=> array('query_type'=>'default', 'db_field'=>array('primary_address_city', 'alt_address_city')), |
|
| 70 | + 'address_state'=> array('query_type'=>'default', 'db_field'=>array('primary_address_state', 'alt_address_state')), |
|
| 71 | + 'address_postalcode'=> array('query_type'=>'default', 'db_field'=>array('primary_address_postalcode', 'alt_address_postalcode')), |
|
| 72 | + 'address_country'=> array('query_type'=>'default', 'db_field'=>array('primary_address_country', 'alt_address_country')), |
|
| 73 | + 'current_user_only'=> array('query_type'=>'default', 'db_field'=>array('assigned_user_id'), 'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'), |
|
| 74 | 74 | 'assigned_user_id'=> array('query_type'=>'default'), |
| 75 | - 'account_id'=> array('query_type'=>'default','db_field'=>array('accounts.id')), |
|
| 75 | + 'account_id'=> array('query_type'=>'default', 'db_field'=>array('accounts.id')), |
|
| 76 | 76 | 'campaign_name'=> array('query_type'=>'default'), |
| 77 | 77 | //Range Search Support |
| 78 | - 'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 79 | - 'start_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 80 | - 'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 81 | - 'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 82 | - 'start_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 83 | - 'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 78 | + 'range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 79 | + 'start_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 80 | + 'end_range_date_entered' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 81 | + 'range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 82 | + 'start_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 83 | + 'end_range_date_modified' => array('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true), |
|
| 84 | 84 | //Range Search Support |
| 85 | 85 | ); |
| 86 | 86 | ?> |