Completed
Push — master ( e40fee...8e8f82 )
by Adam
19:18
created
include/Smarty/plugins/function.multienum_to_array.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -65,29 +65,29 @@
 block discarded – undo
65 65
  */
66 66
 function smarty_function_multienum_to_array($params, &$smarty)
67 67
 {
68
-	$ret = "";
69
-	if(empty($params['string'])) {
68
+    $ret = "";
69
+    if(empty($params['string'])) {
70 70
         if (empty($params['default']))
71 71
             $ret = array();
72 72
         else if(is_array($params['default']))
73 73
             $ret = $params['default'];
74 74
         else
75
-           $ret = unencodeMultienum($params['default']);
75
+            $ret = unencodeMultienum($params['default']);
76 76
     } else {
77
-    	if (is_array($params['string']))
78
-    	  $ret = $params['string'];
79
-    	else
80
-    	  $ret = unencodeMultienum($params['string']);
77
+        if (is_array($params['string']))
78
+            $ret = $params['string'];
79
+        else
80
+            $ret = unencodeMultienum($params['string']);
81 81
     }
82 82
 	
83 83
     
84
-	if (!empty($params['assign']))
85
-	{
86
-		$smarty->assign($params['assign'], $ret);
87
-		return "";
88
-	}
84
+    if (!empty($params['assign']))
85
+    {
86
+        $smarty->assign($params['assign'], $ret);
87
+        return "";
88
+    }
89 89
 	
90
-	return ($ret);
90
+    return ($ret);
91 91
 }
92 92
 
93 93
 ?>
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_button.php 1 patch
Indentation   +109 added lines, -110 removed lines patch added patch discarded remove patch
@@ -281,28 +281,28 @@  discard block
 block discarded – undo
281 281
  */
282 282
 function smarty_function_sugar_button($params, &$smarty)
283 283
 {
284
-   if(empty($params['module'])) {
285
-   	  $smarty->trigger_error("sugar_button: missing required param (module)");
286
-   } else if(empty($params['id'])) {
287
-   	  $smarty->trigger_error("sugar_button: missing required param (id)");
288
-   } else if(empty($params['view'])) {
289
-   	  $smarty->trigger_error("sugar_button: missing required param (view)");
290
-   }
291
-
292
-   $js_form = (empty($params['form_id'])) ? "var _form = (this.form) ? this.form : document.forms[0];" : "var _form = document.getElementById('{$params['form_id']}');";
293
-
294
-   $type = $params['id'];
295
-   $location = (empty($params['location'])) ? "" : "_".$params['location'];
296
-
297
-   if(!is_array($type)) {
298
-   	  $module = $params['module'];
299
-   	  $view = $params['view'];
300
-   	  switch(strtoupper($type)) {
301
-			case "SEARCH":
284
+    if(empty($params['module'])) {
285
+            $smarty->trigger_error("sugar_button: missing required param (module)");
286
+    } else if(empty($params['id'])) {
287
+            $smarty->trigger_error("sugar_button: missing required param (id)");
288
+    } else if(empty($params['view'])) {
289
+            $smarty->trigger_error("sugar_button: missing required param (view)");
290
+    }
291
+
292
+    $js_form = (empty($params['form_id'])) ? "var _form = (this.form) ? this.form : document.forms[0];" : "var _form = document.getElementById('{$params['form_id']}');";
293
+
294
+    $type = $params['id'];
295
+    $location = (empty($params['location'])) ? "" : "_".$params['location'];
296
+
297
+    if(!is_array($type)) {
298
+            $module = $params['module'];
299
+            $view = $params['view'];
300
+            switch(strtoupper($type)) {
301
+            case "SEARCH":
302 302
                 $output = '<input tabindex="2" title="{$APP.LBL_SEARCH_BUTTON_TITLE}" onclick="SUGAR.savedViews.setChooser();" class="button" type="submit" name="button" value="{$APP.LBL_SEARCH_BUTTON_LABEL}" id="search_form_submit"/>&nbsp;';
303
-			break;
303
+            break;
304 304
 
305
-			case "CANCEL":
305
+            case "CANCEL":
306 306
                 $cancelButton  = '{if !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($smarty.request.return_id))}';
307 307
                 $cancelButton .= '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="SUGAR.ajaxUI.loadContent(\'index.php?action=DetailView&module={$smarty.request.return_module|escape:"url"}&record={$smarty.request.return_id|escape:"url"}\'); return false;" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}" type="button" id="'.$type.$location.'"> ';
308 308
                 $cancelButton .= '{elseif !empty($smarty.request.return_action) && ($smarty.request.return_action == "DetailView" && !empty($fields.id.value))}';
@@ -314,30 +314,30 @@  discard block
 block discarded – undo
314 314
                 $cancelButton .= '{/if}';
315 315
 
316 316
                 $output = $cancelButton;
317
-			break;
317
+            break;
318 318
 
319
-			case "DELETE":
319
+            case "DELETE":
320 320
                 $output = '{if $bean->aclAccess("delete")}<input title="{$APP.LBL_DELETE_BUTTON_TITLE}" accessKey="{$APP.LBL_DELETE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'ListView\'; _form.action.value=\'Delete\'; if(confirm(\'{$APP.NTC_DELETE_CONFIRMATION}\')) SUGAR.ajaxUI.submitForm(_form);" type="submit" name="Delete" value="{$APP.LBL_DELETE_BUTTON_LABEL}" id="delete_button">{/if} ';
321 321
             break;
322 322
 
323
-			case "DUPLICATE":
324
-			    $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''. $module . '\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\'' . $view . '\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} ';
323
+            case "DUPLICATE":
324
+                $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_DUPLICATE_BUTTON_TITLE}" accessKey="{$APP.LBL_DUPLICATE_BUTTON_KEY}" class="button" onclick="'.$js_form.' _form.return_module.value=\''. $module . '\'; _form.return_action.value=\'DetailView\'; _form.isDuplicate.value=true; _form.action.value=\'' . $view . '\'; _form.return_id.value=\'{$id}\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Duplicate" value="{$APP.LBL_DUPLICATE_BUTTON_LABEL}" id="duplicate_button">{/if} ';
325 325
             break;
326 326
 
327
-			case "EDIT";
328
-			    $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} ';
327
+            case "EDIT";
328
+                $output = '{if $bean->aclAccess("edit")}<input title="{$APP.LBL_EDIT_BUTTON_TITLE}" accessKey="{$APP.LBL_EDIT_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'EditView\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Edit" id="edit_button" value="{$APP.LBL_EDIT_BUTTON_LABEL}">{/if} ';
329 329
             break;
330 330
 
331
-			case "FIND_DUPLICATES":
332
-			    $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} ';
331
+            case "FIND_DUPLICATES":
332
+                $output = '{if $bean->aclAccess("edit") && $bean->aclAccess("delete")}<input title="{$APP.LBL_DUP_MERGE}" class="button" onclick="'.$js_form.' _form.return_module.value=\'' . $module . '\'; _form.return_action.value=\'DetailView\'; _form.return_id.value=\'{$id}\'; _form.action.value=\'Step1\'; _form.module.value=\'MergeRecords\';SUGAR.ajaxUI.submitForm(_form);" type="button" name="Merge" value="{$APP.LBL_DUP_MERGE}" id="merge_duplicate_button">{/if} ';
333 333
             break;
334 334
 
335
-			case "SAVE":
336
-				$view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view);
337
-				$output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} ';
338
-			break;
335
+            case "SAVE":
336
+                $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view);
337
+                $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $view . '\'))SUGAR.ajaxUI.submitForm(_form);return false;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} ';
338
+            break;
339 339
 
