@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $currency = new Currency(); |
83 | 83 | $currency->retrieve($value); |
84 | - $currencies[$value] = $currency->symbol . ' ' . $currency->iso4217; |
|
84 | + $currencies[$value] = $currency->symbol.' '.$currency->iso4217; |
|
85 | 85 | } |
86 | 86 | return $currencies[$value]; |
87 | 87 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $list = array(); |
99 | 99 | foreach ($tmpList as $bean) |
100 | 100 | { |
101 | - $list[$bean->id] = $bean->symbol . ' ' . $bean->iso4217; |
|
101 | + $list[$bean->id] = $bean->symbol.' '.$bean->iso4217; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $field_def = $this->reporter->all_fields[$layout_def['column_key']]; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -55,27 +55,27 @@ discard block |
||
55 | 55 | global $app_strings; |
56 | 56 | |
57 | 57 | |
58 | - $href = 'index.php?module=' . 'Documents' |
|
59 | - . '&action=' . 'EditView' |
|
60 | - . '&record=' . $layout_def['fields']['ID'] |
|
61 | - . '&return_module=' . $_REQUEST['module'] |
|
62 | - . '&return_action=' . 'DetailView' |
|
63 | - . '&return_id=' . $_REQUEST['record'] |
|
64 | - . '&load_signed_id=' . $layout_def['fields']['LINKED_ID'] |
|
65 | - . '&parent_id=' . $_REQUEST['record'] |
|
66 | - . '&parent_name=' . $layout_def['fields']['CONTRACT_NAME'] |
|
67 | - . '&parent_type=' . $_REQUEST['module'] |
|
68 | - . '&selected_revision_id=' . $layout_def['fields']['SELECTED_REVISION_ID'] |
|
58 | + $href = 'index.php?module='.'Documents' |
|
59 | + . '&action='.'EditView' |
|
60 | + . '&record='.$layout_def['fields']['ID'] |
|
61 | + . '&return_module='.$_REQUEST['module'] |
|
62 | + . '&return_action='.'DetailView' |
|
63 | + . '&return_id='.$_REQUEST['record'] |
|
64 | + . '&load_signed_id='.$layout_def['fields']['LINKED_ID'] |
|
65 | + . '&parent_id='.$_REQUEST['record'] |
|
66 | + . '&parent_name='.$layout_def['fields']['CONTRACT_NAME'] |
|
67 | + . '&parent_type='.$_REQUEST['module'] |
|
68 | + . '&selected_revision_id='.$layout_def['fields']['SELECTED_REVISION_ID'] |
|
69 | 69 | ; |
70 | 70 | |
71 | - $edit_icon_html = SugarThemeRegistry::current()->getImage( 'loadSignedDocument','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LNK_LOAD_SIGNED']); |
|
71 | + $edit_icon_html = SugarThemeRegistry::current()->getImage('loadSignedDocument', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_LOAD_SIGNED']); |
|
72 | 72 | //if the contract state is executed or document is not a template hide this action. |
73 | - if ((!empty($layout_def['fields']['CONTRACT_STATUS']) && $layout_def['fields']['CONTRACT_STATUS']=='executed') or |
|
74 | - empty($layout_def['fields']['IS_TEMPLATE']) or $layout_def['fields']['IS_TEMPLATE']==0) { |
|
73 | + if ((!empty($layout_def['fields']['CONTRACT_STATUS']) && $layout_def['fields']['CONTRACT_STATUS'] == 'executed') or |
|
74 | + empty($layout_def['fields']['IS_TEMPLATE']) or $layout_def['fields']['IS_TEMPLATE'] == 0) { |
|
75 | 75 | return ""; |
76 | 76 | } |
77 | - return '<a href="' . $href . '"' . "title ='". $app_strings['LNK_LOAD_SIGNED_TOOLTIP']."'" |
|
78 | - . 'class="listViewTdToolsS1">' . $edit_icon_html . ' ' . $app_strings['LNK_LOAD_SIGNED'] .'</a> '; |
|
77 | + return '<a href="'.$href.'"'."title ='".$app_strings['LNK_LOAD_SIGNED_TOOLTIP']."'" |
|
78 | + . 'class="listViewTdToolsS1">'.$edit_icon_html.' '.$app_strings['LNK_LOAD_SIGNED'].'</a> '; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return "(".$this->_get_column_select($layout_def)." LIKE 'on' OR ".$this->_get_column_select($layout_def)."='1')\n"; |
52 | 52 | } else { |
53 | 53 | //return "(".$this->_get_column_select($layout_def)." is null OR ".$this->_get_column_select($layout_def)."='0' OR ".$this->_get_column_select($layout_def)."='off')\n"; |
54 | - return "(".$this->_get_column_select($layout_def)." is null OR ". $this->_get_column_select($layout_def)."='0')\n"; |
|
54 | + return "(".$this->_get_column_select($layout_def)." is null OR ".$this->_get_column_select($layout_def)."='0')\n"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $key = $this->_get_column_alias($layout_def); |
64 | 64 | $key = strtoupper($key); |
65 | 65 | |
66 | - if(empty($layout_def['fields'][$key])) |
|
66 | + if (empty($layout_def['fields'][$key])) |
|
67 | 67 | { |
68 | 68 | $layout_def['name'] = $name; |
69 | 69 | global $app_list_strings; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | $on_or_off = 'CHECKED'; |
80 | - if ( empty($value) || $value == 'off') |
|
80 | + if (empty($value) || $value == 'off') |
|
81 | 81 | { |
82 | 82 | $on_or_off = ''; |
83 | 83 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | //$accesskey = $app_strings['LBL_NEW_BUTTON_KEY']; |
60 | 60 | $value = $app_strings['LBL_NEW_BUTTON_LABEL']; |
61 | 61 | $this->module = 'Contacts'; |
62 | - if( ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)){ |
|
62 | + if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) { |
|
63 | 63 | $button = "<input title='$title'class='button' type='button' name='button' value=' $value ' disabled/>\n"; |
64 | 64 | return $button; |
65 | 65 | } |
66 | 66 | |
67 | 67 | $additionalFormFields = array(); |
68 | - if(isset($defines['focus']->billing_address_street)) |
|
68 | + if (isset($defines['focus']->billing_address_street)) |
|
69 | 69 | $additionalFormFields['primary_address_street'] = $defines['focus']->billing_address_street; |
70 | - if(isset($defines['focus']->billing_address_city)) |
|
70 | + if (isset($defines['focus']->billing_address_city)) |
|
71 | 71 | $additionalFormFields['primary_address_city'] = $defines['focus']->billing_address_city; |
72 | - if(isset($defines['focus']->billing_address_state)) |
|
72 | + if (isset($defines['focus']->billing_address_state)) |
|
73 | 73 | $additionalFormFields['primary_address_state'] = $defines['focus']->billing_address_state; |
74 | - if(isset($defines['focus']->billing_address_country)) |
|
74 | + if (isset($defines['focus']->billing_address_country)) |
|
75 | 75 | $additionalFormFields['primary_address_country'] = $defines['focus']->billing_address_country; |
76 | - if(isset($defines['focus']->billing_address_postalcode)) |
|
76 | + if (isset($defines['focus']->billing_address_postalcode)) |
|
77 | 77 | $additionalFormFields['primary_address_postalcode'] = $defines['focus']->billing_address_postalcode; |
78 | - if(isset($defines['focus']->phone_office)) |
|
78 | + if (isset($defines['focus']->phone_office)) |
|
79 | 79 | $additionalFormFields['phone_work'] = $defines['focus']->phone_office; |
80 | 80 | |
81 | 81 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | $return_id = $_REQUEST['record']; |
68 | 68 | |
69 | 69 | |
70 | - if(isset($GLOBALS['FOCUS'])) { |
|
70 | + if (isset($GLOBALS['FOCUS'])) { |
|
71 | 71 | $focus = $GLOBALS['FOCUS']; |
72 | 72 | } |
73 | 73 | |
74 | 74 | /* Handle case where we generate subpanels from MySettings/LoadTabSubpanels.php */ |
75 | - else if($return_module == 'MySettings') { |
|
75 | + else if ($return_module == 'MySettings') { |
|
76 | 76 | global $beanList, $beanFiles; |
77 | 77 | $return_module = $_REQUEST['loadModule']; |
78 | 78 | |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | //if($focus->assigned_user_id == $record) return ''; |
87 | 87 | |
88 | 88 | if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
89 | - $linked_field= $layout_def['linked_field_set'] ; |
|
89 | + $linked_field = $layout_def['linked_field_set']; |
|
90 | 90 | } else { |
91 | 91 | $linked_field = $layout_def['linked_field']; |
92 | 92 | } |
93 | 93 | $refresh_page = 0; |
94 | - if(!empty($layout_def['refresh_page'])){ |
|
94 | + if (!empty($layout_def['refresh_page'])) { |
|
95 | 95 | $refresh_page = 1; |
96 | 96 | } |
97 | 97 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1"; |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | . "&record=$parent_record_id" |
104 | 104 | . "&linked_field=$linked_field" |
105 | 105 | . "&linked_id=$record" |
106 | - . "&return_url=" . urlencode(urlencode($return_url)) |
|
106 | + . "&return_url=".urlencode(urlencode($return_url)) |
|
107 | 107 | . "&refresh_page=$refresh_page" |
108 | 108 | . $layout_def['end_link_wrapper']; |
109 | 109 | $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
110 | 110 | //based on listview since that lets you select records |
111 | - if($layout_def['ListView']) { |
|
112 | - return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" .", '$record', $refresh_page);\"" |
|
113 | - . ' class="listViewTdToolsS1"' . " onclick=\"return sp_rem_conf();\"" . ">$icon_remove_text</a>"; |
|
114 | - }else{ |
|
111 | + if ($layout_def['ListView']) { |
|
112 | + return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'".", '$record', $refresh_page);\"" |
|
113 | + . ' class="listViewTdToolsS1"'." onclick=\"return sp_rem_conf();\"".">$icon_remove_text</a>"; |
|
114 | + } else { |
|
115 | 115 | return ''; |
116 | 116 | } |
117 | 117 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | function displayInput(&$layout_def) |
47 | 47 | { |
48 | 48 | $selected_users = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']; |
49 | - $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; |
|
49 | + $str = '<select multiple="true" size="3" name="'.$layout_def['name'].'[]">'.get_select_options_with_id(get_user_array(false), $selected_users).'</select>'; |
|
50 | 50 | return $str; |
51 | 51 | } |
52 | 52 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | global $app_list_strings; |
57 | 57 | global $current_user; |
58 | 58 | |
59 | - if(isset($layout_def['varname'])) |
|
59 | + if (isset($layout_def['varname'])) |
|
60 | 60 | { |
61 | 61 | $key = strtoupper($layout_def['varname']); |
62 | 62 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | } |
68 | 68 | //add module image |
69 | 69 | //add module image |
70 | - if(!empty($layout_def['target_module_key'])) { |
|
70 | + if (!empty($layout_def['target_module_key'])) { |
|
71 | 71 | if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) { |
72 | - $module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
72 | + $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | 76 | if (empty($module)) { |
77 | - if(empty($layout_def['target_module'])) |
|
77 | + if (empty($layout_def['target_module'])) |
|
78 | 78 | { |
79 | 79 | $module = $layout_def['module']; |
80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | $action = 'DetailView'; |
87 | - if(empty($layout_def['target_record_key'])) |
|
87 | + if (empty($layout_def['target_record_key'])) |
|
88 | 88 | { |
89 | 89 | $record = $layout_def['fields']['ID']; |
90 | 90 | } |
@@ -94,70 +94,70 @@ discard block |
||
94 | 94 | $record = $layout_def['fields'][$record_key]; |
95 | 95 | } |
96 | 96 | $action_access = false; |
97 | - if(!empty($record) && |
|
97 | + if (!empty($record) && |
|
98 | 98 | ($layout_def[$action] && !$layout_def['owner_module'] |
99 | 99 | || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) |
100 | 100 | || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) { |
101 | 101 | $action_access = true; |
102 | 102 | } |
103 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $module . '', 'border="0"',null,null,'.gif',$app_list_strings['moduleList'][$module]); |
|
103 | + $icon_img_html = SugarThemeRegistry::current()->getImage($module.'', 'border="0"', null, null, '.gif', $app_list_strings['moduleList'][$module]); |
|
104 | 104 | if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) { |
105 | - $ret=""; |
|
105 | + $ret = ""; |
|
106 | 106 | } else { |
107 | 107 | if ($action_access) { |
108 | - $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>"; |
|
108 | + $ret = '<a href="index.php?module='.$module.'&action='.$action.'&record='.$record.'" >'.$icon_img_html."</a>"; |
|
109 | 109 | } else { |
110 | 110 | $ret = $icon_img_html; |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])){ |
|
114 | + if (!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])) { |
|
115 | 115 | |
116 | 116 | if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) { |
117 | - $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
117 | + $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $imagePath = ''; |
121 | - if ( $layout_def['image2'] == '__VARIABLE' ) { |
|
122 | - if ( !empty($layout_def['fields'][$key.'_ICON']) ) { |
|
121 | + if ($layout_def['image2'] == '__VARIABLE') { |
|
122 | + if (!empty($layout_def['fields'][$key.'_ICON'])) { |
|
123 | 123 | $imagePath = $layout_def['fields'][$key.'_ICON']; |
124 | 124 | } |
125 | 125 | } else { |
126 | 126 | $imagePath = $layout_def['image2']; |
127 | 127 | } |
128 | 128 | |
129 | - if ( !empty($imagePath) ) { |
|
130 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $imagePath . '', 'border="0"',null,null,'.gif',$imagePath); |
|
131 | - $ret.= (empty($link_url)) ? '' : ' <a href="' . $link_url. '" TARGET = "_blank">' . "$icon_img_html</a>"; |
|
129 | + if (!empty($imagePath)) { |
|
130 | + $icon_img_html = SugarThemeRegistry::current()->getImage($imagePath.'', 'border="0"', null, null, '.gif', $imagePath); |
|
131 | + $ret .= (empty($link_url)) ? '' : ' <a href="'.$link_url.'" TARGET = "_blank">'."$icon_img_html</a>"; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | //if requested, add attachment icon. |
135 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){ |
|
135 | + if (!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])) { |
|
136 | 136 | |
137 | 137 | if (is_array($layout_def['image2_url_field'])) { |
138 | 138 | //Generate file url. |
139 | 139 | if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) |
140 | - and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ) { |
|
140 | + and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])])) { |
|
141 | 141 | |
142 | - $key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
143 | - $file=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]; |
|
144 | - $filepath="index.php?entryPoint=download&id=".$key."&type=".$layout_def['module']; |
|
142 | + $key = $layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
143 | + $file = $layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]; |
|
144 | + $filepath = "index.php?entryPoint=download&id=".$key."&type=".$layout_def['module']; |
|
145 | 145 | } |
146 | 146 | } else { |
147 | 147 | if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) { |
148 | - $filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
148 | + $filepath = "index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
149 | 149 | } |
150 | 150 | } |
151 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $layout_def['image2'] . '', 'border="0"',null,null,'.gif',$layout_def['image2']); |
|
151 | + $icon_img_html = SugarThemeRegistry::current()->getImage($layout_def['image2'].'', 'border="0"', null, null, '.gif', $layout_def['image2']); |
|
152 | 152 | if ($action_access && !empty($filepath)) { |
153 | - $ret .= '<a href="' . $filepath. '" >' . "$icon_img_html</a>"; |
|
153 | + $ret .= '<a href="'.$filepath.'" >'."$icon_img_html</a>"; |
|
154 | 154 | } elseif (!empty($filepath)) { |
155 | 155 | $ret .= $icon_img_html; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | // now handle attachments for Emails |
159 | - else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | - $ret.= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
159 | + else if (!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | + $ret .= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
161 | 161 | } |
162 | 162 | return $ret; |
163 | 163 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | { |
48 | 48 | function displayList(&$layout_def) |
49 | 49 | { |
50 | - $value=''; |
|
50 | + $value = ''; |
|
51 | 51 | if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) { |
52 | 52 | |
53 | 53 | foreach ($layout_def['source'] as $field) { |
54 | 54 | |
55 | 55 | if (isset($layout_def['fields'][strtoupper($field)])) { |
56 | - $value.=$layout_def['fields'][strtoupper($field)]; |
|
56 | + $value .= $layout_def['fields'][strtoupper($field)]; |
|
57 | 57 | } else { |
58 | - $value.=$field; |
|
58 | + $value .= $field; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
2 | +if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
3 | 3 | /********************************************************************************* |
4 | 4 | * SugarCRM Community Edition is a customer relationship management program developed by |
5 | 5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | "ReturnDatesAsStrings" => true, |
176 | 176 | "MultipleActiveResultSets" => true, |
177 | 177 | ); |
178 | - if(!empty($configOptions['db_name'])) { |
|
178 | + if (!empty($configOptions['db_name'])) { |
|
179 | 179 | $options["Database"] = $configOptions['db_name']; |
180 | 180 | } |
181 | 181 | $this->database = sqlsrv_connect($connect_param, $options); |
182 | - if(empty($this->database)) { |
|
182 | + if (empty($this->database)) { |
|
183 | 183 | $GLOBALS['log']->fatal("Could not connect to server ".$configOptions['db_host_name']." as ".$configOptions['db_user_name']."."); |
184 | - if($dieOnError) { |
|
185 | - if(isset($GLOBALS['app_strings']['ERR_NO_DB'])) { |
|
184 | + if ($dieOnError) { |
|
185 | + if (isset($GLOBALS['app_strings']['ERR_NO_DB'])) { |
|
186 | 186 | sugar_die($GLOBALS['app_strings']['ERR_NO_DB']); |
187 | 187 | } else { |
188 | 188 | sugar_die("Could not connect to the database. Please refer to suitecrm.log for details."); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - if($this->checkError('Could Not Connect:', $dieOnError)) |
|
195 | + if ($this->checkError('Could Not Connect:', $dieOnError)) |
|
196 | 196 | $GLOBALS['log']->info("connected to db"); |
197 | 197 | |
198 | 198 | sqlsrv_query($this->database, 'SET DATEFORMAT mdy'); |
@@ -208,26 +208,26 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $keepResult = false) |
210 | 210 | { |
211 | - if(is_array($sql)) { |
|
211 | + if (is_array($sql)) { |
|
212 | 212 | return $this->queryArray($sql, $dieOnError, $msg, $suppress); |
213 | 213 | } |
214 | 214 | $sql = $this->_appendN($sql); |
215 | 215 | |
216 | 216 | $this->countQuery($sql); |
217 | - $GLOBALS['log']->info('Query:' . $sql); |
|
217 | + $GLOBALS['log']->info('Query:'.$sql); |
|
218 | 218 | $this->checkConnection(); |
219 | 219 | $this->query_time = microtime(true); |
220 | 220 | |
221 | - $result = $suppress?@sqlsrv_query($this->database, $sql):sqlsrv_query($this->database, $sql); |
|
221 | + $result = $suppress ? @sqlsrv_query($this->database, $sql) : sqlsrv_query($this->database, $sql); |
|
222 | 222 | |
223 | 223 | $this->query_time = microtime(true) - $this->query_time; |
224 | 224 | $GLOBALS['log']->info('Query Execution Time:'.$this->query_time); |
225 | 225 | |
226 | 226 | |
227 | - $this->checkError($msg.' Query Failed:' . $sql . '::', $dieOnError); |
|
227 | + $this->checkError($msg.' Query Failed:'.$sql.'::', $dieOnError); |
|
228 | 228 | |
229 | 229 | //suppress non error messages |
230 | - sqlsrv_configure('WarningsReturnAsErrors',false); |
|
230 | + sqlsrv_configure('WarningsReturnAsErrors', false); |
|
231 | 231 | |
232 | 232 | return $result; |
233 | 233 | } |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | { |
240 | 240 | $field_array = array(); |
241 | 241 | |
242 | - if ( !$result ) { |
|
242 | + if (!$result) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | |
246 | - foreach ( sqlsrv_field_metadata($result) as $fieldMetadata ) { |
|
246 | + foreach (sqlsrv_field_metadata($result) as $fieldMetadata) { |
|
247 | 247 | $key = $fieldMetadata['Name']; |
248 | - if($make_lower_case==true) |
|
248 | + if ($make_lower_case == true) |
|
249 | 249 | $key = strtolower($key); |
250 | 250 | |
251 | 251 | $field_array[] = $key; |
@@ -261,12 +261,12 @@ discard block |
||
261 | 261 | { |
262 | 262 | if (empty($result)) return false; |
263 | 263 | |
264 | - $row = sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC); |
|
264 | + $row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC); |
|
265 | 265 | if (empty($row)) { |
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | |
269 | - foreach($row as $key => $column) { |
|
269 | + foreach ($row as $key => $column) { |
|
270 | 270 | // MSSQL returns a space " " when a varchar column is empty ("") and not null. |
271 | 271 | // We need to strip empty spaces |
272 | 272 | // notice we only strip if one space is returned. we do not want to strip |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function convert($string, $type, array $additional_parameters = array()) |
286 | 286 | { |
287 | - if ( $type == 'datetime') |
|
287 | + if ($type == 'datetime') |
|
288 | 288 | // see http://msdn.microsoft.com/en-us/library/ms187928.aspx for details |
289 | 289 | return "CONVERT(datetime,$string,120)"; |
290 | 290 | else |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | * @param array $fielddef2 |
301 | 301 | * @return bool true if they match, false if they don't |
302 | 302 | */ |
303 | - public function compareVarDefs($fielddef1,$fielddef2, $ignoreName = false) |
|
303 | + public function compareVarDefs($fielddef1, $fielddef2, $ignoreName = false) |
|
304 | 304 | { |
305 | - if((isset($fielddef2['dbType']) && $fielddef2['dbType'] == 'id') || preg_match('/(_id$|^id$)/', $fielddef2['name'])){ |
|
306 | - if(isset($fielddef1['type']) && isset($fielddef2['type'])){ |
|
305 | + if ((isset($fielddef2['dbType']) && $fielddef2['dbType'] == 'id') || preg_match('/(_id$|^id$)/', $fielddef2['name'])) { |
|
306 | + if (isset($fielddef1['type']) && isset($fielddef2['type'])) { |
|
307 | 307 | $fielddef2['type'] = $fielddef1['type']; |
308 | 308 | } |
309 | 309 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | public function disconnect() |
319 | 319 | { |
320 | 320 | $GLOBALS['log']->debug('Calling Mssql::disconnect()'); |
321 | - if(!empty($this->database)){ |
|
321 | + if (!empty($this->database)) { |
|
322 | 322 | $this->freeResult(); |
323 | 323 | sqlsrv_close($this->database); |
324 | 324 | $this->database = null; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | */ |
331 | 331 | protected function freeDbResult($dbResult) |
332 | 332 | { |
333 | - if(!empty($dbResult)) |
|
333 | + if (!empty($dbResult)) |
|
334 | 334 | sqlsrv_free_stmt($dbResult); |
335 | 335 | } |
336 | 336 | |
@@ -342,19 +342,19 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function getConstraintSql($indices, $table) |
344 | 344 | { |
345 | - if ( $this->doesTableHaveAClusteredIndexDefined($table) ) { |
|
345 | + if ($this->doesTableHaveAClusteredIndexDefined($table)) { |
|
346 | 346 | return parent::getConstraintSql($indices, $table); |
347 | 347 | } |
348 | 348 | |
349 | 349 | // check to see if one of the passed in indices is a primary one; if so we can bail as well |
350 | - foreach ( $indices as $index ) { |
|
351 | - if ( $index['type'] == 'primary' ) { |
|
350 | + foreach ($indices as $index) { |
|
351 | + if ($index['type'] == 'primary') { |
|
352 | 352 | return parent::getConstraintSql($indices, $table); |
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | 356 | // Change the first index listed to be a clustered one instead ( so we have at least one for the table ) |
357 | - if ( isset($indices[0]) ) { |
|
357 | + if (isset($indices[0])) { |
|
358 | 358 | $indices[0]['type'] = 'clustered'; |
359 | 359 | } |
360 | 360 | |
@@ -370,41 +370,41 @@ discard block |
||
370 | 370 | $result = $this->query("sp_columns_90 $tablename"); |
371 | 371 | |
372 | 372 | $columns = array(); |
373 | - while (($row=$this->fetchByAssoc($result)) !=null) { |
|
373 | + while (($row = $this->fetchByAssoc($result)) != null) { |
|
374 | 374 | $column_name = strtolower($row['COLUMN_NAME']); |
375 | - $columns[$column_name]['name']=$column_name; |
|
376 | - $columns[$column_name]['type']=strtolower($row['TYPE_NAME']); |
|
377 | - if ( $row['TYPE_NAME'] == 'decimal' ) { |
|
378 | - $columns[$column_name]['len']=strtolower($row['PRECISION']); |
|
379 | - $columns[$column_name]['len'].=','.strtolower($row['SCALE']); |
|
375 | + $columns[$column_name]['name'] = $column_name; |
|
376 | + $columns[$column_name]['type'] = strtolower($row['TYPE_NAME']); |
|
377 | + if ($row['TYPE_NAME'] == 'decimal') { |
|
378 | + $columns[$column_name]['len'] = strtolower($row['PRECISION']); |
|
379 | + $columns[$column_name]['len'] .= ','.strtolower($row['SCALE']); |
|
380 | 380 | } |
381 | - elseif ( in_array($row['TYPE_NAME'],array('nchar','nvarchar')) ) { |
|
382 | - $columns[$column_name]['len']=strtolower($row['PRECISION']); |
|
383 | - if ( $row['TYPE_NAME'] == 'nvarchar' && $row['PRECISION'] == '0' ) { |
|
384 | - $columns[$column_name]['len']='max'; |
|
381 | + elseif (in_array($row['TYPE_NAME'], array('nchar', 'nvarchar'))) { |
|
382 | + $columns[$column_name]['len'] = strtolower($row['PRECISION']); |
|
383 | + if ($row['TYPE_NAME'] == 'nvarchar' && $row['PRECISION'] == '0') { |
|
384 | + $columns[$column_name]['len'] = 'max'; |
|
385 | 385 | } |
386 | 386 | } |
387 | - elseif ( !in_array($row['TYPE_NAME'],array('datetime','text')) ) { |
|
388 | - $columns[$column_name]['len']=strtolower($row['LENGTH']); |
|
387 | + elseif (!in_array($row['TYPE_NAME'], array('datetime', 'text'))) { |
|
388 | + $columns[$column_name]['len'] = strtolower($row['LENGTH']); |
|
389 | 389 | } |
390 | - if ( stristr($row['TYPE_NAME'],'identity') ) { |
|
390 | + if (stristr($row['TYPE_NAME'], 'identity')) { |
|
391 | 391 | $columns[$column_name]['auto_increment'] = '1'; |
392 | - $columns[$column_name]['type']=str_replace(' identity','',strtolower($row['TYPE_NAME'])); |
|
392 | + $columns[$column_name]['type'] = str_replace(' identity', '', strtolower($row['TYPE_NAME'])); |
|
393 | 393 | } |
394 | 394 | |
395 | - if (!empty($row['IS_NULLABLE']) && $row['IS_NULLABLE'] == 'NO' && (empty($row['KEY']) || !stristr($row['KEY'],'PRI'))) |
|
395 | + if (!empty($row['IS_NULLABLE']) && $row['IS_NULLABLE'] == 'NO' && (empty($row['KEY']) || !stristr($row['KEY'], 'PRI'))) |
|
396 | 396 | $columns[strtolower($row['COLUMN_NAME'])]['required'] = 'true'; |
397 | 397 | |
398 | 398 | $column_def = 1; |
399 | - if ( strtolower($tablename) == 'relationships' ) { |
|
399 | + if (strtolower($tablename) == 'relationships') { |
|
400 | 400 | $column_def = $this->getOne("select cdefault from syscolumns where id = object_id('relationships') and name = '$column_name'"); |
401 | 401 | } |
402 | - if ( $column_def != 0 && ($row['COLUMN_DEF'] != null)) { // NOTE Not using !empty as an empty string may be a viable default value. |
|
402 | + if ($column_def != 0 && ($row['COLUMN_DEF'] != null)) { // NOTE Not using !empty as an empty string may be a viable default value. |
|
403 | 403 | $matches = array(); |
404 | - $row['COLUMN_DEF'] = html_entity_decode($row['COLUMN_DEF'],ENT_QUOTES); |
|
405 | - if ( preg_match('/\([\(|\'](.*)[\)|\']\)/i',$row['COLUMN_DEF'],$matches) ) |
|
404 | + $row['COLUMN_DEF'] = html_entity_decode($row['COLUMN_DEF'], ENT_QUOTES); |
|
405 | + if (preg_match('/\([\(|\'](.*)[\)|\']\)/i', $row['COLUMN_DEF'], $matches)) |
|
406 | 406 | $columns[$column_name]['default'] = $matches[1]; |
407 | - elseif ( preg_match('/\(N\'(.*)\'\)/i',$row['COLUMN_DEF'],$matches) ) |
|
407 | + elseif (preg_match('/\(N\'(.*)\'\)/i', $row['COLUMN_DEF'], $matches)) |
|
408 | 408 | $columns[$column_name]['default'] = $matches[1]; |
409 | 409 | else |
410 | 410 | $columns[$column_name]['default'] = $row['COLUMN_DEF']; |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | EOSQL; |
431 | 431 | |
432 | 432 | $result = $this->getOne($query); |
433 | - if ( !$result ) { |
|
433 | + if (!$result) { |
|
434 | 434 | return false; |
435 | 435 | } |
436 | 436 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | EOSQL; |
454 | 454 | |
455 | 455 | $result = $this->getOne($query); |
456 | - if ( !$result ) { |
|
456 | + if (!$result) { |
|
457 | 457 | return false; |
458 | 458 | } |
459 | 459 | |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | * @see DBManager::changeColumnSQL() |
467 | 467 | * @see MssqlHelper::changeColumnSQL() |
468 | 468 | */ |
469 | - protected function changeColumnSQL($tablename,$fieldDefs, $action, $ignoreRequired = false) |
|
469 | + protected function changeColumnSQL($tablename, $fieldDefs, $action, $ignoreRequired = false) |
|
470 | 470 | { |
471 | 471 | $sql = ''; |
472 | - if ( $action == 'drop' && $this->doesTableHaveAFulltextIndexDefined($tablename) ) { |
|
472 | + if ($action == 'drop' && $this->doesTableHaveAFulltextIndexDefined($tablename)) { |
|
473 | 473 | $sql .= "DROP FULLTEXT INDEX ON {$tablename}"; |
474 | 474 | } |
475 | 475 | |
@@ -495,33 +495,33 @@ discard block |
||
495 | 495 | public function lastDbError() |
496 | 496 | { |
497 | 497 | $errors = sqlsrv_errors(SQLSRV_ERR_ERRORS); |
498 | - if(empty($errors)) return false; |
|
498 | + if (empty($errors)) return false; |
|
499 | 499 | global $app_strings; |
500 | 500 | if (empty($app_strings) |
501 | 501 | or !isset($app_strings['ERR_MSSQL_DB_CONTEXT']) |
502 | - or !isset($app_strings['ERR_MSSQL_WARNING']) ) { |
|
502 | + or !isset($app_strings['ERR_MSSQL_WARNING'])) { |
|
503 | 503 | //ignore the message from sql-server if $app_strings array is empty. This will happen |
504 | 504 | //only if connection if made before languge is set. |
505 | 505 | return false; |
506 | 506 | } |
507 | 507 | $messages = array(); |
508 | - foreach($errors as $error) { |
|
508 | + foreach ($errors as $error) { |
|
509 | 509 | $sqlmsg = $error['message']; |
510 | 510 | $sqlpos = strpos($sqlmsg, 'Changed database context to'); |
511 | 511 | $sqlpos2 = strpos($sqlmsg, 'Warning:'); |
512 | 512 | $sqlpos3 = strpos($sqlmsg, 'Checking identity information:'); |
513 | - if ( $sqlpos !== false || $sqlpos2 !== false || $sqlpos3 !== false ) { |
|
513 | + if ($sqlpos !== false || $sqlpos2 !== false || $sqlpos3 !== false) { |
|
514 | 514 | continue; |
515 | 515 | } |
516 | 516 | $sqlpos = strpos($sqlmsg, $app_strings['ERR_MSSQL_DB_CONTEXT']); |
517 | 517 | $sqlpos2 = strpos($sqlmsg, $app_strings['ERR_MSSQL_WARNING']); |
518 | - if ( $sqlpos !== false || $sqlpos2 !== false) { |
|
518 | + if ($sqlpos !== false || $sqlpos2 !== false) { |
|
519 | 519 | continue; |
520 | 520 | } |
521 | 521 | $messages[] = $sqlmsg; |
522 | 522 | } |
523 | 523 | |
524 | - if(!empty($messages)) { |
|
524 | + if (!empty($messages)) { |
|
525 | 525 | return join("\n", $messages); |
526 | 526 | } |
527 | 527 | return false; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | protected function verifyGenericQueryRollback($type, $table, $query) |
549 | 549 | { |
550 | 550 | $this->log->debug("verifying $type statement"); |
551 | - if(!sqlsrv_begin_transaction($this->database)) { |
|
551 | + if (!sqlsrv_begin_transaction($this->database)) { |
|
552 | 552 | return "Failed to create transaction"; |
553 | 553 | } |
554 | 554 | $this->query($query, false); |