Completed
Push — console-installer ( e2b50d...6ce748 )
by Adam
22:30
created
tests/tests/modules/Project/ProjectTest.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -3,132 +3,132 @@  discard block
 block discarded – undo
3 3
 class ProjectTest extends PHPUnit_Framework_TestCase {
4 4
 
5 5
 
6
-	public function testProject()
7
-	{
8
-		//execute the contructor and check for the Object type and  attributes
9
-		$project = new Project();
6
+    public function testProject()
7
+    {
8
+        //execute the contructor and check for the Object type and  attributes
9
+        $project = new Project();
10 10
 
11
-		$this->assertInstanceOf('Project',$project);
12
-		$this->assertInstanceOf('SugarBean',$project);
11
+        $this->assertInstanceOf('Project',$project);
12
+        $this->assertInstanceOf('SugarBean',$project);
13 13
 
14 14
 
15
-		$this->assertAttributeEquals('project', 'table_name', $project);
16
-		$this->assertAttributeEquals('Project', 'module_dir', $project);
17
-		$this->assertAttributeEquals('Project', 'object_name', $project);
15
+        $this->assertAttributeEquals('project', 'table_name', $project);
16
+        $this->assertAttributeEquals('Project', 'module_dir', $project);
17
+        $this->assertAttributeEquals('Project', 'object_name', $project);
18 18
 
19
-		$this->assertAttributeEquals(true, 'new_schema', $project);
19
+        $this->assertAttributeEquals(true, 'new_schema', $project);
20 20
 
21
-	}
21
+    }
22 22
 
23
-	public function testfill_in_additional_detail_fields()
24
-	{
25
-		error_reporting(E_ERROR | E_PARSE);
23
+    public function testfill_in_additional_detail_fields()
24
+    {
25
+        error_reporting(E_ERROR | E_PARSE);
26 26
 
27
-		$project = new Project();
27
+        $project = new Project();
28 28
 
29
-		//test without setting assigned_user_id
30
-		$project->fill_in_additional_detail_fields();
31
-		$this->assertEquals("", $project->assigned_user_name);
29
+        //test without setting assigned_user_id
30
+        $project->fill_in_additional_detail_fields();
31
+        $this->assertEquals("", $project->assigned_user_name);
32 32
 
33 33
 
34
-		//test with assigned_user_id set
35
-		$project->assigned_user_id = 1;
36
-		$project->fill_in_additional_detail_fields();
37
-		$this->assertEquals("Administrator", $project->assigned_user_name);
34
+        //test with assigned_user_id set
35
+        $project->assigned_user_id = 1;
36
+        $project->fill_in_additional_detail_fields();
37
+        $this->assertEquals("Administrator", $project->assigned_user_name);
38 38
 
39
-	}
39
+    }
40 40
 
41 41
 
42
-	public function testfill_in_additional_list_fields()
43
-	{
44
-		$project = new Project();
42
+    public function testfill_in_additional_list_fields()
43
+    {
44
+        $project = new Project();
45 45
 
46
-		//test without setting assigned_user_id
47
-		$project->fill_in_additional_list_fields();
48
-		$this->assertEquals("", $project->assigned_user_name);
46
+        //test without setting assigned_user_id
47
+        $project->fill_in_additional_list_fields();
48
+        $this->assertEquals("", $project->assigned_user_name);
49 49
 
50 50
 
51
-		//test with assigned_user_id set
52
-		$project->assigned_user_id = 1;
53
-		$project->fill_in_additional_list_fields();
54
-		$this->assertEquals("Administrator", $project->assigned_user_name);
51
+        //test with assigned_user_id set
52
+        $project->assigned_user_id = 1;
53
+        $project->fill_in_additional_list_fields();
54
+        $this->assertEquals("Administrator", $project->assigned_user_name);
55 55
 
56
-	}
56
+    }
57 57
 
58 58
 
59 59
     public function testsave_relationship_changes()
60 60
     {
61 61
 
62
-    	$project = new Project();
62
+        $project = new Project();
63 63
 
64
-    	$project->id =1;
65
-    	$_REQUEST['relate_id'] = 2;
66
-    	$_REQUEST['relate_to'] = "contacts";
64
+        $project->id =1;
65
+        $_REQUEST['relate_id'] = 2;
66
+        $_REQUEST['relate_to'] = "contacts";
67 67
 
68
-    	//execute the method and test if it works and does not throws an exception.
69
-    	try {
70
-    		$project->save_relationship_changes(true);
71
-    		$this->assertTrue(true);
72
-    	}
73
-    	catch (Exception $e) {
74
-    		$this->fail();
75
-    	}
68
+        //execute the method and test if it works and does not throws an exception.
69
+        try {
70
+            $project->save_relationship_changes(true);
71
+            $this->assertTrue(true);
72
+        }
73
+        catch (Exception $e) {
74
+            $this->fail();
75
+        }
76 76
 
77 77
     }
78 78
 
79 79
 
80
-	public function test_get_total_estimated_effort()
81
-	{
82
-		//$project = new Project();
83
-		//$result = $project->_get_total_estimated_effort("1");
84
-		$this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
80
+    public function test_get_total_estimated_effort()
81
+    {
82
+        //$project = new Project();
83
+        //$result = $project->_get_total_estimated_effort("1");
84
+        $this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
85 85
 
86
-	}
86
+    }
87 87
 
88 88
 
89
-	public function test_get_total_actual_effort()
90
-	{
91
-		$this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
92
-	}
89
+    public function test_get_total_actual_effort()
90
+    {
91
+        $this->markTestIncomplete('Can Not be implemented: Unknown column parent_id in where clause \n Argument 3 passed to MysqlManager::convert() must be of the type array, integer given');
92
+    }
93 93
 
94 94
 
95
-	public function testget_summary_text()
96
-	{
97
-		$project = new Project();
95
+    public function testget_summary_text()
96
+    {
97
+        $project = new Project();
98 98
 
99
-		//test without setting name
100
-		$this->assertEquals(Null,$project->get_summary_text());
99
+        //test without setting name
100
+        $this->assertEquals(Null,$project->get_summary_text());
101 101
 
102
-		//test with name set
103
-		$project->name = "test";
104
-		$this->assertEquals('test',$project->get_summary_text());
102
+        //test with name set
103
+        $project->name = "test";
104
+        $this->assertEquals('test',$project->get_summary_text());
105 105
 
106
-	}
106
+    }
107 107
 
108 108
 
109
-	public function testbuild_generic_where_clause ()
110
-	{
109
+    public function testbuild_generic_where_clause ()
110
+    {
111 111
 
112
-		$project = new Project();
112
+        $project = new Project();
113 113
 
114
-		//test with empty string params
115
-		$expected = "project.name LIKE '%%'";
116
-		$actual = $project->build_generic_where_clause('');
117
-		$this->assertSame($expected,$actual);
114
+        //test with empty string params
115
+        $expected = "project.name LIKE '%%'";
116
+        $actual = $project->build_generic_where_clause('');
117
+        $this->assertSame($expected,$actual);
118 118
 
119 119
 
120
-		//test with valid string params
121
-		$expected = "project.name LIKE '%%'";
122
-		$actual = $project->build_generic_where_clause('test');
123
-		$this->assertSame($expected,$actual);
120
+        //test with valid string params
121
+        $expected = "project.name LIKE '%%'";
122
+        $actual = $project->build_generic_where_clause('test');
123
+        $this->assertSame($expected,$actual);
124 124
 
125
-	}
125
+    }
126 126
 
127 127
     /**
128 128
      * @todo: NEEDS FIXING!
129 129
      */
130
-	public function testget_list_view_data()
131
-	{
130
+    public function testget_list_view_data()
131
+    {
132 132
         /*
133 133
 		$project = new Project();
134 134
 
@@ -146,44 +146,44 @@  discard block
 block discarded – undo
146 146
 		$this->assertSame($expected, $actual);
147 147
 		*/
148 148
         $this->assertTrue(true, "NEEDS FIXING!");
149
-	}
149
+    }
150 150
 
151
-	public function testbean_implements(){
151
+    public function testbean_implements(){
152 152
 
153
-		$project = new Project();
153
+        $project = new Project();
154 154
 
155
-		$this->assertEquals(false, $project->bean_implements('')); //test with blank value
156
-		$this->assertEquals(false, $project->bean_implements('test')); //test with invalid value
157
-		$this->assertEquals(true, $project->bean_implements('ACL')); //test with valid value
155
+        $this->assertEquals(false, $project->bean_implements('')); //test with blank value
156
+        $this->assertEquals(false, $project->bean_implements('test')); //test with invalid value
157
+        $this->assertEquals(true, $project->bean_implements('ACL')); //test with valid value
158 158
 
159
-	}
159
+    }
160 160
 
161 161
     public function testcreate_export_query()
162 162
     {
163
-    	$project = new Project();
163
+        $project = new Project();
164 164
 
165
-    	//test with empty string params
166
-    	$expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where  project.deleted=0 ";
167
-    	$actual = $project->create_export_query('','');
168
-    	$this->assertSame($expected,$actual);
165
+        //test with empty string params
166
+        $expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where  project.deleted=0 ";
167
+        $actual = $project->create_export_query('','');
168
+        $this->assertSame($expected,$actual);
169 169
 
170 170
 
171
-    	//test with valid string params
172
-    	$expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where (users.user_name) AND  project.deleted=0  ORDER BY project.id";
173
-    	$actual = $project->create_export_query('project.id','users.user_name');
174
-    	$this->assertSame($expected,$actual);
171
+        //test with valid string params
172
+        $expected = "SELECT\n				project.*,\n                users.user_name as assigned_user_name ,project_cstm.jjwg_maps_lng_c,project_cstm.jjwg_maps_lat_c,project_cstm.jjwg_maps_geocode_status_c,project_cstm.jjwg_maps_address_c FROM project  LEFT JOIN project_cstm ON project.id = project_cstm.id_c  LEFT JOIN users\n                   	ON project.assigned_user_id=users.id where (users.user_name) AND  project.deleted=0  ORDER BY project.id";
173
+        $actual = $project->create_export_query('project.id','users.user_name');
174
+        $this->assertSame($expected,$actual);
175 175
 
176 176
     }
177 177
 
178
-	public function testgetAllProjectTasks(){
178
+    public function testgetAllProjectTasks(){
179 179
 
180
-		$project = new Project();
180
+        $project = new Project();
181 181
 
182
-		$project->id = 1;
183
-		$result = $project->getAllProjectTasks();
184
-		$this->assertTrue(is_array($result));
182
+        $project->id = 1;
183
+        $result = $project->getAllProjectTasks();
184
+        $this->assertTrue(is_array($result));
185 185
 
186
-	}
186
+    }
187 187
 
188 188
 }