340
-			case "SUBPANELSAVE":
340
+            case "SUBPANELSAVE":
341 341
                 if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view =  "form_SubpanelQuickCreate_{$module}";
342 342
 
343 343
                 /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ 
@@ -353,112 +353,111 @@  discard block
 block discarded – undo
353 353
                 }
354 354
                 //if different here then change the group return right above
355 355
                 $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}"  class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
356
-                
357
-                */
356
+                 */
358 357
                 $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}"  class="button" onclick="'.$js_form.' disableOnUnloadEditView(); _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return SUGAR.subpanelUtils.inlineSave(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_subpanel_save_button" id="' . $params['module'] . '_subpanel_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
359 358
                 /* END - SECURITY GROUPS */
360 359
 
361 360
             break;
362
-			case "SUBPANELCANCEL":
361
+            case "SUBPANELCANCEL":
363 362
                 $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="return SUGAR.subpanelUtils.cancelCreate($(this).attr(\'id\'));return false;" type="submit" name="' . $params['module'] . '_subpanel_cancel_button" id="' . $params['module'] . '_subpanel_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
364 363
 
365 364
             break;
366
-		    case "SUBPANELFULLFORM":
365
+            case "SUBPANELFULLFORM":
367 366
                 $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';" type="submit" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> ';
368 367
                 $output .= '<input type="hidden" name="full_form" value="full_form">';
369 368
             break;
370
-			case "DCMENUCANCEL":
369
+            case "DCMENUCANCEL":
371 370
                 $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="javascript:lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" type="submit" name="' . $params['module'] . '_dcmenu_cancel_button" id="' . $params['module'] . '_dcmenu_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
372 371
             break;
373
-			case "DCMENUSAVE":
372
+            case "DCMENUSAVE":
374 373
                             if ($view == 'QuickCreate') {
375 374
                                 $view = "form_DCQuickCreate_{$module}";
376 375
                             } else if ($view == 'EditView') {
377 376
                                 $view = "form_DCEditView_{$module}";
378 377
                             }
379
-				$output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
378
+                $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' _form.action.value=\'Save\';if(check_form(\''.$view.'\'))return DCMenu.save(_form.id, \'' . $params['module'] . '_subpanel_save_button\');return false;" type="submit" name="' . $params['module'] . '_dcmenu_save_button" id="' . $params['module'] . '_dcmenu_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
380 379
             break;
381
-			case "DCMENUFULLFORM":
380
+            case "DCMENUFULLFORM":
382 381
                 $output = '<input title="{$APP.LBL_FULL_FORM_BUTTON_TITLE}" accessKey="{$APP.LBL_FULL_FORM_BUTTON_KEY}" class="button" onclick="'.$js_form.' disableOnUnloadEditView(_form); _form.return_action.value=\'DetailView\'; _form.action.value=\'EditView\'; _form.return_module.value=\'' . $params['module'] . '\';_form.return_id.value=_form.record.value;if(typeof(_form.to_pdf)!=\'undefined\') _form.to_pdf.value=\'0\';SUGAR.ajaxUI.submitForm(_form,null,true);DCMenu.closeOverlay();" type="button" name="' . $params['module'] . '_subpanel_full_form_button" id="' . $params['module'] . '_subpanel_full_form_button" value="{$APP.LBL_FULL_FORM_BUTTON_LABEL}"> ';
383 382
                 $output .= '<input type="hidden" name="full_form" value="full_form">';
384 383
                 $output .= '<input type="hidden" name="is_admin" value="">';
385 384
             break;
386
-			case "POPUPSAVE":
387
-				$view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view;
388
-				$output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" '
389
-					 . 'class="button primary" onclick="'.$js_form.' _form.action.value=\'Popup\';'
390
-					 . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module']
391
-					 . '_popupcreate_save_button" id="' . $params['module']
392
-					 . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
385
+            case "POPUPSAVE":
386
+                $view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view;
387
+                $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" '
388
+                        . 'class="button primary" onclick="'.$js_form.' _form.action.value=\'Popup\';'
389
+                        . 'return check_form(\''.$view.'\')" type="submit" name="' . $params['module']
390
+                        . '_popupcreate_save_button" id="' . $params['module']
391
+                        . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} ';
393 392
             break;
