Test Failed
Push — CI ( 02428e...3e0292 )
by Adam
55:43
created
modules/Campaigns/WebToLeadFormSave.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -62,24 +62,24 @@
 block discarded – undo
62 62
 
63 63
 while (strpos($bodyHTML, "ta_replace") !== false){
64 64
 
65
-	//define the marker edges of the sub string to process (opening and closing tag brackets)
66
-	$marker = strpos($bodyHTML, "ta_replace");
67
-	$start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char;
68
-	$end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">";
65
+    //define the marker edges of the sub string to process (opening and closing tag brackets)
66
+    $marker = strpos($bodyHTML, "ta_replace");
67
+    $start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char;
68
+    $end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">";
69 69
 
70
-	//extract the input tag string
71
-	$working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) );
70
+    //extract the input tag string
71
+    $working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) );
72 72
 
73
-	//replace input markup with text areas markups
74
-	$new_str = str_replace('input','textarea',$working_str);
75
-	$new_str = str_replace("type='text'", ' ', $new_str);
76
-	$new_str = $new_str . '> </textarea';
73
+    //replace input markup with text areas markups
74
+    $new_str = str_replace('input','textarea',$working_str);
75
+    $new_str = str_replace("type='text'", ' ', $new_str);
76
+    $new_str = $new_str . '> </textarea';
77 77
 
78
-	//replace the marker with generic term
79
-	$new_str = str_replace('ta_replace', 'sugarslot', $new_str);
78
+    //replace the marker with generic term
79
+    $new_str = str_replace('ta_replace', 'sugarslot', $new_str);
80 80
 
81
-	//merge the processed string back into bodyhtml string
82
-	$bodyHTML = str_replace($working_str , $new_str, $bodyHTML);
81
+    //merge the processed string back into bodyhtml string
82
+    $bodyHTML = str_replace($working_str , $new_str, $bodyHTML);
83 83
 }
84 84
 //<<<----------end replacing marked text inputs with text area tags
85 85
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -56,52 +56,52 @@  discard block
 block discarded – undo
56 56
 
57 57
 //-----------begin replacing text input tags that have been marked with text area tags
58 58
 //get array of text areas strings to process
59
-$bodyHTML = html_entity_decode($_REQUEST['body_html'],ENT_QUOTES);
59
+$bodyHTML = html_entity_decode($_REQUEST['body_html'], ENT_QUOTES);
60 60
 //Bug53791
61 61
 $bodyHTML = str_replace(chr(160), " ", $bodyHTML);
62 62
 
63
-while (strpos($bodyHTML, "ta_replace") !== false){
63
+while (strpos($bodyHTML, "ta_replace") !== false) {
64 64
 
65 65
 	//define the marker edges of the sub string to process (opening and closing tag brackets)
66 66
 	$marker = strpos($bodyHTML, "ta_replace");
67
-	$start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char;
67
+	$start_border = strpos($bodyHTML, "input", $marker) - 1; // to account for opening '<' char;
68 68
 	$end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">";
69 69
 
70 70
 	//extract the input tag string
71
-	$working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) );
71
+	$working_str = substr($bodyHTML, $marker - 3, $end_border - ($marker - 3));
72 72
 
73 73
 	//replace input markup with text areas markups
74
-	$new_str = str_replace('input','textarea',$working_str);
74
+	$new_str = str_replace('input', 'textarea', $working_str);
75 75
 	$new_str = str_replace("type='text'", ' ', $new_str);
76
-	$new_str = $new_str . '> </textarea';
76
+	$new_str = $new_str.'> </textarea';
77 77
 
78 78
 	//replace the marker with generic term
79 79
 	$new_str = str_replace('ta_replace', 'sugarslot', $new_str);
80 80
 
81 81
 	//merge the processed string back into bodyhtml string
82
-	$bodyHTML = str_replace($working_str , $new_str, $bodyHTML);
82
+	$bodyHTML = str_replace($working_str, $new_str, $bodyHTML);
83 83
 }
84 84
 //<<<----------end replacing marked text inputs with text area tags
85 85
 
86 86
 $guid = create_guid();
87 87
 $form_file = "upload://$guid";
88 88
 
89
-$SugarTiny =  new SugarTinyMCE();
89
+$SugarTiny = new SugarTinyMCE();
90 90
 $html = $SugarTiny->cleanEncodedMCEHtml($bodyHTML);
91 91
 
92 92
 //Check to ensure we have <html> tags in the form. Without them, IE8 will attempt to display the page as XML.
93 93
 if (stripos($html, "<html") === false) {
94 94
     $langHeader = get_language_header();
95
-    $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
95
+    $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>".$html."</body></html>";
96 96
 }
97 97
 file_put_contents($form_file, $html);
98 98
 
99
-$xtpl=new XTemplate ('modules/Campaigns/WebToLeadDownloadForm.html');
99
+$xtpl = new XTemplate('modules/Campaigns/WebToLeadDownloadForm.html');
100 100
 $xtpl->assign("MOD", $mod_strings);
101 101
 $xtpl->assign("APP", $app_strings);
102 102
 $webformlink = "<b>$mod_strings[LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM]</b><br/>";
103 103
 $webformlink .= "<a href=\"index.php?entryPoint=download&id={$guid}&isTempFile=1&tempName=WebToLeadForm.html&type=temp\">$mod_strings[LBL_DOWNLOAD_WEB_TO_LEAD_FORM]</a>";
104
-$xtpl->assign("LINK_TO_WEB_FORM",$webformlink);
104
+$xtpl->assign("LINK_TO_WEB_FORM", $webformlink);
105 105
 $xtpl->assign("RAW_SOURCE", htmlspecialchars($html)); 
106 106
 $xtpl->parse("main.copy_source");
107 107
 $xtpl->parse("main");
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Campaigns/CampaignDiagnostic.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 //if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
60 60
 //account for use within wizards
61 61
 if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
62
-	$params = array();
63
-	$params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
64
-	$params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
62
+    $params = array();
63
+    $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
64
+    $params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
65 65
 	
66
-	echo getClassicModuleTitle('Campaigns', $params, true);
66
+    echo getClassicModuleTitle('Campaigns', $params, true);
67 67
 }
68 68
 