189 189
 ?>
Please login to merge, or discard this patch.
modules/Tasks/metadata/SearchFields.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -40,42 +40,42 @@
 block discarded – undo
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 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
         
50
-		'open_only' => array(
51
-			'query_type'=>'default',
52
-			'db_field'=>array('status'),
53
-			'operator'=>'not in',
54
-			'closed_values' => array('Completed', 'Deferred'),
55
-			'type'=>'bool',
56
-		),				
50
+        'open_only' => array(
51
+            'query_type'=>'default',
52
+            'db_field'=>array('status'),
53
+            'operator'=>'not in',
54
+            'closed_values' => array('Completed', 'Deferred'),
55
+            'type'=>'bool',
56
+        ),				
57 57
         'favorites_only' => array(
58 58
             'query_type'=>'format',
59 59
             'operator' => 'subquery',
60
-			'subquery' => "SELECT favorites.parent_id FROM favorites
60
+            'subquery' => "SELECT favorites.parent_id FROM favorites
61 61
 			                    WHERE favorites.deleted = 0
62 62
 			                        and favorites.parent_type = '".$module_name."'
63 63
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
64 64
             'db_field'=>array('id')),
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),	
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),	
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),	
79
-		//Range Search Support 				
80
-	);
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
+        //Range Search Support 				
80
+    );
81 81
 ?>
Please login to merge, or discard this patch.
modules/EmailTemplates/EmailTemplateFormBase.php 1 patch
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
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
-		global $mod_strings;
60
+        global $mod_strings;
61 61
 
62
-		$temp_strings = $mod_strings;
62
+        $temp_strings = $mod_strings;
63 63
 
64
-		if(!empty($mod)) {
65
-			global $current_language;
66
-			$mod_strings = return_module_language($current_language, $mod);
67
-		}
68
-					global $app_strings;
69
-					global $app_list_strings;
64
+        if(!empty($mod)) {
65
+            global $current_language;
66
+            $mod_strings = return_module_language($current_language, $mod);
67
+        }
68
+                    global $app_strings;
69
+                    global $app_list_strings;
70 70
 
71
-				$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
72
-				$lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
73
-				$lbl_description = $mod_strings['LBL_NOTE'];
74
-				$default_parent_type= $app_list_strings['record_type_default_key'];
71
+                $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
72
+                $lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
73
+                $lbl_description = $mod_strings['LBL_NOTE'];
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="">
@@ -93,325 +93,325 @@  discard block
 block discarded – undo
93 93
 				</table></p>
94 94
 EOF;
95 95
 