394
-			case "POPUPCANCEL":
393
+            case "POPUPCANCEL":
395 394
                 $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" '
396
-					 . 'class="button" onclick="toggleDisplay(\'addform\');return false;" '
397
-					 . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"'
398
-					 . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
395
+                        . 'class="button" onclick="toggleDisplay(\'addform\');return false;" '
396
+                        . 'name="' . $params['module'] . '_popup_cancel_button" type="submit"'
397
+                        . 'id="' . $params['module'] . '_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> ';
399 398
             break;
400
-			case "AUDIT":
401
-	            $popup_request_data = array(
402
-			        'call_back_function' => 'set_return',
403
-			        'form_name' => 'EditView',
404
-			        'field_to_name_array' => array(),
405
-			    );
406
-	            $json = getJSONobj();
407
-
408
-	            require_once('include/SugarFields/Parsers/MetaParser.php');
409
-	            $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data));
410
-	 			$audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">';
399
+            case "AUDIT":
400
+                $popup_request_data = array(
401
+                    'call_back_function' => 'set_return',
402
+                    'form_name' => 'EditView',
403
+                    'field_to_name_array' => array(),
404
+                );
405
+                $json = getJSONobj();
406
+
407
+                require_once('include/SugarFields/Parsers/MetaParser.php');
408
+                $encoded_popup_request_data = MetaParser::parseDelimiters($json->encode($popup_request_data));
409
+                    $audit_link = '<input id="btn_view_change_log" title="{$APP.LNK_VIEW_CHANGE_LOG}" class="button" onclick=\'open_popup("Audit", "600", "400", "&record={$fields.id.value}&module_name=' . $params['module'] . '", true, false, ' . $encoded_popup_request_data . '); return false;\' type="button" value="{$APP.LNK_VIEW_CHANGE_LOG}">';
411 410
                 $output = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}';
