@@ -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. |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | function displayListPlain($layout_def) { |
| 51 | - $value= $this->_get_list_value($layout_def); |
|
| 52 | - if (isset($layout_def['widget_type']) && $layout_def['widget_type'] =='checkbox') { |
|
| 53 | - if ($value != '' && ($value == 'on' || intval($value) == 1 || $value == 'yes')) |
|
| 51 | + $value = $this->_get_list_value($layout_def); |
|
| 52 | + if (isset($layout_def['widget_type']) && $layout_def['widget_type'] == 'checkbox') { |
|
| 53 | + if ($value != '' && ($value == 'on' || intval($value) == 1 || $value == 'yes')) |
|
| 54 | 54 | { |
| 55 | 55 | return "<input name='checkbox_display' class='checkbox' type='checkbox' disabled='true' checked>"; |
| 56 | 56 | } |
@@ -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. |
@@ -45,121 +45,121 @@ |
||
| 45 | 45 | |
| 46 | 46 | class SugarWidgetSubPanelTopCreateNoteButton extends SugarWidgetSubPanelTopButtonQuickCreate |
| 47 | 47 | { |
| 48 | - function &_get_form($defines, $additionalFormFields = null, $asUrl = false) |
|
| 49 | - { |
|
| 50 | - global $app_strings; |
|
| 51 | - global $currentModule; |
|
| 52 | - |
|
| 53 | - $this->module="Notes"; |
|
| 54 | - $this->subpanelDiv = "history"; |
|
| 55 | - |
|
| 56 | - // Create the additional form fields with real values if they were not passed in |
|
| 57 | - if(empty($additionalFormFields) && $this->additional_form_fields) |
|
| 58 | - { |
|
| 59 | - foreach($this->additional_form_fields as $key=>$value) |
|
| 60 | - { |
|
| 61 | - if(!empty($defines['focus']->$value)) |
|
| 62 | - { |
|
| 63 | - $additionalFormFields[$key] = $defines['focus']->$value; |
|
| 64 | - } |
|
| 65 | - else |
|
| 66 | - { |
|
| 67 | - $additionalFormFields[$key] = ''; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - if(!empty($this->module)) |
|
| 73 | - { |
|
| 74 | - $defines['child_module_name'] = $this->module; |
|
| 75 | - } |
|
| 76 | - else |
|
| 77 | - { |
|
| 78 | - $defines['child_module_name'] = $defines['module']; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - if(!empty($this->subpanelDiv)) |
|
| 82 | - { |
|
| 83 | - $defines['subpanelDiv'] = $this->subpanelDiv; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
| 87 | - |
|
| 88 | - $form = 'form' . $defines['child_module_name']; |
|
| 89 | - $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
| 90 | - |
|
| 91 | - //module_button is used to override the value of module name |
|
| 92 | - $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
|
| 93 | - $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
|
| 94 | - |
|
| 95 | - if(isset($defines['focus']->name)) |
|
| 96 | - { |
|
| 97 | - $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
|
| 48 | + function &_get_form($defines, $additionalFormFields = null, $asUrl = false) |
|
| 49 | + { |
|
| 50 | + global $app_strings; |
|
| 51 | + global $currentModule; |
|
| 52 | + |
|
| 53 | + $this->module="Notes"; |
|
| 54 | + $this->subpanelDiv = "history"; |
|
| 55 | + |
|
| 56 | + // Create the additional form fields with real values if they were not passed in |
|
| 57 | + if(empty($additionalFormFields) && $this->additional_form_fields) |
|
| 58 | + { |
|
| 59 | + foreach($this->additional_form_fields as $key=>$value) |
|
| 60 | + { |
|
| 61 | + if(!empty($defines['focus']->$value)) |
|
| 62 | + { |
|
| 63 | + $additionalFormFields[$key] = $defines['focus']->$value; |
|
| 64 | + } |
|
| 65 | + else |
|
| 66 | + { |
|
| 67 | + $additionalFormFields[$key] = ''; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + if(!empty($this->module)) |
|
| 73 | + { |
|
| 74 | + $defines['child_module_name'] = $this->module; |
|
| 75 | + } |
|
| 76 | + else |
|
| 77 | + { |
|
| 78 | + $defines['child_module_name'] = $defines['module']; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + if(!empty($this->subpanelDiv)) |
|
| 82 | + { |
|
| 83 | + $defines['subpanelDiv'] = $this->subpanelDiv; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
| 87 | + |
|
| 88 | + $form = 'form' . $defines['child_module_name']; |
|
| 89 | + $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
| 90 | + |
|
| 91 | + //module_button is used to override the value of module name |
|
| 92 | + $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
|
| 93 | + $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
|
| 94 | + |
|
| 95 | + if(isset($defines['focus']->name)) |
|
| 96 | + { |
|
| 97 | + $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
|
| 101 | 101 | $button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />'; |
| 102 | - $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
| 103 | - $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
| 104 | - $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
| 105 | - $button .= '<input type="hidden" name="record" value="" />'; |
|
| 106 | - |
|
| 107 | - // TODO: move this out and get $additionalFormFields working properly |
|
| 108 | - if(empty($additionalFormFields['parent_type'])) |
|
| 109 | - { |
|
| 110 | - if($defines['focus']->object_name=='Contact') { |
|
| 111 | - $additionalFormFields['parent_type'] = 'Accounts'; |
|
| 112 | - } |
|
| 113 | - else { |
|
| 114 | - $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - if(empty($additionalFormFields['parent_name'])) |
|
| 118 | - { |
|
| 119 | - if($defines['focus']->object_name=='Contact') { |
|
| 120 | - $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
|
| 121 | - $additionalFormFields['account_name'] = $defines['focus']->account_name; |
|
| 122 | - } |
|
| 123 | - else { |
|
| 124 | - $additionalFormFields['parent_name'] = $defines['focus']->name; |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - if(empty($additionalFormFields['parent_id'])) |
|
| 128 | - { |
|
| 129 | - if($defines['focus']->object_name=='Contact') { |
|
| 130 | - $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
|
| 131 | - $additionalFormFields['account_id'] = $defines['focus']->account_id; |
|
| 132 | - } |
|
| 133 | - else { |
|
| 134 | - $additionalFormFields['parent_id'] = $defines['focus']->id; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
| 139 | - $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
| 140 | - $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
| 141 | - |
|
| 142 | - // fill in additional form fields for all but action |
|
| 143 | - foreach($additionalFormFields as $key => $value) |
|
| 144 | - { |
|
| 145 | - if($key != 'action') |
|
| 146 | - { |
|
| 147 | - $button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; |
|
| 148 | - } |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - return $button; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - |
|
| 155 | - function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
| 156 | - { |
|
| 157 | - $focus = new Note; |
|
| 158 | - if ( !$focus->ACLAccess('EditView') ) { |
|
| 159 | - return ''; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - return parent::display($defines, $additionalFormFields); |
|
| 163 | - } |
|
| 102 | + $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
| 103 | + $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
| 104 | + $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
| 105 | + $button .= '<input type="hidden" name="record" value="" />'; |
|
| 106 | + |
|
| 107 | + // TODO: move this out and get $additionalFormFields working properly |
|
| 108 | + if(empty($additionalFormFields['parent_type'])) |
|
| 109 | + { |
|
| 110 | + if($defines['focus']->object_name=='Contact') { |
|
| 111 | + $additionalFormFields['parent_type'] = 'Accounts'; |
|
| 112 | + } |
|
| 113 | + else { |
|
| 114 | + $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + if(empty($additionalFormFields['parent_name'])) |
|
| 118 | + { |
|
| 119 | + if($defines['focus']->object_name=='Contact') { |
|
| 120 | + $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
|
| 121 | + $additionalFormFields['account_name'] = $defines['focus']->account_name; |
|
| 122 | + } |
|
| 123 | + else { |
|
| 124 | + $additionalFormFields['parent_name'] = $defines['focus']->name; |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + if(empty($additionalFormFields['parent_id'])) |
|
| 128 | + { |
|
| 129 | + if($defines['focus']->object_name=='Contact') { |
|
| 130 | + $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
|
| 131 | + $additionalFormFields['account_id'] = $defines['focus']->account_id; |
|
| 132 | + } |
|
| 133 | + else { |
|
| 134 | + $additionalFormFields['parent_id'] = $defines['focus']->id; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
| 139 | + $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
| 140 | + $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
| 141 | + |
|
| 142 | + // fill in additional form fields for all but action |
|
| 143 | + foreach($additionalFormFields as $key => $value) |
|
| 144 | + { |
|
| 145 | + if($key != 'action') |
|
| 146 | + { |
|
| 147 | + $button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; |
|
| 148 | + } |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + return $button; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + |
|
| 155 | + function display($defines, $additionalFormFields = null, $nonbutton = false) |
|
| 156 | + { |
|
| 157 | + $focus = new Note; |
|
| 158 | + if ( !$focus->ACLAccess('EditView') ) { |
|
| 159 | + return ''; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + return parent::display($defines, $additionalFormFields); |
|
| 163 | + } |
|
| 164 | 164 | } |
| 165 | 165 | ?> |
@@ -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. |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | global $app_strings; |
| 51 | 51 | global $currentModule; |
| 52 | 52 | |
| 53 | - $this->module="Notes"; |
|
| 53 | + $this->module = "Notes"; |
|
| 54 | 54 | $this->subpanelDiv = "history"; |
| 55 | 55 | |
| 56 | 56 | // Create the additional form fields with real values if they were not passed in |
| 57 | - if(empty($additionalFormFields) && $this->additional_form_fields) |
|
| 57 | + if (empty($additionalFormFields) && $this->additional_form_fields) |
|
| 58 | 58 | { |
| 59 | - foreach($this->additional_form_fields as $key=>$value) |
|
| 59 | + foreach ($this->additional_form_fields as $key=>$value) |
|
| 60 | 60 | { |
| 61 | - if(!empty($defines['focus']->$value)) |
|
| 61 | + if (!empty($defines['focus']->$value)) |
|
| 62 | 62 | { |
| 63 | 63 | $additionalFormFields[$key] = $defines['focus']->$value; |
| 64 | 64 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if(!empty($this->module)) |
|
| 72 | + if (!empty($this->module)) |
|
| 73 | 73 | { |
| 74 | 74 | $defines['child_module_name'] = $this->module; |
| 75 | 75 | } |
@@ -78,45 +78,45 @@ discard block |
||
| 78 | 78 | $defines['child_module_name'] = $defines['module']; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if(!empty($this->subpanelDiv)) |
|
| 81 | + if (!empty($this->subpanelDiv)) |
|
| 82 | 82 | { |
| 83 | 83 | $defines['subpanelDiv'] = $this->subpanelDiv; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $defines['parent_bean_name'] = get_class( $defines['focus']); |
|
| 86 | + $defines['parent_bean_name'] = get_class($defines['focus']); |
|
| 87 | 87 | |
| 88 | - $form = 'form' . $defines['child_module_name']; |
|
| 89 | - $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_' . strtolower($defines['subpanelDiv']) . '\', \'' . addslashes($app_strings['LBL_LOADING']) . '\');" action="index.php" method="post" name="form" id="form' . $form . "\">\n"; |
|
| 88 | + $form = 'form'.$defines['child_module_name']; |
|
| 89 | + $button = '<form onsubmit="return SUGAR.subpanelUtils.sendAndRetrieve(this.id, \'subpanel_'.strtolower($defines['subpanelDiv']).'\', \''.addslashes($app_strings['LBL_LOADING']).'\');" action="index.php" method="post" name="form" id="form'.$form."\">\n"; |
|
| 90 | 90 | |
| 91 | 91 | //module_button is used to override the value of module name |
| 92 | 92 | $button .= "<input type='hidden' name='target_module' value='".$defines['child_module_name']."'>\n"; |
| 93 | 93 | $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_id' value='".$defines['focus']->id."'>\n"; |
| 94 | 94 | |
| 95 | - if(isset($defines['focus']->name)) |
|
| 95 | + if (isset($defines['focus']->name)) |
|
| 96 | 96 | { |
| 97 | 97 | $button .= "<input type='hidden' name='".strtolower($defines['parent_bean_name'])."_name' value='".$defines['focus']->name."'>"; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $button .= '<input type="hidden" name="to_pdf" value="true" />'; |
| 101 | 101 | $button .= '<input type="hidden" name="tpl" value="QuickCreate.tpl" />'; |
| 102 | - $button .= '<input type="hidden" name="return_module" value="' . $currentModule . "\" />\n"; |
|
| 103 | - $button .= '<input type="hidden" name="return_action" value="' . $defines['action'] . "\" />\n"; |
|
| 104 | - $button .= '<input type="hidden" name="return_id" value="' . $defines['focus']->id . "\" />\n"; |
|
| 102 | + $button .= '<input type="hidden" name="return_module" value="'.$currentModule."\" />\n"; |
|
| 103 | + $button .= '<input type="hidden" name="return_action" value="'.$defines['action']."\" />\n"; |
|
| 104 | + $button .= '<input type="hidden" name="return_id" value="'.$defines['focus']->id."\" />\n"; |
|
| 105 | 105 | $button .= '<input type="hidden" name="record" value="" />'; |
| 106 | 106 | |
| 107 | 107 | // TODO: move this out and get $additionalFormFields working properly |
| 108 | - if(empty($additionalFormFields['parent_type'])) |
|
| 108 | + if (empty($additionalFormFields['parent_type'])) |
|
| 109 | 109 | { |
| 110 | - if($defines['focus']->object_name=='Contact') { |
|
| 110 | + if ($defines['focus']->object_name == 'Contact') { |
|
| 111 | 111 | $additionalFormFields['parent_type'] = 'Accounts'; |
| 112 | 112 | } |
| 113 | 113 | else { |
| 114 | 114 | $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | - if(empty($additionalFormFields['parent_name'])) |
|
| 117 | + if (empty($additionalFormFields['parent_name'])) |
|
| 118 | 118 | { |
| 119 | - if($defines['focus']->object_name=='Contact') { |
|
| 119 | + if ($defines['focus']->object_name == 'Contact') { |
|
| 120 | 120 | $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
| 121 | 121 | $additionalFormFields['account_name'] = $defines['focus']->account_name; |
| 122 | 122 | } |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | $additionalFormFields['parent_name'] = $defines['focus']->name; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | - if(empty($additionalFormFields['parent_id'])) |
|
| 127 | + if (empty($additionalFormFields['parent_id'])) |
|
| 128 | 128 | { |
| 129 | - if($defines['focus']->object_name=='Contact') { |
|
| 129 | + if ($defines['focus']->object_name == 'Contact') { |
|
| 130 | 130 | $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
| 131 | 131 | $additionalFormFields['account_id'] = $defines['focus']->account_id; |
| 132 | 132 | } |
@@ -135,16 +135,16 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $button .= '<input type="hidden" name="action" value="SubpanelCreates" />' . "\n"; |
|
| 139 | - $button .= '<input type="hidden" name="module" value="Home" />' . "\n"; |
|
| 140 | - $button .= '<input type="hidden" name="target_action" value="QuickCreate" />' . "\n"; |
|
| 138 | + $button .= '<input type="hidden" name="action" value="SubpanelCreates" />'."\n"; |
|
| 139 | + $button .= '<input type="hidden" name="module" value="Home" />'."\n"; |
|
| 140 | + $button .= '<input type="hidden" name="target_action" value="QuickCreate" />'."\n"; |
|
| 141 | 141 | |
| 142 | 142 | // fill in additional form fields for all but action |
| 143 | - foreach($additionalFormFields as $key => $value) |
|
| 143 | + foreach ($additionalFormFields as $key => $value) |
|
| 144 | 144 | { |
| 145 | - if($key != 'action') |
|
| 145 | + if ($key != 'action') |
|
| 146 | 146 | { |
| 147 | - $button .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />' . "\n"; |
|
| 147 | + $button .= '<input type="hidden" name="'.$key.'" value="'.$value.'" />'."\n"; |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | function display($defines, $additionalFormFields = null, $nonbutton = false) |
| 156 | 156 | { |
| 157 | 157 | $focus = new Note; |
| 158 | - if ( !$focus->ACLAccess('EditView') ) { |
|
| 158 | + if (!$focus->ACLAccess('EditView')) { |
|
| 159 | 159 | return ''; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -61,8 +63,7 @@ discard block |
||
| 61 | 63 | if(!empty($defines['focus']->$value)) |
| 62 | 64 | { |
| 63 | 65 | $additionalFormFields[$key] = $defines['focus']->$value; |
| 64 | - } |
|
| 65 | - else |
|
| 66 | + } else |
|
| 66 | 67 | { |
| 67 | 68 | $additionalFormFields[$key] = ''; |
| 68 | 69 | } |
@@ -72,8 +73,7 @@ discard block |
||
| 72 | 73 | if(!empty($this->module)) |
| 73 | 74 | { |
| 74 | 75 | $defines['child_module_name'] = $this->module; |
| 75 | - } |
|
| 76 | - else |
|
| 76 | + } else |
|
| 77 | 77 | { |
| 78 | 78 | $defines['child_module_name'] = $defines['module']; |
| 79 | 79 | } |
@@ -109,8 +109,7 @@ discard block |
||
| 109 | 109 | { |
| 110 | 110 | if($defines['focus']->object_name=='Contact') { |
| 111 | 111 | $additionalFormFields['parent_type'] = 'Accounts'; |
| 112 | - } |
|
| 113 | - else { |
|
| 112 | + } else { |
|
| 114 | 113 | $additionalFormFields['parent_type'] = $defines['focus']->module_dir; |
| 115 | 114 | } |
| 116 | 115 | } |
@@ -119,8 +118,7 @@ discard block |
||
| 119 | 118 | if($defines['focus']->object_name=='Contact') { |
| 120 | 119 | $additionalFormFields['parent_name'] = $defines['focus']->account_name; |
| 121 | 120 | $additionalFormFields['account_name'] = $defines['focus']->account_name; |
| 122 | - } |
|
| 123 | - else { |
|
| 121 | + } else { |
|
| 124 | 122 | $additionalFormFields['parent_name'] = $defines['focus']->name; |
| 125 | 123 | } |
| 126 | 124 | } |
@@ -129,8 +127,7 @@ discard block |
||
| 129 | 127 | if($defines['focus']->object_name=='Contact') { |
| 130 | 128 | $additionalFormFields['parent_id'] = $defines['focus']->account_id; |
| 131 | 129 | $additionalFormFields['account_id'] = $defines['focus']->account_id; |
| 132 | - } |
|
| 133 | - else { |
|
| 130 | + } else { |
|
| 134 | 131 | $additionalFormFields['parent_id'] = $defines['focus']->id; |
| 135 | 132 | } |
| 136 | 133 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | function queryFilterEquals($layout_def) |
| 51 | 51 | { |
| 52 | 52 | return $this->reporter->db->convert($this->_get_column_select($layout_def), "text2char"). |
| 53 | - " = ".$this->reporter->db->quoted($layout_def['input_name0']); |
|
| 53 | + " = ".$this->reporter->db->quoted($layout_def['input_name0']); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | function queryFilterNot_Equals_Str($layout_def) |
@@ -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 | function queryFilterNot_Equals_Str($layout_def) |
| 57 | 57 | { |
| 58 | 58 | $column = $this->_get_column_select($layout_def); |
| 59 | - return "($column IS NULL OR ". $this->reporter->db->convert($column, "text2char")." != ". |
|
| 59 | + return "($column IS NULL OR ".$this->reporter->db->convert($column, "text2char")." != ". |
|
| 60 | 60 | $this->reporter->db->quoted($layout_def['input_name0']).")"; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -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. |
@@ -45,133 +45,133 @@ |
||
| 45 | 45 | |
| 46 | 46 | class SugarWidgetSubPanelTopSelectContactsButton extends SugarWidgetSubPanelTopSelectButton |
| 47 | 47 | { |
| 48 | - //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
|
| 49 | - function SugarWidgetSubPanelTopSelectContactsButton($button_properties=array()) |
|
| 50 | - { |
|
| 51 | - $this->button_properties=$button_properties; |
|
| 52 | - } |
|
| 48 | + //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
|
| 49 | + function SugarWidgetSubPanelTopSelectContactsButton($button_properties=array()) |
|
| 50 | + { |
|
| 51 | + $this->button_properties=$button_properties; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | public function getWidgetId($buttonSuffix = true) |
| 55 | 55 | { |
| 56 | 56 | return parent::getWidgetId() . '_select_button'; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - //widget_data is the collection of attributes associated with the button in the layout_defs file. |
|
| 60 | - function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 61 | - { |
|
| 62 | - global $app_strings; |
|
| 63 | - $initial_filter = ''; |
|
| 64 | - |
|
| 65 | - $this->title = $app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE']; |
|
| 66 | - //$this->accesskey = $app_strings['LBL_SELECT_CONTACT_BUTTON_KEY']; |
|
| 67 | - $this->value = $app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL']; |
|
| 68 | - |
|
| 69 | - $this->module_name = 'Contacts'; |
|
| 70 | - |
|
| 71 | - if (is_array($this->button_properties)) { |
|
| 72 | - if( isset($this->button_properties['title'])) { |
|
| 73 | - $this->title = $app_strings[$this->button_properties['title']]; |
|
| 74 | - } |
|
| 75 | - if( isset($this->button_properties['accesskey'])) { |
|
| 76 | - //$this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
|
| 77 | - } |
|
| 78 | - if( isset($this->button_properties['form_value'])) { |
|
| 79 | - $this->value = $app_strings[$this->button_properties['form_value']]; |
|
| 80 | - } |
|
| 81 | - if( isset($this->button_properties['module'])) { |
|
| 82 | - $this->module_name = $this->button_properties['module']; |
|
| 83 | - } |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $focus = $widget_data['focus']; |
|
| 87 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 88 | - $button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 89 | - . ' title="' . $this->title . '"' |
|
| 90 | - . ' value="' . $this->value . "\"\n" |
|
| 91 | - .' disabled />'; |
|
| 92 | - return $button; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - //refresh the whole page after end of action? |
|
| 96 | - $refresh_page = 0; |
|
| 97 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 98 | - $refresh_page = 1; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $subpanel_definition = $widget_data['subpanel_definition']; |
|
| 102 | - |
|
| 103 | - $button_definition = $subpanel_definition->get_buttons(); |
|
| 104 | - $subpanel_name = $subpanel_definition->get_module_name(); |
|
| 105 | - if (empty($this->module_name)) { |
|
| 106 | - $this->module_name = $subpanel_name; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - if ($subpanel_name == 'Project'){ |
|
| 110 | - $link_field_name = 'project_contacts_1'; |
|
| 111 | - } |
|
| 112 | - else{ |
|
| 113 | - $link_field_name = $subpanel_definition->get_data_source_name(true); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - $popup_mode='Single'; |
|
| 117 | - if(isset($widget_data['mode'])){ |
|
| 118 | - $popup_mode=$widget_data['mode']; |
|
| 119 | - } |
|
| 120 | - if(isset($widget_data['initial_filter_fields'])){ |
|
| 121 | - if (is_array($widget_data['initial_filter_fields'])) { |
|
| 122 | - foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
|
| 123 | - if (isset($focus->$value) and !empty($focus->$value)) { |
|
| 124 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - $create="true"; |
|
| 130 | - if(isset($widget_data['create'])){ |
|
| 131 | - $create=$widget_data['create']; |
|
| 132 | - } |
|
| 133 | - $return_module = $_REQUEST['module']; |
|
| 134 | - $return_action = 'SubPanelViewer'; |
|
| 135 | - $return_id = $_REQUEST['record']; |
|
| 136 | - |
|
| 137 | - //field_to_name_array |
|
| 138 | - $fton_array= array('id' => 'subpanel_id'); |
|
| 139 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 140 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
|
| 144 | - |
|
| 145 | - $popup_request_data = array( |
|
| 146 | - 'call_back_function' => 'set_return_and_save_background', |
|
| 147 | - 'form_name' => 'DetailView', |
|
| 148 | - 'field_to_name_array' => $fton_array, |
|
| 149 | - 'passthru_data' => array( |
|
| 150 | - 'child_field' => $this->module_name, |
|
| 151 | - 'return_url' => urlencode($return_url), |
|
| 152 | - 'link_field_name' => $link_field_name, |
|
| 153 | - 'module_name' => $this->module_name, |
|
| 154 | - 'refresh_page' => 1, |
|
| 155 | - ), |
|
| 156 | - ); |
|
| 157 | - |
|
| 158 | - if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) { |
|
| 159 | - $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
|
| 163 | - |
|
| 164 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 165 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
|
| 169 | - |
|
| 170 | - return '<form action="index.php">' . "\n" |
|
| 171 | - . ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 172 | - . ' title="' . $this->title . '"' |
|
| 173 | - . ' value="' . $this->value . "\"\n" |
|
| 174 | - . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n"; |
|
| 175 | - } |
|
| 59 | + //widget_data is the collection of attributes associated with the button in the layout_defs file. |
|
| 60 | + function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 61 | + { |
|
| 62 | + global $app_strings; |
|
| 63 | + $initial_filter = ''; |
|
| 64 | + |
|
| 65 | + $this->title = $app_strings['LBL_SELECT_CONTACT_BUTTON_TITLE']; |
|
| 66 | + //$this->accesskey = $app_strings['LBL_SELECT_CONTACT_BUTTON_KEY']; |
|
| 67 | + $this->value = $app_strings['LBL_SELECT_CONTACT_BUTTON_LABEL']; |
|
| 68 | + |
|
| 69 | + $this->module_name = 'Contacts'; |
|
| 70 | + |
|
| 71 | + if (is_array($this->button_properties)) { |
|
| 72 | + if( isset($this->button_properties['title'])) { |
|
| 73 | + $this->title = $app_strings[$this->button_properties['title']]; |
|
| 74 | + } |
|
| 75 | + if( isset($this->button_properties['accesskey'])) { |
|
| 76 | + //$this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
|
| 77 | + } |
|
| 78 | + if( isset($this->button_properties['form_value'])) { |
|
| 79 | + $this->value = $app_strings[$this->button_properties['form_value']]; |
|
| 80 | + } |
|
| 81 | + if( isset($this->button_properties['module'])) { |
|
| 82 | + $this->module_name = $this->button_properties['module']; |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $focus = $widget_data['focus']; |
|
| 87 | + if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 88 | + $button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 89 | + . ' title="' . $this->title . '"' |
|
| 90 | + . ' value="' . $this->value . "\"\n" |
|
| 91 | + .' disabled />'; |
|
| 92 | + return $button; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + //refresh the whole page after end of action? |
|
| 96 | + $refresh_page = 0; |
|
| 97 | + if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 98 | + $refresh_page = 1; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $subpanel_definition = $widget_data['subpanel_definition']; |
|
| 102 | + |
|
| 103 | + $button_definition = $subpanel_definition->get_buttons(); |
|
| 104 | + $subpanel_name = $subpanel_definition->get_module_name(); |
|
| 105 | + if (empty($this->module_name)) { |
|
| 106 | + $this->module_name = $subpanel_name; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + if ($subpanel_name == 'Project'){ |
|
| 110 | + $link_field_name = 'project_contacts_1'; |
|
| 111 | + } |
|
| 112 | + else{ |
|
| 113 | + $link_field_name = $subpanel_definition->get_data_source_name(true); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + $popup_mode='Single'; |
|
| 117 | + if(isset($widget_data['mode'])){ |
|
| 118 | + $popup_mode=$widget_data['mode']; |
|
| 119 | + } |
|
| 120 | + if(isset($widget_data['initial_filter_fields'])){ |
|
| 121 | + if (is_array($widget_data['initial_filter_fields'])) { |
|
| 122 | + foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
|
| 123 | + if (isset($focus->$value) and !empty($focus->$value)) { |
|
| 124 | + $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + $create="true"; |
|
| 130 | + if(isset($widget_data['create'])){ |
|
| 131 | + $create=$widget_data['create']; |
|
| 132 | + } |
|
| 133 | + $return_module = $_REQUEST['module']; |
|
| 134 | + $return_action = 'SubPanelViewer'; |
|
| 135 | + $return_id = $_REQUEST['record']; |
|
| 136 | + |
|
| 137 | + //field_to_name_array |
|
| 138 | + $fton_array= array('id' => 'subpanel_id'); |
|
| 139 | + if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 140 | + $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
|
| 144 | + |
|
| 145 | + $popup_request_data = array( |
|
| 146 | + 'call_back_function' => 'set_return_and_save_background', |
|
| 147 | + 'form_name' => 'DetailView', |
|
| 148 | + 'field_to_name_array' => $fton_array, |
|
| 149 | + 'passthru_data' => array( |
|
| 150 | + 'child_field' => $this->module_name, |
|
| 151 | + 'return_url' => urlencode($return_url), |
|
| 152 | + 'link_field_name' => $link_field_name, |
|
| 153 | + 'module_name' => $this->module_name, |
|
| 154 | + 'refresh_page' => 1, |
|
| 155 | + ), |
|
| 156 | + ); |
|
| 157 | + |
|
| 158 | + if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) { |
|
| 159 | + $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
|
| 163 | + |
|
| 164 | + if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 165 | + $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
|
| 169 | + |
|
| 170 | + return '<form action="index.php">' . "\n" |
|
| 171 | + . ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 172 | + . ' title="' . $this->title . '"' |
|
| 173 | + . ' value="' . $this->value . "\"\n" |
|
| 174 | + . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n"; |
|
| 175 | + } |
|
| 176 | 176 | } |
| 177 | 177 | ?> |
@@ -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,14 +46,14 @@ discard block |
||
| 46 | 46 | class SugarWidgetSubPanelTopSelectContactsButton extends SugarWidgetSubPanelTopSelectButton |
| 47 | 47 | { |
| 48 | 48 | //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
| 49 | - function SugarWidgetSubPanelTopSelectContactsButton($button_properties=array()) |
|
| 49 | + function SugarWidgetSubPanelTopSelectContactsButton($button_properties = array()) |
|
| 50 | 50 | { |
| 51 | - $this->button_properties=$button_properties; |
|
| 51 | + $this->button_properties = $button_properties; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function getWidgetId($buttonSuffix = true) |
| 55 | 55 | { |
| 56 | - return parent::getWidgetId() . '_select_button'; |
|
| 56 | + return parent::getWidgetId().'_select_button'; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | //widget_data is the collection of attributes associated with the button in the layout_defs file. |
@@ -69,32 +69,32 @@ discard block |
||
| 69 | 69 | $this->module_name = 'Contacts'; |
| 70 | 70 | |
| 71 | 71 | if (is_array($this->button_properties)) { |
| 72 | - if( isset($this->button_properties['title'])) { |
|
| 72 | + if (isset($this->button_properties['title'])) { |
|
| 73 | 73 | $this->title = $app_strings[$this->button_properties['title']]; |
| 74 | 74 | } |
| 75 | - if( isset($this->button_properties['accesskey'])) { |
|
| 75 | + if (isset($this->button_properties['accesskey'])) { |
|
| 76 | 76 | //$this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
| 77 | 77 | } |
| 78 | - if( isset($this->button_properties['form_value'])) { |
|
| 78 | + if (isset($this->button_properties['form_value'])) { |
|
| 79 | 79 | $this->value = $app_strings[$this->button_properties['form_value']]; |
| 80 | 80 | } |
| 81 | - if( isset($this->button_properties['module'])) { |
|
| 81 | + if (isset($this->button_properties['module'])) { |
|
| 82 | 82 | $this->module_name = $this->button_properties['module']; |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $focus = $widget_data['focus']; |
| 87 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 88 | - $button = ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 89 | - . ' title="' . $this->title . '"' |
|
| 90 | - . ' value="' . $this->value . "\"\n" |
|
| 87 | + if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) { |
|
| 88 | + $button = ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\"\n" |
|
| 89 | + . ' title="'.$this->title.'"' |
|
| 90 | + . ' value="'.$this->value."\"\n" |
|
| 91 | 91 | .' disabled />'; |
| 92 | 92 | return $button; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | //refresh the whole page after end of action? |
| 96 | 96 | $refresh_page = 0; |
| 97 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 97 | + if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) { |
|
| 98 | 98 | $refresh_page = 1; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -106,38 +106,38 @@ discard block |
||
| 106 | 106 | $this->module_name = $subpanel_name; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ($subpanel_name == 'Project'){ |
|
| 109 | + if ($subpanel_name == 'Project') { |
|
| 110 | 110 | $link_field_name = 'project_contacts_1'; |
| 111 | 111 | } |
| 112 | - else{ |
|
| 112 | + else { |
|
| 113 | 113 | $link_field_name = $subpanel_definition->get_data_source_name(true); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $popup_mode='Single'; |
|
| 117 | - if(isset($widget_data['mode'])){ |
|
| 118 | - $popup_mode=$widget_data['mode']; |
|
| 116 | + $popup_mode = 'Single'; |
|
| 117 | + if (isset($widget_data['mode'])) { |
|
| 118 | + $popup_mode = $widget_data['mode']; |
|
| 119 | 119 | } |
| 120 | - if(isset($widget_data['initial_filter_fields'])){ |
|
| 120 | + if (isset($widget_data['initial_filter_fields'])) { |
|
| 121 | 121 | if (is_array($widget_data['initial_filter_fields'])) { |
| 122 | 122 | foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
| 123 | 123 | if (isset($focus->$value) and !empty($focus->$value)) { |
| 124 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 124 | + $initial_filter .= "&".$alias.'='.urlencode($focus->$value); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | - $create="true"; |
|
| 130 | - if(isset($widget_data['create'])){ |
|
| 131 | - $create=$widget_data['create']; |
|
| 129 | + $create = "true"; |
|
| 130 | + if (isset($widget_data['create'])) { |
|
| 131 | + $create = $widget_data['create']; |
|
| 132 | 132 | } |
| 133 | 133 | $return_module = $_REQUEST['module']; |
| 134 | 134 | $return_action = 'SubPanelViewer'; |
| 135 | 135 | $return_id = $_REQUEST['record']; |
| 136 | 136 | |
| 137 | 137 | //field_to_name_array |
| 138 | - $fton_array= array('id' => 'subpanel_id'); |
|
| 139 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 140 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 138 | + $fton_array = array('id' => 'subpanel_id'); |
|
| 139 | + if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) { |
|
| 140 | + $fton_array = array_merge($fton_array, $widget_data['field_to_name_array']); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | ); |
| 157 | 157 | |
| 158 | 158 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) { |
| 159 | - $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 159 | + $popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
| 163 | 163 | |
| 164 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 165 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 164 | + if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') { |
|
| 165 | + $initial_filter = "&module_name=".urlencode($widget_data['module']); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
| 169 | 169 | |
| 170 | - return '<form action="index.php">' . "\n" |
|
| 171 | - . ' <input type="button" name="' .$this->getWidgetId() . '" id="' .$this->getWidgetId() . '" class="button"' . "\"\n" |
|
| 172 | - . ' title="' . $this->title . '"' |
|
| 173 | - . ' value="' . $this->value . "\"\n" |
|
| 170 | + return '<form action="index.php">'."\n" |
|
| 171 | + . ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\"\n" |
|
| 172 | + . ' title="'.$this->title.'"' |
|
| 173 | + . ' value="'.$this->value."\"\n" |
|
| 174 | 174 | . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' /></form>\n"; |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -108,8 +110,7 @@ discard block |
||
| 108 | 110 | |
| 109 | 111 | if ($subpanel_name == 'Project'){ |
| 110 | 112 | $link_field_name = 'project_contacts_1'; |
| 111 | - } |
|
| 112 | - else{ |
|
| 113 | + } else{ |
|
| 113 | 114 | $link_field_name = $subpanel_definition->get_data_source_name(true); |
| 114 | 115 | } |
| 115 | 116 | |
@@ -44,21 +44,21 @@ |
||
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | class SugarWidgetSubPanelTopSelectAccountButton extends SugarWidgetSubPanelTopSelectButton { |
| 47 | - function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 48 | - { |
|
| 49 | - /* |
|
| 47 | + function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 48 | + { |
|
| 49 | + /* |
|
| 50 | 50 | * i.dymovsky |
| 51 | 51 | * Because when user role can't edit Accounts, it also can't edit Membership Organizations. Select button leads to change MO list |
| 52 | 52 | * See bug 25633 |
| 53 | 53 | * Bug25633 code change start |
| 54 | 54 | */ |
| 55 | - if (!ACLController::checkAccess($widget_data["module"], "edit", true)) { |
|
| 56 | - return ; |
|
| 57 | - } |
|
| 58 | - /* |
|
| 55 | + if (!ACLController::checkAccess($widget_data["module"], "edit", true)) { |
|
| 56 | + return ; |
|
| 57 | + } |
|
| 58 | + /* |
|
| 59 | 59 | * Bug25633 code change end |
| 60 | 60 | */ |
| 61 | 61 | |
| 62 | - return parent::display($widget_data); |
|
| 63 | - } |
|
| 62 | + return parent::display($widget_data); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -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. |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * Bug25633 code change start |
| 54 | 54 | */ |
| 55 | 55 | if (!ACLController::checkAccess($widget_data["module"], "edit", true)) { |
| 56 | - return ; |
|
| 56 | + return; |
|
| 57 | 57 | } |
| 58 | 58 | /* |
| 59 | 59 | * Bug25633 code change end |
@@ -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. |
@@ -1,5 +1,5 @@ |
||
| 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. |
@@ -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. |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | class SugarWidgetSubPanelTopSelectButton extends SugarWidgetSubPanelTopButton |
| 47 | 47 | { |
| 48 | - //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
|
| 49 | - function SugarWidgetSubPanelTopSelectButton($button_properties=array()) |
|
| 50 | - { |
|
| 51 | - $this->button_properties=$button_properties; |
|
| 52 | - } |
|
| 48 | + //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
|
| 49 | + function SugarWidgetSubPanelTopSelectButton($button_properties=array()) |
|
| 50 | + { |
|
| 51 | + $this->button_properties=$button_properties; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | public function getWidgetId($buttonSuffix = true) |
| 55 | 55 | { |
@@ -60,96 +60,96 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | return $GLOBALS['app_strings']['LBL_SELECT_BUTTON_LABEL']; |
| 62 | 62 | } |
| 63 | - //widget_data is the collection of attributes associated with the button in the layout_defs file. |
|
| 64 | - function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 65 | - { |
|
| 66 | - global $app_strings; |
|
| 67 | - $initial_filter = ''; |
|
| 63 | + //widget_data is the collection of attributes associated with the button in the layout_defs file. |
|
| 64 | + function display($widget_data, $additionalFormFields = NULL, $nonbutton = false) |
|
| 65 | + { |
|
| 66 | + global $app_strings; |
|
| 67 | + $initial_filter = ''; |
|
| 68 | 68 | |
| 69 | - $this->title = $this->getTitle(); |
|
| 69 | + $this->title = $this->getTitle(); |
|
| 70 | 70 | $this->accesskey = $this->getAccesskey(); |
| 71 | 71 | $this->value = $this->getDisplayName(); |
| 72 | 72 | |
| 73 | - if (is_array($this->button_properties)) { |
|
| 74 | - if( isset($this->button_properties['title'])) { |
|
| 75 | - $this->title = $app_strings[$this->button_properties['title']]; |
|
| 76 | - } |
|
| 77 | - if( isset($this->button_properties['accesskey'])) { |
|
| 78 | - $this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
|
| 79 | - } |
|
| 80 | - if( isset($this->button_properties['form_value'])) { |
|
| 81 | - $this->value = $app_strings[$this->button_properties['form_value']]; |
|
| 82 | - } |
|
| 83 | - if( isset($this->button_properties['module'])) { |
|
| 84 | - $this->module_name = $this->button_properties['module']; |
|
| 85 | - } |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - $focus = $widget_data['focus']; |
|
| 90 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 91 | - $button = ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 92 | - . ' title="' . $this->title . '"' |
|
| 93 | - . ' value="' . $this->value . "\"\n" |
|
| 94 | - .' disabled />'; |
|
| 95 | - return $button; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - //refresh the whole page after end of action? |
|
| 99 | - $refresh_page = 0; |
|
| 100 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 101 | - $refresh_page = 1; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $subpanel_definition = $widget_data['subpanel_definition']; |
|
| 105 | - $button_definition = $subpanel_definition->get_buttons(); |
|
| 73 | + if (is_array($this->button_properties)) { |
|
| 74 | + if( isset($this->button_properties['title'])) { |
|
| 75 | + $this->title = $app_strings[$this->button_properties['title']]; |
|
| 76 | + } |
|
| 77 | + if( isset($this->button_properties['accesskey'])) { |
|
| 78 | + $this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
|
| 79 | + } |
|
| 80 | + if( isset($this->button_properties['form_value'])) { |
|
| 81 | + $this->value = $app_strings[$this->button_properties['form_value']]; |
|
| 82 | + } |
|
| 83 | + if( isset($this->button_properties['module'])) { |
|
| 84 | + $this->module_name = $this->button_properties['module']; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + $focus = $widget_data['focus']; |
|
| 90 | + if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 91 | + $button = ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 92 | + . ' title="' . $this->title . '"' |
|
| 93 | + . ' value="' . $this->value . "\"\n" |
|
| 94 | + .' disabled />'; |
|
| 95 | + return $button; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + //refresh the whole page after end of action? |
|
| 99 | + $refresh_page = 0; |
|
| 100 | + if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 101 | + $refresh_page = 1; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $subpanel_definition = $widget_data['subpanel_definition']; |
|
| 105 | + $button_definition = $subpanel_definition->get_buttons(); |
|
| 106 | 106 | |
| 107 | 107 | $subpanel_name = $subpanel_definition->get_name(); |
| 108 | - if (empty($this->module_name)) { |
|
| 109 | - $this->module_name = $subpanel_definition->get_module_name(); |
|
| 110 | - } |
|
| 111 | - $link_field_name = $subpanel_definition->get_data_source_name(true); |
|
| 112 | - $popup_mode='Single'; |
|
| 113 | - if(isset($widget_data['mode'])){ |
|
| 114 | - $popup_mode=$widget_data['mode']; |
|
| 115 | - } |
|
| 116 | - if(isset($widget_data['initial_filter_fields'])){ |
|
| 117 | - if (is_array($widget_data['initial_filter_fields'])) { |
|
| 118 | - foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
|
| 119 | - if (isset($focus->$value) and !empty($focus->$value)) { |
|
| 120 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 121 | - } |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - $create="true"; |
|
| 126 | - if(isset($widget_data['create'])){ |
|
| 127 | - $create=$widget_data['create']; |
|
| 128 | - } |
|
| 129 | - $return_module = $_REQUEST['module']; |
|
| 130 | - $return_action = 'SubPanelViewer'; |
|
| 131 | - $return_id = $_REQUEST['record']; |
|
| 132 | - |
|
| 133 | - //field_to_name_array |
|
| 134 | - $fton_array= array('id' => 'subpanel_id'); |
|
| 135 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 136 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
|
| 140 | - |
|
| 141 | - $popup_request_data = array( |
|
| 142 | - 'call_back_function' => 'set_return_and_save_background', |
|
| 143 | - 'form_name' => 'DetailView', |
|
| 144 | - 'field_to_name_array' => $fton_array, |
|
| 145 | - 'passthru_data' => array( |
|
| 146 | - 'child_field' => $subpanel_name, |
|
| 147 | - 'return_url' => urlencode($return_url), |
|
| 148 | - 'link_field_name' => $link_field_name, |
|
| 149 | - 'module_name' => $subpanel_name, |
|
| 150 | - 'refresh_page'=>$refresh_page, |
|
| 151 | - ), |
|
| 152 | - ); |
|
| 108 | + if (empty($this->module_name)) { |
|
| 109 | + $this->module_name = $subpanel_definition->get_module_name(); |
|
| 110 | + } |
|
| 111 | + $link_field_name = $subpanel_definition->get_data_source_name(true); |
|
| 112 | + $popup_mode='Single'; |
|
| 113 | + if(isset($widget_data['mode'])){ |
|
| 114 | + $popup_mode=$widget_data['mode']; |
|
| 115 | + } |
|
| 116 | + if(isset($widget_data['initial_filter_fields'])){ |
|
| 117 | + if (is_array($widget_data['initial_filter_fields'])) { |
|
| 118 | + foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
|
| 119 | + if (isset($focus->$value) and !empty($focus->$value)) { |
|
| 120 | + $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 121 | + } |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + $create="true"; |
|
| 126 | + if(isset($widget_data['create'])){ |
|
| 127 | + $create=$widget_data['create']; |
|
| 128 | + } |
|
| 129 | + $return_module = $_REQUEST['module']; |
|
| 130 | + $return_action = 'SubPanelViewer'; |
|
| 131 | + $return_id = $_REQUEST['record']; |
|
| 132 | + |
|
| 133 | + //field_to_name_array |
|
| 134 | + $fton_array= array('id' => 'subpanel_id'); |
|
| 135 | + if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 136 | + $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
|
| 140 | + |
|
| 141 | + $popup_request_data = array( |
|
| 142 | + 'call_back_function' => 'set_return_and_save_background', |
|
| 143 | + 'form_name' => 'DetailView', |
|
| 144 | + 'field_to_name_array' => $fton_array, |
|
| 145 | + 'passthru_data' => array( |
|
| 146 | + 'child_field' => $subpanel_name, |
|
| 147 | + 'return_url' => urlencode($return_url), |
|
| 148 | + 'link_field_name' => $link_field_name, |
|
| 149 | + 'module_name' => $subpanel_name, |
|
| 150 | + 'refresh_page'=>$refresh_page, |
|
| 151 | + ), |
|
| 152 | + ); |
|
| 153 | 153 | |
| 154 | 154 | // bugfix #57850 add marketing_id to the request data to allow filtering based on it |
| 155 | 155 | if (!empty($_REQUEST['mkt_id'])) |
@@ -162,35 +162,35 @@ discard block |
||
| 162 | 162 | $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
|
| 165 | + if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
|
| 166 | 166 | |
| 167 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 168 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 169 | - } |
|
| 170 | - } |
|
| 167 | + if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 168 | + $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | 171 | //acl_roles_users_selectuser_button |
| 172 | 172 | |
| 173 | 173 | $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
| 174 | - return ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 175 | - . ' title="' . $this->title . '"' |
|
| 176 | - . ' value="' . $this->value . "\"\n" |
|
| 177 | - . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' />\n"; |
|
| 178 | - } |
|
| 174 | + return ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 175 | + . ' title="' . $this->title . '"' |
|
| 176 | + . ' value="' . $this->value . "\"\n" |
|
| 177 | + . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' />\n"; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | - * @return string |
|
| 182 | - */ |
|
| 181 | + * @return string |
|
| 182 | + */ |
|
| 183 | 183 | protected function getTitle() |
| 184 | 184 | { |
| 185 | - return translate('LBL_SELECT_BUTTON_TITLE'); |
|
| 185 | + return translate('LBL_SELECT_BUTTON_TITLE'); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | - * @return string |
|
| 190 | - */ |
|
| 189 | + * @return string |
|
| 190 | + */ |
|
| 191 | 191 | protected function getAccesskey() |
| 192 | 192 | { |
| 193 | - return translate('LBL_SELECT_BUTTON_KEY'); |
|
| 193 | + return translate('LBL_SELECT_BUTTON_KEY'); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | } |
@@ -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,14 +46,14 @@ discard block |
||
| 46 | 46 | class SugarWidgetSubPanelTopSelectButton extends SugarWidgetSubPanelTopButton |
| 47 | 47 | { |
| 48 | 48 | //button_properties is a collection of properties associated with the widget_class definition. layoutmanager |
| 49 | - function SugarWidgetSubPanelTopSelectButton($button_properties=array()) |
|
| 49 | + function SugarWidgetSubPanelTopSelectButton($button_properties = array()) |
|
| 50 | 50 | { |
| 51 | - $this->button_properties=$button_properties; |
|
| 51 | + $this->button_properties = $button_properties; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function getWidgetId($buttonSuffix = true) |
| 55 | 55 | { |
| 56 | - return parent::getWidgetId(false) . 'select_button'; |
|
| 56 | + return parent::getWidgetId(false).'select_button'; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | public function getDisplayName() |
@@ -66,38 +66,38 @@ discard block |
||
| 66 | 66 | global $app_strings; |
| 67 | 67 | $initial_filter = ''; |
| 68 | 68 | |
| 69 | - $this->title = $this->getTitle(); |
|
| 69 | + $this->title = $this->getTitle(); |
|
| 70 | 70 | $this->accesskey = $this->getAccesskey(); |
| 71 | 71 | $this->value = $this->getDisplayName(); |
| 72 | 72 | |
| 73 | 73 | if (is_array($this->button_properties)) { |
| 74 | - if( isset($this->button_properties['title'])) { |
|
| 74 | + if (isset($this->button_properties['title'])) { |
|
| 75 | 75 | $this->title = $app_strings[$this->button_properties['title']]; |
| 76 | 76 | } |
| 77 | - if( isset($this->button_properties['accesskey'])) { |
|
| 77 | + if (isset($this->button_properties['accesskey'])) { |
|
| 78 | 78 | $this->accesskey = $app_strings[$this->button_properties['accesskey']]; |
| 79 | 79 | } |
| 80 | - if( isset($this->button_properties['form_value'])) { |
|
| 80 | + if (isset($this->button_properties['form_value'])) { |
|
| 81 | 81 | $this->value = $app_strings[$this->button_properties['form_value']]; |
| 82 | 82 | } |
| 83 | - if( isset($this->button_properties['module'])) { |
|
| 83 | + if (isset($this->button_properties['module'])) { |
|
| 84 | 84 | $this->module_name = $this->button_properties['module']; |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
| 89 | 89 | $focus = $widget_data['focus']; |
| 90 | - if(ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)){ |
|
| 91 | - $button = ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 92 | - . ' title="' . $this->title . '"' |
|
| 93 | - . ' value="' . $this->value . "\"\n" |
|
| 90 | + if (ACLController::moduleSupportsACL($widget_data['module']) && !ACLController::checkAccess($widget_data['module'], 'list', true)) { |
|
| 91 | + $button = ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\n" |
|
| 92 | + . ' title="'.$this->title.'"' |
|
| 93 | + . ' value="'.$this->value."\"\n" |
|
| 94 | 94 | .' disabled />'; |
| 95 | 95 | return $button; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | //refresh the whole page after end of action? |
| 99 | 99 | $refresh_page = 0; |
| 100 | - if(!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])){ |
|
| 100 | + if (!empty($widget_data['subpanel_definition']->_instance_properties['refresh_page'])) { |
|
| 101 | 101 | $refresh_page = 1; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -109,31 +109,31 @@ discard block |
||
| 109 | 109 | $this->module_name = $subpanel_definition->get_module_name(); |
| 110 | 110 | } |
| 111 | 111 | $link_field_name = $subpanel_definition->get_data_source_name(true); |
| 112 | - $popup_mode='Single'; |
|
| 113 | - if(isset($widget_data['mode'])){ |
|
| 114 | - $popup_mode=$widget_data['mode']; |
|
| 112 | + $popup_mode = 'Single'; |
|
| 113 | + if (isset($widget_data['mode'])) { |
|
| 114 | + $popup_mode = $widget_data['mode']; |
|
| 115 | 115 | } |
| 116 | - if(isset($widget_data['initial_filter_fields'])){ |
|
| 116 | + if (isset($widget_data['initial_filter_fields'])) { |
|
| 117 | 117 | if (is_array($widget_data['initial_filter_fields'])) { |
| 118 | 118 | foreach ($widget_data['initial_filter_fields'] as $value=>$alias) { |
| 119 | 119 | if (isset($focus->$value) and !empty($focus->$value)) { |
| 120 | - $initial_filter.="&".$alias . '='.urlencode($focus->$value); |
|
| 120 | + $initial_filter .= "&".$alias.'='.urlencode($focus->$value); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | - $create="true"; |
|
| 126 | - if(isset($widget_data['create'])){ |
|
| 127 | - $create=$widget_data['create']; |
|
| 125 | + $create = "true"; |
|
| 126 | + if (isset($widget_data['create'])) { |
|
| 127 | + $create = $widget_data['create']; |
|
| 128 | 128 | } |
| 129 | 129 | $return_module = $_REQUEST['module']; |
| 130 | 130 | $return_action = 'SubPanelViewer'; |
| 131 | 131 | $return_id = $_REQUEST['record']; |
| 132 | 132 | |
| 133 | 133 | //field_to_name_array |
| 134 | - $fton_array= array('id' => 'subpanel_id'); |
|
| 135 | - if(isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])){ |
|
| 136 | - $fton_array=array_merge($fton_array,$widget_data['field_to_name_array']); |
|
| 134 | + $fton_array = array('id' => 'subpanel_id'); |
|
| 135 | + if (isset($widget_data['field_to_name_array']) && is_array($widget_data['field_to_name_array'])) { |
|
| 136 | + $fton_array = array_merge($fton_array, $widget_data['field_to_name_array']); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel_name&record=$return_id&sugar_body_only=1"; |
@@ -159,21 +159,21 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data'])) |
| 161 | 161 | { |
| 162 | - $popup_request_data['passthru_data']= array_merge($popup_request_data['passthru_data'],$this->button_properties['add_to_passthru_data']); |
|
| 162 | + $popup_request_data['passthru_data'] = array_merge($popup_request_data['passthru_data'], $this->button_properties['add_to_passthru_data']); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (is_array($this->button_properties) && !empty($this->button_properties['add_to_passthru_data']['return_type'])) { |
| 166 | 166 | |
| 167 | - if ($this->button_properties['add_to_passthru_data']['return_type']=='report') { |
|
| 168 | - $initial_filter = "&module_name=". urlencode($widget_data['module']); |
|
| 167 | + if ($this->button_properties['add_to_passthru_data']['return_type'] == 'report') { |
|
| 168 | + $initial_filter = "&module_name=".urlencode($widget_data['module']); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | //acl_roles_users_selectuser_button |
| 172 | 172 | |
| 173 | 173 | $json_encoded_php_array = $this->_create_json_encoded_popup_request($popup_request_data); |
| 174 | - return ' <input type="button" name="' . $this->getWidgetId() . '" id="' . $this->getWidgetId() . '" class="button"' . "\n" |
|
| 175 | - . ' title="' . $this->title . '"' |
|
| 176 | - . ' value="' . $this->value . "\"\n" |
|
| 174 | + return ' <input type="button" name="'.$this->getWidgetId().'" id="'.$this->getWidgetId().'" class="button"'."\n" |
|
| 175 | + . ' title="'.$this->title.'"' |
|
| 176 | + . ' value="'.$this->value."\"\n" |
|
| 177 | 177 | . " onclick='open_popup(\"$this->module_name\",600,400,\"$initial_filter\",true,true,$json_encoded_php_array,\"$popup_mode\",$create);' />\n"; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -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,39 +43,39 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | class SugarWidgetFieldDateTime extends SugarWidgetReportField |
| 45 | 45 | { |
| 46 | - var $reporter; |
|
| 47 | - var $assigned_user=null; |
|
| 46 | + var $reporter; |
|
| 47 | + var $assigned_user=null; |
|
| 48 | 48 | |
| 49 | 49 | function SugarWidgetFieldDateTime($layout_manager) |
| 50 | 50 | { |
| 51 | 51 | parent::SugarWidgetReportField($layout_manager); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - // get the reporter attribute |
|
| 54 | + // get the reporter attribute |
|
| 55 | 55 | // deprecated, now called in the constructor |
| 56 | 56 | /** |
| 57 | 57 | * @deprecated |
| 58 | 58 | */ |
| 59 | - function getReporter() { |
|
| 60 | - } |
|
| 59 | + function getReporter() { |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - // get the assigned user of the report |
|
| 63 | - function getAssignedUser() |
|
| 64 | - { |
|
| 65 | - $json_obj = getJSONobj(); |
|
| 62 | + // get the assigned user of the report |
|
| 63 | + function getAssignedUser() |
|
| 64 | + { |
|
| 65 | + $json_obj = getJSONobj(); |
|
| 66 | 66 | |
| 67 | - $report_def_str = $json_obj->decode($this->reporter->report_def_str); |
|
| 67 | + $report_def_str = $json_obj->decode($this->reporter->report_def_str); |
|
| 68 | 68 | |
| 69 | - if(empty($report_def_str['assigned_user_id'])) return null; |
|
| 69 | + if(empty($report_def_str['assigned_user_id'])) return null; |
|
| 70 | 70 | |
| 71 | - $this->assigned_user = new User(); |
|
| 72 | - $this->assigned_user->retrieve($report_def_str['assigned_user_id']); |
|
| 73 | - return $this->assigned_user; |
|
| 74 | - } |
|
| 71 | + $this->assigned_user = new User(); |
|
| 72 | + $this->assigned_user->retrieve($report_def_str['assigned_user_id']); |
|
| 73 | + return $this->assigned_user; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - function queryFilterOn($layout_def) |
|
| 77 | - { |
|
| 78 | - global $timedate; |
|
| 76 | + function queryFilterOn($layout_def) |
|
| 77 | + { |
|
| 78 | + global $timedate; |
|
| 79 | 79 | $begin = $layout_def['input_name0']; |
| 80 | 80 | $hasTime = $this->hasTime($begin); |
| 81 | 81 | $date = $timedate->fromString($begin); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | '=', |
| 94 | 94 | "datetime" |
| 95 | 95 | ); |
| 96 | - } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * expandDate |
@@ -108,61 +108,61 @@ discard block |
||
| 108 | 108 | * @param bool $end Boolean value indicating whether or not this is for an end time period or not |
| 109 | 109 | * @return $date TimeDate object with time value applied |
| 110 | 110 | */ |
| 111 | - protected function expandDate($date, $end = false) |
|
| 112 | - { |
|
| 113 | - global $timedate; |
|
| 114 | - if($this->hasTime($date)) { |
|
| 115 | - return $date; |
|
| 116 | - } |
|
| 111 | + protected function expandDate($date, $end = false) |
|
| 112 | + { |
|
| 113 | + global $timedate; |
|
| 114 | + if($this->hasTime($date)) { |
|
| 115 | + return $date; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | 118 | //C.L. Bug 48616 - If the $date is set to the Today macro, then adjust accordingly |
| 119 | 119 | if(strtolower($date) == 'today') |
| 120 | 120 | { |
| 121 | - $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true)); |
|
| 122 | - return $end ? $startEnd['end'] : $startEnd['start']; |
|
| 121 | + $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true)); |
|
| 122 | + return $end ? $startEnd['end'] : $startEnd['start']; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $parsed = $timedate->fromDbDate($date); |
| 126 | 126 | $date = $timedate->tzUser(new SugarDateTime()); |
| 127 | 127 | $date->setDate($parsed->year, $parsed->month, $parsed->day); |
| 128 | 128 | |
| 129 | - if($end) { |
|
| 130 | - return $date->setTime(23, 59, 59); |
|
| 131 | - } else { |
|
| 132 | - return $date->setTime(0, 0, 0); |
|
| 133 | - } |
|
| 134 | - } |
|
| 129 | + if($end) { |
|
| 130 | + return $date->setTime(23, 59, 59); |
|
| 131 | + } else { |
|
| 132 | + return $date->setTime(0, 0, 0); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - function queryFilterBefore($layout_def) |
|
| 137 | - { |
|
| 136 | + function queryFilterBefore($layout_def) |
|
| 137 | + { |
|
| 138 | 138 | $begin = $this->expandDate($layout_def['input_name0']); |
| 139 | 139 | return $this->queryDateOp($this->_get_column_select($layout_def), $begin, '<', "datetime"); |
| 140 | - } |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - function queryFilterAfter($layout_def) |
|
| 143 | - { |
|
| 142 | + function queryFilterAfter($layout_def) |
|
| 143 | + { |
|
| 144 | 144 | $begin = $this->expandDate($layout_def['input_name0'], true); |
| 145 | 145 | return $this->queryDateOp($this->_get_column_select($layout_def), $begin, '>', "datetime"); |
| 146 | - } |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - function queryFilterBetween_Dates($layout_def) |
|
| 149 | - { |
|
| 148 | + function queryFilterBetween_Dates($layout_def) |
|
| 149 | + { |
|
| 150 | 150 | $begin = $this->expandDate($layout_def['input_name0']); |
| 151 | - $end = $this->expandDate($layout_def['input_name1'], true); |
|
| 151 | + $end = $this->expandDate($layout_def['input_name1'], true); |
|
| 152 | 152 | $column = $this->_get_column_select($layout_def); |
| 153 | - return "(".$this->queryDateOp($column, $begin, ">=", "datetime")." AND ". |
|
| 153 | + return "(".$this->queryDateOp($column, $begin, ">=", "datetime")." AND ". |
|
| 154 | 154 | $this->queryDateOp($column, $end, "<=", "datetime").")\n"; |
| 155 | - } |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - function queryFilterNot_Equals_str($layout_def) |
|
| 158 | - { |
|
| 159 | - global $timedate; |
|
| 157 | + function queryFilterNot_Equals_str($layout_def) |
|
| 158 | + { |
|
| 159 | + global $timedate; |
|
| 160 | 160 | |
| 161 | 161 | $column = $this->_get_column_select($layout_def); |
| 162 | 162 | $begin = $layout_def['input_name0']; |
| 163 | 163 | $hasTime = $this->hasTime($begin); |
| 164 | 164 | if(!$hasTime){ |
| 165 | - $end = $this->expandDate($begin, true); |
|
| 165 | + $end = $this->expandDate($begin, true); |
|
| 166 | 166 | $begin = $this->expandDate($begin); |
| 167 | 167 | $cond = $this->queryDateOp($column, $begin, "<", "datetime")." OR ". |
| 168 | 168 | $this->queryDateOp($column, $end, ">", "datetime"); |
@@ -170,45 +170,45 @@ discard block |
||
| 170 | 170 | $cond = $this->queryDateOp($column, $begin, "!=", "datetime"); |
| 171 | 171 | } |
| 172 | 172 | return "($column IS NULL OR $cond)"; |
| 173 | - } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Get assigned or logged in user's current date and time value. |
| 177 | 177 | * @param boolean $timestamp Format of return value, if set to true, return unix like timestamp , else a formatted date. |
| 178 | 178 | */ |
| 179 | - function get_users_current_date_time($timestamp=false) |
|
| 180 | - { |
|
| 181 | - global $current_user; |
|
| 179 | + function get_users_current_date_time($timestamp=false) |
|
| 180 | + { |
|
| 181 | + global $current_user; |
|
| 182 | 182 | global $timedate; |
| 183 | 183 | |
| 184 | 184 | $begin = TimeDate::getInstance()->nowDb(); |
| 185 | 185 | //kbrill bug #13884 |
| 186 | - //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
|
| 187 | - $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 186 | + //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
|
| 187 | + $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 188 | 188 | |
| 189 | 189 | if (!$timestamp) { |
| 190 | - return $begin; |
|
| 190 | + return $begin; |
|
| 191 | 191 | } else { |
| 192 | - $begin_parts = explode(' ', $begin); |
|
| 193 | - $date_parts=explode('-', $begin_parts[0]); |
|
| 194 | - $time_parts=explode(':', $begin_parts[1]); |
|
| 195 | - $curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]); |
|
| 196 | - return $curr_timestamp; |
|
| 192 | + $begin_parts = explode(' ', $begin); |
|
| 193 | + $date_parts=explode('-', $begin_parts[0]); |
|
| 194 | + $time_parts=explode(':', $begin_parts[1]); |
|
| 195 | + $curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]); |
|
| 196 | + return $curr_timestamp; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - } |
|
| 200 | - /** |
|
| 201 | - * Get specified date and time for a particalur day, in current user's timezone. |
|
| 202 | - * @param int $days Adjust date by this number of days, negative values are valid. |
|
| 203 | - * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time |
|
| 204 | - */ |
|
| 205 | - function get_db_date($days,$time) { |
|
| 199 | + } |
|
| 200 | + /** |
|
| 201 | + * Get specified date and time for a particalur day, in current user's timezone. |
|
| 202 | + * @param int $days Adjust date by this number of days, negative values are valid. |
|
| 203 | + * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time |
|
| 204 | + */ |
|
| 205 | + function get_db_date($days,$time) { |
|
| 206 | 206 | global $timedate; |
| 207 | 207 | |
| 208 | 208 | $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days)); //gmt date with day adjustment applied. |
| 209 | 209 | //kbrill bug #13884 |
| 210 | 210 | //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
| 211 | - $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 211 | + $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 212 | 212 | |
| 213 | 213 | if ($time=='start') { |
| 214 | 214 | $begin_parts = explode(' ', $begin); |
@@ -225,38 +225,38 @@ discard block |
||
| 225 | 225 | $begin = $timedate->handle_offset($be, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
| 226 | 226 | |
| 227 | 227 | return $begin; |
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * Get filter string for a date field. |
|
| 232 | - * @param array layout_def field def for field being filtered |
|
| 233 | - * @param string $begin start date value (in DB format) |
|
| 234 | - * @param string $end End date value (in DB format) |
|
| 235 | - */ |
|
| 236 | - function get_start_end_date_filter(& $layout_def, $begin,$end) |
|
| 237 | - { |
|
| 238 | - if (isset ($layout_def['rel_field'])) { |
|
| 239 | - $field_name = $this->reporter->db->convert( |
|
| 240 | - $this->reporter->db->convert($this->_get_column_select($layout_def), 'date_format', '%Y-%m-%d'), |
|
| 241 | - "CONCAT", |
|
| 242 | - array("' '", $this->reporter->db->convert($layout_def['rel_field'], 'time_format')) |
|
| 243 | - ); |
|
| 244 | - } else { |
|
| 245 | - $field_name = $this->_get_column_select($layout_def); |
|
| 246 | - } |
|
| 247 | - return $field_name.">=".$this->reporter->db->quoted($begin)." AND ".$field_name."<=".$this->reporter->db->quoted($end)."\n"; |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * Create query for binary operation of field of certain type |
|
| 252 | - * Produces query like: |
|
| 253 | - * arg1 op to_date(arg2), e.g.: |
|
| 254 | - * date_closed < '2009-12-01' |
|
| 255 | - * @param string $arg1 1st arg - column name |
|
| 256 | - * @param string|DateTime $arg2 2nd arg - value to be converted |
|
| 257 | - * @param string $op |
|
| 258 | - * @param string $type |
|
| 259 | - */ |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * Get filter string for a date field. |
|
| 232 | + * @param array layout_def field def for field being filtered |
|
| 233 | + * @param string $begin start date value (in DB format) |
|
| 234 | + * @param string $end End date value (in DB format) |
|
| 235 | + */ |
|
| 236 | + function get_start_end_date_filter(& $layout_def, $begin,$end) |
|
| 237 | + { |
|
| 238 | + if (isset ($layout_def['rel_field'])) { |
|
| 239 | + $field_name = $this->reporter->db->convert( |
|
| 240 | + $this->reporter->db->convert($this->_get_column_select($layout_def), 'date_format', '%Y-%m-%d'), |
|
| 241 | + "CONCAT", |
|
| 242 | + array("' '", $this->reporter->db->convert($layout_def['rel_field'], 'time_format')) |
|
| 243 | + ); |
|
| 244 | + } else { |
|
| 245 | + $field_name = $this->_get_column_select($layout_def); |
|
| 246 | + } |
|
| 247 | + return $field_name.">=".$this->reporter->db->quoted($begin)." AND ".$field_name."<=".$this->reporter->db->quoted($end)."\n"; |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * Create query for binary operation of field of certain type |
|
| 252 | + * Produces query like: |
|
| 253 | + * arg1 op to_date(arg2), e.g.: |
|
| 254 | + * date_closed < '2009-12-01' |
|
| 255 | + * @param string $arg1 1st arg - column name |
|
| 256 | + * @param string|DateTime $arg2 2nd arg - value to be converted |
|
| 257 | + * @param string $op |
|
| 258 | + * @param string $type |
|
| 259 | + */ |
|
| 260 | 260 | protected function queryDateOp($arg1, $arg2, $op, $type) |
| 261 | 261 | { |
| 262 | 262 | global $timedate; |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | return $timedate->tzUser($timedate->getNow(), $this->getAssignedUser()); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - /** |
|
| 279 | + /** |
|
| 280 | 280 | * Create query from the beginning to the end of certain day |
| 281 | 281 | * @param array $layout_def |
| 282 | 282 | * @param SugarDateTime $day |
@@ -288,43 +288,43 @@ discard block |
||
| 288 | 288 | return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - function queryFilterTP_yesterday($layout_def) |
|
| 292 | - { |
|
| 293 | - global $timedate; |
|
| 294 | - return $this->queryDay($layout_def, $this->now()->get("-1 day")); |
|
| 295 | - } |
|
| 291 | + function queryFilterTP_yesterday($layout_def) |
|
| 292 | + { |
|
| 293 | + global $timedate; |
|
| 294 | + return $this->queryDay($layout_def, $this->now()->get("-1 day")); |
|
| 295 | + } |
|
| 296 | 296 | |
| 297 | - function queryFilterTP_today($layout_def) |
|
| 298 | - { |
|
| 299 | - global $timedate; |
|
| 300 | - return $this->queryDay($layout_def, $this->now()); |
|
| 301 | - } |
|
| 297 | + function queryFilterTP_today($layout_def) |
|
| 298 | + { |
|
| 299 | + global $timedate; |
|
| 300 | + return $this->queryDay($layout_def, $this->now()); |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - function queryFilterTP_tomorrow(& $layout_def) |
|
| 304 | - { |
|
| 305 | - global $timedate; |
|
| 306 | - return $this->queryDay($layout_def, $this->now()->get("+1 day")); |
|
| 307 | - } |
|
| 303 | + function queryFilterTP_tomorrow(& $layout_def) |
|
| 304 | + { |
|
| 305 | + global $timedate; |
|
| 306 | + return $this->queryDay($layout_def, $this->now()->get("+1 day")); |
|
| 307 | + } |
|
| 308 | 308 | |
| 309 | - function queryFilterTP_last_7_days($layout_def) |
|
| 310 | - { |
|
| 311 | - global $timedate; |
|
| 309 | + function queryFilterTP_last_7_days($layout_def) |
|
| 310 | + { |
|
| 311 | + global $timedate; |
|
| 312 | 312 | |
| 313 | - $begin = $this->now()->get("-6 days")->get_day_begin(); |
|
| 314 | - $end = $this->now()->get_day_end(); |
|
| 313 | + $begin = $this->now()->get("-6 days")->get_day_begin(); |
|
| 314 | + $end = $this->now()->get_day_end(); |
|
| 315 | 315 | |
| 316 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 317 | - } |
|
| 316 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | - function queryFilterTP_next_7_days($layout_def) |
|
| 320 | - { |
|
| 321 | - global $timedate; |
|
| 319 | + function queryFilterTP_next_7_days($layout_def) |
|
| 320 | + { |
|
| 321 | + global $timedate; |
|
| 322 | 322 | |
| 323 | - $begin = $this->now()->get_day_begin(); |
|
| 324 | - $end = $this->now()->get("+6 days")->get_day_end(); |
|
| 323 | + $begin = $this->now()->get_day_begin(); |
|
| 324 | + $end = $this->now()->get("+6 days")->get_day_end(); |
|
| 325 | 325 | |
| 326 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 327 | - } |
|
| 326 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | 329 | /** |
| 330 | 330 | * Create query from the beginning to the end of certain month |
@@ -335,20 +335,20 @@ discard block |
||
| 335 | 335 | { |
| 336 | 336 | $begin = $month->setTime(0, 0, 0); |
| 337 | 337 | $end = clone($begin); |
| 338 | - $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59); |
|
| 338 | + $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59); |
|
| 339 | 339 | return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | function queryFilterTP_last_month($layout_def) |
| 343 | - { |
|
| 344 | - global $timedate; |
|
| 345 | - $month = $this->now(); |
|
| 346 | - return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1)); |
|
| 347 | - } |
|
| 343 | + { |
|
| 344 | + global $timedate; |
|
| 345 | + $month = $this->now(); |
|
| 346 | + return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1)); |
|
| 347 | + } |
|
| 348 | 348 | |
| 349 | - function queryFilterTP_this_month($layout_def) |
|
| 350 | - { |
|
| 351 | - global $timedate; |
|
| 349 | + function queryFilterTP_this_month($layout_def) |
|
| 350 | + { |
|
| 351 | + global $timedate; |
|
| 352 | 352 | |
| 353 | 353 | //Bug 62414 - take timezone into account when determining current month |
| 354 | 354 | $now = $this->now(); |
@@ -357,30 +357,30 @@ discard block |
||
| 357 | 357 | $now->modify($timezoneOffset); |
| 358 | 358 | |
| 359 | 359 | return $this->queryMonth($layout_def, $now->get_day_by_index_this_month(0)); |
| 360 | - } |
|
| 361 | - |
|
| 362 | - function queryFilterTP_next_month($layout_def) |
|
| 363 | - { |
|
| 364 | - global $timedate; |
|
| 365 | - $month = $this->now(); |
|
| 366 | - return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1)); |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - function queryFilterTP_last_30_days($layout_def) |
|
| 370 | - { |
|
| 371 | - global $timedate; |
|
| 372 | - $begin = $this->now()->get("-29 days")->get_day_begin(); |
|
| 373 | - $end = $this->now()->get_day_end(); |
|
| 374 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - function queryFilterTP_next_30_days($layout_def) |
|
| 378 | - { |
|
| 379 | - global $timedate; |
|
| 380 | - $begin = $this->now()->get_day_begin(); |
|
| 381 | - $end = $this->now()->get("+29 days")->get_day_end(); |
|
| 382 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 383 | - } |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + function queryFilterTP_next_month($layout_def) |
|
| 363 | + { |
|
| 364 | + global $timedate; |
|
| 365 | + $month = $this->now(); |
|
| 366 | + return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1)); |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + function queryFilterTP_last_30_days($layout_def) |
|
| 370 | + { |
|
| 371 | + global $timedate; |
|
| 372 | + $begin = $this->now()->get("-29 days")->get_day_begin(); |
|
| 373 | + $end = $this->now()->get_day_end(); |
|
| 374 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + function queryFilterTP_next_30_days($layout_def) |
|
| 378 | + { |
|
| 379 | + global $timedate; |
|
| 380 | + $begin = $this->now()->get_day_begin(); |
|
| 381 | + $end = $this->now()->get("+29 days")->get_day_end(); |
|
| 382 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 383 | + } |
|
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * Return the between WHERE query for Quarter filter |
@@ -453,59 +453,59 @@ discard block |
||
| 453 | 453 | return $this->getQuarterFilter($layout_def, '+3 month'); |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | - function queryFilterTP_last_year($layout_def) |
|
| 457 | - { |
|
| 458 | - global $timedate; |
|
| 459 | - $begin = $this->now(); |
|
| 460 | - $begin->setDate($begin->year-1, 1, 1)->setTime(0, 0); |
|
| 461 | - $end = clone $begin; |
|
| 462 | - $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
| 463 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 464 | - } |
|
| 465 | - |
|
| 466 | - function queryFilterTP_this_year($layout_def) |
|
| 467 | - { |
|
| 468 | - global $timedate; |
|
| 469 | - $begin = $this->now(); |
|
| 470 | - $begin->setDate($begin->year, 1, 1)->setTime(0, 0); |
|
| 471 | - $end = clone $begin; |
|
| 472 | - $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
| 473 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 474 | - } |
|
| 475 | - |
|
| 476 | - function queryFilterTP_next_year(& $layout_def) |
|
| 477 | - { |
|
| 478 | - global $timedate; |
|
| 479 | - $begin = $this->now(); |
|
| 480 | - $begin->setDate($begin->year+1, 1, 1)->setTime(0, 0); |
|
| 481 | - $end = clone $begin; |
|
| 482 | - $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
| 483 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - function queryGroupBy($layout_def) |
|
| 487 | - { |
|
| 488 | - // i guess qualifier and column_function are the same.. |
|
| 489 | - if (!empty ($layout_def['qualifier'])) { |
|
| 490 | - $func_name = 'queryGroupBy'.$layout_def['qualifier']; |
|
| 491 | - if (method_exists($this, $func_name)) { |
|
| 492 | - return $this-> $func_name ($layout_def)." \n"; |
|
| 493 | - } |
|
| 494 | - } |
|
| 495 | - return parent :: queryGroupBy($layout_def)." \n"; |
|
| 496 | - } |
|
| 497 | - |
|
| 498 | - function queryOrderBy($layout_def) |
|
| 499 | - { |
|
| 456 | + function queryFilterTP_last_year($layout_def) |
|
| 457 | + { |
|
| 458 | + global $timedate; |
|
| 459 | + $begin = $this->now(); |
|
| 460 | + $begin->setDate($begin->year-1, 1, 1)->setTime(0, 0); |
|
| 461 | + $end = clone $begin; |
|
| 462 | + $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
| 463 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 464 | + } |
|
| 465 | + |
|
| 466 | + function queryFilterTP_this_year($layout_def) |
|
| 467 | + { |
|
| 468 | + global $timedate; |
|
| 469 | + $begin = $this->now(); |
|
| 470 | + $begin->setDate($begin->year, 1, 1)->setTime(0, 0); |
|
| 471 | + $end = clone $begin; |
|
| 472 | + $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
| 473 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 474 | + } |
|
| 475 | + |
|
| 476 | + function queryFilterTP_next_year(& $layout_def) |
|
| 477 | + { |
|
| 478 | + global $timedate; |
|
| 479 | + $begin = $this->now(); |
|
| 480 | + $begin->setDate($begin->year+1, 1, 1)->setTime(0, 0); |
|
| 481 | + $end = clone $begin; |
|
| 482 | + $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
|
| 483 | + return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + function queryGroupBy($layout_def) |
|
| 487 | + { |
|
| 488 | + // i guess qualifier and column_function are the same.. |
|
| 500 | 489 | if (!empty ($layout_def['qualifier'])) { |
| 501 | - $func_name ='queryOrderBy'.$layout_def['qualifier']; |
|
| 502 | - if (method_exists($this, $func_name)) { |
|
| 503 | - return $this-> $func_name ($layout_def)."\n"; |
|
| 504 | - } |
|
| 505 | - } |
|
| 506 | - $order_by = parent :: queryOrderBy($layout_def)."\n"; |
|
| 507 | - return $order_by; |
|
| 508 | - } |
|
| 490 | + $func_name = 'queryGroupBy'.$layout_def['qualifier']; |
|
| 491 | + if (method_exists($this, $func_name)) { |
|
| 492 | + return $this-> $func_name ($layout_def)." \n"; |
|
| 493 | + } |
|
| 494 | + } |
|
| 495 | + return parent :: queryGroupBy($layout_def)." \n"; |
|
| 496 | + } |
|
| 497 | + |
|
| 498 | + function queryOrderBy($layout_def) |
|
| 499 | + { |
|
| 500 | + if (!empty ($layout_def['qualifier'])) { |
|
| 501 | + $func_name ='queryOrderBy'.$layout_def['qualifier']; |
|
| 502 | + if (method_exists($this, $func_name)) { |
|
| 503 | + return $this-> $func_name ($layout_def)."\n"; |
|
| 504 | + } |
|
| 505 | + } |
|
| 506 | + $order_by = parent :: queryOrderBy($layout_def)."\n"; |
|
| 507 | + return $order_by; |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | 510 | function displayListPlain($layout_def) { |
| 511 | 511 | global $timedate; |
@@ -551,39 +551,39 @@ discard block |
||
| 551 | 551 | return $timedate->to_display_date_time($content); |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - function querySelect(& $layout_def) { |
|
| 555 | - // i guess qualifier and column_function are the same.. |
|
| 556 | - if (!empty ($layout_def['column_function'])) { |
|
| 557 | - $func_name = 'querySelect'.$layout_def['column_function']; |
|
| 558 | - if (method_exists($this, $func_name)) { |
|
| 559 | - return $this-> $func_name ($layout_def)." \n"; |
|
| 560 | - } |
|
| 561 | - } |
|
| 562 | - return parent :: querySelect($layout_def)." \n"; |
|
| 563 | - } |
|
| 564 | - function & displayListday(& $layout_def) { |
|
| 554 | + function querySelect(& $layout_def) { |
|
| 555 | + // i guess qualifier and column_function are the same.. |
|
| 556 | + if (!empty ($layout_def['column_function'])) { |
|
| 557 | + $func_name = 'querySelect'.$layout_def['column_function']; |
|
| 558 | + if (method_exists($this, $func_name)) { |
|
| 559 | + return $this-> $func_name ($layout_def)." \n"; |
|
| 560 | + } |
|
| 561 | + } |
|
| 562 | + return parent :: querySelect($layout_def)." \n"; |
|
| 563 | + } |
|
| 564 | + function & displayListday(& $layout_def) { |
|
| 565 | 565 | $value = parent:: displayListPlain($layout_def); |
| 566 | 566 | return $value; |
| 567 | - } |
|
| 568 | - |
|
| 569 | - function & displayListyear(& $layout_def) { |
|
| 570 | - global $app_list_strings; |
|
| 571 | - $value = parent:: displayListPlain($layout_def); |
|
| 572 | - return $value; |
|
| 573 | - } |
|
| 574 | - |
|
| 575 | - function displayListmonth($layout_def) |
|
| 576 | - { |
|
| 577 | - global $app_list_strings; |
|
| 578 | - $display = ''; |
|
| 579 | - $match = array(); |
|
| 567 | + } |
|
| 568 | + |
|
| 569 | + function & displayListyear(& $layout_def) { |
|
| 570 | + global $app_list_strings; |
|
| 571 | + $value = parent:: displayListPlain($layout_def); |
|
| 572 | + return $value; |
|
| 573 | + } |
|
| 574 | + |
|
| 575 | + function displayListmonth($layout_def) |
|
| 576 | + { |
|
| 577 | + global $app_list_strings; |
|
| 578 | + $display = ''; |
|
| 579 | + $match = array(); |
|
| 580 | 580 | if (preg_match('/(\d{4})-(\d\d)/', $this->displayListPlain($layout_def), $match)) { |
| 581 | - $match[2] = preg_replace('/^0/', '', $match[2]); |
|
| 582 | - $display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}"; |
|
| 583 | - } |
|
| 584 | - return $display; |
|
| 581 | + $match[2] = preg_replace('/^0/', '', $match[2]); |
|
| 582 | + $display = $app_list_strings['dom_cal_month_long'][$match[2]]." {$match[1]}"; |
|
| 583 | + } |
|
| 584 | + return $display; |
|
| 585 | 585 | |
| 586 | - } |
|
| 586 | + } |
|
| 587 | 587 | |
| 588 | 588 | /** |
| 589 | 589 | * Returns part of query for select |
@@ -706,32 +706,32 @@ discard block |
||
| 706 | 706 | return $this->reporter->db->convert($return, "date_format", array('%Y')) . "\n"; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - function querySelectquarter($layout_def) |
|
| 710 | - { |
|
| 711 | - $column = $this->_get_column_select($layout_def); |
|
| 712 | - return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
| 713 | - 'CONCAT', |
|
| 714 | - array("'-'", $this->reporter->db->convert($column, "quarter"))) |
|
| 715 | - ." ".$this->_get_column_alias($layout_def)."\n"; |
|
| 716 | - } |
|
| 709 | + function querySelectquarter($layout_def) |
|
| 710 | + { |
|
| 711 | + $column = $this->_get_column_select($layout_def); |
|
| 712 | + return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
| 713 | + 'CONCAT', |
|
| 714 | + array("'-'", $this->reporter->db->convert($column, "quarter"))) |
|
| 715 | + ." ".$this->_get_column_alias($layout_def)."\n"; |
|
| 716 | + } |
|
| 717 | 717 | |
| 718 | - function displayListquarter(& $layout_def) { |
|
| 719 | - $match = array(); |
|
| 718 | + function displayListquarter(& $layout_def) { |
|
| 719 | + $match = array(); |
|
| 720 | 720 | if (preg_match('/(\d{4})-(\d)/', $this->displayListPlain($layout_def), $match)) { |
| 721 | - return "Q".$match[2]." ".$match[1]; |
|
| 722 | - } |
|
| 723 | - return ''; |
|
| 721 | + return "Q".$match[2]." ".$match[1]; |
|
| 722 | + } |
|
| 723 | + return ''; |
|
| 724 | 724 | |
| 725 | - } |
|
| 725 | + } |
|
| 726 | 726 | |
| 727 | - function queryGroupByQuarter($layout_def) |
|
| 728 | - { |
|
| 729 | - $this->getReporter(); |
|
| 727 | + function queryGroupByQuarter($layout_def) |
|
| 728 | + { |
|
| 729 | + $this->getReporter(); |
|
| 730 | 730 | $column = $this->_get_column_select($layout_def); |
| 731 | - return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
| 732 | - 'CONCAT', |
|
| 733 | - array("'-'", $this->reporter->db->convert($column, "quarter"))); |
|
| 734 | - } |
|
| 731 | + return $this->reporter->db->convert($this->reporter->db->convert($column, "date_format", array('%Y')), |
|
| 732 | + 'CONCAT', |
|
| 733 | + array("'-'", $this->reporter->db->convert($column, "quarter"))); |
|
| 734 | + } |
|
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * For oracle we have to return order by string like group by string instead of return field alias |
@@ -760,23 +760,23 @@ discard block |
||
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | function displayInput(&$layout_def) { |
| 763 | - global $timedate, $current_language, $app_strings; |
|
| 763 | + global $timedate, $current_language, $app_strings; |
|
| 764 | 764 | $home_mod_strings = return_module_language($current_language, 'Home'); |
| 765 | 765 | $filterTypes = array(' ' => $app_strings['LBL_NONE'], |
| 766 | - 'TP_today' => $home_mod_strings['LBL_TODAY'], |
|
| 767 | - 'TP_yesterday' => $home_mod_strings['LBL_YESTERDAY'], |
|
| 768 | - 'TP_tomorrow' => $home_mod_strings['LBL_TOMORROW'], |
|
| 769 | - 'TP_this_month' => $home_mod_strings['LBL_THIS_MONTH'], |
|
| 770 | - 'TP_this_year' => $home_mod_strings['LBL_THIS_YEAR'], |
|
| 771 | - 'TP_last_30_days' => $home_mod_strings['LBL_LAST_30_DAYS'], |
|
| 772 | - 'TP_last_7_days' => $home_mod_strings['LBL_LAST_7_DAYS'], |
|
| 773 | - 'TP_last_month' => $home_mod_strings['LBL_LAST_MONTH'], |
|
| 774 | - 'TP_last_year' => $home_mod_strings['LBL_LAST_YEAR'], |
|
| 775 | - 'TP_next_30_days' => $home_mod_strings['LBL_NEXT_30_DAYS'], |
|
| 776 | - 'TP_next_7_days' => $home_mod_strings['LBL_NEXT_7_DAYS'], |
|
| 777 | - 'TP_next_month' => $home_mod_strings['LBL_NEXT_MONTH'], |
|
| 778 | - 'TP_next_year' => $home_mod_strings['LBL_NEXT_YEAR'], |
|
| 779 | - ); |
|
| 766 | + 'TP_today' => $home_mod_strings['LBL_TODAY'], |
|
| 767 | + 'TP_yesterday' => $home_mod_strings['LBL_YESTERDAY'], |
|
| 768 | + 'TP_tomorrow' => $home_mod_strings['LBL_TOMORROW'], |
|
| 769 | + 'TP_this_month' => $home_mod_strings['LBL_THIS_MONTH'], |
|
| 770 | + 'TP_this_year' => $home_mod_strings['LBL_THIS_YEAR'], |
|
| 771 | + 'TP_last_30_days' => $home_mod_strings['LBL_LAST_30_DAYS'], |
|
| 772 | + 'TP_last_7_days' => $home_mod_strings['LBL_LAST_7_DAYS'], |
|
| 773 | + 'TP_last_month' => $home_mod_strings['LBL_LAST_MONTH'], |
|
| 774 | + 'TP_last_year' => $home_mod_strings['LBL_LAST_YEAR'], |
|
| 775 | + 'TP_next_30_days' => $home_mod_strings['LBL_NEXT_30_DAYS'], |
|
| 776 | + 'TP_next_7_days' => $home_mod_strings['LBL_NEXT_7_DAYS'], |
|
| 777 | + 'TP_next_month' => $home_mod_strings['LBL_NEXT_MONTH'], |
|
| 778 | + 'TP_next_year' => $home_mod_strings['LBL_NEXT_YEAR'], |
|
| 779 | + ); |
|
| 780 | 780 | |
| 781 | 781 | $cal_dateformat = $timedate->get_cal_date_format(); |
| 782 | 782 | $str = "<select name='type_{$layout_def['name']}'>"; |
@@ -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. |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | class SugarWidgetFieldDateTime extends SugarWidgetReportField |
| 45 | 45 | { |
| 46 | 46 | var $reporter; |
| 47 | - var $assigned_user=null; |
|
| 47 | + var $assigned_user = null; |
|
| 48 | 48 | |
| 49 | 49 | function SugarWidgetFieldDateTime($layout_manager) |
| 50 | 50 | { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $report_def_str = $json_obj->decode($this->reporter->report_def_str); |
| 68 | 68 | |
| 69 | - if(empty($report_def_str['assigned_user_id'])) return null; |
|
| 69 | + if (empty($report_def_str['assigned_user_id'])) return null; |
|
| 70 | 70 | |
| 71 | 71 | $this->assigned_user = new User(); |
| 72 | 72 | $this->assigned_user->retrieve($report_def_str['assigned_user_id']); |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | protected function expandDate($date, $end = false) |
| 112 | 112 | { |
| 113 | 113 | global $timedate; |
| 114 | - if($this->hasTime($date)) { |
|
| 114 | + if ($this->hasTime($date)) { |
|
| 115 | 115 | return $date; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | //C.L. Bug 48616 - If the $date is set to the Today macro, then adjust accordingly |
| 119 | - if(strtolower($date) == 'today') |
|
| 119 | + if (strtolower($date) == 'today') |
|
| 120 | 120 | { |
| 121 | 121 | $startEnd = $timedate->getDayStartEndGMT($timedate->getNow(true)); |
| 122 | 122 | return $end ? $startEnd['end'] : $startEnd['start']; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $date = $timedate->tzUser(new SugarDateTime()); |
| 127 | 127 | $date->setDate($parsed->year, $parsed->month, $parsed->day); |
| 128 | 128 | |
| 129 | - if($end) { |
|
| 129 | + if ($end) { |
|
| 130 | 130 | return $date->setTime(23, 59, 59); |
| 131 | 131 | } else { |
| 132 | 132 | return $date->setTime(0, 0, 0); |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | $column = $this->_get_column_select($layout_def); |
| 162 | 162 | $begin = $layout_def['input_name0']; |
| 163 | 163 | $hasTime = $this->hasTime($begin); |
| 164 | - if(!$hasTime){ |
|
| 164 | + if (!$hasTime) { |
|
| 165 | 165 | $end = $this->expandDate($begin, true); |
| 166 | 166 | $begin = $this->expandDate($begin); |
| 167 | 167 | $cond = $this->queryDateOp($column, $begin, "<", "datetime")." OR ". |
| 168 | 168 | $this->queryDateOp($column, $end, ">", "datetime"); |
| 169 | 169 | } else { |
| 170 | - $cond = $this->queryDateOp($column, $begin, "!=", "datetime"); |
|
| 170 | + $cond = $this->queryDateOp($column, $begin, "!=", "datetime"); |
|
| 171 | 171 | } |
| 172 | 172 | return "($column IS NULL OR $cond)"; |
| 173 | 173 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * Get assigned or logged in user's current date and time value. |
| 177 | 177 | * @param boolean $timestamp Format of return value, if set to true, return unix like timestamp , else a formatted date. |
| 178 | 178 | */ |
| 179 | - function get_users_current_date_time($timestamp=false) |
|
| 179 | + function get_users_current_date_time($timestamp = false) |
|
| 180 | 180 | { |
| 181 | 181 | global $current_user; |
| 182 | 182 | global $timedate; |
@@ -190,9 +190,9 @@ discard block |
||
| 190 | 190 | return $begin; |
| 191 | 191 | } else { |
| 192 | 192 | $begin_parts = explode(' ', $begin); |
| 193 | - $date_parts=explode('-', $begin_parts[0]); |
|
| 194 | - $time_parts=explode(':', $begin_parts[1]); |
|
| 195 | - $curr_timestamp=mktime($time_parts[0],$time_parts[1],0,$date_parts[1], $date_parts[2],$date_parts[0]); |
|
| 193 | + $date_parts = explode('-', $begin_parts[0]); |
|
| 194 | + $time_parts = explode(':', $begin_parts[1]); |
|
| 195 | + $curr_timestamp = mktime($time_parts[0], $time_parts[1], 0, $date_parts[1], $date_parts[2], $date_parts[0]); |
|
| 196 | 196 | return $curr_timestamp; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -202,23 +202,23 @@ discard block |
||
| 202 | 202 | * @param int $days Adjust date by this number of days, negative values are valid. |
| 203 | 203 | * @param time string falg for desired time value, start: minimum time, end: maximum time, default: current time |
| 204 | 204 | */ |
| 205 | - function get_db_date($days,$time) { |
|
| 205 | + function get_db_date($days, $time) { |
|
| 206 | 206 | global $timedate; |
| 207 | 207 | |
| 208 | - $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time()+(86400 * $days)); //gmt date with day adjustment applied. |
|
| 208 | + $begin = date($GLOBALS['timedate']->get_db_date_time_format(), time() + (86400 * $days)); //gmt date with day adjustment applied. |
|
| 209 | 209 | //kbrill bug #13884 |
| 210 | 210 | //$begin = $timedate->to_display_date_time($begin,true,true,$this->assigned_user); |
| 211 | 211 | $begin = $timedate->handle_offset($begin, $timedate->get_db_date_time_format(), false, $this->assigned_user); |
| 212 | 212 | |
| 213 | - if ($time=='start') { |
|
| 213 | + if ($time == 'start') { |
|
| 214 | 214 | $begin_parts = explode(' ', $begin); |
| 215 | - $be = $begin_parts[0] . ' 00:00:00'; |
|
| 215 | + $be = $begin_parts[0].' 00:00:00'; |
|
| 216 | 216 | } |
| 217 | - else if ($time=='end') { |
|
| 217 | + else if ($time == 'end') { |
|
| 218 | 218 | $begin_parts = explode(' ', $begin); |
| 219 | - $be = $begin_parts[0] . ' 23:59:59'; |
|
| 219 | + $be = $begin_parts[0].' 23:59:59'; |
|
| 220 | 220 | } else { |
| 221 | - $be=$begin; |
|
| 221 | + $be = $begin; |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | //convert date to db format without converting to GMT. |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @param string $begin start date value (in DB format) |
| 234 | 234 | * @param string $end End date value (in DB format) |
| 235 | 235 | */ |
| 236 | - function get_start_end_date_filter(& $layout_def, $begin,$end) |
|
| 236 | + function get_start_end_date_filter(& $layout_def, $begin, $end) |
|
| 237 | 237 | { |
| 238 | 238 | if (isset ($layout_def['rel_field'])) { |
| 239 | 239 | $field_name = $this->reporter->db->convert( |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | protected function queryDateOp($arg1, $arg2, $op, $type) |
| 261 | 261 | { |
| 262 | 262 | global $timedate; |
| 263 | - if($arg2 instanceof DateTime) { |
|
| 263 | + if ($arg2 instanceof DateTime) { |
|
| 264 | 264 | $arg2 = $timedate->asDbType($arg2, $type); |
| 265 | 265 | } |
| 266 | 266 | return "$arg1 $op ".$this->reporter->db->convert($this->reporter->db->quoted($arg2), $type)."\n"; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | { |
| 286 | 286 | $begin = $day->get_day_begin(); |
| 287 | 287 | $end = $day->get_day_end(); |
| 288 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 288 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | function queryFilterTP_yesterday($layout_def) |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $begin = $this->now()->get("-6 days")->get_day_begin(); |
| 314 | 314 | $end = $this->now()->get_day_end(); |
| 315 | 315 | |
| 316 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 316 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | function queryFilterTP_next_7_days($layout_def) |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $begin = $this->now()->get_day_begin(); |
| 324 | 324 | $end = $this->now()->get("+6 days")->get_day_end(); |
| 325 | 325 | |
| 326 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 326 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -336,14 +336,14 @@ discard block |
||
| 336 | 336 | $begin = $month->setTime(0, 0, 0); |
| 337 | 337 | $end = clone($begin); |
| 338 | 338 | $end->setDate($begin->year, $begin->month, $begin->days_in_month)->setTime(23, 59, 59); |
| 339 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 339 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | function queryFilterTP_last_month($layout_def) |
| 343 | 343 | { |
| 344 | 344 | global $timedate; |
| 345 | 345 | $month = $this->now(); |
| 346 | - return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month-1, 1)); |
|
| 346 | + return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month - 1, 1)); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | function queryFilterTP_this_month($layout_def) |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | { |
| 364 | 364 | global $timedate; |
| 365 | 365 | $month = $this->now(); |
| 366 | - return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month+1, 1)); |
|
| 366 | + return $this->queryMonth($layout_def, $month->setDate($month->year, $month->month + 1, 1)); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | function queryFilterTP_last_30_days($layout_def) |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | global $timedate; |
| 372 | 372 | $begin = $this->now()->get("-29 days")->get_day_begin(); |
| 373 | 373 | $end = $this->now()->get_day_end(); |
| 374 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 374 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | function queryFilterTP_next_30_days($layout_def) |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | global $timedate; |
| 380 | 380 | $begin = $this->now()->get_day_begin(); |
| 381 | 381 | $end = $this->now()->get("+29 days")->get_day_end(); |
| 382 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 382 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /** |
@@ -457,10 +457,10 @@ discard block |
||
| 457 | 457 | { |
| 458 | 458 | global $timedate; |
| 459 | 459 | $begin = $this->now(); |
| 460 | - $begin->setDate($begin->year-1, 1, 1)->setTime(0, 0); |
|
| 460 | + $begin->setDate($begin->year - 1, 1, 1)->setTime(0, 0); |
|
| 461 | 461 | $end = clone $begin; |
| 462 | 462 | $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
| 463 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 463 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | function queryFilterTP_this_year($layout_def) |
@@ -470,17 +470,17 @@ discard block |
||
| 470 | 470 | $begin->setDate($begin->year, 1, 1)->setTime(0, 0); |
| 471 | 471 | $end = clone $begin; |
| 472 | 472 | $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
| 473 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 473 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | function queryFilterTP_next_year(& $layout_def) |
| 477 | 477 | { |
| 478 | 478 | global $timedate; |
| 479 | 479 | $begin = $this->now(); |
| 480 | - $begin->setDate($begin->year+1, 1, 1)->setTime(0, 0); |
|
| 480 | + $begin->setDate($begin->year + 1, 1, 1)->setTime(0, 0); |
|
| 481 | 481 | $end = clone $begin; |
| 482 | 482 | $end->setDate($end->year, 12, 31)->setTime(23, 59, 59); |
| 483 | - return $this->get_start_end_date_filter($layout_def,$begin->asDb(),$end->asDb()); |
|
| 483 | + return $this->get_start_end_date_filter($layout_def, $begin->asDb(), $end->asDb()); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | function queryGroupBy($layout_def) |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | if (!empty ($layout_def['qualifier'])) { |
| 490 | 490 | $func_name = 'queryGroupBy'.$layout_def['qualifier']; |
| 491 | 491 | if (method_exists($this, $func_name)) { |
| 492 | - return $this-> $func_name ($layout_def)." \n"; |
|
| 492 | + return $this-> $func_name($layout_def)." \n"; |
|
| 493 | 493 | } |
| 494 | 494 | } |
| 495 | 495 | return parent :: queryGroupBy($layout_def)." \n"; |
@@ -498,9 +498,9 @@ discard block |
||
| 498 | 498 | function queryOrderBy($layout_def) |
| 499 | 499 | { |
| 500 | 500 | if (!empty ($layout_def['qualifier'])) { |
| 501 | - $func_name ='queryOrderBy'.$layout_def['qualifier']; |
|
| 501 | + $func_name = 'queryOrderBy'.$layout_def['qualifier']; |
|
| 502 | 502 | if (method_exists($this, $func_name)) { |
| 503 | - return $this-> $func_name ($layout_def)."\n"; |
|
| 503 | + return $this-> $func_name($layout_def)."\n"; |
|
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | $order_by = parent :: queryOrderBy($layout_def)."\n"; |
@@ -511,15 +511,15 @@ discard block |
||
| 511 | 511 | global $timedate; |
| 512 | 512 | $content = parent:: displayListPlain($layout_def); |
| 513 | 513 | // awu: this if condition happens only in Reports where group by month comes back as YYYY-mm format |
| 514 | - if (count(explode('-',$content)) == 2){ |
|
| 514 | + if (count(explode('-', $content)) == 2) { |
|
| 515 | 515 | return $content; |
| 516 | 516 | // if date field |
| 517 | - }elseif(substr_count($layout_def['type'], 'date') > 0){ |
|
| 517 | + }elseif (substr_count($layout_def['type'], 'date') > 0) { |
|
| 518 | 518 | // if date time field |
| 519 | - if(substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content)!= false){ |
|
| 519 | + if (substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content) != false) { |
|
| 520 | 520 | $td = $timedate->to_display_date_time($content); |
| 521 | 521 | return $td; |
| 522 | - }else{// if date only field |
|
| 522 | + } else {// if date only field |
|
| 523 | 523 | $td = $timedate->to_display_date($content, false); // Avoid PHP notice of returning by reference. |
| 524 | 524 | return $td; |
| 525 | 525 | } |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | { |
| 531 | 531 | global $timedate; |
| 532 | 532 | |
| 533 | - $date_parts=$timedate->split_date_time($date_time_value); |
|
| 533 | + $date_parts = $timedate->split_date_time($date_time_value); |
|
| 534 | 534 | if (count($date_parts) > 1) { |
| 535 | 535 | return $date_parts[1]; |
| 536 | 536 | } else { |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | if (!empty ($layout_def['column_function'])) { |
| 545 | 545 | $func_name = 'displayList'.$layout_def['column_function']; |
| 546 | 546 | if (method_exists($this, $func_name)) { |
| 547 | - return $this-> $func_name ($layout_def); |
|
| 547 | + return $this-> $func_name($layout_def); |
|
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | $content = parent :: displayListPlain($layout_def); |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | if (!empty ($layout_def['column_function'])) { |
| 557 | 557 | $func_name = 'querySelect'.$layout_def['column_function']; |
| 558 | 558 | if (method_exists($this, $func_name)) { |
| 559 | - return $this-> $func_name ($layout_def)." \n"; |
|
| 559 | + return $this-> $func_name($layout_def)." \n"; |
|
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | 562 | return parent :: querySelect($layout_def)." \n"; |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | { |
| 599 | 599 | $return = $this->reporter->db->convert($return, 'add_tz_offset'); |
| 600 | 600 | } |
| 601 | - return $this->reporter->db->convert($return, "date_format", array('%Y-%m')) . ' ' . $this->_get_column_alias($layout_def) . "\n"; |
|
| 601 | + return $this->reporter->db->convert($return, "date_format", array('%Y-%m')).' '.$this->_get_column_alias($layout_def)."\n"; |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | { |
| 615 | 615 | $return = $this->reporter->db->convert($return, 'add_tz_offset'); |
| 616 | 616 | } |
| 617 | - return $this->reporter->db->convert($return, "date_format", array('%Y-%m')) . "\n"; |
|
| 617 | + return $this->reporter->db->convert($return, "date_format", array('%Y-%m'))."\n"; |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | /** |
@@ -634,11 +634,11 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
| 636 | 636 | { |
| 637 | - return $orderBy . " ASC\n"; |
|
| 637 | + return $orderBy." ASC\n"; |
|
| 638 | 638 | } |
| 639 | 639 | else |
| 640 | 640 | { |
| 641 | - return $orderBy . " DESC\n"; |
|
| 641 | + return $orderBy." DESC\n"; |
|
| 642 | 642 | } |
| 643 | 643 | } |
| 644 | 644 | |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | { |
| 656 | 656 | $return = $this->reporter->db->convert($return, 'add_tz_offset'); |
| 657 | 657 | } |
| 658 | - return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d')) . ' ' . $this->_get_column_alias($layout_def) . "\n"; |
|
| 658 | + return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d')).' '.$this->_get_column_alias($layout_def)."\n"; |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | 661 | /** |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | { |
| 672 | 672 | $return = $this->reporter->db->convert($return, 'add_tz_offset'); |
| 673 | 673 | } |
| 674 | - return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d')) . "\n"; |
|
| 674 | + return $this->reporter->db->convert($return, "date_format", array('%Y-%m-%d'))."\n"; |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | /** |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | { |
| 688 | 688 | $return = $this->reporter->db->convert($return, 'add_tz_offset'); |
| 689 | 689 | } |
| 690 | - return $this->reporter->db->convert($return, "date_format", array('%Y')) . ' ' . $this->_get_column_alias($layout_def) . "\n"; |
|
| 690 | + return $this->reporter->db->convert($return, "date_format", array('%Y')).' '.$this->_get_column_alias($layout_def)."\n"; |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | /** |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | { |
| 704 | 704 | $return = $this->reporter->db->convert($return, 'add_tz_offset'); |
| 705 | 705 | } |
| 706 | - return $this->reporter->db->convert($return, "date_format", array('%Y')) . "\n"; |
|
| 706 | + return $this->reporter->db->convert($return, "date_format", array('%Y'))."\n"; |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | function querySelectquarter($layout_def) |
@@ -751,11 +751,11 @@ discard block |
||
| 751 | 751 | |
| 752 | 752 | if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
| 753 | 753 | { |
| 754 | - return $orderBy . " ASC\n"; |
|
| 754 | + return $orderBy." ASC\n"; |
|
| 755 | 755 | } |
| 756 | 756 | else |
| 757 | 757 | { |
| 758 | - return $orderBy . " DESC\n"; |
|
| 758 | + return $orderBy." DESC\n"; |
|
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -66,7 +68,9 @@ discard block |
||
| 66 | 68 | |
| 67 | 69 | $report_def_str = $json_obj->decode($this->reporter->report_def_str); |
| 68 | 70 | |
| 69 | - if(empty($report_def_str['assigned_user_id'])) return null; |
|
| 71 | + if(empty($report_def_str['assigned_user_id'])) { |
|
| 72 | + return null; |
|
| 73 | + } |
|
| 70 | 74 | |
| 71 | 75 | $this->assigned_user = new User(); |
| 72 | 76 | $this->assigned_user->retrieve($report_def_str['assigned_user_id']); |
@@ -213,8 +217,7 @@ discard block |
||
| 213 | 217 | if ($time=='start') { |
| 214 | 218 | $begin_parts = explode(' ', $begin); |
| 215 | 219 | $be = $begin_parts[0] . ' 00:00:00'; |
| 216 | - } |
|
| 217 | - else if ($time=='end') { |
|
| 220 | + } else if ($time=='end') { |
|
| 218 | 221 | $begin_parts = explode(' ', $begin); |
| 219 | 222 | $be = $begin_parts[0] . ' 23:59:59'; |
| 220 | 223 | } else { |
@@ -514,12 +517,12 @@ discard block |
||
| 514 | 517 | if (count(explode('-',$content)) == 2){ |
| 515 | 518 | return $content; |
| 516 | 519 | // if date field |
| 517 | - }elseif(substr_count($layout_def['type'], 'date') > 0){ |
|
| 520 | + } elseif(substr_count($layout_def['type'], 'date') > 0){ |
|
| 518 | 521 | // if date time field |
| 519 | 522 | if(substr_count($layout_def['type'], 'time') > 0 && $this->get_time_part($content)!= false){ |
| 520 | 523 | $td = $timedate->to_display_date_time($content); |
| 521 | 524 | return $td; |
| 522 | - }else{// if date only field |
|
| 525 | + } else{// if date only field |
|
| 523 | 526 | $td = $timedate->to_display_date($content, false); // Avoid PHP notice of returning by reference. |
| 524 | 527 | return $td; |
| 525 | 528 | } |
@@ -635,8 +638,7 @@ discard block |
||
| 635 | 638 | if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
| 636 | 639 | { |
| 637 | 640 | return $orderBy . " ASC\n"; |
| 638 | - } |
|
| 639 | - else |
|
| 641 | + } else |
|
| 640 | 642 | { |
| 641 | 643 | return $orderBy . " DESC\n"; |
| 642 | 644 | } |
@@ -752,8 +754,7 @@ discard block |
||
| 752 | 754 | if (empty($layout_def['sort_dir']) || $layout_def['sort_dir'] == 'a') |
| 753 | 755 | { |
| 754 | 756 | return $orderBy . " ASC\n"; |
| 755 | - } |
|
| 756 | - else |
|
| 757 | + } else |
|
| 757 | 758 | { |
| 758 | 759 | return $orderBy . " DESC\n"; |
| 759 | 760 | } |
@@ -42,28 +42,28 @@ |
||
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | class SugarWidgetFieldDateTimecombo extends SugarWidgetFieldDateTime { |
| 45 | - var $reporter; |
|
| 46 | - var $assigned_user=null; |
|
| 45 | + var $reporter; |
|
| 46 | + var $assigned_user=null; |
|
| 47 | 47 | |
| 48 | 48 | function SugarWidgetFieldDateTimecombo(&$layout_manager) { |
| 49 | 49 | parent::SugarWidgetFieldDateTime($layout_manager); |
| 50 | 50 | $this->reporter = $this->layout_manager->getAttribute('reporter'); |
| 51 | 51 | } |
| 52 | - //TODO:now for date time field , we just search from date start to date end. The time is from 00:00:00 to 23:59:59 |
|
| 53 | - //If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function |
|
| 54 | - function queryFilterBetween_Datetimes(& $layout_def) { |
|
| 55 | - global $timedate; |
|
| 56 | - if($this->getAssignedUser()) { |
|
| 57 | - $begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 58 | - $end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 59 | - } |
|
| 60 | - else { |
|
| 61 | - $begin = $layout_def['input_name0']; |
|
| 62 | - $end = $layout_def['input_name1']; |
|
| 63 | - } |
|
| 64 | - return "(".$this->_get_column_select($layout_def).">=".$this->reporter->db->convert($this->reporter->db->quoted($begin), "datetime"). |
|
| 65 | - " AND\n ".$this->_get_column_select($layout_def)."<=".$this->reporter->db->convert($this->reporter->db->quoted($end), "datetime"). |
|
| 66 | - ")\n"; |
|
| 67 | - } |
|
| 52 | + //TODO:now for date time field , we just search from date start to date end. The time is from 00:00:00 to 23:59:59 |
|
| 53 | + //If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function |
|
| 54 | + function queryFilterBetween_Datetimes(& $layout_def) { |
|
| 55 | + global $timedate; |
|
| 56 | + if($this->getAssignedUser()) { |
|
| 57 | + $begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 58 | + $end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
|
| 59 | + } |
|
| 60 | + else { |
|
| 61 | + $begin = $layout_def['input_name0']; |
|
| 62 | + $end = $layout_def['input_name1']; |
|
| 63 | + } |
|
| 64 | + return "(".$this->_get_column_select($layout_def).">=".$this->reporter->db->convert($this->reporter->db->quoted($begin), "datetime"). |
|
| 65 | + " AND\n ".$this->_get_column_select($layout_def)."<=".$this->reporter->db->convert($this->reporter->db->quoted($end), "datetime"). |
|
| 66 | + ")\n"; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | 69 | } |
@@ -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. |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | class SugarWidgetFieldDateTimecombo extends SugarWidgetFieldDateTime { |
| 45 | 45 | var $reporter; |
| 46 | - var $assigned_user=null; |
|
| 46 | + var $assigned_user = null; |
|
| 47 | 47 | |
| 48 | 48 | function SugarWidgetFieldDateTimecombo(&$layout_manager) { |
| 49 | 49 | parent::SugarWidgetFieldDateTime($layout_manager); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | //If there is requirement, we can modify report.js::addFilterInputDatetimesBetween and this function |
| 54 | 54 | function queryFilterBetween_Datetimes(& $layout_def) { |
| 55 | 55 | global $timedate; |
| 56 | - if($this->getAssignedUser()) { |
|
| 56 | + if ($this->getAssignedUser()) { |
|
| 57 | 57 | $begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
| 58 | 58 | $end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
| 59 | 59 | } |
@@ -1,5 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 2 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 3 | + die('Not A Valid Entry Point'); |
|
| 4 | +} |
|
| 3 | 5 | /********************************************************************************* |
| 4 | 6 | * SugarCRM Community Edition is a customer relationship management program developed by |
| 5 | 7 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
@@ -56,8 +58,7 @@ discard block |
||
| 56 | 58 | if($this->getAssignedUser()) { |
| 57 | 59 | $begin = $timedate->handle_offset($layout_def['input_name0'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
| 58 | 60 | $end = $timedate->handle_offset($layout_def['input_name2'], $timedate->get_db_date_time_format(), false, $this->assigned_user); |
| 59 | - } |
|
| 60 | - else { |
|
| 61 | + } else { |
|
| 61 | 62 | $begin = $layout_def['input_name0']; |
| 62 | 63 | $end = $layout_def['input_name1']; |
| 63 | 64 | } |