96
-	$javascript = new javascript();
97
-	$javascript->setFormName($formname);
98
-	$javascript->setSugarBean(new EmailTemplate());
99
-	$javascript->addRequiredFields($prefix);
100
-	$form .=$javascript->getScript();
101
-	$mod_strings = $temp_strings;
102
-	return $form;
103
-	}
104
-
105
-	function getForm($prefix, $mod='') {
106
-		if(!empty($mod)) {
107
-		global $current_language;
108
-		$mod_strings = return_module_language($current_language, $mod);
109
-	}else global $mod_strings;
110
-		global $app_strings;
111
-		global $app_list_strings;
112
-
113
-		$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
114
-		$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
115
-		$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
116
-
117
-
118
-		$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
96
+    $javascript = new javascript();
97
+    $javascript->setFormName($formname);
98
+    $javascript->setSugarBean(new EmailTemplate());
99
+    $javascript->addRequiredFields($prefix);
100
+    $form .=$javascript->getScript();
101
+    $mod_strings = $temp_strings;
102
+    return $form;
103
+    }
104
+
105
+    function getForm($prefix, $mod='') {
106
+        if(!empty($mod)) {
107
+        global $current_language;
108
+        $mod_strings = return_module_language($current_language, $mod);
109
+    }else global $mod_strings;
110
+        global $app_strings;
111
+        global $app_list_strings;
112
+
113
+        $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
114
+        $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
115
+        $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
116
+
117
+
118
+        $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
119 119
 $the_form .= <<<EOQ
120 120
 
121 121
 				<form name="${prefix}EmailTemplateSave" onSubmit="return check_form('${prefix}EmailTemplateSave')" method="POST" action="index.php">
122 122
 					<input type="hidden" name="${prefix}module" value="EmailTemplates">
123 123
 					<input type="hidden" name="${prefix}action" value="Save">
124 124
 EOQ;
125
-		$the_form .= $this->getFormBody($prefix, $mod, "${prefix}EmailTemplateSave", "20");
125
+        $the_form .= $this->getFormBody($prefix, $mod, "${prefix}EmailTemplateSave", "20");
126 126
 $the_form .= <<<EOQ
127 127
 				<p><input title="$lbl_save_button_title" accessKey="$lbl_save_button_key" class="button" type="submit" name="button" value="  $lbl_save_button_label  " ></p>
128 128
 				</form>
129 129
 
130 130
 EOQ;
131 131
 
132
-		$the_form .= get_left_form_footer();
133
-		$the_form .= get_validate_record_js();
134
-
135
-
136
-		return $the_form;
137
-	}
138
-
139
-
140
-	function handleSave($prefix,$redirect=true, $useRequired=false, $useSiteURL = false, $entryPoint = 'download', $useUploadFolder = false)
141
-	{
142
-		require_once('include/formbase.php');
143
-		require_once('include/upload_file.php');
144
-		global $upload_maxsize;
145
-		global $mod_strings;
146
-		global $sugar_config;
147
-
148
-		$focus = new EmailTemplate();
149
-		if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150
-			return null;
151
-		}
152
-		$focus = populateFromPost($prefix, $focus);
153
-		//process the text only flag
154
-		if (isset($_POST['text_only']) && ($_POST['text_only'] == '1')) {
155
-			$focus->text_only = 1;
156
-		} else {
157
-			$focus->text_only = 0;
158
-		}
159
-		if (!$focus->ACLAccess('Save')) {
160
-			ACLController::displayNoAccess(true);
161
-			sugar_cleanup(true);
162
-		}
163
-		if (!isset($_REQUEST['published'])) $focus->published = 'off';
164
-
165
-		$this->handleAttachmentsProcessImages($focus, $redirect, $useSiteURL, $entryPoint, $useUploadFolder);
166
-		return $focus;
167
-	}
168
-
169
-	public function handleAttachmentsProcessImages($focus, $redirect, $useSiteURL = false, $entryPoint = 'download', $useUploadFolder = false) {
170
-		$return_id = $this->processImages($focus, $useSiteURL, $entryPoint, $useUploadFolder);
171
-		return $this->handleAttachments($focus, $redirect, $return_id);
172
-	}
173
-
174
-	public function processImages(&$focus, $useSiteURL, $entryPoint, $useUploadFolder) {
175
-		global $sugar_config;
176
-		$preProcessedImages = array();
177
-		$emailTemplateBodyHtml = from_html($focus->body_html);
178
-		if (strpos($emailTemplateBodyHtml, '"cache/images/')) {
179
-			$matches = array();
180
-			preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
181
-			foreach ($matches[1] as $match) {
182
-				$filename = urldecode($match);
183
-				if ($filename != pathinfo($filename, PATHINFO_BASENAME)) {
184
-					// don't allow paths there
185
-					$emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
186
-					continue;
187
-				}
188
-				$file_location = sugar_cached("images/{$filename}");
189
-				$mime_type = pathinfo($filename, PATHINFO_EXTENSION);
190
-
191
-				if (file_exists($file_location)) {
192
-					//$id = create_guid();
193
-
194
-					$note = new Note();
195
-					$note->save();
196
-					$id = $note->id;
197
-
198
-					$newFileLocation = "upload://$id";
199
-					if (!copy($file_location, $newFileLocation)) {
200
-						$GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
201
-					} else {
202
-						if($useUploadFolder) {
203
-							$secureLink = ($useSiteURL ? $sugar_config['site_url'] . '/' : '') . "public/{$id}";
204
-							// create a copy with correct extension by mime type
205
-							if(!file_exists('public')) {
206
-								sugar_mkdir('public', 777);
207
-							}
208
-							if(copy($file_location, "public/{$id}.{$mime_type}")) {
209
-								$secureLink .= ".{$mime_type}";
210
-							}
211
-						}
212
-						else {
213
-							$secureLink = ($useSiteURL ? $sugar_config['site_url'] . '/' : '') . "index.php?entryPoint=" . $entryPoint . "&type=Notes&id={$id}&filename=" . $match;
214
-						}
215
-
216
-						$emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml);
217
-						//unlink($file_location);
218
-						$preProcessedImages[$filename] = $id;
219
-					}
220
-				} // if
221
-			} // foreach
222
-		} // if
223
-		if (isset($GLOBALS['check_notify'])) {
224
-			$check_notify = $GLOBALS['check_notify'];
225
-		} else {
226
-			$check_notify = FALSE;
227
-		}
228
-		if($preProcessedImages) {
229
-			$focus->body_html = $emailTemplateBodyHtml;
230
-		}
231
-		$return_id = $focus->save($check_notify);
232
-		return $return_id;
233
-	}
234
-
235
-	public function handleAttachments($focus, $redirect, $return_id) {
236
-		///////////////////////////////////////////////////////////////////////////////
237
-		////	ATTACHMENT HANDLING
238
-
239
-		///////////////////////////////////////////////////////////////////////////
240
-		////	ADDING NEW ATTACHMENTS
241
-
242
-		global $mod_strings;
243
-
244
-		$max_files_upload = count($_FILES);
245
-
246
-		if(!empty($focus->id)) {
247
-			$note = new Note();
248
-			$where = "notes.parent_id='{$focus->id}'";
249
-			if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
250
-				$where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
251
-			}
252
-			$notes_list = $note->get_full_list("", $where, true);
253
-		}
254
-
255
-		if(!isset($notes_list)) {
256
-			$notes_list = array();
257
-		}
258
-
259
-		if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
260
-			$focus->attachments = array();
261
-		}
262
-		$focus->attachments = array_merge($focus->attachments, $notes_list);
263
-
264
-
265
-
266
-		//for($i = 0; $i < $max_files_upload; $i++) {
267
-
268
-		foreach ($_FILES as $key => $file)
269
-		{
270
-			$note = new Note();
271
-
272
-			//Images are presaved above so we need to prevent duplicate files from being created.
273
-			if( isset($preProcessedImages[$file['name']]) )
274
-			{
275
-			    $oldId = $preProcessedImages[$file['name']];
276
-			    $note->id = $oldId;
277
-			    $note->new_with_id = TRUE;
278
-			    $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
132
+        $the_form .= get_left_form_footer();
133
+        $the_form .= get_validate_record_js();
134
+
135
+
136
+        return $the_form;
137
+    }
138
+
139
+
140
+    function handleSave($prefix,$redirect=true, $useRequired=false, $useSiteURL = false, $entryPoint = 'download', $useUploadFolder = false)
141
+    {
142
+        require_once('include/formbase.php');
143
+        require_once('include/upload_file.php');
144
+        global $upload_maxsize;
145
+        global $mod_strings;
146
+        global $sugar_config;
147
+
148
+        $focus = new EmailTemplate();
149
+        if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150
+            return null;
151
+        }
152
+        $focus = populateFromPost($prefix, $focus);
153
+        //process the text only flag
154
+        if (isset($_POST['text_only']) && ($_POST['text_only'] == '1')) {
155
+            $focus->text_only = 1;
156
+        } else {
157
+            $focus->text_only = 0;
158
+        }
159
+        if (!$focus->ACLAccess('Save')) {
160
+            ACLController::displayNoAccess(true);
161
+            sugar_cleanup(true);
162
+        }
163
+        if (!isset($_REQUEST['published'])) $focus->published = 'off';
164
+
165
+        $this->handleAttachmentsProcessImages($focus, $redirect, $useSiteURL, $entryPoint, $useUploadFolder);
166
+        return $focus;
167
+    }
168
+
169
+    public function handleAttachmentsProcessImages($focus, $redirect, $useSiteURL = false, $entryPoint = 'download', $useUploadFolder = false) {
170
+        $return_id = $this->processImages($focus, $useSiteURL, $entryPoint, $useUploadFolder);
171
+        return $this->handleAttachments($focus, $redirect, $return_id);
172
+    }
173
+
174
+    public function processImages(&$focus, $useSiteURL, $entryPoint, $useUploadFolder) {
175
+        global $sugar_config;
176
+        $preProcessedImages = array();
177
+        $emailTemplateBodyHtml = from_html($focus->body_html);
178
+        if (strpos($emailTemplateBodyHtml, '"cache/images/')) {
179
+            $matches = array();
180
+            preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
181
+            foreach ($matches[1] as $match) {
182
+                $filename = urldecode($match);
183
+                if ($filename != pathinfo($filename, PATHINFO_BASENAME)) {
184
+                    // don't allow paths there
185
+                    $emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
186
+                    continue;
187
+                }
188
+                $file_location = sugar_cached("images/{$filename}");
189
+                $mime_type = pathinfo($filename, PATHINFO_EXTENSION);
190
+
191
+                if (file_exists($file_location)) {
192
+                    //$id = create_guid();
193
+
194
+                    $note = new Note();
195
+                    $note->save();
196
+                    $id = $note->id;
197
+
198
+                    $newFileLocation = "upload://$id";
199
+                    if (!copy($file_location, $newFileLocation)) {
200
+                        $GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
201
+                    } else {
202
+                        if($useUploadFolder) {
203
+                            $secureLink = ($useSiteURL ? $sugar_config['site_url'] . '/' : '') . "public/{$id}";
204
+                            // create a copy with correct extension by mime type
205
+                            if(!file_exists('public')) {
206
+                                sugar_mkdir('public', 777);
207
+                            }
208
+                            if(copy($file_location, "public/{$id}.{$mime_type}")) {
209
+                                $secureLink .= ".{$mime_type}";
210
+                            }
211
+                        }
212
+                        else {
213
+                            $secureLink = ($useSiteURL ? $sugar_config['site_url'] . '/' : '') . "index.php?entryPoint=" . $entryPoint . "&type=Notes&id={$id}&filename=" . $match;
214
+                        }
215
+
216
+                        $emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml);
217
+                        //unlink($file_location);
218
+                        $preProcessedImages[$filename] = $id;
219
+                    }
220
+                } // if
221
+            } // foreach
222
+        } // if
223
+        if (isset($GLOBALS['check_notify'])) {
224
+            $check_notify = $GLOBALS['check_notify'];
225
+        } else {
226
+            $check_notify = FALSE;
227
+        }
228
+        if($preProcessedImages) {
229
+            $focus->body_html = $emailTemplateBodyHtml;
230
+        }
231
+        $return_id = $focus->save($check_notify);
232
+        return $return_id;
233
+    }
234
+
235
+    public function handleAttachments($focus, $redirect, $return_id) {
236
+        ///////////////////////////////////////////////////////////////////////////////
237
+        ////	ATTACHMENT HANDLING
238
+
239
+        ///////////////////////////////////////////////////////////////////////////
240
+        ////	ADDING NEW ATTACHMENTS
241
+
242
+        global $mod_strings;
243
+
244
+        $max_files_upload = count($_FILES);
245
+
246
+        if(!empty($focus->id)) {
247
+            $note = new Note();
248
+            $where = "notes.parent_id='{$focus->id}'";
249
+            if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
250
+                $where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
279 251
             }
252
+            $notes_list = $note->get_full_list("", $where, true);
253
+        }
254
+
255
+        if(!isset($notes_list)) {
256
+            $notes_list = array();
257
+        }
258
+
259
+        if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
260
+            $focus->attachments = array();
261
+        }
262
+        $focus->attachments = array_merge($focus->attachments, $notes_list);
263
+
264
+
265
+
266
+        //for($i = 0; $i < $max_files_upload; $i++) {
267
+
268
+        foreach ($_FILES as $key => $file)
269
+        {
270
+            $note = new Note();
280 271
 
281
-			$i=preg_replace("/email_attachment(.+)/",'$1',$key);
282
-			$upload_file = new UploadFile($key);
283
-
284
-			if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
285
-				$note->filename = $upload_file->get_stored_file_name();
286
-				$note->file = $upload_file;
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;
291
-                  }
292
-                  else{
293
-                  	$note->embed_flag =false;
294
-                  }
295
-				}
296
-				array_push($focus->attachments, $note);
297
-			}
298
-
299
-		}
300
-
301
-		$focus->saved_attachments = array();
302
-		foreach($focus->attachments as $note)
303
-		{
304
-			if( !empty($note->id) && $note->new_with_id === FALSE)
305
-			{
306
-				if(empty($_REQUEST['old_id']))
307
-					array_push($focus->saved_attachments, $note); // to support duplication of email templates
308
-				else
309
-				{
310
-					// we're duplicating a template with attachments
311
-					// dupe the file, create a new note, assign the note to the new template
312
-					$newNote = new Note();
313
-					$newNote->retrieve($note->id);
314
-					$newNote->id = create_guid();
315
-					$newNote->parent_id = $focus->id;
316
-					$newNote->new_with_id = true;
317
-					$newNote->date_modified = '';
318
-					$newNote->date_entered = '';
319
-					/* BEGIN - SECURITY GROUPS */
320
-					//Need to do this so that attachments show under an EmailTemplate correctly for a normal user
321
-					global $current_user;
322
-					$newNote->assigned_user_id = $current_user->id;
323
-					/* END - SECURITY GROUPS */
324
-					$newNoteId = $newNote->save();
325
-
326
-					UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
327
-				}
328
-				continue;
329
-			}
330
-			$note->parent_id = $focus->id;
331
-			$note->parent_type = 'Emails';
332
-			$note->file_mime_type = $note->file->mime_type;
333
-			/* BEGIN - SECURITY GROUPS */
334
-			//Need to do this so that attachments show under an EmailTemplate correctly for a normal user
335
-			global $current_user;
336
-			$note->assigned_user_id = $current_user->id;
337
-			/* END - SECURITY GROUPS */
338
-			$note_id = $note->save();
339
-			array_push($focus->saved_attachments, $note);
340
-			$note->id = $note_id;
341
-
342
-			if($note->new_with_id === FALSE)
343
-    			$note->file->final_move($note->id);
344
-    	    else
345
-    	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
346
-		}
347
-
348
-		////	END NEW ATTACHMENTS
349
-		///////////////////////////////////////////////////////////////////////////
350
-
351
-	///////////////////////////////////////////////////////////////////////////
352
-	////	ATTACHMENTS FROM DOCUMENTS
353
-	$count='';
354
-	//_pp($_REQUEST);
355
-	//_ppd(count($_REQUEST['document']));
356
-	if(!empty($_REQUEST['document'])){
357
-      $count = count($_REQUEST['document']);
272
+            //Images are presaved above so we need to prevent duplicate files from being created.
273
+            if( isset($preProcessedImages[$file['name']]) )
274
+            {
275
+                $oldId = $preProcessedImages[$file['name']];
276
+                $note->id = $oldId;
277
+                $note->new_with_id = TRUE;
278
+                $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
279
+            }
280
+
281
+            $i=preg_replace("/email_attachment(.+)/",'$1',$key);
282
+            $upload_file = new UploadFile($key);
283
+
284
+            if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
285
+                $note->filename = $upload_file->get_stored_file_name();
286
+                $note->file = $upload_file;
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;
291
+                    }
292
+                    else{
293
+                        $note->embed_flag =false;
294
+                    }
295
+                }
296
+                array_push($focus->attachments, $note);
297
+            }
298
+
299
+        }
300
+
301
+        $focus->saved_attachments = array();
302
+        foreach($focus->attachments as $note)
303
+        {
304
+            if( !empty($note->id) && $note->new_with_id === FALSE)
305
+            {
306
+                if(empty($_REQUEST['old_id']))
307
+                    array_push($focus->saved_attachments, $note); // to support duplication of email templates
308
+                else
309
+                {
310
+                    // we're duplicating a template with attachments
311
+                    // dupe the file, create a new note, assign the note to the new template
312
+                    $newNote = new Note();
313
+                    $newNote->retrieve($note->id);
314
+                    $newNote->id = create_guid();
315
+                    $newNote->parent_id = $focus->id;
316
+                    $newNote->new_with_id = true;
317
+                    $newNote->date_modified = '';
318
+                    $newNote->date_entered = '';
319
+                    /* BEGIN - SECURITY GROUPS */
320
+                    //Need to do this so that attachments show under an EmailTemplate correctly for a normal user
321
+                    global $current_user;
322
+                    $newNote->assigned_user_id = $current_user->id;
323
+                    /* END - SECURITY GROUPS */
324
+                    $newNoteId = $newNote->save();
325
+
326
+                    UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
327
+                }
328
+                continue;
329
+            }
330
+            $note->parent_id = $focus->id;
331
+            $note->parent_type = 'Emails';
332
+            $note->file_mime_type = $note->file->mime_type;
333
+            /* BEGIN - SECURITY GROUPS */
334
+            //Need to do this so that attachments show under an EmailTemplate correctly for a normal user
335
+            global $current_user;
336
+            $note->assigned_user_id = $current_user->id;
337
+            /* END - SECURITY GROUPS */
338
+            $note_id = $note->save();
339
+            array_push($focus->saved_attachments, $note);
340
+            $note->id = $note_id;
341
+
342
+            if($note->new_with_id === FALSE)
343
+                $note->file->final_move($note->id);
344
+            else
345
+                $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
346
+        }
347
+
348
+        ////	END NEW ATTACHMENTS
349
+        ///////////////////////////////////////////////////////////////////////////
350
+
351
+    ///////////////////////////////////////////////////////////////////////////
352
+    ////	ATTACHMENTS FROM DOCUMENTS
353
+    $count='';
354
+    //_pp($_REQUEST);
355
+    //_ppd(count($_REQUEST['document']));
356
+    if(!empty($_REQUEST['document'])){
357
+        $count = count($_REQUEST['document']);
358 358
     }