412 411
             break;
413 412
 
414 413
 
415
-   	  } //switch
416
-      if(isset($params['appendTo'])) {
417
-          $smarty->append($params['appendTo'], $output);
418
-          return;
419
-      }
420
-      return $output;
421
-   } else if(is_array($type) && isset($type['sugar_html'])) {
422
-       require_once('include/SugarHtml/SugarHtml.php');
423
-
424
-       $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']);
425
-       replaceFormClick($dom_tree, $js_form);
426
-       $output = SugarHtml::createHtml($dom_tree);
427
-
428
-       if(isset($params['appendTo'])) {
429
-           $smarty->append($params['appendTo'], $output);
430
-           return;
431
-       }
432
-       return $output;
433
-   } else if(is_array($type) && isset($type['customCode'])) {
434
-       require_once('include/SugarHtml/SugarHtml.php');
435
-
436
-       $dom_tree = SugarHtml::parseHtmlTag($type['customCode']);
437
-       $hidden_exists = false;
438
-
439
-       replaceFormClick($dom_tree, $js_form, $hidden_exists);
440
-       if($hidden_exists) {
441
-           //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form
442
-           $form = $smarty->get_template_vars('form');
443
-           $hidden_fields = $dom_tree;
444
-           extractHiddenInputs($hidden_fields);
445
-           if(!isset($form)) {
446
-               $form = array();
447
-           }
448
-           if(!isset($form['hidden'])) {
449
-               $form['hidden'] = array();
450
-           }
451
-           $form['hidden'][] = SugarHtml::createHtml($hidden_fields);
452
-           $smarty->assign('form', $form);
453
-       }
454
-       $output = SugarHtml::createHtml($dom_tree);
455
-
456
-       if(isset($params['appendTo'])) {
457
-           $smarty->append($params['appendTo'], $output);
458
-           return;
459
-       }
460
-       return $output;
461
-   }
414
+            } //switch
415
+        if(isset($params['appendTo'])) {
416
+            $smarty->append($params['appendTo'], $output);
417
+            return;
418
+        }
419
+        return $output;
420
+    } else if(is_array($type) && isset($type['sugar_html'])) {
421
+        require_once('include/SugarHtml/SugarHtml.php');
422
+
423
+        $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']);
424
+        replaceFormClick($dom_tree, $js_form);
425
+        $output = SugarHtml::createHtml($dom_tree);
426
+
427
+        if(isset($params['appendTo'])) {
428
+            $smarty->append($params['appendTo'], $output);
429
+            return;
430
+        }
431
+        return $output;
432
+    } else if(is_array($type) && isset($type['customCode'])) {
433
+        require_once('include/SugarHtml/SugarHtml.php');
434
+
435
+        $dom_tree = SugarHtml::parseHtmlTag($type['customCode']);
436
+        $hidden_exists = false;
437
+
438
+        replaceFormClick($dom_tree, $js_form, $hidden_exists);
439
+        if($hidden_exists) {
440
+            //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form
441
+            $form = $smarty->get_template_vars('form');
442
+            $hidden_fields = $dom_tree;
443
+            extractHiddenInputs($hidden_fields);
444
+            if(!isset($form)) {
445
+                $form = array();
446
+            }
447
+            if(!isset($form['hidden'])) {
448
+                $form['hidden'] = array();
449
+            }
450
+            $form['hidden'][] = SugarHtml::createHtml($hidden_fields);
451
+            $smarty->assign('form', $form);
452
+        }
453
+        $output = SugarHtml::createHtml($dom_tree);
454
+
455
+        if(isset($params['appendTo'])) {
456
+            $smarty->append($params['appendTo'], $output);
457
+            return;
458
+        }
459
+        return $output;
460
+    }
462 461
 