69 69
 global $theme;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 if(isset($mbox) && count($mbox)>0){
111 111
     $mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
112 112
         $mboxTable .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></th>"
113
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></th>"
114
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></th>"
115
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></th>"
116
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></th></tr>";
113
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></th>"
114
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></th>"
115
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></th>"
116
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></th></tr>";
117 117
 
118 118
     foreach($mbox as $details){
119 119
         $mboxTable .= "<tr><td>".$details['name']."</td>";
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 }else{
145 145
     $conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
146 146
     $conf_msg .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></th>"
147
-               .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
148
-               .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></th>";
147
+                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
148
+                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></th>";
149 149
     if($focus->settings['mail_sendtype']=='SMTP'){
150
-     $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151
-               .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
150
+        $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151
+                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
152 152
 
153 153
     }else{$conf_msg .= "</tr>";}
154 154
                    
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $conf_msg .= "<tr><td>".$focus->settings['notify_fromname']."</td>";
158 158
         $conf_msg .= "<td>".$focus->settings['notify_fromaddress']."</td>";
159 159
         $conf_msg .= "<td>".$focus->settings['mail_sendtype']."</td>";
160
-     if($focus->settings['mail_sendtype']=='SMTP'){
160
+        if($focus->settings['mail_sendtype']=='SMTP'){
161 161
         $conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
162 162
         $conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
163 163
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 //build the table rows for scheduler display
199 199
 while ($sched_row = $focus->db->fetchByAssoc($sched_res)){$scheds[] = $sched_row;}
200 200
 foreach ($scheds as $funct){
201
-  if( ($funct['job']==$check_sched1)  ||   ($funct['job']==$check_sched2)){
201
+    if( ($funct['job']==$check_sched1)  ||   ($funct['job']==$check_sched2)){
202 202
         $sched_mes = 'use';
203 203
         $sched_mes_body .= "<tr><td style='text-align: left;'>".$funct['name']."</td>";
204 204
         $sched_mes_body .= "<td style='text-align: left;'>".$funct['status']."</td></tr>";
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $check_sched2 ="found";
209 209
         }  
210 210
         
211
-  }
211
+    }
212 212
 }
213 213
 
214 214
 //determine which table header to use, based on whether or not schedulers were found
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 if($sched_mes == 'use'){
217 217
     $sched_mes = "<h5>".$mod_strings['LBL_SCHEDULER_CHECK_GOOD']."</h5><br><table class='other view' cellspacing='1'>";
218 218
     $sched_mes .= "<tr><th scope='col' width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></tH>"
219
-               .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
219
+                .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
220 220
             
221 221
 }else{
222 222
     $sched_mes = "<table class='other view' cellspacing='1'>";
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     if (is_admin($current_user)){
239 239
         $admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240 240
     }else{
241
-     $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
241
+        $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
242 242
     }    
243 243
 }    
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 /********** FINAL END OF PAGE UI Stuff ********/
252 252
 if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
253 253
 
254
-      $ss->display('modules/Campaigns/CampaignDiagnostic.html');
254
+        $ss->display('modules/Campaigns/CampaignDiagnostic.html');
255 255
 }
256 256
 
257 257
 /**
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     }elseif($num == 0){
273 273
         //if health number is zero, then all checks passed, set green image
274 274
         //green
275
-       return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
275
+        return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
276 276
 
277 277
 
278 278
     }else{
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 //if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
60 60
 //account for use within wizards
61
-if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
61
+if (!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline') {
62 62
 	$params = array();
63 63
 	$params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
64 64
 	$params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 
73 73
 
74 74
 
75
-if(isset($_REQUEST['inline']) && $_REQUEST['inline'] == 'inline'){
75
+if (isset($_REQUEST['inline']) && $_REQUEST['inline'] == 'inline') {
76 76
     {
77 77
 
78 78
 }
79
-}else{
79
+} else {
80 80
     //use html if not inline
81 81
     $ss = new Sugar_Smarty();
82 82
     $ss->assign("MOD", $mod_strings);
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 $mboxTable = "<table border ='0' width='100%'  class='detail view' cellpadding='0' cellspacing='0'>";
105 105
 //put all rows returned into an array
106 106
 $mbox = array();
107
-while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;}
107
+while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)) {$mbox[] = $mbox_row; }
108 108
     $mbox_msg = ' ';
109 109
 //if the array is not empty, then set "good" message
110
-if(isset($mbox) && count($mbox)>0){
111
-    $mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
110
+if (isset($mbox) && count($mbox) > 0) {
111
+    $mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>".count($mbox)." ".$mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
112 112
         $mboxTable .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></th>"
113 113
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></th>"
114 114
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></th>"
115 115
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></th>"
116 116
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></th></tr>";
117 117
 
118
-    foreach($mbox as $details){
118
+    foreach ($mbox as $details) {
119 119
         $mboxTable .= "<tr><td>".$details['name']."</td>";
120 120
         $mboxTable .= "<td>".$details['email_user']."</td>";
121 121
         $mboxTable .= "<td>".$details['mailbox']."</td>";
@@ -123,64 +123,64 @@  discard block
 block discarded – undo
123 123
         $mboxTable .= "<td>".$details['status']."</td></tr>";
124 124
     }
125 125
 
126
-}else{
126
+} else {
127 127
     //if array is empty, then set "bad" message and increment health counter
128
-    $mboxTable .=  "<tr><td colspan='5'><b class='error'>". $mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
129
-    $email_health =$email_health +1;
128
+    $mboxTable .= "<tr><td colspan='5'><b class='error'>".$mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
129
+    $email_health = $email_health + 1;
130 130
 }
131 131
 
132
-$mboxTable.= '</table>' ;
132
+$mboxTable .= '</table>';
133 133
 
134 134
 
135 135
     
136 136
 $ss->assign("MAILBOXES_DETECTED_MESSAGE", $mboxTable);
137 137
 
138 138
 //email settings configured 
139
-$conf_msg="<table border='0' width='100%' class='detail view' cellpadding='0' cellspacing='0'>";
140
-if (strstr($focus->settings['notify_fromaddress'], 'example.com')){
139
+$conf_msg = "<table border='0' width='100%' class='detail view' cellpadding='0' cellspacing='0'>";
140
+if (strstr($focus->settings['notify_fromaddress'], 'example.com')) {
141 141
     //if from address is the default, then set "bad" message and increment health counter
142 142
     $conf_msg .= "<tr><td colspan = '5'><b class='error'> ".$mod_strings['LBL_MAILBOX_CHECK2_BAD']." </b></td></td>";
143
-    $email_health =$email_health +1;
144
-}else{
143
+    $email_health = $email_health + 1;
144
+} else {
145 145
     $conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
146 146
     $conf_msg .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></th>"
147 147
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
148 148
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></th>";
149
-    if($focus->settings['mail_sendtype']=='SMTP'){
149
+    if ($focus->settings['mail_sendtype'] == 'SMTP') {
150 150
      $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151 151
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
152 152
 
153
-    }else{$conf_msg .= "</tr>";}
153
+    } else {$conf_msg .= "</tr>"; }
154 154
                    
155 155
     
156 156
 
157 157
         $conf_msg .= "<tr><td>".$focus->settings['notify_fromname']."</td>";
158 158
         $conf_msg .= "<td>".$focus->settings['notify_fromaddress']."</td>";
159 159
         $conf_msg .= "<td>".$focus->settings['mail_sendtype']."</td>";
160
-     if($focus->settings['mail_sendtype']=='SMTP'){
160
+     if ($focus->settings['mail_sendtype'] == 'SMTP') {
161 161
         $conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
162 162
         $conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
163 163
 
164
-    }else{$conf_msg .= "</tr>";}       
164
+    } else {$conf_msg .= "</tr>"; }       
165 165
 
166 166
 }
167 167
           
168 168
 $conf_msg .= '</table>'; 
169 169
 $ss->assign("EMAIL_SETTINGS_CONFIGURED_MESSAGE", $conf_msg);
170
-$email_setup_wiz_link='';
171
-if ($email_health>0){
172
-    if (is_admin($current_user)){
173
-        $email_setup_wiz_link="<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
174
-    }else{
175
-        $email_setup_wiz_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
170
+$email_setup_wiz_link = '';
171
+if ($email_health > 0) {
172
+    if (is_admin($current_user)) {
173
+        $email_setup_wiz_link = "<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
174
+    } else {
175
+        $email_setup_wiz_link = $mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
176 176
     }    
177 177
 }
178 178
 
179 179
 $ss->assign("EMAIL_SETUP_WIZ_LINK", $email_setup_wiz_link);
180
-$ss->assign( 'EMAIL_IMAGE', define_image($email_health, 2));
181
-$ss->assign( 'EMAIL_COMPONENTS', $mod_strings['LBL_EMAIL_COMPONENTS']);
182
-$ss->assign( 'SCHEDULER_COMPONENTS', $mod_strings['LBL_SCHEDULER_COMPONENTS']);
183
-$ss->assign( 'RECHECK_BTN', $mod_strings['LBL_RECHECK_BTN']);
180
+$ss->assign('EMAIL_IMAGE', define_image($email_health, 2));
181
+$ss->assign('EMAIL_COMPONENTS', $mod_strings['LBL_EMAIL_COMPONENTS']);
182
+$ss->assign('SCHEDULER_COMPONENTS', $mod_strings['LBL_SCHEDULER_COMPONENTS']);
183
+$ss->assign('RECHECK_BTN', $mod_strings['LBL_RECHECK_BTN']);
184 184
 
185 185
 /************* SCHEDULER COMPONENTS ************/
186 186
 
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 
197 197
 $scheds = array();
198 198
 //build the table rows for scheduler display
199
-while ($sched_row = $focus->db->fetchByAssoc($sched_res)){$scheds[] = $sched_row;}
200
-foreach ($scheds as $funct){
201
-  if( ($funct['job']==$check_sched1)  ||   ($funct['job']==$check_sched2)){
199
+while ($sched_row = $focus->db->fetchByAssoc($sched_res)) {$scheds[] = $sched_row; }
200
+foreach ($scheds as $funct) {
201
+  if (($funct['job'] == $check_sched1) || ($funct['job'] == $check_sched2)) {
202 202
         $sched_mes = 'use';
203 203
         $sched_mes_body .= "<tr><td style='text-align: left;'>".$funct['name']."</td>";
204 204
         $sched_mes_body .= "<td style='text-align: left;'>".$funct['status']."</td></tr>";
205
-        if($funct['job']==$check_sched1){
206
-            $check_sched1 ="found";
207
-        }else{
208
-            $check_sched2 ="found";
205
+        if ($funct['job'] == $check_sched1) {
206
+            $check_sched1 = "found";
207
+        } else {
208
+            $check_sched2 = "found";
209 209
         }  
210 210
         
211 211
   }
@@ -213,43 +213,43 @@  discard block
 block discarded – undo
213 213
 
214 214
 //determine which table header to use, based on whether or not schedulers were found
215 215
 $show_admin_link = false;
216
-if($sched_mes == 'use'){
216
+if ($sched_mes == 'use') {
217 217
     $sched_mes = "<h5>".$mod_strings['LBL_SCHEDULER_CHECK_GOOD']."</h5><br><table class='other view' cellspacing='1'>";
218 218
     $sched_mes .= "<tr><th scope='col' width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></tH>"
219 219
                .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
220 220
             
221
-}else{
221
+} else {
222 222
     $sched_mes = "<table class='other view' cellspacing='1'>";
223
-    $sched_mes  .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
223
+    $sched_mes .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
224 224
     $show_admin_link = true;
225 225
 }
226 226
 
227 227
 //determine if error messages need to be displayed for schedulers
228
-if($check_sched2 != 'found'){
229
-    $sched_health =$sched_health +1;
230
-    $sched_mes_body  .= "<tr><td colspan ='3'><font color='red'> ".$mod_strings['LBL_SCHEDULER_CHECK1_BAD']."</font></td></tr>";
228
+if ($check_sched2 != 'found') {
229
+    $sched_health = $sched_health + 1;
230
+    $sched_mes_body .= "<tr><td colspan ='3'><font color='red'> ".$mod_strings['LBL_SCHEDULER_CHECK1_BAD']."</font></td></tr>";
231 231
 }
232
-if($check_sched1 != 'found'){
233
-    $sched_health =$sched_health +1;
234
-    $sched_mes_body  .= "<tr><td colspan ='3' scope='row'><font color='red'>".$mod_strings['LBL_SCHEDULER_CHECK2_BAD']."</font></td></tr>";
232
+if ($check_sched1 != 'found') {
233
+    $sched_health = $sched_health + 1;
234
+    $sched_mes_body .= "<tr><td colspan ='3' scope='row'><font color='red'>".$mod_strings['LBL_SCHEDULER_CHECK2_BAD']."</font></td></tr>";
235 235
 }
236
-$admin_sched_link='';
237
-if ($sched_health>0){
238
-    if (is_admin($current_user)){
239
-        $admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240
-    }else{
241
-     $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
236
+$admin_sched_link = '';
237
+if ($sched_health > 0) {
238
+    if (is_admin($current_user)) {
239
+        $admin_sched_link = "<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240
+    } else {
241
+     $admin_sched_link = $mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
242 242
     }    
243 243
 }    
244 244
 
245 245
 //put table html together and display
246
-    $final_sched_msg = $sched_mes . $sched_mes_body . '</table>' . $admin_sched_link;        
246
+    $final_sched_msg = $sched_mes.$sched_mes_body.'</table>'.$admin_sched_link;        
247 247
     $ss->assign("SCHEDULER_EMAILS_MESSAGE", $final_sched_msg);
248
-    $ss->assign( 'SCHEDULE_IMAGE', define_image($sched_health, 2));
248
+    $ss->assign('SCHEDULE_IMAGE', define_image($sched_health, 2));
249 249
 
250 250
 
251 251
 /********** FINAL END OF PAGE UI Stuff ********/
252
-if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
252
+if (!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline') {
253 253
 
254 254
       $ss->display('modules/Campaigns/CampaignDiagnostic.html');
255 255
 }
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
 function define_image($num, $total)
265 265
 { global $mod_strings;
266 266
     //if health number is equal to total number then all checks failed, set red image
267
-    if($num == $total){
267
+    if ($num == $total) {
268 268
         //red
269 269
         return SugarThemeRegistry::current()->getImage('red_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_INVALID']);
270 270
 
271 271
 
272
-    }elseif($num == 0){
272
+    }elseif ($num == 0) {
273 273
         //if health number is zero, then all checks passed, set green image
274 274
         //green
275 275
        return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
276 276
 
277 277
 
278
-    }else{
278
+    } else {
279 279
         //if health number is between total and num params, then some checks failed but not all, set yellow image
280 280
         //yellow
281 281
         return SugarThemeRegistry::current()->getImage('yellow_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ALERT']);
Please login to merge, or discard this patch.
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -76,14 +78,20 @@  discard block
 block discarded – undo
76 78
     {
77 79
 
78 80
 }
79
-}else{
81
+} else{
80 82
     //use html if not inline
81 83
     $ss = new Sugar_Smarty();
82 84
     $ss->assign("MOD", $mod_strings);
83 85
     $ss->assign("APP", $app_strings);
84
-    if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
85
-    if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
86
-    if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
86
+    if (isset($_REQUEST['return_module'])) {
87
+        $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
88
+    }
89
+    if (isset($_REQUEST['return_action'])) {
90
+        $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
91
+    }
92
+    if (isset($_REQUEST['return_id'])) {
93
+        $ss->assign("RETURN_ID", $_REQUEST['return_id']);
94
+    }
87 95
     // handle Create $module then Cancel
88 96
     if (empty($_REQUEST['return_id'])) {
89 97
         $ss->assign("RETURN_ACTION", 'index');
@@ -123,7 +131,7 @@  discard block
 block discarded – undo
123 131
         $mboxTable .= "<td>".$details['status']."</td></tr>";
124 132
     }
125 133
 
126
-}else{
134
+} else{
127 135
     //if array is empty, then set "bad" message and increment health counter
128 136
     $mboxTable .=  "<tr><td colspan='5'><b class='error'>". $mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
129 137
     $email_health =$email_health +1;
@@ -141,7 +149,7 @@  discard block
 block discarded – undo
141 149
     //if from address is the default, then set "bad" message and increment health counter
142 150
     $conf_msg .= "<tr><td colspan = '5'><b class='error'> ".$mod_strings['LBL_MAILBOX_CHECK2_BAD']." </b></td></td>";
143 151
     $email_health =$email_health +1;
144
-}else{
152
+} else{
145 153
     $conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
146 154
     $conf_msg .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></th>"
147 155
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
@@ -150,7 +158,7 @@  discard block
 block discarded – undo
150 158
      $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151 159
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
152 160
 
153
-    }else{$conf_msg .= "</tr>";}
161
+    } else{$conf_msg .= "</tr>";}
154 162
                    
155 163
     
156 164
 
@@ -161,7 +169,7 @@  discard block
 block discarded – undo
161 169
         $conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
162 170
         $conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
163 171
 
164
-    }else{$conf_msg .= "</tr>";}       
172
+    } else{$conf_msg .= "</tr>";}       
165 173
 
166 174
 }
167 175
           
@@ -171,7 +179,7 @@  discard block
 block discarded – undo
171 179
 if ($email_health>0){
172 180
     if (is_admin($current_user)){
173 181
         $email_setup_wiz_link="<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
174
-    }else{
182
+    } else{
175 183
         $email_setup_wiz_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
176 184
     }    
177 185
 }
@@ -204,7 +212,7 @@  discard block
 block discarded – undo
204 212
         $sched_mes_body .= "<td style='text-align: left;'>".$funct['status']."</td></tr>";
205 213
         if($funct['job']==$check_sched1){
206 214
             $check_sched1 ="found";
207
-        }else{
215
+        } else{
208 216
             $check_sched2 ="found";
209 217
         }  
210 218
         
@@ -218,7 +226,7 @@  discard block
 block discarded – undo
218 226
     $sched_mes .= "<tr><th scope='col' width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></tH>"
219 227
                .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
220 228
             
221
-}else{
229
+} else{
222 230
     $sched_mes = "<table class='other view' cellspacing='1'>";
223 231
     $sched_mes  .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
224 232
     $show_admin_link = true;
@@ -237,7 +245,7 @@  discard block
 block discarded – undo
237 245
 if ($sched_health>0){
238 246
     if (is_admin($current_user)){
239 247
         $admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240
-    }else{
248
+    } else{
241 249
      $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
242 250
     }    
243 251
 }    
@@ -269,13 +277,13 @@  discard block
 block discarded – undo
269 277
         return SugarThemeRegistry::current()->getImage('red_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_INVALID']);
270 278
 
271 279
 
272
-    }elseif($num == 0){
280
+    } elseif($num == 0){
273 281
         //if health number is zero, then all checks passed, set green image
274 282
         //green
275 283
        return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
276 284
 
277 285
 
278
-    }else{
286
+    } else{
279 287
         //if health number is between total and num params, then some checks failed but not all, set yellow image
280 288
         //yellow
281 289
         return SugarThemeRegistry::current()->getImage('yellow_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ALERT']);
Please login to merge, or discard this patch.
modules/Campaigns/WizardMarketingSave.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
     }
66 66
         
67 67
 }else{
68
-     //default to just saving and exiting wizard
69
-     $master = 'save';   
68
+        //default to just saving and exiting wizard
69
+        $master = 'save';   
70 70
 }
71 71
 
72 72
 
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
     foreach ($_REQUEST as $key => $val) {
93
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
-              $newkey  =substr($key, strlen($prefix)) ;
95
-              $_REQUEST[$newkey] = $val;
96
-         }               
93
+                if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
+                $newkey  =substr($key, strlen($prefix)) ;
95
+                $_REQUEST[$newkey] = $val;
96
+            }               
97 97
     }
98 98
 
99 99
     foreach ($_REQUEST as $key => $val) {
100
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
-              $newkey  =substr($key, strlen($prefix)) ;
102
-              $_REQUEST[$newkey] = $val;
103
-         }               
100
+                if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
+                $newkey  =substr($key, strlen($prefix)) ;
102
+                $_REQUEST[$newkey] = $val;
103
+            }               
104 104
     }