359 359
     else{
360
-    	$count=10;
360
+        $count=10;
361 361
     }
362 362
 
363
-	for($i=0; $i<$count; $i++) {
364
-		if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
365
-			$doc = new Document();
366
-			$docRev = new DocumentRevision();
367
-			$docNote = new Note();
363
+    for($i=0; $i<$count; $i++) {
364
+        if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
365
+            $doc = new Document();
366
+            $docRev = new DocumentRevision();
367
+            $docNote = new Note();
368 368
 
369
-			$doc->retrieve($_REQUEST['documentId'.$i]);
370
-			$docRev->retrieve($doc->document_revision_id);
369
+            $doc->retrieve($_REQUEST['documentId'.$i]);
370
+            $docRev->retrieve($doc->document_revision_id);
371 371
 
372
-			array_push($focus->saved_attachments, $docRev);
372
+            array_push($focus->saved_attachments, $docRev);
373 373
 
374
-			$docNote->name = $doc->document_name;
375
-			$docNote->filename = $docRev->filename;
376
-			$docNote->description = $doc->description;
377
-			$docNote->parent_id = $focus->id;
378
-			$docNote->parent_type = 'Emails';
379
-			$docNote->file_mime_type = $docRev->file_mime_type;
380
-			$docId = $docNote = $docNote->save();
374
+            $docNote->name = $doc->document_name;
375
+            $docNote->filename = $docRev->filename;
376
+            $docNote->description = $doc->description;
377
+            $docNote->parent_id = $focus->id;
378
+            $docNote->parent_type = 'Emails';
379
+            $docNote->file_mime_type = $docRev->file_mime_type;
380
+            $docId = $docNote = $docNote->save();
381 381
 
382
-			UploadFile::duplicate_file($docRev->id, $docId, $docRev->filename);
383
-		}
382
+            UploadFile::duplicate_file($docRev->id, $docId, $docRev->filename);
383
+        }
384 384
 