463 462
 }
464 463
 /**
Please login to merge, or discard this patch.
include/Smarty/plugins/shared.make_timestamp.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     } elseif (preg_match('/^\d{14}$/', $string)) {
24 24
         // it is mysql timestamp format of YYYYMMDDHHMMSS?            
25 25
         $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),
26
-                       substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
26
+                        substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
27 27
         
28 28
     } elseif (is_numeric($string)) {
29 29
         // it is a numeric string, we handle it as timestamp
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.in_array.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@
 block discarded – undo
44 44
  */
45 45
 function smarty_modifier_in_array($needle = null, $haystack = null)
46 46
 {
47
-	//Smarty barfs if Array is empty
47
+    //Smarty barfs if Array is empty
48 48
     if($haystack == null || empty($haystack)) {
49
-       return false;	
49
+        return false;	
50 50
     }
51 51
     return in_array($needle, $haystack);
52 52
 }
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_email_btn.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -39,24 +39,24 @@
 block discarded – undo
39 39
 
40 40
 
41 41
 
42
- /**
43
- * smarty_function_sugar_email_btn
44
- * This is the constructor for the Smarty plugin.
45
- * This function exists so that the proper email button based on user prefs is loaded into the quotes module.
46
- * 
47
- * @param $params The runtime Smarty key/value arguments
48
- * @param $smarty The reference to the Smarty object used in this invocation
49
- */
42
+    /**
43
+     * smarty_function_sugar_email_btn
44
+     * This is the constructor for the Smarty plugin.
45
+     * This function exists so that the proper email button based on user prefs is loaded into the quotes module.
46
+     * 
47
+     * @param $params The runtime Smarty key/value arguments
48
+     * @param $smarty The reference to the Smarty object used in this invocation
49
+     */
50 50
 function smarty_function_sugar_email_btn($params, &$smarty)
51 51
 {
52
-	global $app_strings, $current_user;
53
-	$pdfButtons = '';
54
-	$client = $current_user->getPreference('email_link_type');
55
-	if ($client != 'sugar') {
56
-		$pdfButtons = '<input title="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" onclick="location.href=\'mailto:\';return false;"> ';
57
-	} else {
58
-		$pdfButtons = '<input id="email_as_pdf_button" title="'. $app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"] . '" onclick="this.form.email_action.value=\'EmailLayout\';"> ';
59
-	}
60
-	return $pdfButtons;
52
+    global $app_strings, $current_user;
53
+    $pdfButtons = '';
54
+    $client = $current_user->getPreference('email_link_type');
55
+    if ($client != 'sugar') {
56
+        $pdfButtons = '<input title="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_COMPOSE"] . '" onclick="location.href=\'mailto:\';return false;"> ';
57
+    } else {
58
+        $pdfButtons = '<input id="email_as_pdf_button" title="'. $app_strings["LBL_EMAIL_PDF_BUTTON_TITLE"] . '" class="button" type="submit" name="button" value="'. $app_strings["LBL_EMAIL_PDF_BUTTON_LABEL"] . '" onclick="this.form.email_action.value=\'EmailLayout\';"> ';
59
+    }
60
+    return $pdfButtons;
61 61
 }