105 105
 
106 106
 if(!empty($_REQUEST['meridiem'])){
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 }
109 109
 
110 110
 if(empty($_REQUEST['time_start'])) {
111
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
111
+    $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
112 112
 } else {
113
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
113
+    $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
114 114
 }
115 115
 
116 116
 foreach($marketing->column_fields as $field)
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
     $_REQUEST['record'] =$marketing->campaign_id;
181 181
     $_POST['record']=$marketing->campaign_id;
182 182
     $_REQUEST['mode'] = $master;
183
-     $_POST['mode'] = $master; 
184
-     $_REQUEST['from_wiz']= 'true';
183
+        $_POST['mode'] = $master; 
184
+        $_REQUEST['from_wiz']= 'true';
185 185
     require_once('modules/Campaigns/QueueCampaign.php');
186 186
 }
187 187
 
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 $master = 'save';
54 54
 if (isset($_REQUEST['wiz_home_next_step']) && !empty($_REQUEST['wiz_home_next_step'])) {
55 55
     
56
-    if($_REQUEST['wiz_home_next_step']==3){
56
+    if ($_REQUEST['wiz_home_next_step'] == 3) {
57 57
         //user has chosen to save and schedule this campaign for email
58 58
         $master = 'send';
59
-    }elseif($_REQUEST['wiz_home_next_step']==2){
59
+    }elseif ($_REQUEST['wiz_home_next_step'] == 2) {
60 60
         //user has chosen to save and send this campaign in test mode
61 61
         $master = 'test';
62
-    }else{
62
+    } else {
63 63
         //user has chosen to simply save
64
-        $master  = 'save';        
64
+        $master = 'save';        
65 65
     }
66 66
         
67
-}else{
67
+} else {
68 68
      //default to just saving and exiting wizard
69 69
      $master = 'save';   
70 70
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) {
78 78
     $marketing->retrieve($_REQUEST['record']);
79 79
 }
80
-if(!$marketing->ACLAccess('Save')){
80
+if (!$marketing->ACLAccess('Save')) {
81 81
         ACLController::displayNoAccess(true);
82 82
         sugar_cleanup(true);
83 83
 }
@@ -90,40 +90,40 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
     foreach ($_REQUEST as $key => $val) {
93
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
-              $newkey  =substr($key, strlen($prefix)) ;
93
+              if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) {
94
+              $newkey = substr($key, strlen($prefix));
95 95
               $_REQUEST[$newkey] = $val;
96 96
          }               
97 97
     }
98 98
 
99 99
     foreach ($_REQUEST as $key => $val) {
100
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
-              $newkey  =substr($key, strlen($prefix)) ;
100
+              if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) {
101
+              $newkey = substr($key, strlen($prefix));
102 102
               $_REQUEST[$newkey] = $val;
103 103
          }               
104 104
     }
105 105
 