385
-	}
385
+    }
386 386
 
387
-	////	END ATTACHMENTS FROM DOCUMENTS
388
-	///////////////////////////////////////////////////////////////////////////
387
+    ////	END ATTACHMENTS FROM DOCUMENTS
388
+    ///////////////////////////////////////////////////////////////////////////
389 389
 
390
-		///////////////////////////////////////////////////////////////////////////
391
-		////	REMOVE ATTACHMENTS
390
+        ///////////////////////////////////////////////////////////////////////////
391
+        ////	REMOVE ATTACHMENTS
392 392
 
393
-		if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
394
-			foreach($_REQUEST['remove_attachment'] as $noteId) {
395
-				$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
396
-				$focus->db->query($q);
397
-			}
393
+        if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
394
+            foreach($_REQUEST['remove_attachment'] as $noteId) {
395
+                $q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
396
+                $focus->db->query($q);
397
+            }
398 398
 
399
-		}
399
+        }
400 400
 
401
-		////	END REMOVE ATTACHMENTS
402
-		///////////////////////////////////////////////////////////////////////////
403
-	////	END ATTACHMENT HANDLING
404
-	///////////////////////////////////////////////////////////////////////////////
401
+        ////	END REMOVE ATTACHMENTS
402
+        ///////////////////////////////////////////////////////////////////////////
403
+    ////	END ATTACHMENT HANDLING
404
+    ///////////////////////////////////////////////////////////////////////////////
405 405
 
406 406
         clear_register_value('select_array', $focus->object_name);
407 407
 
408
-		if($redirect) {
409
-		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
410
-			handleRedirect($return_id, "EmailTemplates");
411
-		}else{
412
-			return $focus;
413
-		}
414
-	}
408
+        if($redirect) {
409
+        $GLOBALS['log']->debug("Saved record with id of ".$return_id);
410
+            handleRedirect($return_id, "EmailTemplates");
411
+        }else{
412
+            return $focus;
413
+        }
414
+    }
415 415
 