62 62
 ?>
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.lookup.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@
 block discarded – undo
42 42
 
43 43
 
44 44
 function smarty_modifier_lookup($value='', $from=array()){
45
-	$value = trim($value);
46
-	if (array_key_exists($value, $from)) { 
47
-		return $from[$value]; 
48
-	} 
49
-	return ''; 
45
+    $value = trim($value);
46
+    if (array_key_exists($value, $from)) { 
47
+        return $from[$value]; 
48
+    } 
49
+    return ''; 
50 50
 } 
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugarvar_connector.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,14 +74,14 @@
 block discarded – undo
74 74
 
75 75
 function smarty_function_sugarvar_connector($params, &$smarty) {
76 76
       
77
-      $displayParams = $smarty->get_template_vars('displayParams');
78
-      if(!isset($displayParams['module'])) {
79
-         $smarty->trigger_error("sugarvar_connector: missing 'module' parameter");
80
-         $GLOBALS['log']->error("sugarvar_connector: missing 'module' parameter");
81
-         return;     	
82
-      }
77
+        $displayParams = $smarty->get_template_vars('displayParams');
78
+        if(!isset($displayParams['module'])) {
79
+            $smarty->trigger_error("sugarvar_connector: missing 'module' parameter");
80
+            $GLOBALS['log']->error("sugarvar_connector: missing 'module' parameter");
81
+            return;     	
82
+        }
83 83
       
84
-      require_once('include/connectors/utils/ConnectorUtils.php');
85
-      echo ConnectorUtils::getConnectorButtonScript($displayParams, $smarty);
84
+        require_once('include/connectors/utils/ConnectorUtils.php');
85
+        echo ConnectorUtils::getConnectorButtonScript($displayParams, $smarty);
86 86
 }
87 87
 ?>
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
include/Smarty/Smarty_Compiler.class.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
         // matches all valid variables (no quotes, no modifiers)
132 132
         $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|'
133
-           . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')';
133
+            . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')';
134 134
 
135 135
         // matches valid variable syntax:
136 136
         // $foo
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         // |foo|bar
173 173
         // |foo:$foo->bar
174 174
         $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|'
175
-           . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
175
+            . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
176 176
 
177 177
         // matches valid function name:
178 178
         // foo123
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         // "text"|bar
194 194
         // $foo->bar
195 195
         $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|'
196
-           . $this->_var_regexp . '|' . $this->_num_const_regexp  . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
196
+            . $this->_var_regexp . '|' . $this->_num_const_regexp  . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
197 197
 
198 198
         // matches valid parenthesised function parameters:
199 199
         //
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         // _foo_bar($foo,"bar")
211 211
         // foo123($foo,$foo->bar(),"foo")
212 212
         $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:'
213
-           . $this->_parenth_param_regexp . '))';
213
+            . $this->_parenth_param_regexp . '))';
214 214
     }
215 215
 
216 216
     /**
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 
264 264
         /* replace special blocks by "{php}" */
265 265
         $source_content = preg_replace_callback($search, create_function ('$matches', "return '"
266
-                                       . $this->_quote_replace($this->left_delimiter) . 'php'
267
-                                       . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
268
-                                       . $this->_quote_replace($this->right_delimiter)
269
-                                       . "';")
270
-                                       , $source_content);
266
+                                        . $this->_quote_replace($this->left_delimiter) . 'php'
267
+                                        . "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
268
+                                        . $this->_quote_replace($this->right_delimiter)
269
+                                        . "';")
270
+                                        , $source_content);
271 271
 
