@@ -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,29 +56,29 @@ discard block |
||
| 56 | 56 | var $hideNewButton = false; |
| 57 | 57 | var $focus; |
| 58 | 58 | |
| 59 | -function setFocus(&$value){ |
|
| 60 | - $this->focus =(object) $value; |
|
| 59 | +function setFocus(&$value) { |
|
| 60 | + $this->focus = (object)$value; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | -function setNotesList(&$value){ |
|
| 65 | - $this->notes_list =$value; |
|
| 64 | +function setNotesList(&$value) { |
|
| 65 | + $this->notes_list = $value; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | -function setHideNewButton($value){ |
|
| 68 | +function setHideNewButton($value) { |
|
| 69 | 69 | $this->hideNewButton = $value; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | -function __construct(){ |
|
| 72 | +function __construct() { |
|
| 73 | 73 | global $theme; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 78 | 78 | */ |
| 79 | - function SubPanelViewNotes(){ |
|
| 79 | + function SubPanelViewNotes() { |
|
| 80 | 80 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 81 | - if(isset($GLOBALS['log'])) { |
|
| 81 | + if (isset($GLOBALS['log'])) { |
|
| 82 | 82 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 83 | 83 | } |
| 84 | 84 | else { |
@@ -88,33 +88,33 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
| 91 | -function getHeaderText($action, $currentModule){ |
|
| 91 | +function getHeaderText($action, $currentModule) { |
|
| 92 | 92 | global $app_strings; |
| 93 | 93 | $button = "<table cellspacing='0' cellpadding='0' border='0'><form border='0' action='index.php' method='post' name='form' id='form'>\n"; |
| 94 | 94 | $button .= "<input type='hidden' name='module' value='Notes'>\n"; |
| 95 | - if(!$this->hideNewButton){ |
|
| 95 | + if (!$this->hideNewButton) { |
|
| 96 | 96 | $button .= "<td><input title='".$app_strings['LBL_NEW_BUTTON_TITLE']."' class='button' onclick=\"this.form.action.value='EditView'\" type='submit' name='button' value=' ".$app_strings['LBL_NEW_BUTTON_LABEL']." '></td>\n"; |
| 97 | 97 | } |
| 98 | 98 | $button .= "</tr></form></table>\n"; |
| 99 | 99 | return $button; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | -function ProcessSubPanelListView($xTemplatePath, &$mod_strings,$action, $curModule=''){ |
|
| 103 | - global $currentModule,$app_strings; |
|
| 104 | - if(empty($curModule)) |
|
| 102 | +function ProcessSubPanelListView($xTemplatePath, &$mod_strings, $action, $curModule = '') { |
|
| 103 | + global $currentModule, $app_strings; |
|
| 104 | + if (empty($curModule)) |
|
| 105 | 105 | $curModule = $currentModule; |
| 106 | 106 | $ListView = new ListView(); |
| 107 | 107 | global $current_user; |
| 108 | 108 | $header_text = ''; |
| 109 | -if(is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])){ |
|
| 110 | - $header_text = " <a href='index.php?action=index&module=DynamicLayout&from_action=SubPanelView&from_module=Notes&record=". $this->focus->id."'>".SugarThemeRegistry::current()->getImage("EditLayout","border='0' align='bottom'",null,null,'.gif',$mod_strings['LBL_EDITLAYOUT'])."</a>"; |
|
| 109 | +if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) { |
|
| 110 | + $header_text = " <a href='index.php?action=index&module=DynamicLayout&from_action=SubPanelView&from_module=Notes&record=".$this->focus->id."'>".SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDITLAYOUT'])."</a>"; |
|
| 111 | 111 | } |
| 112 | - $ListView->initNewXTemplate($xTemplatePath,$mod_strings); |
|
| 112 | + $ListView->initNewXTemplate($xTemplatePath, $mod_strings); |
|
| 113 | 113 | $ListView->xTemplateAssign("RETURN_URL", "&return_module=".$curModule."&return_action=DetailView&return_id=".$this->focus->id); |
| 114 | - $ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LNK_DELETE'])); |
|
| 115 | - $ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline','align="absmiddle" border="0"',null,null,'.gif',$app_strings['LNK_EDIT'])); |
|
| 116 | - $ListView->xTemplateAssign("RECORD_ID", $this->focus->id); |
|
| 117 | - $ListView->setHeaderTitle($mod_strings['LBL_MODULE_NAME']. $header_text); |
|
| 114 | + $ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_DELETE'])); |
|
| 115 | + $ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_EDIT'])); |
|
| 116 | + $ListView->xTemplateAssign("RECORD_ID", $this->focus->id); |
|
| 117 | + $ListView->setHeaderTitle($mod_strings['LBL_MODULE_NAME'].$header_text); |
|
| 118 | 118 | $ListView->setHeaderText($this->getHeaderText($action, $curModule)); |
| 119 | 119 | $ListView->processListView($this->notes_list, "notes", "NOTE"); |
| 120 | 120 | } |
@@ -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. |
@@ -80,8 +82,7 @@ discard block |
||
| 80 | 82 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 81 | 83 | if(isset($GLOBALS['log'])) { |
| 82 | 84 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 83 | - } |
|
| 84 | - else { |
|
| 85 | + } else { |
|
| 85 | 86 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 86 | 87 | } |
| 87 | 88 | self::__construct(); |
@@ -101,8 +102,9 @@ discard block |
||
| 101 | 102 | |
| 102 | 103 | function ProcessSubPanelListView($xTemplatePath, &$mod_strings,$action, $curModule=''){ |
| 103 | 104 | global $currentModule,$app_strings; |
| 104 | - if(empty($curModule)) |
|
| 105 | - $curModule = $currentModule; |
|
| 105 | + if(empty($curModule)) { |
|
| 106 | + $curModule = $currentModule; |
|
| 107 | + } |
|
| 106 | 108 | $ListView = new ListView(); |
| 107 | 109 | global $current_user; |
| 108 | 110 | $header_text = ''; |
@@ -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. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | parent::__construct($id, $def); |
| 51 | 51 | |
| 52 | - if(empty($def['title'])) $this->title = translate('LBL_MY_NOTES_DASHLETNAME', 'Notes'); |
|
| 52 | + if (empty($def['title'])) $this->title = translate('LBL_MY_NOTES_DASHLETNAME', 'Notes'); |
|
| 53 | 53 | |
| 54 | 54 | $this->searchFields = $dashletData['MyNotesDashlet']['searchFields']; |
| 55 | 55 | $this->columns = $dashletData['MyNotesDashlet']['columns']; |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 62 | 62 | */ |
| 63 | - function MyNotesDashlet($id, $def = null){ |
|
| 63 | + function MyNotesDashlet($id, $def = null) { |
|
| 64 | 64 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 65 | - if(isset($GLOBALS['log'])) { |
|
| 65 | + if (isset($GLOBALS['log'])) { |
|
| 66 | 66 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 67 | 67 | } |
| 68 | 68 | else { |
@@ -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. |
@@ -49,7 +51,9 @@ discard block |
||
| 49 | 51 | |
| 50 | 52 | parent::__construct($id, $def); |
| 51 | 53 | |
| 52 | - if(empty($def['title'])) $this->title = translate('LBL_MY_NOTES_DASHLETNAME', 'Notes'); |
|
| 54 | + if(empty($def['title'])) { |
|
| 55 | + $this->title = translate('LBL_MY_NOTES_DASHLETNAME', 'Notes'); |
|
| 56 | + } |
|
| 53 | 57 | |
| 54 | 58 | $this->searchFields = $dashletData['MyNotesDashlet']['searchFields']; |
| 55 | 59 | $this->columns = $dashletData['MyNotesDashlet']['columns']; |
@@ -64,8 +68,7 @@ discard block |
||
| 64 | 68 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 65 | 69 | if(isset($GLOBALS['log'])) { |
| 66 | 70 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 67 | - } |
|
| 68 | - else { |
|
| 71 | + } else { |
|
| 69 | 72 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 70 | 73 | } |
| 71 | 74 | self::__construct($id, $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. |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 56 | 56 | */ |
| 57 | - function NoteSoap(){ |
|
| 57 | + function NoteSoap() { |
|
| 58 | 58 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | - if(isset($GLOBALS['log'])) { |
|
| 59 | + if (isset($GLOBALS['log'])) { |
|
| 60 | 60 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | 61 | } |
| 62 | 62 | else { |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | |
| 76 | 76 | |
| 77 | - if(!empty($note['id'])){ |
|
| 77 | + if (!empty($note['id'])) { |
|
| 78 | 78 | $focus->retrieve($note['id']); |
| 79 | - if(empty($focus->id)) { |
|
| 79 | + if (empty($focus->id)) { |
|
| 80 | 80 | return '-1'; |
| 81 | 81 | } |
| 82 | - }else{ |
|
| 82 | + } else { |
|
| 83 | 83 | return '-1'; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if(!empty($note['file'])){ |
|
| 86 | + if (!empty($note['file'])) { |
|
| 87 | 87 | $decodedFile = base64_decode($note['file']); |
| 88 | 88 | $this->upload_file->set_for_soap($note['filename'], $decodedFile); |
| 89 | 89 | |
@@ -99,29 +99,29 @@ discard block |
||
| 99 | 99 | $focus->id = $note['id']; |
| 100 | 100 | $return_id = $focus->save(); |
| 101 | 101 | $this->upload_file->final_move($focus->id); |
| 102 | - }else{ |
|
| 102 | + } else { |
|
| 103 | 103 | return '-1'; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return $return_id; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - function newSaveFile($note, $portal = false){ |
|
| 109 | + function newSaveFile($note, $portal = false) { |
|
| 110 | 110 | global $sugar_config; |
| 111 | 111 | |
| 112 | 112 | $focus = new Note(); |
| 113 | 113 | |
| 114 | 114 | |
| 115 | - if(!empty($note['id'])){ |
|
| 115 | + if (!empty($note['id'])) { |
|
| 116 | 116 | $focus->retrieve($note['id']); |
| 117 | - if(empty($focus->id)) { |
|
| 117 | + if (empty($focus->id)) { |
|
| 118 | 118 | return '-1'; |
| 119 | 119 | } |
| 120 | 120 | } else { |
| 121 | 121 | return '-1'; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if(!empty($note['file'])){ |
|
| 124 | + if (!empty($note['file'])) { |
|
| 125 | 125 | $decodedFile = base64_decode($note['file']); |
| 126 | 126 | $this->upload_file->set_for_soap($note['filename'], $decodedFile); |
| 127 | 127 | |
@@ -139,19 +139,19 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $return_id = $focus->id; |
| 141 | 141 | |
| 142 | - if(!empty($note['file'])){ |
|
| 142 | + if (!empty($note['file'])) { |
|
| 143 | 143 | $this->upload_file->final_move($focus->id); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (!empty($note['related_module_id']) && !empty($note['related_module_name'])) { |
| 147 | - $focus->process_save_dates=false; |
|
| 147 | + $focus->process_save_dates = false; |
|
| 148 | 148 | $module_name = $note['related_module_name']; |
| 149 | 149 | $module_id = $note['related_module_id']; |
| 150 | - if($module_name != 'Contacts'){ |
|
| 151 | - $focus->parent_type=$module_name; |
|
| 150 | + if ($module_name != 'Contacts') { |
|
| 151 | + $focus->parent_type = $module_name; |
|
| 152 | 152 | $focus->parent_id = $module_id; |
| 153 | - }else{ |
|
| 154 | - $focus->contact_id=$module_id; |
|
| 153 | + } else { |
|
| 154 | + $focus->contact_id = $module_id; |
|
| 155 | 155 | } |
| 156 | 156 | $focus->save(); |
| 157 | 157 | |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | function retrieveFile($id, $filename) |
| 163 | 163 | { |
| 164 | - if(empty($filename)){ |
|
| 164 | + if (empty($filename)) { |
|
| 165 | 165 | return ''; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $this->upload_file->stored_file_name = $filename; |
| 169 | 169 | $filepath = $this->upload_file->get_upload_path($id); |
| 170 | - if(file_exists($filepath)){ |
|
| 170 | + if (file_exists($filepath)) { |
|
| 171 | 171 | $file = file_get_contents($filepath); |
| 172 | 172 | return base64_encode($file); |
| 173 | 173 | } |
@@ -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. |
@@ -58,8 +60,7 @@ discard block |
||
| 58 | 60 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | 61 | if(isset($GLOBALS['log'])) { |
| 60 | 62 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | - } |
|
| 62 | - else { |
|
| 63 | + } else { |
|
| 63 | 64 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 64 | 65 | } |
| 65 | 66 | self::__construct(); |
@@ -79,7 +80,7 @@ discard block |
||
| 79 | 80 | if(empty($focus->id)) { |
| 80 | 81 | return '-1'; |
| 81 | 82 | } |
| 82 | - }else{ |
|
| 83 | + } else{ |
|
| 83 | 84 | return '-1'; |
| 84 | 85 | } |
| 85 | 86 | |
@@ -99,7 +100,7 @@ discard block |
||
| 99 | 100 | $focus->id = $note['id']; |
| 100 | 101 | $return_id = $focus->save(); |
| 101 | 102 | $this->upload_file->final_move($focus->id); |
| 102 | - }else{ |
|
| 103 | + } else{ |
|
| 103 | 104 | return '-1'; |
| 104 | 105 | } |
| 105 | 106 | |
@@ -150,7 +151,7 @@ discard block |
||
| 150 | 151 | if($module_name != 'Contacts'){ |
| 151 | 152 | $focus->parent_type=$module_name; |
| 152 | 153 | $focus->parent_id = $module_id; |
| 153 | - }else{ |
|
| 154 | + } else{ |
|
| 154 | 155 | $focus->contact_id=$module_id; |
| 155 | 156 | } |
| 156 | 157 | $focus->save(); |
@@ -54,48 +54,48 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // Note is used to store customer information. |
| 56 | 56 | class Note extends SugarBean { |
| 57 | - var $field_name_map; |
|
| 58 | - // Stored fields |
|
| 59 | - var $id; |
|
| 60 | - var $date_entered; |
|
| 61 | - var $date_modified; |
|
| 62 | - var $modified_user_id; |
|
| 63 | - var $assigned_user_id; |
|
| 64 | - var $created_by; |
|
| 65 | - var $created_by_name; |
|
| 66 | - var $modified_by_name; |
|
| 67 | - var $description; |
|
| 68 | - var $name; |
|
| 69 | - var $filename; |
|
| 70 | - // handle to an upload_file object |
|
| 71 | - // used in emails |
|
| 72 | - var $file; |
|
| 73 | - var $embed_flag; // inline image flag |
|
| 74 | - var $parent_type; |
|
| 75 | - var $parent_id; |
|
| 76 | - var $contact_id; |
|
| 77 | - var $portal_flag; |
|
| 78 | - |
|
| 79 | - var $parent_name; |
|
| 80 | - var $contact_name; |
|
| 81 | - var $contact_phone; |
|
| 82 | - var $contact_email; |
|
| 83 | - var $file_mime_type; |
|
| 84 | - var $module_dir = "Notes"; |
|
| 85 | - var $default_note_name_dom = array('Meeting notes', 'Reminder'); |
|
| 86 | - var $table_name = "notes"; |
|
| 87 | - var $new_schema = true; |
|
| 88 | - var $object_name = "Note"; |
|
| 89 | - var $importable = true; |
|
| 90 | - |
|
| 91 | - // This is used to retrieve related fields from form posts. |
|
| 92 | - var $additional_column_fields = Array('contact_name', 'contact_phone', 'contact_email', 'parent_name','first_name','last_name'); |
|
| 57 | + var $field_name_map; |
|
| 58 | + // Stored fields |
|
| 59 | + var $id; |
|
| 60 | + var $date_entered; |
|
| 61 | + var $date_modified; |
|
| 62 | + var $modified_user_id; |
|
| 63 | + var $assigned_user_id; |
|
| 64 | + var $created_by; |
|
| 65 | + var $created_by_name; |
|
| 66 | + var $modified_by_name; |
|
| 67 | + var $description; |
|
| 68 | + var $name; |
|
| 69 | + var $filename; |
|
| 70 | + // handle to an upload_file object |
|
| 71 | + // used in emails |
|
| 72 | + var $file; |
|
| 73 | + var $embed_flag; // inline image flag |
|
| 74 | + var $parent_type; |
|
| 75 | + var $parent_id; |
|
| 76 | + var $contact_id; |
|
| 77 | + var $portal_flag; |
|
| 78 | + |
|
| 79 | + var $parent_name; |
|
| 80 | + var $contact_name; |
|
| 81 | + var $contact_phone; |
|
| 82 | + var $contact_email; |
|
| 83 | + var $file_mime_type; |
|
| 84 | + var $module_dir = "Notes"; |
|
| 85 | + var $default_note_name_dom = array('Meeting notes', 'Reminder'); |
|
| 86 | + var $table_name = "notes"; |
|
| 87 | + var $new_schema = true; |
|
| 88 | + var $object_name = "Note"; |
|
| 89 | + var $importable = true; |
|
| 90 | + |
|
| 91 | + // This is used to retrieve related fields from form posts. |
|
| 92 | + var $additional_column_fields = Array('contact_name', 'contact_phone', 'contact_email', 'parent_name','first_name','last_name'); |
|
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | public function __construct() { |
| 97 | - parent::__construct(); |
|
| 98 | - } |
|
| 97 | + parent::__construct(); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -112,109 +112,109 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | |
| 115 | - function safeAttachmentName() { |
|
| 116 | - global $sugar_config; |
|
| 117 | - |
|
| 118 | - //get position of last "." in file name |
|
| 119 | - $file_ext_beg = strrpos($this->filename, "."); |
|
| 120 | - $file_ext = ""; |
|
| 121 | - |
|
| 122 | - //get file extension |
|
| 123 | - if($file_ext_beg !== false) { |
|
| 124 | - $file_ext = substr($this->filename, $file_ext_beg + 1); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - //check to see if this is a file with extension located in "badext" |
|
| 128 | - foreach($sugar_config['upload_badext'] as $badExt) { |
|
| 129 | - if(strtolower($file_ext) == strtolower($badExt)) { |
|
| 130 | - //if found, then append with .txt and break out of lookup |
|
| 131 | - $this->name = $this->name . ".txt"; |
|
| 132 | - $this->file_mime_type = 'text/'; |
|
| 133 | - $this->filename = $this->filename . ".txt"; |
|
| 134 | - break; // no need to look for more |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * overrides SugarBean's method. |
|
| 142 | - * If a system setting is set, it will mark all related notes as deleted, and attempt to delete files that are |
|
| 143 | - * related to those notes |
|
| 144 | - * @param string id ID |
|
| 145 | - */ |
|
| 146 | - function mark_deleted($id) { |
|
| 147 | - global $sugar_config; |
|
| 148 | - |
|
| 149 | - if($this->parent_type == 'Emails') { |
|
| 150 | - if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) { |
|
| 151 | - $removeFile = "upload://$id"; |
|
| 152 | - if(file_exists($removeFile)) { |
|
| 153 | - if(!unlink($removeFile)) { |
|
| 154 | - $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
|
| 155 | - } |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - // delete note |
|
| 161 | - parent::mark_deleted($id); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - function deleteAttachment($isduplicate="false"){ |
|
| 165 | - if($this->ACLAccess('edit')){ |
|
| 166 | - if($isduplicate=="true"){ |
|
| 167 | - return true; |
|
| 168 | - } |
|
| 169 | - $removeFile = "upload://{$this->id}"; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - if(file_exists($removeFile)) { |
|
| 173 | - if(!unlink($removeFile)) { |
|
| 174 | - $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
|
| 175 | - }else{ |
|
| 176 | - $this->filename = ''; |
|
| 177 | - $this->file_mime_type = ''; |
|
| 178 | - $this->file = ''; |
|
| 179 | - $this->save(); |
|
| 180 | - return true; |
|
| 181 | - } |
|
| 182 | - } else { |
|
| 183 | - $this->filename = ''; |
|
| 184 | - $this->file_mime_type = ''; |
|
| 185 | - $this->file = ''; |
|
| 186 | - $this->save(); |
|
| 187 | - return true; |
|
| 188 | - } |
|
| 189 | - return false; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - |
|
| 193 | - function get_summary_text() { |
|
| 194 | - return "$this->name"; |
|
| 195 | - } |
|
| 115 | + function safeAttachmentName() { |
|
| 116 | + global $sugar_config; |
|
| 117 | + |
|
| 118 | + //get position of last "." in file name |
|
| 119 | + $file_ext_beg = strrpos($this->filename, "."); |
|
| 120 | + $file_ext = ""; |
|
| 121 | + |
|
| 122 | + //get file extension |
|
| 123 | + if($file_ext_beg !== false) { |
|
| 124 | + $file_ext = substr($this->filename, $file_ext_beg + 1); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + //check to see if this is a file with extension located in "badext" |
|
| 128 | + foreach($sugar_config['upload_badext'] as $badExt) { |
|
| 129 | + if(strtolower($file_ext) == strtolower($badExt)) { |
|
| 130 | + //if found, then append with .txt and break out of lookup |
|
| 131 | + $this->name = $this->name . ".txt"; |
|
| 132 | + $this->file_mime_type = 'text/'; |
|
| 133 | + $this->filename = $this->filename . ".txt"; |
|
| 134 | + break; // no need to look for more |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * overrides SugarBean's method. |
|
| 142 | + * If a system setting is set, it will mark all related notes as deleted, and attempt to delete files that are |
|
| 143 | + * related to those notes |
|
| 144 | + * @param string id ID |
|
| 145 | + */ |
|
| 146 | + function mark_deleted($id) { |
|
| 147 | + global $sugar_config; |
|
| 148 | + |
|
| 149 | + if($this->parent_type == 'Emails') { |
|
| 150 | + if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) { |
|
| 151 | + $removeFile = "upload://$id"; |
|
| 152 | + if(file_exists($removeFile)) { |
|
| 153 | + if(!unlink($removeFile)) { |
|
| 154 | + $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + // delete note |
|
| 161 | + parent::mark_deleted($id); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + function deleteAttachment($isduplicate="false"){ |
|
| 165 | + if($this->ACLAccess('edit')){ |
|
| 166 | + if($isduplicate=="true"){ |
|
| 167 | + return true; |
|
| 168 | + } |
|
| 169 | + $removeFile = "upload://{$this->id}"; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + if(file_exists($removeFile)) { |
|
| 173 | + if(!unlink($removeFile)) { |
|
| 174 | + $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
|
| 175 | + }else{ |
|
| 176 | + $this->filename = ''; |
|
| 177 | + $this->file_mime_type = ''; |
|
| 178 | + $this->file = ''; |
|
| 179 | + $this->save(); |
|
| 180 | + return true; |
|
| 181 | + } |
|
| 182 | + } else { |
|
| 183 | + $this->filename = ''; |
|
| 184 | + $this->file_mime_type = ''; |
|
| 185 | + $this->file = ''; |
|
| 186 | + $this->save(); |
|
| 187 | + return true; |
|
| 188 | + } |
|
| 189 | + return false; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + |
|
| 193 | + function get_summary_text() { |
|
| 194 | + return "$this->name"; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | 197 | function create_export_query($order_by, $where, $relate_link_join='') |
| 198 | 198 | { |
| 199 | 199 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 200 | 200 | $custom_join['join'] .= $relate_link_join; |
| 201 | - $query = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name "; |
|
| 201 | + $query = "SELECT notes.*, contacts.first_name, contacts.last_name, users.user_name as assigned_user_name "; |
|
| 202 | 202 | |
| 203 | 203 | $query .= $custom_join['select']; |
| 204 | 204 | |
| 205 | - $query .= " FROM notes "; |
|
| 205 | + $query .= " FROM notes "; |
|
| 206 | 206 | |
| 207 | - $query .= " LEFT JOIN contacts ON notes.contact_id=contacts.id "; |
|
| 208 | - $query .= " LEFT JOIN users ON notes.assigned_user_id=users.id "; |
|
| 207 | + $query .= " LEFT JOIN contacts ON notes.contact_id=contacts.id "; |
|
| 208 | + $query .= " LEFT JOIN users ON notes.assigned_user_id=users.id "; |
|
| 209 | 209 | |
| 210 | 210 | $query .= $custom_join['join']; |
| 211 | 211 | |
| 212 | - $where_auto = " notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0)"; |
|
| 212 | + $where_auto = " notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0)"; |
|
| 213 | 213 | |
| 214 | 214 | if($where != "") |
| 215 | - $query .= "where $where AND ".$where_auto; |
|
| 215 | + $query .= "where $where AND ".$where_auto; |
|
| 216 | 216 | else |
| 217 | - $query .= "where ".$where_auto; |
|
| 217 | + $query .= "where ".$where_auto; |
|
| 218 | 218 | |
| 219 | 219 | $order_by = $this->process_order_by($order_by); |
| 220 | 220 | if (empty($order_by)) { |
@@ -222,143 +222,143 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | $query .= ' ORDER BY ' . $order_by; |
| 224 | 224 | |
| 225 | - return $query; |
|
| 226 | - } |
|
| 225 | + return $query; |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - function fill_in_additional_list_fields() { |
|
| 229 | - $this->fill_in_additional_detail_fields(); |
|
| 230 | - } |
|
| 228 | + function fill_in_additional_list_fields() { |
|
| 229 | + $this->fill_in_additional_detail_fields(); |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - function fill_in_additional_detail_fields() { |
|
| 233 | - parent::fill_in_additional_detail_fields(); |
|
| 234 | - //TODO: Seems odd we need to clear out these values so that list views don't show the previous rows value if current value is blank |
|
| 235 | - $this->getRelatedFields('Contacts', $this->contact_id, array('name'=>'contact_name', 'phone_work'=>'contact_phone') ); |
|
| 236 | - if(!empty($this->contact_name)){ |
|
| 232 | + function fill_in_additional_detail_fields() { |
|
| 233 | + parent::fill_in_additional_detail_fields(); |
|
| 234 | + //TODO: Seems odd we need to clear out these values so that list views don't show the previous rows value if current value is blank |
|
| 235 | + $this->getRelatedFields('Contacts', $this->contact_id, array('name'=>'contact_name', 'phone_work'=>'contact_phone') ); |
|
| 236 | + if(!empty($this->contact_name)){ |
|
| 237 | 237 | |
| 238 | - $emailAddress = new SugarEmailAddress(); |
|
| 239 | - $this->contact_email = $emailAddress->getPrimaryAddress(false, $this->contact_id, 'Contacts'); |
|
| 240 | - } |
|
| 238 | + $emailAddress = new SugarEmailAddress(); |
|
| 239 | + $this->contact_email = $emailAddress->getPrimaryAddress(false, $this->contact_id, 'Contacts'); |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | - if(isset($this->contact_id) && $this->contact_id != '') { |
|
| 243 | - $contact = new Contact(); |
|
| 244 | - $contact->retrieve($this->contact_id); |
|
| 245 | - if(isset($contact->id)) { |
|
| 246 | - $this->contact_name = $contact->full_name; |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - } |
|
| 242 | + if(isset($this->contact_id) && $this->contact_id != '') { |
|
| 243 | + $contact = new Contact(); |
|
| 244 | + $contact->retrieve($this->contact_id); |
|
| 245 | + if(isset($contact->id)) { |
|
| 246 | + $this->contact_name = $contact->full_name; |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | 251 | |
| 252 | - function get_list_view_data() |
|
| 253 | - { |
|
| 254 | - $note_fields = $this->get_list_view_array(); |
|
| 255 | - global $app_list_strings, $focus, $action, $currentModule,$mod_strings, $sugar_config; |
|
| 252 | + function get_list_view_data() |
|
| 253 | + { |
|
| 254 | + $note_fields = $this->get_list_view_array(); |
|
| 255 | + global $app_list_strings, $focus, $action, $currentModule,$mod_strings, $sugar_config; |
|
| 256 | 256 | |
| 257 | - if(isset($this->parent_type)) { |
|
| 258 | - $note_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 259 | - } |
|
| 257 | + if(isset($this->parent_type)) { |
|
| 258 | + $note_fields['PARENT_MODULE'] = $this->parent_type; |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - if(!empty($this->filename)) { |
|
| 261 | + if(!empty($this->filename)) { |
|
| 262 | 262 | if(file_exists("upload://{$this->id}")){ |
| 263 | 263 | $note_fields['FILENAME'] = $this->filename; |
| 264 | 264 | $note_fields['FILE_URL'] = UploadFile::get_upload_url($this); |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | if(isset($this->contact_id) && $this->contact_id != '') { |
| 268 | - $contact = new Contact(); |
|
| 269 | - $contact->retrieve($this->contact_id); |
|
| 270 | - if(isset($contact->id)) { |
|
| 271 | - $this->contact_name = $contact->full_name; |
|
| 272 | - } |
|
| 273 | - } |
|
| 268 | + $contact = new Contact(); |
|
| 269 | + $contact->retrieve($this->contact_id); |
|
| 270 | + if(isset($contact->id)) { |
|
| 271 | + $this->contact_name = $contact->full_name; |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | 274 | if(isset($this->contact_name)){ |
| 275 | - $note_fields['CONTACT_NAME'] = $this->contact_name; |
|
| 275 | + $note_fields['CONTACT_NAME'] = $this->contact_name; |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - global $current_language; |
|
| 279 | - $mod_strings = return_module_language($current_language, 'Notes'); |
|
| 280 | - $note_fields['STATUS']=$mod_strings['LBL_NOTE_STATUS']; |
|
| 281 | - |
|
| 282 | - |
|
| 283 | - return $note_fields; |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - function listviewACLHelper() { |
|
| 287 | - $array_assign = parent::listviewACLHelper(); |
|
| 288 | - $is_owner = false; |
|
| 289 | - $in_group = false; //SECURITY GROUPS |
|
| 290 | - if(!empty($this->parent_name)) { |
|
| 291 | - if(!empty($this->parent_name_owner)) { |
|
| 292 | - global $current_user; |
|
| 293 | - $is_owner = $current_user->id == $this->parent_name_owner; |
|
| 294 | - } |
|
| 295 | - /* BEGIN - SECURITY GROUPS */ |
|
| 296 | - //parent_name_owner not being set for whatever reason so we need to figure this out |
|
| 297 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 298 | - global $current_user; |
|
| 278 | + global $current_language; |
|
| 279 | + $mod_strings = return_module_language($current_language, 'Notes'); |
|
| 280 | + $note_fields['STATUS']=$mod_strings['LBL_NOTE_STATUS']; |
|
| 281 | + |
|
| 282 | + |
|
| 283 | + return $note_fields; |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + function listviewACLHelper() { |
|
| 287 | + $array_assign = parent::listviewACLHelper(); |
|
| 288 | + $is_owner = false; |
|
| 289 | + $in_group = false; //SECURITY GROUPS |
|
| 290 | + if(!empty($this->parent_name)) { |
|
| 291 | + if(!empty($this->parent_name_owner)) { |
|
| 292 | + global $current_user; |
|
| 293 | + $is_owner = $current_user->id == $this->parent_name_owner; |
|
| 294 | + } |
|
| 295 | + /* BEGIN - SECURITY GROUPS */ |
|
| 296 | + //parent_name_owner not being set for whatever reason so we need to figure this out |
|
| 297 | + else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 298 | + global $current_user; |
|
| 299 | 299 | $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
| 300 | 300 | if($parent_bean !== false) { |
| 301 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 301 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 302 | 302 | } |
| 303 | - } |
|
| 304 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 305 | - $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
| 306 | - /* END - SECURITY GROUPS */ |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - /* BEGIN - SECURITY GROUPS */ |
|
| 310 | - /** |
|
| 303 | + } |
|
| 304 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 305 | + $in_group = SecurityGroup::groupHasAccess($this->parent_type, $this->parent_id, 'view'); |
|
| 306 | + /* END - SECURITY GROUPS */ |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + /* BEGIN - SECURITY GROUPS */ |
|
| 310 | + /** |
|
| 311 | 311 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)) { |
| 312 | - */ |
|
| 313 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 312 | + */ |
|
| 313 | + if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 314 | 314 | /* END - SECURITY GROUPS */ |
| 315 | - $array_assign['PARENT'] = 'a'; |
|
| 316 | - } else { |
|
| 317 | - $array_assign['PARENT'] = 'span'; |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - $is_owner = false; |
|
| 321 | - $in_group = false; //SECURITY GROUPS |
|
| 322 | - if(!empty($this->contact_name)) { |
|
| 323 | - if(!empty($this->contact_name_owner)) { |
|
| 324 | - global $current_user; |
|
| 325 | - $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 326 | - } |
|
| 327 | - /* BEGIN - SECURITY GROUPS */ |
|
| 328 | - //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 329 | - else { |
|
| 330 | - global $current_user; |
|
| 315 | + $array_assign['PARENT'] = 'a'; |
|
| 316 | + } else { |
|
| 317 | + $array_assign['PARENT'] = 'span'; |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + $is_owner = false; |
|
| 321 | + $in_group = false; //SECURITY GROUPS |
|
| 322 | + if(!empty($this->contact_name)) { |
|
| 323 | + if(!empty($this->contact_name_owner)) { |
|
| 324 | + global $current_user; |
|
| 325 | + $is_owner = $current_user->id == $this->contact_name_owner; |
|
| 326 | + } |
|
| 327 | + /* BEGIN - SECURITY GROUPS */ |
|
| 328 | + //contact_name_owner not being set for whatever reason so we need to figure this out |
|
| 329 | + else { |
|
| 330 | + global $current_user; |
|
| 331 | 331 | $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
| 332 | 332 | if($parent_bean !== false) { |
| 333 | - $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 333 | + $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
|
| 334 | 334 | } |
| 335 | - } |
|
| 336 | - require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 337 | - $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 338 | - /* END - SECURITY GROUPS */ |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - /* BEGIN - SECURITY GROUPS */ |
|
| 342 | - /** |
|
| 335 | + } |
|
| 336 | + require_once("modules/SecurityGroups/SecurityGroup.php"); |
|
| 337 | + $in_group = SecurityGroup::groupHasAccess('Contacts', $this->contact_id, 'view'); |
|
| 338 | + /* END - SECURITY GROUPS */ |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + /* BEGIN - SECURITY GROUPS */ |
|
| 342 | + /** |
|
| 343 | 343 | if( ACLController::checkAccess('Contacts', 'view', $is_owner)) { |
| 344 | - */ |
|
| 345 | - if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 344 | + */ |
|
| 345 | + if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 346 | 346 | /* END - SECURITY GROUPS */ |
| 347 | - $array_assign['CONTACT'] = 'a'; |
|
| 348 | - } else { |
|
| 349 | - $array_assign['CONTACT'] = 'span'; |
|
| 350 | - } |
|
| 347 | + $array_assign['CONTACT'] = 'a'; |
|
| 348 | + } else { |
|
| 349 | + $array_assign['CONTACT'] = 'span'; |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | - return $array_assign; |
|
| 353 | - } |
|
| 352 | + return $array_assign; |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | - function bean_implements($interface) { |
|
| 356 | - switch($interface) { |
|
| 357 | - case 'ACL':return true; |
|
| 355 | + function bean_implements($interface) { |
|
| 356 | + switch($interface) { |
|
| 357 | + case 'ACL':return true; |
|
| 358 | 358 | case 'FILE' : return true; |
| 359 | - } |
|
| 360 | - return false; |
|
| 361 | - } |
|
| 359 | + } |
|
| 360 | + return false; |
|
| 361 | + } |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | ?> |
@@ -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. |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | var $importable = true; |
| 90 | 90 | |
| 91 | 91 | // This is used to retrieve related fields from form posts. |
| 92 | - var $additional_column_fields = Array('contact_name', 'contact_phone', 'contact_email', 'parent_name','first_name','last_name'); |
|
| 92 | + var $additional_column_fields = Array('contact_name', 'contact_phone', 'contact_email', 'parent_name', 'first_name', 'last_name'); |
|
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 102 | 102 | */ |
| 103 | - public function Note(){ |
|
| 103 | + public function Note() { |
|
| 104 | 104 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 105 | - if(isset($GLOBALS['log'])) { |
|
| 105 | + if (isset($GLOBALS['log'])) { |
|
| 106 | 106 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 107 | 107 | } |
| 108 | 108 | else { |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | $file_ext = ""; |
| 121 | 121 | |
| 122 | 122 | //get file extension |
| 123 | - if($file_ext_beg !== false) { |
|
| 123 | + if ($file_ext_beg !== false) { |
|
| 124 | 124 | $file_ext = substr($this->filename, $file_ext_beg + 1); |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //check to see if this is a file with extension located in "badext" |
| 128 | - foreach($sugar_config['upload_badext'] as $badExt) { |
|
| 129 | - if(strtolower($file_ext) == strtolower($badExt)) { |
|
| 128 | + foreach ($sugar_config['upload_badext'] as $badExt) { |
|
| 129 | + if (strtolower($file_ext) == strtolower($badExt)) { |
|
| 130 | 130 | //if found, then append with .txt and break out of lookup |
| 131 | - $this->name = $this->name . ".txt"; |
|
| 131 | + $this->name = $this->name.".txt"; |
|
| 132 | 132 | $this->file_mime_type = 'text/'; |
| 133 | - $this->filename = $this->filename . ".txt"; |
|
| 133 | + $this->filename = $this->filename.".txt"; |
|
| 134 | 134 | break; // no need to look for more |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | function mark_deleted($id) { |
| 147 | 147 | global $sugar_config; |
| 148 | 148 | |
| 149 | - if($this->parent_type == 'Emails') { |
|
| 150 | - if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) { |
|
| 149 | + if ($this->parent_type == 'Emails') { |
|
| 150 | + if (isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) { |
|
| 151 | 151 | $removeFile = "upload://$id"; |
| 152 | - if(file_exists($removeFile)) { |
|
| 153 | - if(!unlink($removeFile)) { |
|
| 152 | + if (file_exists($removeFile)) { |
|
| 153 | + if (!unlink($removeFile)) { |
|
| 154 | 154 | $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
| 155 | 155 | } |
| 156 | 156 | } |
@@ -161,18 +161,18 @@ discard block |
||
| 161 | 161 | parent::mark_deleted($id); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - function deleteAttachment($isduplicate="false"){ |
|
| 165 | - if($this->ACLAccess('edit')){ |
|
| 166 | - if($isduplicate=="true"){ |
|
| 164 | + function deleteAttachment($isduplicate = "false") { |
|
| 165 | + if ($this->ACLAccess('edit')) { |
|
| 166 | + if ($isduplicate == "true") { |
|
| 167 | 167 | return true; |
| 168 | 168 | } |
| 169 | 169 | $removeFile = "upload://{$this->id}"; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if(file_exists($removeFile)) { |
|
| 173 | - if(!unlink($removeFile)) { |
|
| 172 | + if (file_exists($removeFile)) { |
|
| 173 | + if (!unlink($removeFile)) { |
|
| 174 | 174 | $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
| 175 | - }else{ |
|
| 175 | + } else { |
|
| 176 | 176 | $this->filename = ''; |
| 177 | 177 | $this->file_mime_type = ''; |
| 178 | 178 | $this->file = ''; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | return "$this->name"; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - function create_export_query($order_by, $where, $relate_link_join='') |
|
| 197 | + function create_export_query($order_by, $where, $relate_link_join = '') |
|
| 198 | 198 | { |
| 199 | 199 | $custom_join = $this->getCustomJoin(true, true, $where); |
| 200 | 200 | $custom_join['join'] .= $relate_link_join; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | $where_auto = " notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0)"; |
| 213 | 213 | |
| 214 | - if($where != "") |
|
| 214 | + if ($where != "") |
|
| 215 | 215 | $query .= "where $where AND ".$where_auto; |
| 216 | 216 | else |
| 217 | 217 | $query .= "where ".$where_auto; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | if (empty($order_by)) { |
| 221 | 221 | $order_by = 'notes.name'; |
| 222 | 222 | } |
| 223 | - $query .= ' ORDER BY ' . $order_by; |
|
| 223 | + $query .= ' ORDER BY '.$order_by; |
|
| 224 | 224 | |
| 225 | 225 | return $query; |
| 226 | 226 | } |
@@ -232,17 +232,17 @@ discard block |
||
| 232 | 232 | function fill_in_additional_detail_fields() { |
| 233 | 233 | parent::fill_in_additional_detail_fields(); |
| 234 | 234 | //TODO: Seems odd we need to clear out these values so that list views don't show the previous rows value if current value is blank |
| 235 | - $this->getRelatedFields('Contacts', $this->contact_id, array('name'=>'contact_name', 'phone_work'=>'contact_phone') ); |
|
| 236 | - if(!empty($this->contact_name)){ |
|
| 235 | + $this->getRelatedFields('Contacts', $this->contact_id, array('name'=>'contact_name', 'phone_work'=>'contact_phone')); |
|
| 236 | + if (!empty($this->contact_name)) { |
|
| 237 | 237 | |
| 238 | 238 | $emailAddress = new SugarEmailAddress(); |
| 239 | 239 | $this->contact_email = $emailAddress->getPrimaryAddress(false, $this->contact_id, 'Contacts'); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if(isset($this->contact_id) && $this->contact_id != '') { |
|
| 242 | + if (isset($this->contact_id) && $this->contact_id != '') { |
|
| 243 | 243 | $contact = new Contact(); |
| 244 | 244 | $contact->retrieve($this->contact_id); |
| 245 | - if(isset($contact->id)) { |
|
| 245 | + if (isset($contact->id)) { |
|
| 246 | 246 | $this->contact_name = $contact->full_name; |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -252,32 +252,32 @@ discard block |
||
| 252 | 252 | function get_list_view_data() |
| 253 | 253 | { |
| 254 | 254 | $note_fields = $this->get_list_view_array(); |
| 255 | - global $app_list_strings, $focus, $action, $currentModule,$mod_strings, $sugar_config; |
|
| 255 | + global $app_list_strings, $focus, $action, $currentModule, $mod_strings, $sugar_config; |
|
| 256 | 256 | |
| 257 | - if(isset($this->parent_type)) { |
|
| 257 | + if (isset($this->parent_type)) { |
|
| 258 | 258 | $note_fields['PARENT_MODULE'] = $this->parent_type; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - if(!empty($this->filename)) { |
|
| 262 | - if(file_exists("upload://{$this->id}")){ |
|
| 261 | + if (!empty($this->filename)) { |
|
| 262 | + if (file_exists("upload://{$this->id}")) { |
|
| 263 | 263 | $note_fields['FILENAME'] = $this->filename; |
| 264 | 264 | $note_fields['FILE_URL'] = UploadFile::get_upload_url($this); |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | - if(isset($this->contact_id) && $this->contact_id != '') { |
|
| 267 | + if (isset($this->contact_id) && $this->contact_id != '') { |
|
| 268 | 268 | $contact = new Contact(); |
| 269 | 269 | $contact->retrieve($this->contact_id); |
| 270 | - if(isset($contact->id)) { |
|
| 270 | + if (isset($contact->id)) { |
|
| 271 | 271 | $this->contact_name = $contact->full_name; |
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | - if(isset($this->contact_name)){ |
|
| 274 | + if (isset($this->contact_name)) { |
|
| 275 | 275 | $note_fields['CONTACT_NAME'] = $this->contact_name; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | global $current_language; |
| 279 | 279 | $mod_strings = return_module_language($current_language, 'Notes'); |
| 280 | - $note_fields['STATUS']=$mod_strings['LBL_NOTE_STATUS']; |
|
| 280 | + $note_fields['STATUS'] = $mod_strings['LBL_NOTE_STATUS']; |
|
| 281 | 281 | |
| 282 | 282 | |
| 283 | 283 | return $note_fields; |
@@ -287,17 +287,17 @@ discard block |
||
| 287 | 287 | $array_assign = parent::listviewACLHelper(); |
| 288 | 288 | $is_owner = false; |
| 289 | 289 | $in_group = false; //SECURITY GROUPS |
| 290 | - if(!empty($this->parent_name)) { |
|
| 291 | - if(!empty($this->parent_name_owner)) { |
|
| 290 | + if (!empty($this->parent_name)) { |
|
| 291 | + if (!empty($this->parent_name_owner)) { |
|
| 292 | 292 | global $current_user; |
| 293 | 293 | $is_owner = $current_user->id == $this->parent_name_owner; |
| 294 | 294 | } |
| 295 | 295 | /* BEGIN - SECURITY GROUPS */ |
| 296 | 296 | //parent_name_owner not being set for whatever reason so we need to figure this out |
| 297 | - else if(!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 297 | + else if (!empty($this->parent_type) && !empty($this->parent_id)) { |
|
| 298 | 298 | global $current_user; |
| 299 | - $parent_bean = BeanFactory::getBean($this->parent_type,$this->parent_id); |
|
| 300 | - if($parent_bean !== false) { |
|
| 299 | + $parent_bean = BeanFactory::getBean($this->parent_type, $this->parent_id); |
|
| 300 | + if ($parent_bean !== false) { |
|
| 301 | 301 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 302 | 302 | } |
| 303 | 303 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | /** |
| 311 | 311 | if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner)) { |
| 312 | 312 | */ |
| 313 | - if(!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)){ |
|
| 313 | + if (!ACLController::moduleSupportsACL($this->parent_type) || ACLController::checkAccess($this->parent_type, 'view', $is_owner, 'module', $in_group)) { |
|
| 314 | 314 | /* END - SECURITY GROUPS */ |
| 315 | 315 | $array_assign['PARENT'] = 'a'; |
| 316 | 316 | } else { |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $is_owner = false; |
| 321 | 321 | $in_group = false; //SECURITY GROUPS |
| 322 | - if(!empty($this->contact_name)) { |
|
| 323 | - if(!empty($this->contact_name_owner)) { |
|
| 322 | + if (!empty($this->contact_name)) { |
|
| 323 | + if (!empty($this->contact_name_owner)) { |
|
| 324 | 324 | global $current_user; |
| 325 | 325 | $is_owner = $current_user->id == $this->contact_name_owner; |
| 326 | 326 | } |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | //contact_name_owner not being set for whatever reason so we need to figure this out |
| 329 | 329 | else { |
| 330 | 330 | global $current_user; |
| 331 | - $parent_bean = BeanFactory::getBean('Contacts',$this->contact_id); |
|
| 332 | - if($parent_bean !== false) { |
|
| 331 | + $parent_bean = BeanFactory::getBean('Contacts', $this->contact_id); |
|
| 332 | + if ($parent_bean !== false) { |
|
| 333 | 333 | $is_owner = $current_user->id == $parent_bean->assigned_user_id; |
| 334 | 334 | } |
| 335 | 335 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | /** |
| 343 | 343 | if( ACLController::checkAccess('Contacts', 'view', $is_owner)) { |
| 344 | 344 | */ |
| 345 | - if( ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 345 | + if (ACLController::checkAccess('Contacts', 'view', $is_owner, 'module', $in_group)) { |
|
| 346 | 346 | /* END - SECURITY GROUPS */ |
| 347 | 347 | $array_assign['CONTACT'] = 'a'; |
| 348 | 348 | } else { |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | function bean_implements($interface) { |
| 356 | - switch($interface) { |
|
| 356 | + switch ($interface) { |
|
| 357 | 357 | case 'ACL':return true; |
| 358 | 358 | case 'FILE' : return true; |
| 359 | 359 | } |
@@ -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. |
@@ -104,8 +106,7 @@ discard block |
||
| 104 | 106 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 105 | 107 | if(isset($GLOBALS['log'])) { |
| 106 | 108 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 107 | - } |
|
| 108 | - else { |
|
| 109 | + } else { |
|
| 109 | 110 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 110 | 111 | } |
| 111 | 112 | self::__construct(); |
@@ -172,7 +173,7 @@ discard block |
||
| 172 | 173 | if(file_exists($removeFile)) { |
| 173 | 174 | if(!unlink($removeFile)) { |
| 174 | 175 | $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); |
| 175 | - }else{ |
|
| 176 | + } else{ |
|
| 176 | 177 | $this->filename = ''; |
| 177 | 178 | $this->file_mime_type = ''; |
| 178 | 179 | $this->file = ''; |
@@ -211,10 +212,11 @@ discard block |
||
| 211 | 212 | |
| 212 | 213 | $where_auto = " notes.deleted=0 AND (contacts.deleted IS NULL OR contacts.deleted=0)"; |
| 213 | 214 | |
| 214 | - if($where != "") |
|
| 215 | - $query .= "where $where AND ".$where_auto; |
|
| 216 | - else |
|
| 217 | - $query .= "where ".$where_auto; |
|
| 215 | + if($where != "") { |
|
| 216 | + $query .= "where $where AND ".$where_auto; |
|
| 217 | + } else { |
|
| 218 | + $query .= "where ".$where_auto; |
|
| 219 | + } |
|
| 218 | 220 | |
| 219 | 221 | $order_by = $this->process_order_by($order_by); |
| 220 | 222 | if (empty($order_by)) { |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | class FieldViewer{ |
| 41 | - function __construct(){ |
|
| 42 | - $this->ss = new Sugar_Smarty(); |
|
| 43 | - } |
|
| 41 | + function __construct(){ |
|
| 42 | + $this->ss = new Sugar_Smarty(); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
@@ -56,83 +56,83 @@ discard block |
||
| 56 | 56 | self::__construct(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - function getLayout($vardef){ |
|
| 59 | + function getLayout($vardef){ |
|
| 60 | 60 | |
| 61 | - if(empty($vardef['type']))$vardef['type'] = 'varchar'; |
|
| 62 | - $mod = return_module_language($GLOBALS['current_language'], 'DynamicFields'); |
|
| 63 | - $this->ss->assign('vardef', $vardef); |
|
| 64 | - $this->ss->assign('MOD', $mod); |
|
| 65 | - $this->ss->assign('APP', $GLOBALS['app_strings']); |
|
| 66 | - //Only display range search option if in Studio, not ModuleBuilder |
|
| 67 | - $this->ss->assign('range_search_option_enabled', empty($_REQUEST['view_package'])); |
|
| 61 | + if(empty($vardef['type']))$vardef['type'] = 'varchar'; |
|
| 62 | + $mod = return_module_language($GLOBALS['current_language'], 'DynamicFields'); |
|
| 63 | + $this->ss->assign('vardef', $vardef); |
|
| 64 | + $this->ss->assign('MOD', $mod); |
|
| 65 | + $this->ss->assign('APP', $GLOBALS['app_strings']); |
|
| 66 | + //Only display range search option if in Studio, not ModuleBuilder |
|
| 67 | + $this->ss->assign('range_search_option_enabled', empty($_REQUEST['view_package'])); |
|
| 68 | 68 | |
| 69 | - $GLOBALS['log']->debug('FieldViewer.php->getLayout() = '.$vardef['type']); |
|
| 70 | - switch($vardef['type']){ |
|
| 71 | - case 'address': |
|
| 69 | + $GLOBALS['log']->debug('FieldViewer.php->getLayout() = '.$vardef['type']); |
|
| 70 | + switch($vardef['type']){ |
|
| 71 | + case 'address': |
|
| 72 | 72 | return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/address.tpl'); |
| 73 | - case 'bool': |
|
| 74 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/bool.tpl'); |
|
| 75 | - case 'int': |
|
| 76 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/int.tpl'); |
|
| 77 | - case 'float': |
|
| 78 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/float.tpl'); |
|
| 79 | - case 'decimal': |
|
| 80 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/float.tpl'); |
|
| 81 | - case 'date': |
|
| 82 | - require_once('modules/DynamicFields/templates/Fields/Forms/date.php'); |
|
| 83 | - return get_body($this->ss, $vardef); |
|
| 84 | - case 'datetimecombo': |
|
| 85 | - case 'datetime': |
|
| 86 | - require_once('modules/DynamicFields/templates/Fields/Forms/datetimecombo.php'); |
|
| 87 | - return get_body($this->ss, $vardef); |
|
| 88 | - case 'enum': |
|
| 89 | - require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php'); |
|
| 90 | - return get_body($this->ss, $vardef); |
|
| 91 | - case 'multienum': |
|
| 92 | - require_once('modules/DynamicFields/templates/Fields/Forms/multienum.php'); |
|
| 93 | - return get_body($this->ss, $vardef); |
|
| 94 | - case 'radioenum': |
|
| 95 | - require_once('modules/DynamicFields/templates/Fields/Forms/radioenum.php'); |
|
| 96 | - return get_body($this->ss, $vardef); |
|
| 97 | - case 'html': |
|
| 98 | - require_once('modules/DynamicFields/templates/Fields/Forms/html.php'); |
|
| 99 | - return get_body($this->ss, $vardef); |
|
| 100 | - case 'currency': |
|
| 101 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/currency.tpl'); |
|
| 102 | - case 'relate': |
|
| 103 | - require_once('modules/DynamicFields/templates/Fields/Forms/relate.php'); |
|
| 104 | - return get_body($this->ss, $vardef); |
|
| 105 | - case 'parent': |
|
| 106 | - require_once('modules/DynamicFields/templates/Fields/Forms/parent.php'); |
|
| 107 | - return get_body($this->ss, $vardef); |
|
| 108 | - case 'text': |
|
| 109 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/text.tpl'); |
|
| 110 | - case 'encrypt': |
|
| 111 | - require_once('modules/DynamicFields/templates/Fields/Forms/encrypt.php'); |
|
| 112 | - return get_body($this->ss, $vardef); |
|
| 113 | - case 'iframe': |
|
| 114 | - require_once('modules/DynamicFields/templates/Fields/Forms/iframe.php'); |
|
| 115 | - return get_body($this->ss, $vardef); |
|
| 116 | - case 'url': |
|
| 117 | - require_once('modules/DynamicFields/templates/Fields/Forms/url.php'); |
|
| 118 | - return get_body($this->ss, $vardef); |
|
| 119 | - case 'phone:': |
|
| 120 | - require_once('modules/DynamicFields/templates/Fields/Forms/phone.php'); |
|
| 121 | - return get_body($this->ss, $vardef); |
|
| 122 | - default: |
|
| 123 | - $file = false; |
|
| 124 | - if(file_exists('custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){ |
|
| 125 | - $file = 'custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php'; |
|
| 126 | - } elseif(file_exists('modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){ |
|
| 127 | - $file = 'modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php'; |
|
| 128 | - } |
|
| 129 | - if(!empty($file)){ |
|
| 130 | - require_once($file); |
|
| 131 | - return get_body($this->ss, $vardef); |
|
| 132 | - }else{ |
|
| 133 | - return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/varchar.tpl'); |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 73 | + case 'bool': |
|
| 74 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/bool.tpl'); |
|
| 75 | + case 'int': |
|
| 76 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/int.tpl'); |
|
| 77 | + case 'float': |
|
| 78 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/float.tpl'); |
|
| 79 | + case 'decimal': |
|
| 80 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/float.tpl'); |
|
| 81 | + case 'date': |
|
| 82 | + require_once('modules/DynamicFields/templates/Fields/Forms/date.php'); |
|
| 83 | + return get_body($this->ss, $vardef); |
|
| 84 | + case 'datetimecombo': |
|
| 85 | + case 'datetime': |
|
| 86 | + require_once('modules/DynamicFields/templates/Fields/Forms/datetimecombo.php'); |
|
| 87 | + return get_body($this->ss, $vardef); |
|
| 88 | + case 'enum': |
|
| 89 | + require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php'); |
|
| 90 | + return get_body($this->ss, $vardef); |
|
| 91 | + case 'multienum': |
|
| 92 | + require_once('modules/DynamicFields/templates/Fields/Forms/multienum.php'); |
|
| 93 | + return get_body($this->ss, $vardef); |
|
| 94 | + case 'radioenum': |
|
| 95 | + require_once('modules/DynamicFields/templates/Fields/Forms/radioenum.php'); |
|
| 96 | + return get_body($this->ss, $vardef); |
|
| 97 | + case 'html': |
|
| 98 | + require_once('modules/DynamicFields/templates/Fields/Forms/html.php'); |
|
| 99 | + return get_body($this->ss, $vardef); |
|
| 100 | + case 'currency': |
|
| 101 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/currency.tpl'); |
|
| 102 | + case 'relate': |
|
| 103 | + require_once('modules/DynamicFields/templates/Fields/Forms/relate.php'); |
|
| 104 | + return get_body($this->ss, $vardef); |
|
| 105 | + case 'parent': |
|
| 106 | + require_once('modules/DynamicFields/templates/Fields/Forms/parent.php'); |
|
| 107 | + return get_body($this->ss, $vardef); |
|
| 108 | + case 'text': |
|
| 109 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/text.tpl'); |
|
| 110 | + case 'encrypt': |
|
| 111 | + require_once('modules/DynamicFields/templates/Fields/Forms/encrypt.php'); |
|
| 112 | + return get_body($this->ss, $vardef); |
|
| 113 | + case 'iframe': |
|
| 114 | + require_once('modules/DynamicFields/templates/Fields/Forms/iframe.php'); |
|
| 115 | + return get_body($this->ss, $vardef); |
|
| 116 | + case 'url': |
|
| 117 | + require_once('modules/DynamicFields/templates/Fields/Forms/url.php'); |
|
| 118 | + return get_body($this->ss, $vardef); |
|
| 119 | + case 'phone:': |
|
| 120 | + require_once('modules/DynamicFields/templates/Fields/Forms/phone.php'); |
|
| 121 | + return get_body($this->ss, $vardef); |
|
| 122 | + default: |
|
| 123 | + $file = false; |
|
| 124 | + if(file_exists('custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){ |
|
| 125 | + $file = 'custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php'; |
|
| 126 | + } elseif(file_exists('modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){ |
|
| 127 | + $file = 'modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php'; |
|
| 128 | + } |
|
| 129 | + if(!empty($file)){ |
|
| 130 | + require_once($file); |
|
| 131 | + return get_body($this->ss, $vardef); |
|
| 132 | + }else{ |
|
| 133 | + return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/varchar.tpl'); |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | 138 | } |
| 139 | 139 | \ No newline at end of file |
@@ -37,17 +37,17 @@ discard block |
||
| 37 | 37 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
| 38 | 38 | ********************************************************************************/ |
| 39 | 39 | |
| 40 | -class FieldViewer{ |
|
| 41 | - function __construct(){ |
|
| 40 | +class FieldViewer { |
|
| 41 | + function __construct() { |
|
| 42 | 42 | $this->ss = new Sugar_Smarty(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 47 | 47 | */ |
| 48 | - function FieldViewer(){ |
|
| 48 | + function FieldViewer() { |
|
| 49 | 49 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 50 | - if(isset($GLOBALS['log'])) { |
|
| 50 | + if (isset($GLOBALS['log'])) { |
|
| 51 | 51 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 52 | 52 | } |
| 53 | 53 | else { |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | self::__construct(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - function getLayout($vardef){ |
|
| 59 | + function getLayout($vardef) { |
|
| 60 | 60 | |
| 61 | - if(empty($vardef['type']))$vardef['type'] = 'varchar'; |
|
| 61 | + if (empty($vardef['type']))$vardef['type'] = 'varchar'; |
|
| 62 | 62 | $mod = return_module_language($GLOBALS['current_language'], 'DynamicFields'); |
| 63 | 63 | $this->ss->assign('vardef', $vardef); |
| 64 | 64 | $this->ss->assign('MOD', $mod); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $this->ss->assign('range_search_option_enabled', empty($_REQUEST['view_package'])); |
| 68 | 68 | |
| 69 | 69 | $GLOBALS['log']->debug('FieldViewer.php->getLayout() = '.$vardef['type']); |
| 70 | - switch($vardef['type']){ |
|
| 70 | + switch ($vardef['type']) { |
|
| 71 | 71 | case 'address': |
| 72 | 72 | return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/address.tpl'); |
| 73 | 73 | case 'bool': |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | return get_body($this->ss, $vardef); |
| 122 | 122 | default: |
| 123 | 123 | $file = false; |
| 124 | - if(file_exists('custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){ |
|
| 125 | - $file = 'custom/modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php'; |
|
| 126 | - } elseif(file_exists('modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php')){ |
|
| 127 | - $file = 'modules/DynamicFields/templates/Fields/Forms/' . $vardef['type'] . '.php'; |
|
| 124 | + if (file_exists('custom/modules/DynamicFields/templates/Fields/Forms/'.$vardef['type'].'.php')) { |
|
| 125 | + $file = 'custom/modules/DynamicFields/templates/Fields/Forms/'.$vardef['type'].'.php'; |
|
| 126 | + } elseif (file_exists('modules/DynamicFields/templates/Fields/Forms/'.$vardef['type'].'.php')) { |
|
| 127 | + $file = 'modules/DynamicFields/templates/Fields/Forms/'.$vardef['type'].'.php'; |
|
| 128 | 128 | } |
| 129 | - if(!empty($file)){ |
|
| 129 | + if (!empty($file)) { |
|
| 130 | 130 | require_once($file); |
| 131 | 131 | return get_body($this->ss, $vardef); |
| 132 | - }else{ |
|
| 132 | + } else { |
|
| 133 | 133 | return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/varchar.tpl'); |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 50 | 50 | if(isset($GLOBALS['log'])) { |
| 51 | 51 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 52 | - } |
|
| 53 | - else { |
|
| 52 | + } else { |
|
| 54 | 53 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 55 | 54 | } |
| 56 | 55 | self::__construct(); |
@@ -58,7 +57,9 @@ discard block |
||
| 58 | 57 | |
| 59 | 58 | function getLayout($vardef){ |
| 60 | 59 | |
| 61 | - if(empty($vardef['type']))$vardef['type'] = 'varchar'; |
|
| 60 | + if(empty($vardef['type'])) { |
|
| 61 | + $vardef['type'] = 'varchar'; |
|
| 62 | + } |
|
| 62 | 63 | $mod = return_module_language($GLOBALS['current_language'], 'DynamicFields'); |
| 63 | 64 | $this->ss->assign('vardef', $vardef); |
| 64 | 65 | $this->ss->assign('MOD', $mod); |
@@ -129,7 +130,7 @@ discard block |
||
| 129 | 130 | if(!empty($file)){ |
| 130 | 131 | require_once($file); |
| 131 | 132 | return get_body($this->ss, $vardef); |
| 132 | - }else{ |
|
| 133 | + } else{ |
|
| 133 | 134 | return $this->ss->fetch('modules/DynamicFields/templates/Fields/Forms/varchar.tpl'); |
| 134 | 135 | } |
| 135 | 136 | } |
@@ -1,20 +1,20 @@ 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 | require_once('modules/DynamicFields/templates/Fields/TemplateText.php'); |
| 5 | -class TemplateCronSchedule extends TemplateText{ |
|
| 6 | - var $type='CronSchedule'; |
|
| 5 | +class TemplateCronSchedule extends TemplateText { |
|
| 6 | + var $type = 'CronSchedule'; |
|
| 7 | 7 | |
| 8 | - function __construct(){ |
|
| 8 | + function __construct() { |
|
| 9 | 9 | parent::__construct(); |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 14 | 14 | */ |
| 15 | - function TemplateCronSchedule(){ |
|
| 15 | + function TemplateCronSchedule() { |
|
| 16 | 16 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 17 | - if(isset($GLOBALS['log'])) { |
|
| 17 | + if (isset($GLOBALS['log'])) { |
|
| 18 | 18 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 19 | 19 | } |
| 20 | 20 | else { |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - function get_field_def(){ |
|
| 27 | + function get_field_def() { |
|
| 28 | 28 | $def = parent::get_field_def(); |
| 29 | 29 | $def['dbType'] = 'varchar'; |
| 30 | 30 | return $def; |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -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. |
@@ -39,21 +39,21 @@ discard block |
||
| 39 | 39 | ********************************************************************************/ |
| 40 | 40 | |
| 41 | 41 | |
| 42 | -class TemplateDecimal extends TemplateFloat{ |
|
| 42 | +class TemplateDecimal extends TemplateFloat { |
|
| 43 | 43 | var $type = 'decimal'; |
| 44 | 44 | var $default = null; |
| 45 | 45 | var $default_value = null; |
| 46 | 46 | |
| 47 | - function __construct(){ |
|
| 47 | + function __construct() { |
|
| 48 | 48 | parent::__construct(); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 53 | 53 | */ |
| 54 | - function TemplateDecimal(){ |
|
| 54 | + function TemplateDecimal() { |
|
| 55 | 55 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 56 | - if(isset($GLOBALS['log'])) { |
|
| 56 | + if (isset($GLOBALS['log'])) { |
|
| 57 | 57 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 58 | 58 | } |
| 59 | 59 | else { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | function get_db_type() |
| 67 | 67 | { |
| 68 | - if(empty($this->len)) { |
|
| 68 | + if (empty($this->len)) { |
|
| 69 | 69 | return parent::get_db_type(); |
| 70 | 70 | } |
| 71 | 71 | $precision = (!empty($this->precision)) ? $this->precision : 6; |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 56 | 56 | */ |
| 57 | - function TemplateDynamicenum(){ |
|
| 57 | + function TemplateDynamicenum() { |
|
| 58 | 58 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 59 | - if(isset($GLOBALS['log'])) { |
|
| 59 | + if (isset($GLOBALS['log'])) { |
|
| 60 | 60 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 61 | 61 | } |
| 62 | 62 | else { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | if (!empty($this->help)) { |
| 89 | - $returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir); |
|
| 89 | + $returnXTPL[strtoupper($this->name.'_help')] = translate($this->help, $this->bean->module_dir); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | global $app_list_strings; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | if (empty($this->ext1)) { |
| 96 | 96 | $this->ext1 = $this->options; |
| 97 | 97 | } |
| 98 | - $returnXTPL[strtoupper('options_' . $this->name)] = get_select_options_with_id($app_list_strings[$this->ext1], $value); |
|
| 98 | + $returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id($app_list_strings[$this->ext1], $value); |
|
| 99 | 99 | |
| 100 | 100 | return $returnXTPL; |
| 101 | 101 | |
@@ -1,6 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 3 | +if (!defined('sugarEntry') || !sugarEntry) { |
|
| 4 | + die('Not A Valid Entry Point'); |
|
| 5 | +} |
|
| 4 | 6 | |
| 5 | 7 | class MeetingsJjwg_MapsLogicHook |
| 6 | 8 | { |
@@ -19,8 +21,7 @@ discard block |
||
| 19 | 21 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 20 | 22 | if(isset($GLOBALS['log'])) { |
| 21 | 23 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 22 | - } |
|
| 23 | - else { |
|
| 24 | + } else { |
|
| 24 | 25 | trigger_error($deprecatedMessage, E_USER_DEPRECATED); |
| 25 | 26 | } |
| 26 | 27 | self::__construct(); |
@@ -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,18 +48,18 @@ discard block |
||
| 48 | 48 | var $len = '18'; |
| 49 | 49 | var $precision = '8'; |
| 50 | 50 | |
| 51 | - public function __construct(){ |
|
| 51 | + public function __construct() { |
|
| 52 | 52 | parent::__construct(); |
| 53 | - $this->vardef_map['precision']='ext1'; |
|
| 53 | + $this->vardef_map['precision'] = 'ext1'; |
|
| 54 | 54 | //$this->vardef_map['precision']='precision'; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead |
| 59 | 59 | */ |
| 60 | - public function TemplateFloat(){ |
|
| 60 | + public function TemplateFloat() { |
|
| 61 | 61 | $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code'; |
| 62 | - if(isset($GLOBALS['log'])) { |
|
| 62 | + if (isset($GLOBALS['log'])) { |
|
| 63 | 63 | $GLOBALS['log']->deprecated($deprecatedMessage); |
| 64 | 64 | } |
| 65 | 65 | else { |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - function get_field_def(){ |
|
| 72 | + function get_field_def() { |
|
| 73 | 73 | $def = parent::get_field_def(); |
| 74 | 74 | $def['precision'] = isset($this->ext1) && $this->ext1 != '' ? $this->ext1 : $this->precision; |
| 75 | 75 | return $def; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - function get_db_type(){ |
|
| 79 | - $precision = (!empty($this->precision))? $this->precision: 6; |
|
| 80 | - if(empty($this->len)) { |
|
| 78 | + function get_db_type() { |
|
| 79 | + $precision = (!empty($this->precision)) ? $this->precision : 6; |
|
| 80 | + if (empty($this->len)) { |
|
| 81 | 81 | return parent::get_db_type(); |
| 82 | 82 | } |
| 83 | 83 | return " ".sprintf($GLOBALS['db']->getColumnType("decimal_tpl"), $this->len, $precision); |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | * Date: 06/03/15 |
| 44 | 44 | * Comments |
| 45 | 45 | */ |
| 46 | -if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
|
| 46 | +if(!defined('sugarEntry') || !sugarEntry) { |
|
| 47 | + die('Not A Valid Entry Point'); |
|
| 48 | +} |
|
| 47 | 49 | |
| 48 | 50 | class CasesController extends SugarController { |
| 49 | 51 | |
@@ -90,8 +92,7 @@ discard block |
||
| 90 | 92 | $count++; |
| 91 | 93 | } |
| 92 | 94 | echo '</table>'; |
| 93 | - } |
|
| 94 | - else { |
|
| 95 | + } else { |
|
| 95 | 96 | echo $mod_strings['LBL_NO_SUGGESTIONS']; |
| 96 | 97 | } |
| 97 | 98 | die(); |