416 416
 }
417 417
 ?>
418 418
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Contacts/metadata/SearchFields.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -40,47 +40,47 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Contacts";
42 42
 $searchFields['Contacts'] = 
43
-	array (
44
-		'first_name' => array( 'query_type'=>'default'),
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'),
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')),
51
-		'email'=> array(
52
-			'query_type' => 'default',
53
-			'operator' => 'subquery',
54
-			'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
55
-			'db_field' => array(
56
-				'id',
57
-			),
58
-		),	
43
+    array (
44
+        'first_name' => array( 'query_type'=>'default'),
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'),
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')),
51
+        'email'=> array(
52
+            'query_type' => 'default',
53
+            'operator' => 'subquery',
54
+            'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
55
+            'db_field' => array(
56
+                'id',
57
+            ),
58
+        ),	
59 59
         'favorites_only' => array(
60 60
             'query_type'=>'format',
61 61
             'operator' => 'subquery',
62
-			'subquery' => "SELECT favorites.parent_id FROM favorites
62
+            'subquery' => "SELECT favorites.parent_id FROM favorites
63 63
 			                    WHERE favorites.deleted = 0
64 64
 			                        and favorites.parent_type = '".$module_name."'
65 65
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
66 66
             'db_field'=>array('id')),
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'),
74
-		'assigned_user_id'=> array('query_type'=>'default'),
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'),
74
+        'assigned_user_id'=> array('query_type'=>'default'),
75 75
         'account_id'=> array('query_type'=>'default','db_field'=>array('accounts.id')),
76 76
         'campaign_name'=> array('query_type'=>'default'),
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),
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 83
         'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
84
-	    //Range Search Support 			
85
-	);
84
+        //Range Search Support 			
85
+    );
86 86
 ?>
Please login to merge, or discard this patch.
modules/Opportunities/metadata/SearchFields.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -40,48 +40,48 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Opportunities";
42 42
 $searchFields['Opportunities'] = 
43
-	array (
44
-		'name' => array( 'query_type'=>'default'),
45
-		'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
46
-		'amount'=> array('query_type'=>'default'),
47
-		'next_step'=> array('query_type'=>'default'),
48
-		'probability'=> array('query_type'=>'default'),
49
-		'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50
-		'opportunity_type'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'opportunity_type_dom', 'template_var' => 'TYPE_OPTIONS'),
51
-		'sales_stage'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'sales_stage_dom', 'template_var' => 'SALES_STAGE_OPTIONS', 'options_add_blank' => true),
52
-		'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
53
-		'assigned_user_id'=> array('query_type'=>'default'),
54
-		'open_only' => array(
55
-			'query_type'=>'default',
56
-			'db_field'=>array('sales_stage'),
57
-			'operator'=>'not in',
58
-			'closed_values' => array('Closed Won', 'Closed Lost'),
59
-			'type'=>'bool',
60
-		),
43
+    array (
44
+        'name' => array( 'query_type'=>'default'),
45
+        'account_name'=> array('query_type'=>'default','db_field'=>array('accounts.name')),
46
+        'amount'=> array('query_type'=>'default'),
47
+        'next_step'=> array('query_type'=>'default'),
48
+        'probability'=> array('query_type'=>'default'),
49
+        'lead_source'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'lead_source_dom', 'template_var' => 'LEAD_SOURCE_OPTIONS'),
50
+        'opportunity_type'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'opportunity_type_dom', 'template_var' => 'TYPE_OPTIONS'),
51
+        'sales_stage'=> array('query_type'=>'default', 'operator'=>'=', 'options' => 'sales_stage_dom', 'template_var' => 'SALES_STAGE_OPTIONS', 'options_add_blank' => true),
52
+        'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
53
+        'assigned_user_id'=> array('query_type'=>'default'),
54
+        'open_only' => array(
55
+            'query_type'=>'default',
56
+            'db_field'=>array('sales_stage'),
57
+            'operator'=>'not in',
58
+            'closed_values' => array('Closed Won', 'Closed Lost'),
59
+            'type'=>'bool',
60
+        ),
61 61
         'favorites_only' => array(
62 62
             'query_type'=>'format',
63 63
             'operator' => 'subquery',
64
-			'subquery' => "SELECT favorites.parent_id FROM favorites
64
+            'subquery' => "SELECT favorites.parent_id FROM favorites
65 65
 			                    WHERE favorites.deleted = 0
66 66
 			                        and favorites.parent_type = '".$module_name."'
67 67
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
68 68
             'db_field'=>array('id')),
69 69
 
70
-		//Range Search Support 
71
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
73
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
76
-       'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
70
+        //Range Search Support 
71
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
72
+        'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
73
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
74
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
75
+        'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
76
+        'end_range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
77 77
 	   
78
-       'range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
-	   'start_range_date_closed' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
80
-       'end_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
78
+        'range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
79
+        'start_range_date_closed' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
80
+        'end_range_date_closed' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
81 81
 
82
-       'range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
83
-	   'start_range_amount' => array ('query_type' => 'default',  'enable_range_search' => true),
84
-       'end_range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
85
-		//Range Search Support 			
86
-	);
82
+        'range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
83
+        'start_range_amount' => array ('query_type' => 'default',  'enable_range_search' => true),
84
+        'end_range_amount' => array ('query_type' => 'default', 'enable_range_search' => true),
85
+        //Range Search Support 			
86
+    );
87 87
 ?>
Please login to merge, or discard this patch.
modules/Campaigns/GenerateWebToLeadForm.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,11 +107,11 @@
 block discarded – undo
107 107
 }
108 108
 
109 109
 $typeOfPerson = !empty($_REQUEST['typeOfPerson']) ? $_REQUEST['typeOfPerson'] : 'Lead';
110
- $person = new $typeOfPerson();
111
- $fieldsMetaData = new FieldsMetaData();
112
- $xtpl=new XTemplate ('modules/Campaigns/WebToLeadForm.html');
113
- $xtpl->assign("MOD", $mod_strings);
114
- $xtpl->assign("APP", $app_strings);
110
+    $person = new $typeOfPerson();
111
+    $fieldsMetaData = new FieldsMetaData();
112
+    $xtpl=new XTemplate ('modules/Campaigns/WebToLeadForm.html');
113
+    $xtpl->assign("MOD", $mod_strings);
114
+    $xtpl->assign("APP", $app_strings);
115 115
 
116 116
 include_once 'WebToLeadFormBuilder.php';
117 117
 $Web_To_Lead_Form_html = WebToLeadFormBuilder::generate(
Please login to merge, or discard this patch.
modules/Campaigns/WebToLeadCapture.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
  * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there
56 56
  */
57 57
 $users = array(
58
-	'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
58
+    'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
59 59
 );
60 60
 
61 61
 if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) {
62
-	    //adding the client ip address
63
-	    $_POST['client_id_address'] = query_client_ip();
64
-		$campaign_id=$_POST['campaign_id'];
65
-		$campaign = new Campaign();
66
-		$camp_query  = "select name,id from campaigns where id='$campaign_id'";
67
-		$camp_query .= " and deleted=0";
62
+        //adding the client ip address
63
+        $_POST['client_id_address'] = query_client_ip();
64
+        $campaign_id=$_POST['campaign_id'];
65
+        $campaign = new Campaign();
66
+        $camp_query  = "select name,id from campaigns where id='$campaign_id'";
67
+        $camp_query .= " and deleted=0";
68 68
         $camp_result=$campaign->db->query($camp_query);
69 69
         $camp_data = $campaign->db->fetchByAssoc($camp_result);
70 70
         // Bug 41292 - have to select marketing_id for new lead
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
         $marketing_result = $db->limitQuery($marketing_query, 0, 1, true);
79 79
         $marketing_data = $db->fetchByAssoc($marketing_result);
80 80
         // .Bug 41292
81
-		if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
82
-			$current_user = new User();
83
-			$current_user->retrieve($_REQUEST['assigned_user_id']);
84
-		} 
81
+        if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
82
+            $current_user = new User();
83
+            $current_user->retrieve($_REQUEST['assigned_user_id']);
84
+        } 
85 85
 