272 272
         /* Gather all template tags. */
273 273
         preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
                 if ($postfilter === false) continue;
389 389
                 if ($postfilter[3] || is_callable($postfilter[0])) {
390 390
                     $compiled_content = call_user_func_array($postfilter[0],
391
-                                                              array($compiled_content, &$this));
391
+                                                                array($compiled_content, &$this));
392 392
                     $this->_plugins['postfilter'][$filter_name][3] = true;
393 393
                 } else {
394 394
                     $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented");
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
                 $output = call_user_func_array($plugin_func, array($tag_args, &$this));
650 650
                 if($output != '') {
651 651
                 $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command)
652
-                                   . $output
653
-                                   . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>';
652
+                                    . $output
653
+                                    . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>';
654 654
                 }
655 655
             } else {
656 656
                 $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__);
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
             $output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
1116 1116
         else
1117 1117
             $output .= "if ({$section_props}['max'] < 0)\n" .
1118
-                       "    {$section_props}['max'] = {$section_props}['loop'];\n";
1118
+                        "    {$section_props}['max'] = {$section_props}['loop'];\n";
1119 1119
 
1120 1120
         if (!isset($attrs['step']))
1121 1121
             $output .= "{$section_props}['step'] = 1;\n";
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
             $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
1125 1125
         else {
1126 1126
             $output .= "if ({$section_props}['start'] < 0)\n" .
1127
-                       "    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" .
1128
-                       "else\n" .
1129
-                       "    {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
1127
+                        "    {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" .
1128
+                        "else\n" .
1129
+                        "    {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
1130 1130
         }
1131 1131
 
1132 1132
         $output .= "if ({$section_props}['show']) {\n";
@@ -1136,9 +1136,9 @@  discard block
 block discarded – undo
1136 1136
             $output .= "    {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n";
1137 1137
         }
1138 1138
         $output .= "    if ({$section_props}['total'] == 0)\n" .
1139
-                   "        {$section_props}['show'] = false;\n" .
1140
-                   "} else\n" .
1141
-                   "    {$section_props}['total'] = 0;\n";
1139
+                    "        {$section_props}['show'] = false;\n" .
1140
+                    "} else\n" .
1141
+                    "    {$section_props}['total'] = 0;\n";
1142 1142
 
1143 1143
         $output .= "if ({$section_props}['show']):\n";
1144 1144
         $output .= "
@@ -1987,8 +1987,8 @@  discard block
 block discarded – undo
1987 1987
         }
1988 1988
         if (!isset($this->_plugin_info[$type][$name])) {
1989 1989
             $this->_plugin_info[$type][$name] = array($this->_current_file,
1990
-                                                      $this->_current_line_no,
1991
-                                                      $delayed_loading);
1990
+                                                        $this->_current_line_no,
1991
+                                                        $delayed_loading);
1992 1992
         }
1993 1993
     }
1994 1994
 
@@ -2056,7 +2056,7 @@  discard block
 block discarded – undo
2056 2056
             case 'get':
2057 2057
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2058 2058
                     $this->_syntax_error("(secure mode) super global access not permitted",
2059
-                                         E_USER_WARNING, __FILE__, __LINE__);
2059
+                                            E_USER_WARNING, __FILE__, __LINE__);
2060 2060
                     return;
2061 2061
                 }
2062 2062
                 $compiled_ref = "\$_GET";
@@ -2065,7 +2065,7 @@  discard block
 block discarded – undo
2065 2065
             case 'post':
2066 2066
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2067 2067
                     $this->_syntax_error("(secure mode) super global access not permitted",
2068
-                                         E_USER_WARNING, __FILE__, __LINE__);
2068
+                                            E_USER_WARNING, __FILE__, __LINE__);
2069 2069
                     return;
2070 2070
                 }
2071 2071
                 $compiled_ref = "\$_POST";
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
             case 'cookies':
2075 2075
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2076 2076
                     $this->_syntax_error("(secure mode) super global access not permitted",
2077
-                                         E_USER_WARNING, __FILE__, __LINE__);
2077
+                                            E_USER_WARNING, __FILE__, __LINE__);
2078 2078
                     return;
