@@ -102,11 +102,11 @@ |
||
| 102 | 102 | $field = $params['field']; |
| 103 | 103 | $type = $bean->field_name_map[$field]['type']; |
| 104 | 104 | if($type == 'text') { |
| 105 | - echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47) . '...' : $bean->field; |
|
| 105 | + echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47) . '...' : $bean->field; |
|
| 106 | 106 | } else if($type == 'link') { |
| 107 | - echo "<a href='{$bean->$field}' target='_blank'>{$bean->$field}</a>"; |
|
| 107 | + echo "<a href='{$bean->$field}' target='_blank'>{$bean->$field}</a>"; |
|
| 108 | 108 | } else { |
| 109 | - echo $bean->$field; |
|
| 109 | + echo $bean->$field; |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | |
| 59 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 59 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 60 | 60 | /********************************************************************************* |
| 61 | 61 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 62 | 62 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | $bean = $params['bean']; |
| 102 | 102 | $field = $params['field']; |
| 103 | 103 | $type = $bean->field_name_map[$field]['type']; |
| 104 | - if($type == 'text') { |
|
| 105 | - echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47) . '...' : $bean->field; |
|
| 106 | - } else if($type == 'link') { |
|
| 104 | + if ($type == 'text') { |
|
| 105 | + echo strlen($bean->$field) > 50 ? substr($bean->$field, 0, 47).'...' : $bean->field; |
|
| 106 | + } else if ($type == 'link') { |
|
| 107 | 107 | echo "<a href='{$bean->$field}' target='_blank'>{$bean->$field}</a>"; |
| 108 | 108 | } else { |
| 109 | 109 | echo $bean->$field; |
@@ -1,5 +1,7 @@ |
||
| 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. |
@@ -43,9 +43,9 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | function smarty_function_sugar_getjspath($params, &$smarty) |
| 45 | 45 | { |
| 46 | - if(!isset($params['file'])) { |
|
| 47 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
| 48 | - } |
|
| 49 | - return getJSPath($params['file']); |
|
| 46 | + if(!isset($params['file'])) { |
|
| 47 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
| 48 | + } |
|
| 49 | + return getJSPath($params['file']); |
|
| 50 | 50 | } |
| 51 | 51 | ?> |
| 52 | 52 | \ No newline at end of file |
@@ -43,8 +43,8 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | function smarty_function_sugar_getjspath($params, &$smarty) |
| 45 | 45 | { |
| 46 | - if(!isset($params['file'])) { |
|
| 47 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file'); |
|
| 46 | + if (!isset($params['file'])) { |
|
| 47 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'file'); |
|
| 48 | 48 | } |
| 49 | 49 | return getJSPath($params['file']); |
| 50 | 50 | } |
@@ -64,19 +64,19 @@ |
||
| 64 | 64 | function smarty_function_sugar_currency_format($params, &$smarty) { |
| 65 | 65 | |
| 66 | 66 | // Bug #47406 : Currency field doesn't accept 0.00 as default value |
| 67 | - if(!isset($params['var']) || $params['var'] === '') { |
|
| 67 | + if(!isset($params['var']) || $params['var'] === '') { |
|
| 68 | 68 | return ''; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | global $locale; |
| 72 | 72 | if(empty($params['currency_id'])){ |
| 73 | - $params['currency_id'] = $locale->getPrecedentPreference('currency'); |
|
| 74 | - if(!isset($params['convert'])) { |
|
| 75 | - $params['convert'] = true; |
|
| 76 | - } |
|
| 77 | - if(!isset($params['currency_symbol'])) { |
|
| 78 | - $params['currency_symbol'] = $locale->getPrecedentPreference('default_currency_symbol'); |
|
| 79 | - } |
|
| 73 | + $params['currency_id'] = $locale->getPrecedentPreference('currency'); |
|
| 74 | + if(!isset($params['convert'])) { |
|
| 75 | + $params['convert'] = true; |
|
| 76 | + } |
|
| 77 | + if(!isset($params['currency_symbol'])) { |
|
| 78 | + $params['currency_symbol'] = $locale->getPrecedentPreference('default_currency_symbol'); |
|
| 79 | + } |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $_contents = currency_format_number($params['var'], $params); |
@@ -64,17 +64,17 @@ |
||
| 64 | 64 | function smarty_function_sugar_currency_format($params, &$smarty) { |
| 65 | 65 | |
| 66 | 66 | // Bug #47406 : Currency field doesn't accept 0.00 as default value |
| 67 | - if(!isset($params['var']) || $params['var'] === '') { |
|
| 67 | + if (!isset($params['var']) || $params['var'] === '') { |
|
| 68 | 68 | return ''; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | global $locale; |
| 72 | - if(empty($params['currency_id'])){ |
|
| 72 | + if (empty($params['currency_id'])) { |
|
| 73 | 73 | $params['currency_id'] = $locale->getPrecedentPreference('currency'); |
| 74 | - if(!isset($params['convert'])) { |
|
| 74 | + if (!isset($params['convert'])) { |
|
| 75 | 75 | $params['convert'] = true; |
| 76 | 76 | } |
| 77 | - if(!isset($params['currency_symbol'])) { |
|
| 77 | + if (!isset($params['currency_symbol'])) { |
|
| 78 | 78 | $params['currency_symbol'] = $locale->getPrecedentPreference('default_currency_symbol'); |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -65,29 +65,29 @@ |
||
| 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 | ?> |
@@ -66,10 +66,10 @@ |
||
| 66 | 66 | function smarty_function_multienum_to_array($params, &$smarty) |
| 67 | 67 | { |
| 68 | 68 | $ret = ""; |
| 69 | - if(empty($params['string'])) { |
|
| 69 | + if (empty($params['string'])) { |
|
| 70 | 70 | if (empty($params['default'])) |
| 71 | 71 | $ret = array(); |
| 72 | - else if(is_array($params['default'])) |
|
| 72 | + else if (is_array($params['default'])) |
|
| 73 | 73 | $ret = $params['default']; |
| 74 | 74 | else |
| 75 | 75 | $ret = unencodeMultienum($params['default']); |
@@ -67,17 +67,19 @@ |
||
| 67 | 67 | { |
| 68 | 68 | $ret = ""; |
| 69 | 69 | if(empty($params['string'])) { |
| 70 | - if (empty($params['default'])) |
|
| 71 | - $ret = array(); |
|
| 72 | - else if(is_array($params['default'])) |
|
| 73 | - $ret = $params['default']; |
|
| 74 | - else |
|
| 75 | - $ret = unencodeMultienum($params['default']); |
|
| 70 | + if (empty($params['default'])) { |
|
| 71 | + $ret = array(); |
|
| 72 | + } else if(is_array($params['default'])) { |
|
| 73 | + $ret = $params['default']; |
|
| 74 | + } else { |
|
| 75 | + $ret = unencodeMultienum($params['default']); |
|
| 76 | + } |
|
| 76 | 77 | } else { |
| 77 | - if (is_array($params['string'])) |
|
| 78 | - $ret = $params['string']; |
|
| 79 | - else |
|
| 80 | - $ret = unencodeMultienum($params['string']); |
|
| 78 | + if (is_array($params['string'])) { |
|
| 79 | + $ret = $params['string']; |
|
| 80 | + } else { |
|
| 81 | + $ret = unencodeMultienum($params['string']); |
|
| 82 | + } |
|
| 81 | 83 | } |
| 82 | 84 | |
| 83 | 85 | |
@@ -281,28 +281,28 @@ discard block |
||
| 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"/> '; |
| 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 |
||
| 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 |
||
| 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 | /** |
@@ -281,11 +281,11 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | function smarty_function_sugar_button($params, &$smarty) |
| 283 | 283 | { |
| 284 | - if(empty($params['module'])) { |
|
| 284 | + if (empty($params['module'])) { |
|
| 285 | 285 | $smarty->trigger_error("sugar_button: missing required param (module)"); |
| 286 | - } else if(empty($params['id'])) { |
|
| 286 | + } else if (empty($params['id'])) { |
|
| 287 | 287 | $smarty->trigger_error("sugar_button: missing required param (id)"); |
| 288 | - } else if(empty($params['view'])) { |
|
| 288 | + } else if (empty($params['view'])) { |
|
| 289 | 289 | $smarty->trigger_error("sugar_button: missing required param (view)"); |
| 290 | 290 | } |
| 291 | 291 | |
@@ -294,10 +294,10 @@ discard block |
||
| 294 | 294 | $type = $params['id']; |
| 295 | 295 | $location = (empty($params['location'])) ? "" : "_".$params['location']; |
| 296 | 296 | |
| 297 | - if(!is_array($type)) { |
|
| 297 | + if (!is_array($type)) { |
|
| 298 | 298 | $module = $params['module']; |
| 299 | 299 | $view = $params['view']; |
| 300 | - switch(strtoupper($type)) { |
|
| 300 | + switch (strtoupper($type)) { |
|
| 301 | 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"/> '; |
| 303 | 303 | break; |
@@ -317,28 +317,28 @@ discard block |
||
| 317 | 317 | break; |
| 318 | 318 | |
| 319 | 319 | case "DELETE": |
| 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} '; |
|
| 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 | 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} '; |
|
| 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 | 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} '; |
|
| 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 | 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} '; |
|
| 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 | 335 | case "SAVE": |
| 336 | 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} '; |
|
| 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 | 338 | break; |
| 339 | 339 | |
| 340 | 340 | case "SUBPANELSAVE": |
| 341 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
| 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*/ |
| 344 | 344 | /** |
@@ -355,20 +355,20 @@ discard block |
||
| 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 | 356 | |
| 357 | 357 | */ |
| 358 | - $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} '; |
|
| 358 | + $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 | 359 | /* END - SECURITY GROUPS */ |
| 360 | 360 | |
| 361 | 361 | break; |
| 362 | 362 | case "SUBPANELCANCEL": |
| 363 | - $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}"> '; |
|
| 363 | + $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 | 364 | |
| 365 | 365 | break; |
| 366 | 366 | case "SUBPANELFULLFORM": |
| 367 | - $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}"> '; |
|
| 367 | + $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 | 368 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
| 369 | 369 | break; |
| 370 | 370 | case "DCMENUCANCEL": |
| 371 | - $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}"> '; |
|
| 371 | + $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 | 372 | break; |
| 373 | 373 | case "DCMENUSAVE": |
| 374 | 374 | if ($view == 'QuickCreate') { |
@@ -376,10 +376,10 @@ discard block |
||
| 376 | 376 | } else if ($view == 'EditView') { |
| 377 | 377 | $view = "form_DCEditView_{$module}"; |
| 378 | 378 | } |
| 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} '; |
|
| 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} '; |
|
| 380 | 380 | break; |
| 381 | 381 | case "DCMENUFULLFORM": |
| 382 | - $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}"> '; |
|
| 382 | + $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 | 383 | $output .= '<input type="hidden" name="full_form" value="full_form">'; |
| 384 | 384 | $output .= '<input type="hidden" name="is_admin" value="">'; |
| 385 | 385 | break; |
@@ -387,15 +387,15 @@ discard block |
||
| 387 | 387 | $view = ($view == 'QuickCreate') ? "form_QuickCreate_{$module}" : $view; |
| 388 | 388 | $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" ' |
| 389 | 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'] |
|
| 390 | + . 'return check_form(\''.$view.'\')" type="submit" name="'.$params['module'] |
|
| 391 | + . '_popupcreate_save_button" id="'.$params['module'] |
|
| 392 | 392 | . '_popupcreate_save_button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">{/if} '; |
| 393 | 393 | break; |
| 394 | 394 | case "POPUPCANCEL": |
| 395 | 395 | $output = '<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" ' |
| 396 | 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}"> '; |
|
| 397 | + . 'name="'.$params['module'].'_popup_cancel_button" type="submit"' |
|
| 398 | + . 'id="'.$params['module'].'_popup_cancel_button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}"> '; |
|
| 399 | 399 | break; |
| 400 | 400 | case "AUDIT": |
| 401 | 401 | $popup_request_data = array( |
@@ -407,45 +407,45 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | require_once('include/SugarFields/Parsers/MetaParser.php'); |
| 409 | 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}">'; |
|
| 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}">'; |
|
| 411 | 411 | $output = '{if $bean->aclAccess("detail")}{if !empty($fields.id.value) && $isAuditEnabled}'.$audit_link.'{/if}{/if}'; |
| 412 | 412 | break; |
| 413 | 413 | |
| 414 | 414 | |
| 415 | 415 | } //switch |
| 416 | - if(isset($params['appendTo'])) { |
|
| 416 | + if (isset($params['appendTo'])) { |
|
| 417 | 417 | $smarty->append($params['appendTo'], $output); |
| 418 | 418 | return; |
| 419 | 419 | } |
| 420 | 420 | return $output; |
| 421 | - } else if(is_array($type) && isset($type['sugar_html'])) { |
|
| 421 | + } else if (is_array($type) && isset($type['sugar_html'])) { |
|
| 422 | 422 | require_once('include/SugarHtml/SugarHtml.php'); |
| 423 | 423 | |
| 424 | 424 | $dom_tree = SugarHtml::parseSugarHtml($type['sugar_html']); |
| 425 | 425 | replaceFormClick($dom_tree, $js_form); |
| 426 | 426 | $output = SugarHtml::createHtml($dom_tree); |
| 427 | 427 | |
| 428 | - if(isset($params['appendTo'])) { |
|
| 428 | + if (isset($params['appendTo'])) { |
|
| 429 | 429 | $smarty->append($params['appendTo'], $output); |
| 430 | 430 | return; |
| 431 | 431 | } |
| 432 | 432 | return $output; |
| 433 | - } else if(is_array($type) && isset($type['customCode'])) { |
|
| 433 | + } else if (is_array($type) && isset($type['customCode'])) { |
|
| 434 | 434 | require_once('include/SugarHtml/SugarHtml.php'); |
| 435 | 435 | |
| 436 | 436 | $dom_tree = SugarHtml::parseHtmlTag($type['customCode']); |
| 437 | 437 | $hidden_exists = false; |
| 438 | 438 | |
| 439 | 439 | replaceFormClick($dom_tree, $js_form, $hidden_exists); |
| 440 | - if($hidden_exists) { |
|
| 440 | + if ($hidden_exists) { |
|
| 441 | 441 | //If the customCode contains hidden fields, the extracted hidden fields need to append in the original form |
| 442 | 442 | $form = $smarty->get_template_vars('form'); |
| 443 | 443 | $hidden_fields = $dom_tree; |
| 444 | 444 | extractHiddenInputs($hidden_fields); |
| 445 | - if(!isset($form)) { |
|
| 445 | + if (!isset($form)) { |
|
| 446 | 446 | $form = array(); |
| 447 | 447 | } |
| 448 | - if(!isset($form['hidden'])) { |
|
| 448 | + if (!isset($form['hidden'])) { |
|
| 449 | 449 | $form['hidden'] = array(); |
| 450 | 450 | } |
| 451 | 451 | $form['hidden'][] = SugarHtml::createHtml($hidden_fields); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | $output = SugarHtml::createHtml($dom_tree); |
| 455 | 455 | |
| 456 | - if(isset($params['appendTo'])) { |
|
| 456 | + if (isset($params['appendTo'])) { |
|
| 457 | 457 | $smarty->append($params['appendTo'], $output); |
| 458 | 458 | return; |
| 459 | 459 | } |
@@ -475,21 +475,21 @@ discard block |
||
| 475 | 475 | $set_submit = false; |
| 476 | 476 | $is_hidden_field = false; |
| 477 | 477 | //if the code is wrapped with the form element, it will escape the operation for JS replacement |
| 478 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
| 478 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
| 479 | 479 | return false; |
| 480 | 480 | |
| 481 | - if(isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
|
| 481 | + if (isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
|
| 482 | 482 | $is_hidden_field = true; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | //Replace the JS syntax where the sugar_button contains the event handler for this.form |
| 486 | - if(isset($dom_tree['onclick'])) { |
|
| 487 | - if(strpos($dom_tree['onclick'], "this.form") !== false) { |
|
| 486 | + if (isset($dom_tree['onclick'])) { |
|
| 487 | + if (strpos($dom_tree['onclick'], "this.form") !== false) { |
|
| 488 | 488 | $dom_tree['onclick'] = str_replace("this.form", "_form", $dom_tree['onclick']); |
| 489 | - if(substr($dom_tree['onclick'], -1) != ';') |
|
| 489 | + if (substr($dom_tree['onclick'], -1) != ';') |
|
| 490 | 490 | $dom_tree['onclick'] .= ";"; |
| 491 | 491 | //Onclick handler contains returning a variable, for example it prompts a confirm message. |
| 492 | - if(strpos($dom_tree['onclick'], "return ") !== false ) { |
|
| 492 | + if (strpos($dom_tree['onclick'], "return ") !== false) { |
|
| 493 | 493 | $dom_tree['onclick'] = $js_form.' var _onclick=(function(){ldelim}'.$dom_tree['onclick']."{rdelim}()); if(_onclick!==false) _form.submit();"; |
| 494 | 494 | } else { |
| 495 | 495 | $dom_tree['onclick'] = $js_form.$dom_tree['onclick']."_form.submit();"; |
@@ -498,19 +498,19 @@ discard block |
||
| 498 | 498 | $set_submit = true; |
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | - foreach($dom_tree as $key => $sub_tree) { |
|
| 502 | - if(is_array($sub_tree)) { |
|
| 501 | + foreach ($dom_tree as $key => $sub_tree) { |
|
| 502 | + if (is_array($sub_tree)) { |
|
| 503 | 503 | list($_submit, $_hidden) = replaceFormClick($dom_tree[$key], $js_form, $hidden_field_exists); |
| 504 | 504 | $set_submit = ($set_submit) ? $set_submit : $_submit; |
| 505 | 505 | $is_hidden_field = ($is_hidden_field) ? $is_hidden_field : $_hidden; |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if($set_submit && isset($dom_tree['type'])) { |
|
| 509 | + if ($set_submit && isset($dom_tree['type'])) { |
|
| 510 | 510 | $dom_tree['type'] = "button"; |
| 511 | 511 | $set_submit = false; |
| 512 | 512 | } |
| 513 | - if($is_hidden_field && isset($dom_tree['tag']) && $dom_tree['tag'] == 'input' ) { |
|
| 513 | + if ($is_hidden_field && isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
| 514 | 514 | $hidden_field_exists = true; |
| 515 | 515 | $is_hidden_field = false; |
| 516 | 516 | } |
@@ -527,20 +527,20 @@ discard block |
||
| 527 | 527 | 'hidden' |
| 528 | 528 | ); |
| 529 | 529 | //all hidden fields in the form elements must NOT attach in the original form |
| 530 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
| 530 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
| 531 | 531 | $dom_tree = array(); |
| 532 | 532 | } |
| 533 | - foreach($dom_tree as $key => $sub_tree) { |
|
| 534 | - if(is_numeric($key) && isset($sub_tree['tag']) && $sub_tree['tag'] == 'input') { |
|
| 535 | - if( !isset($sub_tree['type']) || in_array($sub_tree['type'], $allow_types) === false ) { |
|
| 533 | + foreach ($dom_tree as $key => $sub_tree) { |
|
| 534 | + if (is_numeric($key) && isset($sub_tree['tag']) && $sub_tree['tag'] == 'input') { |
|
| 535 | + if (!isset($sub_tree['type']) || in_array($sub_tree['type'], $allow_types) === false) { |
|
| 536 | 536 | unset($dom_tree[$key]); |
| 537 | 537 | } |
| 538 | - } else if(is_array($sub_tree)) { |
|
| 538 | + } else if (is_array($sub_tree)) { |
|
| 539 | 539 | extractHiddenInputs($dom_tree[$key]); |
| 540 | 540 | } |
| 541 | 541 | } |
| 542 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
| 543 | - if( !isset($dom_tree['type']) || in_array($dom_tree['type'], $allow_types) === false ) { |
|
| 542 | + if (isset($dom_tree['tag']) && $dom_tree['tag'] == 'input') { |
|
| 543 | + if (!isset($dom_tree['type']) || in_array($dom_tree['type'], $allow_types) === false) { |
|
| 544 | 544 | $dom_tree = array(); |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -338,7 +338,9 @@ discard block |
||
| 338 | 338 | break; |
| 339 | 339 | |
| 340 | 340 | case "SUBPANELSAVE": |
| 341 | - if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) $view = "form_SubpanelQuickCreate_{$module}"; |
|
| 341 | + if($view == 'QuickCreate' || (isset($_REQUEST['target_action']) && strtolower($_REQUEST['target_action']) == 'quickcreate')) { |
|
| 342 | + $view = "form_SubpanelQuickCreate_{$module}"; |
|
| 343 | + } |
|
| 342 | 344 | |
| 343 | 345 | /* BEGIN - SECURITY GROUPS - redirect a subpanel save to the detail view if select popup and user in more than 1 group*/ |
| 344 | 346 | /** |
@@ -475,8 +477,9 @@ discard block |
||
| 475 | 477 | $set_submit = false; |
| 476 | 478 | $is_hidden_field = false; |
| 477 | 479 | //if the code is wrapped with the form element, it will escape the operation for JS replacement |
| 478 | - if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') |
|
| 479 | - return false; |
|
| 480 | + if(isset($dom_tree['tag']) && $dom_tree['tag'] == 'form') { |
|
| 481 | + return false; |
|
| 482 | + } |
|
| 480 | 483 | |
| 481 | 484 | if(isset($dom_tree['type']) && $dom_tree['type'] == 'hidden') { |
| 482 | 485 | $is_hidden_field = true; |
@@ -486,8 +489,9 @@ discard block |
||
| 486 | 489 | if(isset($dom_tree['onclick'])) { |
| 487 | 490 | if(strpos($dom_tree['onclick'], "this.form") !== false) { |
| 488 | 491 | $dom_tree['onclick'] = str_replace("this.form", "_form", $dom_tree['onclick']); |
| 489 | - if(substr($dom_tree['onclick'], -1) != ';') |
|
| 490 | - $dom_tree['onclick'] .= ";"; |
|
| 492 | + if(substr($dom_tree['onclick'], -1) != ';') { |
|
| 493 | + $dom_tree['onclick'] .= ";"; |
|
| 494 | + } |
|
| 491 | 495 | //Onclick handler contains returning a variable, for example it prompts a confirm message. |
| 492 | 496 | if(strpos($dom_tree['onclick'], "return ") !== false ) { |
| 493 | 497 | $dom_tree['onclick'] = $js_form.' var _onclick=(function(){ldelim}'.$dom_tree['onclick']."{rdelim}()); if(_onclick!==false) _form.submit();"; |
@@ -23,7 +23,7 @@ |
||
| 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 |
@@ -16,14 +16,14 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | function smarty_make_timestamp($string) |
| 18 | 18 | { |
| 19 | - if(empty($string)) { |
|
| 19 | + if (empty($string)) { |
|
| 20 | 20 | // use "now": |
| 21 | 21 | $time = time(); |
| 22 | 22 | |
| 23 | 23 | } elseif (preg_match('/^\d{14}$/', $string)) { |
| 24 | 24 | // it is mysql timestamp format of YYYYMMDDHHMMSS? |
| 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)); |
|
| 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)); |
|
| 27 | 27 | |
| 28 | 28 | } elseif (is_numeric($string)) { |
| 29 | 29 | // it is a numeric string, we handle it as timestamp |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | * from a string. |
| 13 | 13 | * @author Monte Ohrt <monte at ohrt dot com> |
| 14 | 14 | * @param string |
| 15 | - * @return string |
|
| 15 | + * @return integer |
|
| 16 | 16 | */ |
| 17 | 17 | function smarty_make_timestamp($string) |
| 18 | 18 | { |
@@ -44,9 +44,9 @@ |
||
| 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 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | function smarty_modifier_in_array($needle = null, $haystack = null) |
| 46 | 46 | { |
| 47 | 47 | //Smarty barfs if Array is empty |
| 48 | - if($haystack == null || empty($haystack)) { |
|
| 48 | + if ($haystack == null || empty($haystack)) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | return in_array($needle, $haystack); |
@@ -39,24 +39,24 @@ |
||
| 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 | ?> |
@@ -53,9 +53,9 @@ |
||
| 53 | 53 | $pdfButtons = ''; |
| 54 | 54 | $client = $current_user->getPreference('email_link_type'); |
| 55 | 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;"> '; |
|
| 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 | 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\';"> '; |
|
| 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 | 59 | } |
| 60 | 60 | return $pdfButtons; |
| 61 | 61 | } |
@@ -42,9 +42,9 @@ |
||
| 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 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 4 | 4 | /********************************************************************************* |
| 5 | 5 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 6 | 6 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | -function smarty_modifier_lookup($value='', $from=array()){ |
|
| 44 | +function smarty_modifier_lookup($value = '', $from = array()) { |
|
| 45 | 45 | $value = trim($value); |
| 46 | 46 | if (array_key_exists($value, $from)) { |
| 47 | 47 | return $from[$value]; |
@@ -1,5 +1,7 @@ |
||
| 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. |