86
-	    if(isset($camp_data) && $camp_data != null ){
87
-			$leadForm = new LeadFormBase();
86
+        if(isset($camp_data) && $camp_data != null ){
87
+            $leadForm = new LeadFormBase();
88 88
             $lead = new Lead();
89
-			$prefix = '';
90
-			if(!empty($_POST['prefix'])){
91
-				$prefix = $_POST['prefix'];
92
-			}
89
+            $prefix = '';
90
+            if(!empty($_POST['prefix'])){
91
+                $prefix = $_POST['prefix'];
92
+            }
93 93
 
94
-			if(empty($lead->id)) {
94
+            if(empty($lead->id)) {
95 95
                 $lead->id = create_guid();
96 96
                 $lead->new_with_id = true;
97 97
             }
@@ -114,47 +114,47 @@  discard block
 block discarded – undo
114 114
             // checkRequired needs a major overhaul before it works for web to lead forms.
115 115
             $lead = $leadForm->handleSave($prefix, false, false, false, $lead);
116 116
             
117
-			if(!empty($lead)){
117
+            if(!empty($lead)){
118 118
 				
119
-	            //create campaign log
120
-	            $camplog = new CampaignLog();
121
-	            $camplog->campaign_id  = $_POST['campaign_id'];
122
-	            $camplog->related_id   = $lead->id;
123
-	            $camplog->related_type = $lead->module_dir;
124
-	            $camplog->activity_type = "lead";
125
-	            $camplog->target_type = $lead->module_dir;
126
-	            $campaign_log->activity_date=$timedate->now();
127
-	            $camplog->target_id    = $lead->id;
119
+                //create campaign log
120
+                $camplog = new CampaignLog();
121
+                $camplog->campaign_id  = $_POST['campaign_id'];
122
+                $camplog->related_id   = $lead->id;
123
+                $camplog->related_type = $lead->module_dir;
124
+                $camplog->activity_type = "lead";
125
+                $camplog->target_type = $lead->module_dir;
126
+                $campaign_log->activity_date=$timedate->now();
127
+                $camplog->target_id    = $lead->id;
128 128
                 if(isset($marketing_data['id']))
129 129
                 {
130 130
                     $camplog->marketing_id = $marketing_data['id'];
131 131
                 }
132
-	            $camplog->save();
132
+                $camplog->save();
133 133
 
134
-		        //link campaignlog and lead
134
+                //link campaignlog and lead
135 135
 
136
-		        if (isset($_POST['email1']) && $_POST['email1'] != null)
136
+                if (isset($_POST['email1']) && $_POST['email1'] != null)
137 137
                 {
138 138
                     $lead->email1 = $_POST['email1'];
139
-		        } 
139
+                } 
140 140
                 //in case there are old forms used webtolead_email1
141 141
                 elseif (isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null)
142 142
                 {
143 143
                     $lead->email1 = $_POST['webtolead_email1'];
144 144
                 }
145 145
                 
146
-		        if (isset($_POST['email2']) && $_POST['email2'] != null)
146
+                if (isset($_POST['email2']) && $_POST['email2'] != null)
147 147
                 {
148 148
                     $lead->email2 = $_POST['email2'];
149
-		        } 
149
+                } 
150 150
                 //in case there are old forms used webtolead_email2
151 151
                 elseif (isset($_POST['webtolead_email2']) && $_POST['webtolead_email2'] != null)
152 152
                 {
153 153
                     $lead->email2 = $_POST['webtolead_email2'];
154 154
                 }
155 155
                 
156
-		        $lead->load_relationship('campaigns');
157
-		        $lead->campaigns->add($camplog->id);
156
+                $lead->load_relationship('campaigns');
157
+                $lead->campaigns->add($camplog->id);
158 158
                 if(!empty($GLOBALS['check_notify'])) {
159 159
                     $lead->save($GLOBALS['check_notify']);
160 160
                 }
@@ -176,105 +176,105 @@  discard block
 block discarded – undo
176 176
                     
177 177
                 }
178 178
             }              
179
-			if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
180
-			    // Get the redirect url, and make sure the query string is not too long
181
-		        $redirect_url = $_POST['redirect_url'];
182
-		        $query_string = '';
183
-				$first_char = '&';
184
-				if(strpos($redirect_url, '?') === FALSE){
185
-					$first_char = '?';
186
-				}
187
-				$first_iteration = true;
188
-				$get_and_post = array_merge($_GET, $_POST);
189
-				foreach($get_and_post as $param => $value) {
179
+            if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
180
+                // Get the redirect url, and make sure the query string is not too long
181
+                $redirect_url = $_POST['redirect_url'];
182
+                $query_string = '';
183
+                $first_char = '&';
184
+                if(strpos($redirect_url, '?') === FALSE){
185
+                    $first_char = '?';
186
+                }
187
+                $first_iteration = true;
188
+                $get_and_post = array_merge($_GET, $_POST);
189
+                foreach($get_and_post as $param => $value) {
190 190
 
191
-					if($param == 'redirect_url' && $param == 'submit')
192
-						continue;
191
+                    if($param == 'redirect_url' && $param == 'submit')
192
+                        continue;
193 193
 					
194
-					if($first_iteration){
195
-						$first_iteration = false;
196
-						$query_string .= $first_char;
197
-					}
198
-					else{
199
-						$query_string .= "&";
200
-					}
201
-					$query_string .= "{$param}=".urlencode($value);
202
-				}
203
-				if(empty($lead)) {
204
-					if($first_iteration){
205
-						$query_string .= $first_char;
206
-					}
207
-					else{
208
-						$query_string .= "&";
209
-					}
210
-					$query_string .= "error=1";
211
-				}
194
+                    if($first_iteration){
195
+                        $first_iteration = false;
196
+                        $query_string .= $first_char;
197
+                    }
198
+                    else{
199
+                        $query_string .= "&";
200
+                    }
201
+                    $query_string .= "{$param}=".urlencode($value);
202
+                }
203
+                if(empty($lead)) {
204
+                    if($first_iteration){
205
+                        $query_string .= $first_char;
206
+                    }
207
+                    else{
208
+                        $query_string .= "&";
209
+                    }
210
+                    $query_string .= "error=1";
211
+                }
212 212
 				
213
-				$redirect_url = $redirect_url.$query_string;
213
+                $redirect_url = $redirect_url.$query_string;
214 214
 
215 215
 
216
-				// Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
217
-				//   and use a javascript form submission if that is the case.
218
-			    if(headers_sent() || strlen($redirect_url) > 2083){
219
-    				echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
220
-    				echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">';
216
+                // Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
217
+                //   and use a javascript form submission if that is the case.
218
+                if(headers_sent() || strlen($redirect_url) > 2083){
219
+                    echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
220
+                    echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">';
221 221
     
222
-    				foreach($_POST as $param => $value) {
223
-    					if($param != 'redirect_url' ||$param != 'submit') {
224
-    						echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225
-    					}
226
-    				}
227
-    				if(empty($lead)) {
228
-    					echo '<input type="hidden" name="error" value="1">';
229
-    				}
230
-    				echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231
-    				echo '</body></html>';
232
-    			}
233
-				else{
234
-    				$header_URL = "Location: {$redirect_url}";
222
+                    foreach($_POST as $param => $value) {
223
+                        if($param != 'redirect_url' ||$param != 'submit') {
224
+                            echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225
+                        }
226
+                    }
227
+                    if(empty($lead)) {
228
+                        echo '<input type="hidden" name="error" value="1">';
229
+                    }
230
+                    echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231
+                    echo '</body></html>';
232
+                }
233
+                else{
234
+                    $header_URL = "Location: {$redirect_url}";
235 235
 
236
-					if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) {
237
-						$href = $matches[1];
238
-						SugarApplication::redirect($href);
239
-					}
240
-					else {
241
-						header($header_URL);
242
-					}
236
+                    if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) {
237
+                        $href = $matches[1];
238
+                        SugarApplication::redirect($href);
239
+                    }
240
+                    else {
241
+                        header($header_URL);
242
+                    }
243 243
 
244
-    				die();
245
-			    }
246
-			}
247
-			else{
248
-				echo $mod_strings['LBL_THANKS_FOR_SUBMITTING'];
249
-			}
250
-			sugar_cleanup();
251
-			// die to keep code from running into redirect case below
252
-			die();
253
-	    }
254
-	   else{
255
-	  	  echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
256
-	  }
244
+                    die();
245
+                }
246
+            }
247
+            else{
248
+                echo $mod_strings['LBL_THANKS_FOR_SUBMITTING'];
249
+            }
250
+            sugar_cleanup();
251
+            // die to keep code from running into redirect case below
252
+            die();
253
+        }
254
+        else{
255
+            echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
256
+        }
257 257
 }