2079 2079
                 }
2080 2080
                 $compiled_ref = "\$_COOKIE";
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
             case 'env':
2084 2084
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2085 2085
                     $this->_syntax_error("(secure mode) super global access not permitted",
2086
-                                         E_USER_WARNING, __FILE__, __LINE__);
2086
+                                            E_USER_WARNING, __FILE__, __LINE__);
2087 2087
                     return;
2088 2088
                 }
2089 2089
                 $compiled_ref = "\$_ENV";
@@ -2092,7 +2092,7 @@  discard block
 block discarded – undo
2092 2092
             case 'server':
2093 2093
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2094 2094
                     $this->_syntax_error("(secure mode) super global access not permitted",
2095
-                                         E_USER_WARNING, __FILE__, __LINE__);
2095
+                                            E_USER_WARNING, __FILE__, __LINE__);
2096 2096
                     return;
2097 2097
                 }
2098 2098
                 $compiled_ref = "\$_SERVER";
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
             case 'session':
2102 2102
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2103 2103
                     $this->_syntax_error("(secure mode) super global access not permitted",
2104
-                                         E_USER_WARNING, __FILE__, __LINE__);
2104
+                                            E_USER_WARNING, __FILE__, __LINE__);
2105 2105
                     return;
2106 2106
                 }
2107 2107
                 $compiled_ref = "\$_SESSION";
@@ -2114,7 +2114,7 @@  discard block
 block discarded – undo
2114 2114
             case 'request':
2115 2115
                 if ($this->security && !$this->security_settings['ALLOW_SUPER_GLOBALS']) {
2116 2116
                     $this->_syntax_error("(secure mode) super global access not permitted",
2117
-                                         E_USER_WARNING, __FILE__, __LINE__);
2117
+                                            E_USER_WARNING, __FILE__, __LINE__);
2118 2118
                     return;
2119 2119
                 }
2120 2120
                 if ($this->request_use_auto_globals) {
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
             case 'const':
2142 2142
                 if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) {
2143 2143
                     $this->_syntax_error("(secure mode) constants not permitted",
2144
-                                         E_USER_WARNING, __FILE__, __LINE__);
2144
+                                            E_USER_WARNING, __FILE__, __LINE__);
2145 2145
                     return;
2146 2146
                 }
2147 2147
                 array_shift($indexes);
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
                 return ((is_object($this->_plugins[$type][$name][0][0])) ?
2198 2198
                         "\$this->_plugins['$type']['$name'][0][0]->"    /* method callback */
2199 2199
                         : (string)($this->_plugins[$type][$name][0][0]).'::'    /* class callback */
2200
-                       ). $this->_plugins[$type][$name][0][1];
2200
+                        ). $this->_plugins[$type][$name][0][1];
2201 2201
 
2202 2202
             } else {
2203 2203
                 /* function callback */
@@ -2342,7 +2342,7 @@  discard block
 block discarded – undo
2342 2342
             $message = " expected {/$_open_tag} (opened line $_line_no).";
2343 2343
         }
2344 2344
         $this->_syntax_error("mismatched tag {/$close_tag}.$message",
2345
-                             E_USER_ERROR, __FILE__, __LINE__);
2345
+                                E_USER_ERROR, __FILE__, __LINE__);
2346 2346
     }
2347 2347
 
2348 2348
 }
Please login to merge, or discard this patch.
data/Relationships/One2OneBeanRelationship.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@
 block discarded – undo
102 102
 
103 103
         //join the related module's table
104 104
         $join .= "$join_type $targetTableWithAlias ON $targetTable.$targetKey=$startingTable.$startingKey"
105
-               . " AND $targetTable.deleted=$deleted\n"
105
+                . " AND $targetTable.deleted=$deleted\n"
106 106
         //Next add any role filters
107
-               . $this->getRoleWhere();
107
+                . $this->getRoleWhere();
108 108
 
109 109
         if($return_array){
110 110
             return array(
Please login to merge, or discard this patch.