106
-if(!empty($_REQUEST['meridiem'])){
107
-    $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'],$timedate->get_time_format(), $_REQUEST['meridiem']);
106
+if (!empty($_REQUEST['meridiem'])) {
107
+    $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'], $timedate->get_time_format(), $_REQUEST['meridiem']);
108 108
 }
109 109
 
110
-if(empty($_REQUEST['time_start'])) {
111
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
110
+if (empty($_REQUEST['time_start'])) {
111
+  $_REQUEST['date_start'] = $_REQUEST['date_start'].' 00:00';	
112 112
 } else {
113
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
113
+  $_REQUEST['date_start'] = $_REQUEST['date_start'].' '.$_REQUEST['time_start'];
114 114
 }
115 115
 
116
-foreach($marketing->column_fields as $field)
116
+foreach ($marketing->column_fields as $field)
117 117
 {
118 118
     if ($field == 'all_prospect_lists') {
119
-        if(isset($_REQUEST[$field]) && $_REQUEST[$field]='on' )
119
+        if (isset($_REQUEST[$field]) && $_REQUEST[$field] = 'on')
120 120
         {
121 121
             $marketing->$field = 1;
122 122
         } else {
123 123
             $marketing->$field = 0;         
124 124
         }
125
-    }else {
126
-        if(isset($_REQUEST[$field]))
125
+    } else {
126
+        if (isset($_REQUEST[$field]))
127 127
         {
128 128
             $value = $_REQUEST[$field];
129 129
             $marketing->$field = trim($value);
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     }
132 132
 }
133 133
 
134
-foreach($marketing->additional_column_fields as $field)
134
+foreach ($marketing->additional_column_fields as $field)
135 135
 {
136
-    if(isset($_REQUEST[$field]))
136
+    if (isset($_REQUEST[$field]))
137 137
     {
138 138
         $value = $_REQUEST[$field];
139 139
         $marketing->$field = $value;
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 
146 146
 //add prospect lists to campaign.
147 147
 $marketing->load_relationship('prospectlists');
148
-$prospectlists=$marketing->prospectlists->get();
149
-if ($marketing->all_prospect_lists==1) {
148
+$prospectlists = $marketing->prospectlists->get();
149
+if ($marketing->all_prospect_lists == 1) {
150 150
     //remove all related prospect lists.
151 151
     if (!empty($prospectlists)) {
152 152
         $marketing->prospectlists->delete($marketing->id);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     if (isset($_REQUEST['message_for']) && is_array($_REQUEST['message_for'])) {
156 156
         foreach ($_REQUEST['message_for'] as $prospect_list_id) {
157 157
             
158
-            $key=array_search($prospect_list_id,$prospectlists);
158
+            $key = array_search($prospect_list_id, $prospectlists);
159 159
             if ($key === null or $key === false) {
160 160
                 $marketing->prospectlists->add($prospect_list_id);          
161 161
             } else {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         }
165 165
         if (count($prospectlists) != 0) {
166 166
             foreach ($prospectlists as $key=>$list_id) {
167
-                $marketing->prospectlists->delete($marketing->id,$list_id);             
167
+                $marketing->prospectlists->delete($marketing->id, $list_id);             
168 168
             }   
169 169
         }
170 170
     }
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
 $mass[] = $marketing->id; 
175 175
 //if sending an email was chosen, set all the needed variables for queuing campaign
176 176
 
177
-if($master !='save'){
178
-    $_REQUEST['mass']= $mass;
179
-    $_POST['mass']=$mass;
180
-    $_REQUEST['record'] =$marketing->campaign_id;
181
-    $_POST['record']=$marketing->campaign_id;
177
+if ($master != 'save') {
178
+    $_REQUEST['mass'] = $mass;
179
+    $_POST['mass'] = $mass;
180
+    $_REQUEST['record'] = $marketing->campaign_id;
181
+    $_POST['record'] = $marketing->campaign_id;
182 182
     $_REQUEST['mode'] = $master;
183 183
      $_POST['mode'] = $master; 
184
-     $_REQUEST['from_wiz']= 'true';
184
+     $_REQUEST['from_wiz'] = 'true';
185 185
     require_once('modules/Campaigns/QueueCampaign.php');
186 186
 }
187 187
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -56,15 +58,15 @@  discard block
 block discarded – undo
56 58
     if($_REQUEST['wiz_home_next_step']==3){
57 59
         //user has chosen to save and schedule this campaign for email
58 60
         $master = 'send';
59
-    }elseif($_REQUEST['wiz_home_next_step']==2){
61
+    } elseif($_REQUEST['wiz_home_next_step']==2){
60 62
         //user has chosen to save and send this campaign in test mode
61 63
         $master = 'test';
62
-    }else{
64
+    } else{
63 65
         //user has chosen to simply save
64 66
         $master  = 'save';        
65 67
     }
66 68
         
67
-}else{
69
+} else{
68 70
      //default to just saving and exiting wizard
69 71
      $master = 'save';   
70 72
 }
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
 
85 87
 if (!empty($_REQUEST['assigned_user_id']) && ($marketing->assigned_user_id != $_REQUEST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
86 88
     $check_notify = TRUE;
87
-}
88
-else {
89
+} else {
89 90
     $check_notify = FALSE;
90 91
 }
91 92
 
@@ -122,7 +123,7 @@  discard block
 block discarded – undo
122 123
         } else {
123 124
             $marketing->$field = 0;         
124 125
         }
125
-    }else {
126
+    } else {
126 127
         if(isset($_REQUEST[$field]))
127 128
         {
128 129
             $value = $_REQUEST[$field];
Please login to merge, or discard this patch.
modules/AOR_Conditions/vardefs.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 $dictionary['AOR_Condition'] = array(
26
-	'table'=>'aor_conditions',
27
-	'audited'=>false,
28
-	'duplicate_merge'=>true,
29
-	'fields'=>array (
30
-  'aor_report_id' =>
31
-  array (
26
+    'table'=>'aor_conditions',
27
+    'audited'=>false,
28
+    'duplicate_merge'=>true,
29
+    'fields'=>array (
30
+    'aor_report_id' =>
31
+    array (
32 32
     'required' => false,
33 33
     'name' => 'aor_report_id',
34 34
     'vname' => 'LBL_AOR_REPORT_ID',
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     'merge_filter' => 'disabled',
46 46
     'len' => 36,
47 47
     'size' => '20',
48
-  ),
49
-  'condition_order' => 
50
-  array (
48
+    ),
49
+    'condition_order' => 
50
+    array (
51 51
     'required' => false,
52 52
     'name' => 'condition_order',
53 53
     'vname' => 'LBL_ORDER',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     'size' => '20',
67 67
     'enable_range_search' => false,
68 68
     'disable_num_format' => '',
69
-  ),
69
+    ),
70 70
         'logic_op' => array(
71 71
             'name' => 'logic_op',
72 72
             'vname' => 'LBL_LOGIC_OP',
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
             'vname' => 'LBL_PARENTHESIS',
79 79
             'type' => 'varchar',
80 80
         ),
81
-  'module_path' =>
82
-  array (
81
+    'module_path' =>
82
+    array (
83 83
     'name' => 'module_path',
84 84
     'type' => 'longtext',
85 85
     'vname' => 'LBL_MODULE_PATH',
86 86
     'isnull' => true,
87
-  ),
88
-  'field' => 
89
-  array (
87
+    ),
88
+    'field' => 
89
+    array (
90 90
     'required' => false,
91 91
     'name' => 'field',
92 92
     'vname' => 'LBL_FIELD',
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
     'options' => 'user_type_dom',
107 107
     'studio' => 'visible',
108 108
     'dependency' => false,
109
-  ),
110
-  'operator' => 
111
-  array (
109
+    ),
110
+    'operator' => 
111
+    array (
112 112
     'required' => false,
113 113
     'name' => 'operator',
114 114
     'vname' => 'LBL_OPERATOR',
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     'options' => 'aor_operator_list',
130 130
     'studio' => 'visible',
131 131
     'dependency' => false,
132
-  ),
132
+    ),
133 133
     'value_type' =>
134 134
     array (
135 135
     'required' => false,
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
     'len' => '255',
150 150
     'size' => '20',
151 151
     ),
152
-  'value' => 
153
-  array (
152
+    'value' => 
153
+    array (
154 154
     'required' => false,
155 155
     'name' => 'value',
156 156
     'vname' => 'LBL_VALUE',
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     'merge_filter' => 'disabled',
168 168
     'len' => '255',
169 169
     'size' => '20',
170
-  ),
170
+    ),
171 171
         'parameter' =>
172 172
             array (
173 173
                 'required' => false,
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
                 'merge_filter' => 'disabled',
187 187
                 'studio' => 'visible',
188 188
             ),
189
-  'aor_reports' =>
190
-  array (
189
+    'aor_reports' =>
190
+    array (
191 191
     'name' => 'aor_reports',
192 192
     'type' => 'link',
193 193
     'relationship' => 'aor_report_aor_conditions',
194 194
     'module'=>'AOR_Reports',
195 195
     'bean_name'=>'AOR_Reports',
196 196
     'source'=>'non-db',
197
-  ),
197
+    ),
198 198
 ),
199
-	'relationships'=>array (
199
+    'relationships'=>array (
200 200
 ),
201 201
     'indices' => array(
202 202
         array(
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
             'fields' => array('aor_report_id'),
206 206
         ),
207 207
     ),
208
-	'optimistic_locking'=>true,
209
-	'unified_search'=>true,
208
+    'optimistic_locking'=>true,
209
+    'unified_search'=>true,
210 210
 );
211 211
 
212 212
 if (!class_exists('VardefManager')){
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	'table'=>'aor_conditions',
27 27
 	'audited'=>false,
28 28
 	'duplicate_merge'=>true,
29
-	'fields'=>array (
29
+	'fields'=>array(
30 30
   'aor_report_id' =>
31
-  array (
31
+  array(
32 32
     'required' => false,
33 33
     'name' => 'aor_report_id',
34 34
     'vname' => 'LBL_AOR_REPORT_ID',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     'size' => '20',
48 48
   ),
49 49
   'condition_order' => 
50
-  array (
50
+  array(
51 51
     'required' => false,
52 52
     'name' => 'condition_order',
53 53
     'vname' => 'LBL_ORDER',
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
             'type' => 'varchar',
80 80
         ),
81 81
   'module_path' =>
82
-  array (
82
+  array(
83 83
     'name' => 'module_path',
84 84
     'type' => 'longtext',
85 85
     'vname' => 'LBL_MODULE_PATH',
86 86
     'isnull' => true,
87 87
   ),
88 88
   'field' => 
89
-  array (
89
+  array(
90 90
     'required' => false,
91 91
     'name' => 'field',
92 92
     'vname' => 'LBL_FIELD',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     'dependency' => false,
109 109
   ),
110 110
   'operator' => 
111
-  array (
111
+  array(
112 112
     'required' => false,
113 113
     'name' => 'operator',
114 114
     'vname' => 'LBL_OPERATOR',
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     'dependency' => false,
132 132
   ),
133 133
     'value_type' =>
134
-    array (
134
+    array(
135 135
     'required' => false,
136 136
     'name' => 'value_type',
137 137
     'vname' => 'LBL_VALUE_TYPE',
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     'size' => '20',
151 151
     ),
152 152
   'value' => 
153
-  array (
153
+  array(
154 154
     'required' => false,
155 155
     'name' => 'value',
156 156
     'vname' => 'LBL_VALUE',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     'size' => '20',
170 170
   ),
171 171
         'parameter' =>
172
-            array (
172
+            array(
173 173
                 'required' => false,
174 174
                 'name' => 'parameter',
175 175
                 'vname' => 'LBL_PARAMETER',
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 'studio' => 'visible',
188 188
             ),
189 189
   'aor_reports' =>
190
-  array (
190
+  array(
191 191
     'name' => 'aor_reports',
192 192
     'type' => 'link',
193 193
     'relationship' => 'aor_report_aor_conditions',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     'source'=>'non-db',
197 197
   ),
198 198
 ),
199
-	'relationships'=>array (
199
+	'relationships'=>array(
200 200
 ),
201 201
     'indices' => array(
202 202
         array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	'unified_search'=>true,
210 210
 );
211 211
 
212
-if (!class_exists('VardefManager')){
212
+if (!class_exists('VardefManager')) {
213 213
         require_once('include/SugarObjects/VardefManager.php');
214 214
 }
215
-VardefManager::createVardef('AOR_Conditions','AOR_Condition', array('basic'));
215
+VardefManager::createVardef('AOR_Conditions', 'AOR_Condition', array('basic'));
Please login to merge, or discard this patch.
modules/AOR_Conditions/AOR_Condition.php 4 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	var $table_name = 'aor_conditions';
31 31
     var $tracker_visibility = false;
32 32
 	var $importable = true;
33
-	var $disable_row_level_security = true ;
33
+	var $disable_row_level_security = true;
34 34
 	
35 35
 	var $id;
36 36
 	var $name;
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	var $operator;
53 53
 	var $value;
54 54
 	
55
-	function AOR_Condition(){
55
+	function AOR_Condition() {
56 56
 		parent::Basic();
57 57
 	}
58 58
 
59
-    function save_lines($post_data, $parent, $key = ''){
59
+    function save_lines($post_data, $parent, $key = '') {
60 60
 
61 61
         require_once('modules/AOW_WorkFlow/aow_utils.php');
62 62
 
@@ -64,57 +64,57 @@  discard block
 block discarded – undo
64 64
         $j = 0;
65 65
         for ($i = 0; $i < $line_count; ++$i) {
66 66
 
67
-            if($post_data[$key.'deleted'][$i] == 1){
67
+            if ($post_data[$key.'deleted'][$i] == 1) {
68 68
                 $this->mark_deleted($post_data[$key.'id'][$i]);
69 69
             } else {
70 70
                 $condition = new AOR_Condition();
71
-                foreach($this->field_defs as $field_def) {
72
-                    if(isset($post_data[$key.$field_def['name']][$i])){
73
-                        if(is_array($post_data[$key.$field_def['name']][$i])){
71
+                foreach ($this->field_defs as $field_def) {
72
+                    if (isset($post_data[$key.$field_def['name']][$i])) {
73
+                        if (is_array($post_data[$key.$field_def['name']][$i])) {
74 74
 
75
-                                switch($condition->value_type) {
75
+                                switch ($condition->value_type) {
76 76
                                     case 'Date':
77 77
                                         $post_data[$key.$field_def['name']][$i] = base64_encode(serialize($post_data[$key.$field_def['name']][$i]));
78 78
                                     default:
79 79
                                         $post_data[$key.$field_def['name']][$i] = encodeMultienumValue($post_data[$key.$field_def['name']][$i]);
80 80
                                 }
81
-                        } else if($field_def['name'] == 'value' && $post_data[$key.'value_type'][$i] === 'Value') {
81
+                        } else if ($field_def['name'] == 'value' && $post_data[$key.'value_type'][$i] === 'Value') {
82 82
                             $post_data[$key.$field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $condition->field, $post_data[$key.$field_def['name']][$i]);
83
-                        }else if($field_def['name'] == 'parameter'){
83
+                        } else if ($field_def['name'] == 'parameter') {
84 84
                             $post_data[$key.$field_def['name']][$i] = isset($post_data[$key.$field_def['name']][$i]);
85
-                        }else if($field_def['name'] == 'module_path'){
86
-                            $post_data[$key.$field_def['name']][$i] = base64_encode(serialize(explode(":",$post_data[$key.$field_def['name']][$i])));
85
+                        } else if ($field_def['name'] == 'module_path') {
86
+                            $post_data[$key.$field_def['name']][$i] = base64_encode(serialize(explode(":", $post_data[$key.$field_def['name']][$i])));
87 87
                         }
88
-                        if($field_def['name'] == 'parenthesis' && $post_data[$key.$field_def['name']][$i] == 'END') {
89
-                            if(!isset($lastParenthesisStartConditionId)) {
88
+                        if ($field_def['name'] == 'parenthesis' && $post_data[$key.$field_def['name']][$i] == 'END') {
89
+                            if (!isset($lastParenthesisStartConditionId)) {
90 90
                                 throw new Exception('a closure parenthesis has no starter pair');
91 91
                             }
92 92
                             $condition->parenthesis = $lastParenthesisStartConditionId;
93 93
                         }
94 94
                         else {
95
-                            $condition->$field_def['name'] = $post_data[$key . $field_def['name']][$i];
95
+                            $condition->$field_def['name'] = $post_data[$key.$field_def['name']][$i];
96 96
                         }
97
-                    }else if($field_def['name'] == 'parameter'){
97
+                    } else if ($field_def['name'] == 'parameter') {
98 98
                         $condition->$field_def['name'] = 0;
99 99
                     }
100 100
 
101 101
                 }
102 102
                 // Period must be saved as a string instead of a base64 encoded datetime.
103 103
                 // Overwriting value
104
-                if((!isset($condition->parenthesis) || !$condition->parenthesis) && isset($condition->value_type) && $condition->value_type == 'Period') {
104
+                if ((!isset($condition->parenthesis) || !$condition->parenthesis) && isset($condition->value_type) && $condition->value_type == 'Period') {
105 105
                     $condition->value = base64_encode($_POST['aor_conditions_value'][$i]);
106 106
 //                    $condition->value = $_POST['aor_conditions_value'][$i];
107 107
                 }
108
-                if(trim($condition->field) != '' || $condition->parenthesis){
109
-                    if(isset($_POST['aor_conditions_order'][$i])) {
110
-                        $condition->condition_order = (int) $_POST['aor_conditions_order'][$i];
108
+                if (trim($condition->field) != '' || $condition->parenthesis) {
109
+                    if (isset($_POST['aor_conditions_order'][$i])) {
110
+                        $condition->condition_order = (int)$_POST['aor_conditions_order'][$i];
111 111
                     }
112 112
                     else {
113 113
                         $condition->condition_order = ++$j;
114 114
                     }
115 115
                     $condition->aor_report_id = $parent->id;
116 116
                     $conditionId = $condition->save();
117
-                    if($condition->parenthesis=='START') {
117
+                    if ($condition->parenthesis == 'START') {
118 118
                         $lastParenthesisStartConditionId = $conditionId;
119 119
                     }
120 120
                 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -7 removed lines patch added patch discarded remove patch
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
                                 }
81 81
                         } else if($field_def['name'] == 'value' && $post_data[$key.'value_type'][$i] === 'Value') {
82 82
                             $post_data[$key.$field_def['name']][$i] = fixUpFormatting($_REQUEST['report_module'], $condition->field, $post_data[$key.$field_def['name']][$i]);
83
-                        }else if($field_def['name'] == 'parameter'){
83
+                        } else if($field_def['name'] == 'parameter'){
84 84
                             $post_data[$key.$field_def['name']][$i] = isset($post_data[$key.$field_def['name']][$i]);
85
-                        }else if($field_def['name'] == 'module_path'){
85
+                        } else if($field_def['name'] == 'module_path'){
86 86
                             $post_data[$key.$field_def['name']][$i] = base64_encode(serialize(explode(":",$post_data[$key.$field_def['name']][$i])));
87 87
                         }
88 88
                         if($field_def['name'] == 'parenthesis' && $post_data[$key.$field_def['name']][$i] == 'END') {
@@ -90,11 +90,10 @@  discard block
 block discarded – undo
90 90
                                 throw new Exception('a closure parenthesis has no starter pair');
91 91
                             }
92 92
                             $condition->parenthesis = $lastParenthesisStartConditionId;
93
-                        }
94
-                        else {
93
+                        } else {
95 94
                             $condition->$field_def['name'] = $post_data[$key . $field_def['name']][$i];
96 95
                         }
97
-                    }else if($field_def['name'] == 'parameter'){
96
+                    } else if($field_def['name'] == 'parameter'){
98 97
                         $condition->$field_def['name'] = 0;
99 98
                     }
100 99
 
@@ -108,8 +107,7 @@  discard block
 block discarded – undo
108 107
                 if(trim($condition->field) != '' || $condition->parenthesis){
109 108
                     if(isset($_POST['aor_conditions_order'][$i])) {
110 109
                         $condition->condition_order = (int) $_POST['aor_conditions_order'][$i];
111
-                    }
112
-                    else {
110
+                    } else {
113 111
                         $condition->condition_order = ++$j;
114 112
                     }
115 113
                     $condition->aor_report_id = $parent->id;
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,37 +24,37 @@
 block discarded – undo
24 24
 
25 25
 
26 26
 class AOR_Condition extends Basic {
27
-	var $new_schema = true;
28
-	var $module_dir = 'AOR_Conditions';
29
-	var $object_name = 'AOR_Condition';
30
-	var $table_name = 'aor_conditions';
27
+    var $new_schema = true;
28
+    var $module_dir = 'AOR_Conditions';
29
+    var $object_name = 'AOR_Condition';
30
+    var $table_name = 'aor_conditions';
31 31
     var $tracker_visibility = false;
32
-	var $importable = true;
33
-	var $disable_row_level_security = true ;
32
+    var $importable = true;
33
+    var $disable_row_level_security = true ;
34 34
 	
35
-	var $id;
36
-	var $name;
37
-	var $date_entered;
38
-	var $date_modified;
39
-	var $modified_user_id;
40
-	var $modified_by_name;
41
-	var $created_by;
42
-	var $created_by_name;
43
-	var $description;
44
-	var $deleted;
45
-	var $created_by_link;
46
-	var $modified_user_link;
47
-	var $aor_report_id;
48
-	var $condition_order;
49
-	var $field;
35
+    var $id;
36
+    var $name;
37
+    var $date_entered;
38
+    var $date_modified;
39
+    var $modified_user_id;
40
+    var $modified_by_name;
41
+    var $created_by;
42
+    var $created_by_name;
43
+    var $description;
44
+    var $deleted;
45
+    var $created_by_link;
46
+    var $modified_user_link;
47
+    var $aor_report_id;
48
+    var $condition_order;
49
+    var $field;
50 50
     var $logic_op;
51 51
     var $parenthesis;
52
-	var $operator;
53
-	var $value;
52
+    var $operator;
53
+    var $value;
54 54
 	
55
-	function AOR_Condition(){
56
-		parent::Basic();
57
-	}
55
+    function AOR_Condition(){
56
+        parent::Basic();
57
+    }
58 58
 
59 59
     function save_lines($post_data, $parent, $key = ''){
60 60
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -57,6 +57,9 @@
 block discarded – undo
57 57
 		parent::Basic();
58 58
 	}
59 59
 
60
+    /**
61
+     * @param AOR_Report $parent
62
+     */
60 63
     function save_lines($post_data, $parent, $key = ''){
61 64
 
62 65
         require_once('modules/AOW_WorkFlow/aow_utils.php');
Please login to merge, or discard this patch.
modules/AOR_Conditions/conditionLines.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function display_condition_lines($focus, $field, $value, $view){
26
+function display_condition_lines($focus, $field, $value, $view) {
27 27
 
28 28
     global $locale, $app_list_strings, $mod_strings;
29 29
 
30 30
     $html = '';
31 31
 
32
-    if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) {
32
+    if (!is_file('cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js')) {
33 33
         require_once ('include/language/jsLanguage.php');
34 34
         jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']);
35 35
     }
36
-    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'. $GLOBALS['current_language'] . '.js"></script>';
36
+    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js"></script>';
37 37
 
38
-    if($view == 'EditView'){
38
+    if ($view == 'EditView') {
39 39
 
40 40
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
41 41
         $html .= "<table border='0' cellspacing='4' width='100%' id='conditionLines'></table>";
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
         $html .= "</div>";
46 46
 
47 47
 
48
-        if(isset($focus->report_module) && $focus->report_module != ''){
48
+        if (isset($focus->report_module) && $focus->report_module != '') {
49 49
             require_once("modules/AOW_WorkFlow/aow_utils.php");
50 50
             $html .= "<script>";
51 51
             $html .= "report_module = \"".$focus->report_module."\";";
52 52
             $html .= "document.getElementById('btn_ConditionLine').disabled = '';";
53
-            if($focus->id != ''){
53
+            if ($focus->id != '') {
54 54
                 $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '".$focus->id."' AND deleted = 0 ORDER BY condition_order ASC";
55 55
                 $result = $focus->db->query($sql);
56 56
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
                     $condition_name = new AOR_Condition();
59 59
                     $condition_name->retrieve($row['id']);
60 60
                     $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
61
-                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module,$condition_name->module_path[0]))))."\";";
62
-                    if($condition_name->value_type == 'Date'){
61
+                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module, $condition_name->module_path[0]))))."\";";
62
+                    if ($condition_name->value_type == 'Date') {
63 63
                         $condition_name->value = unserialize(base64_decode($condition_name->value));
64 64
                     }
65 65
                     $condition_item = json_encode($condition_name->toArray());
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
         }
72 72
 
73 73
     }
74
-    else if($view == 'DetailView'){
74
+    else if ($view == 'DetailView') {
75 75
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 76
         $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>";
77 77
 
78 78
 
79
-        if(isset($focus->report_module) && $focus->report_module != ''){
79
+        if (isset($focus->report_module) && $focus->report_module != '') {
80 80
             require_once("modules/AOW_WorkFlow/aow_utils.php");
81 81
             $html .= "<script>";
82 82
             $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields($focus->report_module)))."\";";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $condition_name = new AOR_Condition();
89 89
                 $condition_name->retrieve($row['id']);
90 90
                 $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
91
-                if($condition_name->value_type == 'Date'){
91
+                if ($condition_name->value_type == 'Date') {
92 92
                     $condition_name->value = unserialize(base64_decode($condition_name->value));
93 93
                 }
94 94
                 $condition_item = json_encode($condition_name->toArray());
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@
 block discarded – undo
70 70
             $html .= "</script>";
71 71
         }
72 72
 
73
-    }
74
-    else if($view == 'DetailView'){
73
+    } else if($view == 'DetailView'){
75 74
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 75
         $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>";
77 76
 
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Advanced OpenReports, SugarCRM Reporting.
4
- * @package Advanced OpenReports for SugarCRM
5
- * @copyright SalesAgility Ltd http://www.salesagility.com
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
9
- * the Free Software Foundation; either version 3 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
18
- * along with this program; if not, see http://www.gnu.org/licenses
19
- * or write to the Free Software Foundation,Inc., 51 Franklin Street,
20
- * Fifth Floor, Boston, MA 02110-1301  USA
21
- *
22
- * @author SalesAgility <[email protected]>
23
- */
3
+         * Advanced OpenReports, SugarCRM Reporting.
4
+         * @package Advanced OpenReports for SugarCRM
5
+         * @copyright SalesAgility Ltd http://www.salesagility.com
6
+         *
7
+         * This program is free software; you can redistribute it and/or modify
8
+         * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
9
+         * the Free Software Foundation; either version 3 of the License, or
10
+         * (at your option) any later version.
11
+         *
12
+         * This program is distributed in the hope that it will be useful,
13
+         * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+         * GNU General Public License for more details.
16
+         *
17
+         * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
18
+         * along with this program; if not, see http://www.gnu.org/licenses
19
+         * or write to the Free Software Foundation,Inc., 51 Franklin Street,
20
+         * Fifth Floor, Boston, MA 02110-1301  USA
21
+         *
22
+         * @author SalesAgility <[email protected]>
23
+         */
24 24
 
25 25
 
26 26
 function display_field_lines($focus, $field, $value, $view){
Please login to merge, or discard this patch.
modules/EmailTemplates/field_arrays.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@
 block discarded – undo
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48 48
 $fields_array['EmailTemplate'] = array ('column_fields' => Array("id"
49
-		, "date_entered"
50
-		, "date_modified"
51
-		, "modified_user_id"
52
-		, "created_by"
53
-		, "description"
54
-		, "subject"
55
-		, "body"
56
-		, "body_html"
57
-		, "name"
58
-		, "published"
59
-		),
49
+        , "date_entered"
50
+        , "date_modified"
51
+        , "modified_user_id"
52
+        , "created_by"
53
+        , "description"
54
+        , "subject"
55
+        , "body"
56
+        , "body_html"
57
+        , "name"
58
+        , "published"
59
+        ),
60 60
         'list_fields' =>  Array('id', 'name', 'description','date_modified'
61
-	),
61
+    ),
62 62
     'required_fields' => array("name"=>1),
63 63
 );
64 64
 ?>
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * All Rights Reserved.
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48
-$fields_array['EmailTemplate'] = array ('column_fields' => Array("id"
48
+$fields_array['EmailTemplate'] = array('column_fields' => Array("id"
49 49
 		, "date_entered"
50 50
 		, "date_modified"
51 51
 		, "modified_user_id"
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		, "name"
58 58
 		, "published"
59 59
 		),
60
-        'list_fields' =>  Array('id', 'name', 'description','date_modified'
60
+        'list_fields' =>  Array('id', 'name', 'description', 'date_modified'
61 61
 	),
62 62
     'required_fields' => array("name"=>1),
63 63
 );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/EmailTemplates/PopupDocumentsCampaignTemplate.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@
 block discarded – undo
76 76
 $button  = "<form action='index.php' method='post' name='form' id='form'>\n";
77 77
 if(!$hide_clear_button)
78 78
 {
79
-	$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80
-		.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
81
-		.$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
79
+    $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80
+        .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
81
+        .$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
82 82
 }
83 83
 $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
84
-	.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
85
-	.$app_strings['LBL_CANCEL_BUTTON_KEY']."' value='  "
86
-	.$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
84
+    .$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
85
+    .$app_strings['LBL_CANCEL_BUTTON_KEY']."' value='  "
86
+    .$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
87 87
 $button .= "</form>\n";
88 88
 
89 89
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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.
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
 $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
76
-$button  = "<form action='index.php' method='post' name='form' id='form'>\n";
77
-if(!$hide_clear_button)
76
+$button = "<form action='index.php' method='post' name='form' id='form'>\n";
77
+if (!$hide_clear_button)
78 78
 {
79 79
 	$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80 80
 		.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $form->assign('MODULE_NAME', $currentModule);
95 95
 $form->assign('NAME', $name);
96 96
 $form->assign('DOCUMENT_NAME', $document_name);
97
-if(isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
97
+if (isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
98 98
 else $form->assign('DOCUMENT_TARGET', '');
99 99
 
100 100
 $form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,8 +96,11 @@  discard block
 block discarded – undo
94 96
 $form->assign('MODULE_NAME', $currentModule);
95 97
 $form->assign('NAME', $name);
96 98
 $form->assign('DOCUMENT_NAME', $document_name);
97
-if(isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
98
-else $form->assign('DOCUMENT_TARGET', '');
99
+if(isset($_REQUEST['target'])) {
100
+    $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
101
+} else {
102
+    $form->assign('DOCUMENT_TARGET', '');
103
+}
99 104
 
100 105
 $form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
101 106
 
Please login to merge, or discard this patch.
modules/EmailTemplates/EmailTemplateFormBase.php 3 patches
Indentation   +233 added lines, -233 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,105 +93,105 @@  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();
132
+        $the_form .= get_left_form_footer();
133
+        $the_form .= get_validate_record_js();
134 134
 
135 135
 
136
-		return $the_form;
137
-	}
138
-
136
+        return $the_form;
137
+    }
139 138
 
140
-	function handleSave($prefix,$redirect=true, $useRequired=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 139
 
148
-		$focus = new EmailTemplate();
149
-		if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150
-			return null;
151
-		}
152
-		$focus = populateFromPost($prefix, $focus);
140
+    function handleSave($prefix,$redirect=true, $useRequired=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 153
         //process the text only flag
154 154
         if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
155 155
             $focus->text_only = 1;
156 156
         }else{
157 157
             $focus->text_only = 0;
158 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
-		$preProcessedImages = array();
166
-		$emailTemplateBodyHtml = from_html($focus->body_html);
167
-		if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
168
-			$matches = array();
169
-			preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
-			foreach($matches[1] as $match) {
171
-				$filename = urldecode($match);
159
+        if(!$focus->ACLAccess('Save')) {
160
+            ACLController::displayNoAccess(true);
161
+            sugar_cleanup(true);
162
+        }
163
+        if(!isset($_REQUEST['published'])) $focus->published = 'off';
164
+
165
+        $preProcessedImages = array();
166
+        $emailTemplateBodyHtml = from_html($focus->body_html);
167
+        if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
168
+            $matches = array();
169
+            preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
+            foreach($matches[1] as $match) {
171
+                $filename = urldecode($match);
172 172
                 if($filename != pathinfo($filename, PATHINFO_BASENAME)) {
173 173
                     // don't allow paths there
174 174
                     $emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
175 175
                     continue;
176 176
                 }
177
-				$file_location = sugar_cached("images/{$filename}");
178
-				$mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179
-
180
-				if(file_exists($file_location)) {
181
-					$id = create_guid();
182
-					$newFileLocation = "upload://$id";
183
-					if(!copy($file_location, $newFileLocation)) {
184
-						$GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185
-					} else {
186
-						$secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
187
-					    $emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml);
188
-						unlink($file_location);
189
-						$preProcessedImages[$filename] = $id;
190
-					}
191
-				} // if
192
-			} // foreach
193
-		} // if
194
-		if (isset($GLOBALS['check_notify'])) {
177
+                $file_location = sugar_cached("images/{$filename}");
178
+                $mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179
+
180
+                if(file_exists($file_location)) {
181
+                    $id = create_guid();
182
+                    $newFileLocation = "upload://$id";
183
+                    if(!copy($file_location, $newFileLocation)) {
184
+                        $GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185
+                    } else {
186
+                        $secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
187
+                        $emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml);
188
+                        unlink($file_location);
189
+                        $preProcessedImages[$filename] = $id;
190
+                    }
191
+                } // if
192
+            } // foreach
193
+        } // if
194
+        if (isset($GLOBALS['check_notify'])) {
195 195
             $check_notify = $GLOBALS['check_notify'];
196 196
         }
197 197
         else {
@@ -199,183 +199,183 @@  discard block
 block discarded – undo
199 199
         }
200 200
         $focus->body_html = $emailTemplateBodyHtml;
201 201
         $return_id = $focus->save($check_notify);
202
-		///////////////////////////////////////////////////////////////////////////////
203
-		////	ATTACHMENT HANDLING
202
+        ///////////////////////////////////////////////////////////////////////////////
203
+        ////	ATTACHMENT HANDLING
204
+
205
+        ///////////////////////////////////////////////////////////////////////////
206
+        ////	ADDING NEW ATTACHMENTS
207
+
208
+        $max_files_upload = count($_FILES);
209
+
210
+        if(!empty($focus->id)) {
211
+            $note = new Note();
212
+            $where = "notes.parent_id='{$focus->id}'";
213
+            if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214
+                $where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215
+            }
216
+            $notes_list = $note->get_full_list("", $where, true);
217
+        }
204 218
 
205
-		///////////////////////////////////////////////////////////////////////////
206
-		////	ADDING NEW ATTACHMENTS
219
+        if(!isset($notes_list)) {
220
+            $notes_list = array();
221
+        }
207 222
 
208
-		$max_files_upload = count($_FILES);
223
+        if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224
+            $focus->attachments = array();
225
+        }
226
+        $focus->attachments = array_merge($focus->attachments, $notes_list);
209 227
 
210
-		if(!empty($focus->id)) {
211
-			$note = new Note();
212
-			$where = "notes.parent_id='{$focus->id}'";
213
-			if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214
-				$where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215
-			}
216
-			$notes_list = $note->get_full_list("", $where, true);
217
-		}
218 228
 
219
-		if(!isset($notes_list)) {
220
-			$notes_list = array();
221
-		}
222 229
 
223
-		if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224
-			$focus->attachments = array();
225
-		}
226
-		$focus->attachments = array_merge($focus->attachments, $notes_list);
230
+        //for($i = 0; $i < $max_files_upload; $i++) {
227 231
 
232
+        foreach ($_FILES as $key => $file)
233
+        {
234
+            $note = new Note();
228 235
 
236
+            //Images are presaved above so we need to prevent duplicate files from being created.
237
+            if( isset($preProcessedImages[$file['name']]) )
238
+            {
239
+                $oldId = $preProcessedImages[$file['name']];
240
+                $note->id = $oldId;
241
+                $note->new_with_id = TRUE;
242
+                $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
243
+            }
229 244
 
230
-		//for($i = 0; $i < $max_files_upload; $i++) {
245
+            $i=preg_replace("/email_attachment(.+)/",'$1',$key);
246
+            $upload_file = new UploadFile($key);
247
+
248
+            if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
249
+                $note->filename = $upload_file->get_stored_file_name();
250
+                $note->file = $upload_file;
251
+                $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
+                if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
+                    if($_REQUEST['embedded'.$i]=='true'){
254
+                        $note->embed_flag =true;
255
+                    }
256
+                    else{
257
+                        $note->embed_flag =false;
258
+                    }
259
+                }
260
+                array_push($focus->attachments, $note);
261
+            }
231 262
 
232
-		foreach ($_FILES as $key => $file)
233
-		{
234
-			$note = new Note();
263
+        }
235 264
 
236
-			//Images are presaved above so we need to prevent duplicate files from being created.
237
-			if( isset($preProcessedImages[$file['name']]) )
238
-			{
239
-			    $oldId = $preProcessedImages[$file['name']];
240
-			    $note->id = $oldId;
241
-			    $note->new_with_id = TRUE;
242
-			    $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
265
+        $focus->saved_attachments = array();
266
+        foreach($focus->attachments as $note)
267
+        {
268
+            if( !empty($note->id) && $note->new_with_id === FALSE)
269
+            {
270
+                if(empty($_REQUEST['old_id']))
271
+                    array_push($focus->saved_attachments, $note); // to support duplication of email templates
272
+                else
273
+                {
274
+                    // we're duplicating a template with attachments
275
+                    // dupe the file, create a new note, assign the note to the new template
276
+                    $newNote = new Note();
277
+                    $newNote->retrieve($note->id);
278
+                    $newNote->id = create_guid();
279
+                    $newNote->parent_id = $focus->id;
280
+                    $newNote->new_with_id = true;
281
+                    $newNote->date_modified = '';
282
+                    $newNote->date_entered = '';
283
+                    /* BEGIN - SECURITY GROUPS */
284
+                    //Need to do this so that attachments show under an EmailTemplate correctly for a normal user
285
+                    global $current_user;
286
+                    $newNote->assigned_user_id = $current_user->id;
287
+                    /* END - SECURITY GROUPS */
288
+                    $newNoteId = $newNote->save();
289
+
290
+                    UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
291
+                }
292
+                continue;
243 293
             }
294
+            $note->parent_id = $focus->id;
295
+            $note->parent_type = 'Emails';
296
+            $note->file_mime_type = $note->file->mime_type;
297
+            /* BEGIN - SECURITY GROUPS */
298
+            //Need to do this so that attachments show under an EmailTemplate correctly for a normal user
299
+            global $current_user;
300
+            $note->assigned_user_id = $current_user->id;
301
+            /* END - SECURITY GROUPS */
302
+            $note_id = $note->save();
303
+            array_push($focus->saved_attachments, $note);
304
+            $note->id = $note_id;
305
+
306
+            if($note->new_with_id === FALSE)
307
+                $note->file->final_move($note->id);
308
+            else
309
+                $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
310
+        }
244 311
 
245
-			$i=preg_replace("/email_attachment(.+)/",'$1',$key);
246
-			$upload_file = new UploadFile($key);
247
-
248
-			if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
249
-				$note->filename = $upload_file->get_stored_file_name();
250
-				$note->file = $upload_file;
251
-				$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
-				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
-                  if($_REQUEST['embedded'.$i]=='true'){
254
-				  	$note->embed_flag =true;
255
-                  }
256
-                  else{
257
-                  	$note->embed_flag =false;
258
-                  }
259
-				}
260
-				array_push($focus->attachments, $note);
261
-			}
262
-
263
-		}
264
-
265
-		$focus->saved_attachments = array();
266
-		foreach($focus->attachments as $note)
267
-		{
268
-			if( !empty($note->id) && $note->new_with_id === FALSE)
269
-			{
270
-				if(empty($_REQUEST['old_id']))
271
-					array_push($focus->saved_attachments, $note); // to support duplication of email templates
272
-				else
273
-				{
274
-					// we're duplicating a template with attachments
275
-					// dupe the file, create a new note, assign the note to the new template
276
-					$newNote = new Note();
277
-					$newNote->retrieve($note->id);
278
-					$newNote->id = create_guid();
279
-					$newNote->parent_id = $focus->id;
280
-					$newNote->new_with_id = true;
281
-					$newNote->date_modified = '';
282
-					$newNote->date_entered = '';
283
-					/* BEGIN - SECURITY GROUPS */
284
-					//Need to do this so that attachments show under an EmailTemplate correctly for a normal user
285
-					global $current_user;
286
-					$newNote->assigned_user_id = $current_user->id;
287
-					/* END - SECURITY GROUPS */
288
-					$newNoteId = $newNote->save();
289
-
290
-					UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
291
-				}
292
-				continue;
293
-			}
294
-			$note->parent_id = $focus->id;
295
-			$note->parent_type = 'Emails';
296
-			$note->file_mime_type = $note->file->mime_type;
297
-			/* BEGIN - SECURITY GROUPS */
298
-			//Need to do this so that attachments show under an EmailTemplate correctly for a normal user
299
-			global $current_user;
300
-			$note->assigned_user_id = $current_user->id;
301
-			/* END - SECURITY GROUPS */
302
-			$note_id = $note->save();
303
-			array_push($focus->saved_attachments, $note);
304
-			$note->id = $note_id;
305
-
306
-			if($note->new_with_id === FALSE)
307
-    			$note->file->final_move($note->id);
308
-    	    else
309
-    	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
310
-		}
311
-
312
-		////	END NEW ATTACHMENTS
313
-		///////////////////////////////////////////////////////////////////////////
314
-
315
-	///////////////////////////////////////////////////////////////////////////
316
-	////	ATTACHMENTS FROM DOCUMENTS
317
-	$count='';
318
-	//_pp($_REQUEST);
319
-	//_ppd(count($_REQUEST['document']));
320
-	if(!empty($_REQUEST['document'])){
321
-      $count = count($_REQUEST['document']);
312
+        ////	END NEW ATTACHMENTS
313
+        ///////////////////////////////////////////////////////////////////////////
314
+
315
+    ///////////////////////////////////////////////////////////////////////////
316
+    ////	ATTACHMENTS FROM DOCUMENTS
317
+    $count='';
318
+    //_pp($_REQUEST);
319
+    //_ppd(count($_REQUEST['document']));
320
+    if(!empty($_REQUEST['document'])){
321
+        $count = count($_REQUEST['document']);
322 322
     }
323 323
     else{
324
-    	$count=10;
324
+        $count=10;
325 325
     }
326 326
 
327
-	for($i=0; $i<$count; $i++) {
328
-		if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329
-			$doc = new Document();
330
-			$docRev = new DocumentRevision();
331
-			$docNote = new Note();
327
+    for($i=0; $i<$count; $i++) {
328
+        if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329
+            $doc = new Document();
330
+            $docRev = new DocumentRevision();
331
+            $docNote = new Note();
332 332
 
333
-			$doc->retrieve($_REQUEST['documentId'.$i]);
334
-			$docRev->retrieve($doc->document_revision_id);
333
+            $doc->retrieve($_REQUEST['documentId'.$i]);
334
+            $docRev->retrieve($doc->document_revision_id);
335 335
 
336
-			array_push($focus->saved_attachments, $docRev);
336
+            array_push($focus->saved_attachments, $docRev);
337 337
 
338
-			$docNote->name = $doc->document_name;
339
-			$docNote->filename = $docRev->filename;
340
-			$docNote->description = $doc->description;
341
-			$docNote->parent_id = $focus->id;
342
-			$docNote->parent_type = 'Emails';
343
-			$docNote->file_mime_type = $docRev->file_mime_type;
344
-			$docId = $docNote = $docNote->save();
338
+            $docNote->name = $doc->document_name;
339
+            $docNote->filename = $docRev->filename;
340
+            $docNote->description = $doc->description;
341
+            $docNote->parent_id = $focus->id;
342
+            $docNote->parent_type = 'Emails';
343
+            $docNote->file_mime_type = $docRev->file_mime_type;
344
+            $docId = $docNote = $docNote->save();
345 345
 
346
-			UploadFile::duplicate_file($docRev->id, $docId, $docRev->filename);
347
-		}
346
+            UploadFile::duplicate_file($docRev->id, $docId, $docRev->filename);
347
+        }
348 348
 
349
-	}
349
+    }
350 350
 
351
-	////	END ATTACHMENTS FROM DOCUMENTS
352
-	///////////////////////////////////////////////////////////////////////////
351
+    ////	END ATTACHMENTS FROM DOCUMENTS
352
+    ///////////////////////////////////////////////////////////////////////////
353 353
 
354
-		///////////////////////////////////////////////////////////////////////////
355
-		////	REMOVE ATTACHMENTS
354
+        ///////////////////////////////////////////////////////////////////////////
355
+        ////	REMOVE ATTACHMENTS
356 356
 
357
-		if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
-			foreach($_REQUEST['remove_attachment'] as $noteId) {
359
-				$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360
-				$focus->db->query($q);
361
-			}
357
+        if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
+            foreach($_REQUEST['remove_attachment'] as $noteId) {
359
+                $q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360
+                $focus->db->query($q);
361
+            }
362 362
 
363
-		}
363
+        }
364 364
 
365
-		////	END REMOVE ATTACHMENTS
366
-		///////////////////////////////////////////////////////////////////////////
367
-	////	END ATTACHMENT HANDLING
368
-	///////////////////////////////////////////////////////////////////////////////
365
+        ////	END REMOVE ATTACHMENTS
366
+        ///////////////////////////////////////////////////////////////////////////
367
+    ////	END ATTACHMENT HANDLING
368
+    ///////////////////////////////////////////////////////////////////////////////
369 369
 
370 370
         clear_register_value('select_array', $focus->object_name);
371 371
 
372
-		if($redirect) {
373
-		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374
-			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
376
-			return $focus;
377
-		}
378
-	}
372
+        if($redirect) {
373
+        $GLOBALS['log']->debug("Saved record with id of ".$return_id);
374
+            handleRedirect($return_id, "EmailTemplates");
375
+        }else{
376
+            return $focus;
377
+        }
378
+    }
379 379
 
380 380
 }
381 381
 ?>
382 382
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 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 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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
137 137
 	}
138 138
 
139 139
 
140
-	function handleSave($prefix,$redirect=true, $useRequired=false)
140
+	function handleSave($prefix, $redirect = true, $useRequired = false)
141 141
 	{
142 142
 		require_once('include/formbase.php');
143 143
 		require_once('include/upload_file.php');
@@ -146,30 +146,30 @@  discard block
 block discarded – undo
146 146
 		global $sugar_config;
147 147
 
148 148
 		$focus = new EmailTemplate();
149
-		if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
149
+		if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150 150
 			return null;
151 151
 		}
152 152
 		$focus = populateFromPost($prefix, $focus);
153 153
         //process the text only flag
154
-        if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
154
+        if (isset($_POST['text_only']) && ($_POST['text_only'] == '1')) {
155 155
             $focus->text_only = 1;
156
-        }else{
156
+        } else {
157 157
             $focus->text_only = 0;
158 158
         }
159
-		if(!$focus->ACLAccess('Save')) {
159
+		if (!$focus->ACLAccess('Save')) {
160 160
 			ACLController::displayNoAccess(true);
161 161
 			sugar_cleanup(true);
162 162
 		}
163
-		if(!isset($_REQUEST['published'])) $focus->published = 'off';
163
+		if (!isset($_REQUEST['published'])) $focus->published = 'off';
164 164
 
165 165
 		$preProcessedImages = array();
166 166
 		$emailTemplateBodyHtml = from_html($focus->body_html);
167
-		if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
167
+		if (strpos($emailTemplateBodyHtml, '"cache/images/')) {
168 168
 			$matches = array();
169 169
 			preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
-			foreach($matches[1] as $match) {
170
+			foreach ($matches[1] as $match) {
171 171
 				$filename = urldecode($match);
172
-                if($filename != pathinfo($filename, PATHINFO_BASENAME)) {
172
+                if ($filename != pathinfo($filename, PATHINFO_BASENAME)) {
173 173
                     // don't allow paths there
174 174
                     $emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
175 175
                     continue;
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 				$file_location = sugar_cached("images/{$filename}");
178 178
 				$mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179 179
 
180
-				if(file_exists($file_location)) {
180
+				if (file_exists($file_location)) {
181 181
 					$id = create_guid();
182 182
 					$newFileLocation = "upload://$id";
183
-					if(!copy($file_location, $newFileLocation)) {
183
+					if (!copy($file_location, $newFileLocation)) {
184 184
 						$GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185 185
 					} else {
186 186
 						$secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
@@ -207,20 +207,20 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$max_files_upload = count($_FILES);
209 209
 
210
-		if(!empty($focus->id)) {
210
+		if (!empty($focus->id)) {
211 211
 			$note = new Note();
212 212
 			$where = "notes.parent_id='{$focus->id}'";
213
-			if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
213
+			if (!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214 214
 				$where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215 215
 			}
216 216
 			$notes_list = $note->get_full_list("", $where, true);
217 217
 		}
218 218
 
219
-		if(!isset($notes_list)) {
219
+		if (!isset($notes_list)) {
220 220
 			$notes_list = array();
221 221
 		}
222 222
 
223
-		if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
223
+		if (!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224 224
 			$focus->attachments = array();
225 225
 		}
226 226
 		$focus->attachments = array_merge($focus->attachments, $notes_list);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			$note = new Note();
235 235
 
236 236
 			//Images are presaved above so we need to prevent duplicate files from being created.
237
-			if( isset($preProcessedImages[$file['name']]) )
237
+			if (isset($preProcessedImages[$file['name']]))
238 238
 			{
239 239
 			    $oldId = $preProcessedImages[$file['name']];
240 240
 			    $note->id = $oldId;
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
 			    $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
243 243
             }
244 244
 
245
-			$i=preg_replace("/email_attachment(.+)/",'$1',$key);
245
+			$i = preg_replace("/email_attachment(.+)/", '$1', $key);
246 246
 			$upload_file = new UploadFile($key);
247 247
 
248
-			if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
248
+			if (isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/", $key)) {
249 249
 				$note->filename = $upload_file->get_stored_file_name();
250 250
 				$note->file = $upload_file;
251 251
 				$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
-				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
-                  if($_REQUEST['embedded'.$i]=='true'){
254
-				  	$note->embed_flag =true;
252
+				if (isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])) {
253
+                  if ($_REQUEST['embedded'.$i] == 'true') {
254
+				  	$note->embed_flag = true;
255 255
                   }
256
-                  else{
257
-                  	$note->embed_flag =false;
256
+                  else {
257
+                  	$note->embed_flag = false;
258 258
                   }
259 259
 				}
260 260
 				array_push($focus->attachments, $note);
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 
265 265
 		$focus->saved_attachments = array();
266
-		foreach($focus->attachments as $note)
266
+		foreach ($focus->attachments as $note)
267 267
 		{
268
-			if( !empty($note->id) && $note->new_with_id === FALSE)
268
+			if (!empty($note->id) && $note->new_with_id === FALSE)
269 269
 			{
270
-				if(empty($_REQUEST['old_id']))
270
+				if (empty($_REQUEST['old_id']))
271 271
 					array_push($focus->saved_attachments, $note); // to support duplication of email templates
272 272
 				else
273 273
 				{
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 			array_push($focus->saved_attachments, $note);
304 304
 			$note->id = $note_id;
305 305
 
306
-			if($note->new_with_id === FALSE)
306
+			if ($note->new_with_id === FALSE)
307 307
     			$note->file->final_move($note->id);
308 308
     	    else
309 309
     	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
@@ -314,18 +314,18 @@  discard block
 block discarded – undo
314 314
 
315 315
 	///////////////////////////////////////////////////////////////////////////
316 316
 	////	ATTACHMENTS FROM DOCUMENTS
317
-	$count='';
317
+	$count = '';
318 318
 	//_pp($_REQUEST);
319 319
 	//_ppd(count($_REQUEST['document']));
320
-	if(!empty($_REQUEST['document'])){
320
+	if (!empty($_REQUEST['document'])) {
321 321
       $count = count($_REQUEST['document']);
322 322
     }
323
-    else{
324
-    	$count=10;
323
+    else {
324
+    	$count = 10;
325 325
     }
326 326
 
327
-	for($i=0; $i<$count; $i++) {
328
-		if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
327
+	for ($i = 0; $i < $count; $i++) {
328
+		if (isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329 329
 			$doc = new Document();
330 330
 			$docRev = new DocumentRevision();
331 331
 			$docNote = new Note();
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 		///////////////////////////////////////////////////////////////////////////
355 355
 		////	REMOVE ATTACHMENTS
356 356
 
357
-		if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
-			foreach($_REQUEST['remove_attachment'] as $noteId) {
357
+		if (isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
+			foreach ($_REQUEST['remove_attachment'] as $noteId) {
359 359
 				$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360 360
 				$focus->db->query($q);
361 361
 			}
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 
370 370
         clear_register_value('select_array', $focus->object_name);
371 371
 
372
-		if($redirect) {
372
+		if ($redirect) {
373 373
 		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374 374
 			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
375
+		} else {
376 376
 			return $focus;
377 377
 		}
378 378
 	}
Please login to merge, or discard this patch.
Braces   +23 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -106,7 +108,9 @@  discard block
 block discarded – undo
106 108
 		if(!empty($mod)) {
107 109
 		global $current_language;
108 110
 		$mod_strings = return_module_language($current_language, $mod);
109
-	}else global $mod_strings;
111
+	} else {
112
+	    global $mod_strings;
113
+	}
110 114
 		global $app_strings;
111 115
 		global $app_list_strings;
112 116
 
@@ -153,14 +157,16 @@  discard block
 block discarded – undo
153 157
         //process the text only flag
154 158
         if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
155 159
             $focus->text_only = 1;
156
-        }else{
160
+        } else{
157 161
             $focus->text_only = 0;
158 162
         }
159 163
 		if(!$focus->ACLAccess('Save')) {
160 164
 			ACLController::displayNoAccess(true);
161 165
 			sugar_cleanup(true);
162 166
 		}
163
-		if(!isset($_REQUEST['published'])) $focus->published = 'off';
167
+		if(!isset($_REQUEST['published'])) {
168
+		    $focus->published = 'off';
169
+		}
164 170
 
165 171
 		$preProcessedImages = array();
166 172
 		$emailTemplateBodyHtml = from_html($focus->body_html);
@@ -193,8 +199,7 @@  discard block
 block discarded – undo
193 199
 		} // if
194 200
 		if (isset($GLOBALS['check_notify'])) {
195 201
             $check_notify = $GLOBALS['check_notify'];
196
-        }
197
-        else {
202
+        } else {
198 203
             $check_notify = FALSE;
199 204
         }
200 205
         $focus->body_html = $emailTemplateBodyHtml;
@@ -252,8 +257,7 @@  discard block
 block discarded – undo
252 257
 				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253 258
                   if($_REQUEST['embedded'.$i]=='true'){
254 259
 				  	$note->embed_flag =true;
255
-                  }
256
-                  else{
260
+                  } else{
257 261
                   	$note->embed_flag =false;
258 262
                   }
259 263
 				}
@@ -267,8 +271,10 @@  discard block
 block discarded – undo
267 271
 		{
268 272
 			if( !empty($note->id) && $note->new_with_id === FALSE)
269 273
 			{
270
-				if(empty($_REQUEST['old_id']))
271
-					array_push($focus->saved_attachments, $note); // to support duplication of email templates
274
+				if(empty($_REQUEST['old_id'])) {
275
+									array_push($focus->saved_attachments, $note);
276
+				}
277
+				// to support duplication of email templates
272 278
 				else
273 279
 				{
274 280
 					// we're duplicating a template with attachments
@@ -303,10 +309,11 @@  discard block
 block discarded – undo
303 309
 			array_push($focus->saved_attachments, $note);
304 310
 			$note->id = $note_id;
305 311
 
306
-			if($note->new_with_id === FALSE)
307
-    			$note->file->final_move($note->id);
308
-    	    else
309
-    	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
312
+			if($note->new_with_id === FALSE) {
313
+			    			$note->file->final_move($note->id);
314
+			} else {
315
+    	        	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
316
+    	    }
310 317
 		}
311 318
 
312 319
 		////	END NEW ATTACHMENTS
@@ -319,8 +326,7 @@  discard block
 block discarded – undo
319 326
 	//_ppd(count($_REQUEST['document']));
320 327
 	if(!empty($_REQUEST['document'])){
321 328
       $count = count($_REQUEST['document']);
322
-    }
323
-    else{
329
+    } else{
324 330
     	$count=10;
325 331
     }
326 332
 
@@ -372,7 +378,7 @@  discard block
 block discarded – undo
372 378
 		if($redirect) {
373 379
 		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374 380
 			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
381
+		} else{
376 382
 			return $focus;
377 383
 		}
378 384
 	}
Please login to merge, or discard this patch.