258 258
 
259 259
 if (!empty($_POST['redirect'])) {
260 260
     if(headers_sent()){
261
-    	echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
262
-    	echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
263
-    	echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
264
-    	echo '</body></html>';
261
+        echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
262
+        echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
263
+        echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
264
+        echo '</body></html>';
265 265
     }
266 266
     else{
267
-    	$header_URL = "Location: {$_POST['redirect']}";
267
+        $header_URL = "Location: {$_POST['redirect']}";
268 268
 
269
-		if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) {
270
-			$href = $matches[1];
271
-			SugarApplication::redirect($href);
272
-		}
273
-		else {
274
-			header($header_URL);
275
-		}
269
+        if(preg_match('/\s*Location:\s*(.*)$/', $header_URL, $matches)) {
270
+            $href = $matches[1];
271
+            SugarApplication::redirect($href);
272
+        }
273
+        else {
274
+            header($header_URL);
275
+        }
276 276
 
277
-    	die();
277
+        die();
278 278
     }
279 279
 }
280 280
 
Please login to merge, or discard this patch.
modules/Campaigns/WebToLeadCreation.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,23 +108,23 @@
 block discarded – undo
108 108
 $json = getJSONobj();
109 109
 // Users Popup
110 110
 $popup_request_data = array(
111
-	'call_back_function' => 'set_return',
112
-	'form_name' => 'WebToLeadCreation',
113
-	'field_to_name_array' => array(
114
-		'id' => 'assigned_user_id',
115
-		'user_name' => 'assigned_user_name',
116
-		),
117
-	);
111
+    'call_back_function' => 'set_return',
112
+    'form_name' => 'WebToLeadCreation',
113
+    'field_to_name_array' => array(
114
+        'id' => 'assigned_user_id',
115
+        'user_name' => 'assigned_user_name',
116
+        ),
117
+    );
118 118
 $xtpl->assign('encoded_users_popup_request_data', $json->encode($popup_request_data));
119 119
 
120 120
 //Campaigns popup
121 121
 $popup_request_data = array(
122
-		'call_back_function' => 'set_return',
123
-		'form_name' => 'WebToLeadCreation',
124
-		'field_to_name_array' => array(
125
-			'id' => 'campaign_id',
126
-			'name' => 'campaign_name',
127
-		),
122
+        'call_back_function' => 'set_return',
123
+        'form_name' => 'WebToLeadCreation',
124
+        'field_to_name_array' => array(
125
+            'id' => 'campaign_id',
126
+            'name' => 'campaign_name',
127
+        ),
128 128
 );
129 129
 $encoded_users_popup_request_data = $json->encode($popup_request_data);
130 130
 $xtpl->assign('encoded_campaigns_popup_request_data' , $json->encode($popup_request_data));
Please login to merge, or discard this patch.
modules/Meetings/metadata/SearchFields.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -40,42 +40,42 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 $module_name = "Meetings";
42 42
 $searchFields['Meetings'] = 
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')),        
46 46
         'date_start' => array( 'query_type'=>'default'),
47 47
         'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
48 48
         'assigned_user_id'=> array('query_type'=>'default'),
49 49
         'status'=> array('query_type'=>'default', 'options' => 'meeting_status_dom', 'template_var' => 'STATUS_FILTER'),
50 50
         
51
-		'open_only' => array(
52
-			'query_type'=>'default',
53
-			'db_field'=>array('status'),
54
-			'operator'=>'not in',
55
-			'closed_values' => array('Held', 'Not Held'),
56
-			'type'=>'bool',
57
-		),		
51
+        'open_only' => array(
52
+            'query_type'=>'default',
53
+            'db_field'=>array('status'),
54
+            'operator'=>'not in',
55
+            'closed_values' => array('Held', 'Not Held'),
56
+            'type'=>'bool',
57
+        ),		
58 58
         'favorites_only' => array(
59 59
             'query_type'=>'format',
60 60
             'operator' => 'subquery',
61
-			'subquery' => "SELECT favorites.parent_id FROM favorites
61
+            'subquery' => "SELECT favorites.parent_id FROM favorites
62 62
 			                    WHERE favorites.deleted = 0
63 63
 			                        and favorites.parent_type = '".$module_name."'
64 64
 			                        and favorites.assigned_user_id = '" .$current_user->id . "') OR NOT ({0}",
65 65
             'db_field'=>array('id')),
66
-		//Range Search Support
67
-	   'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
-	   'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
69
-	   'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
-	   'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
71
-	   'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
72
-       'end_range_date_modified' => 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_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
-	   'start_range_date_end' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
78
-       'end_range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
79
-	    //Range Search Support 				
80
-	);
66
+        //Range Search Support
67
+        'range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
68
+        'start_range_date_entered' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
69
+        'end_range_date_entered' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
70
+        'range_date_modified' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
71
+        'start_range_date_modified' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
72
+        'end_range_date_modified' => 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_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),
77
+        'start_range_date_end' => array ('query_type' => 'default',  'enable_range_search' => true, 'is_date_field' => true),
78
+        'end_range_date_end' => array ('query_type' => 'default', 'enable_range_search' => true, 'is_date_field' => true),	
79
+        //Range Search Support 				
80
+    );
81 81
 ?>
Please login to merge, or discard this patch.