2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Description: Base Form For Notes
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
47 class ProspectListFormBase {
50 function getForm($prefix, $mod='', $form=''){
52 if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
57 global $current_language;
58 $mod_strings = return_module_language($current_language, $mod);
62 global $app_strings,$current_user;
64 $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
65 $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
66 $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
67 $user_id = $current_user->id;
70 $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
72 <form name="${prefix}ProspectListSave" onSubmit="return check_form('${prefix}ProspectListSave');" method="POST" action="index.php">
73 <input type="hidden" name="${prefix}module" value="ProspectLists">
74 <input type="hidden" name="${prefix}action" value="Save">
75 <input type="hidden" name="assigned_user_id" value='${user_id}'>
78 $the_form .= $this->getFormBody($prefix, $mod, $prefix."ProspectListSave");
80 <p><input title="$lbl_save_button_title" accessKey="$lbl_save_button_key" class="button" type="submit" name="button" value=" $lbl_save_button_label " ></p>
85 $the_form .= get_left_form_footer();
86 $the_form .= get_validate_record_js();
91 function getFormBody($prefix, $mod='',$formname='', $size='30',$script=true) {
92 if(!ACLController::checkAccess('ProspectLists', 'edit', true)){
96 $temp_strings = $mod_strings;
98 global $current_language;
99 $mod_strings = return_module_language($current_language, $mod);
102 global $current_user;
103 global $app_list_strings;
105 $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
106 $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
107 $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
108 $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
109 $user_id = $current_user->id;
111 $list_options=get_select_options_with_id($app_list_strings['prospect_list_type_dom'], 'default');
113 $lbl_prospect_list_name = $mod_strings['LBL_PROSPECT_LIST_NAME'];
114 $lbl_list_type = $mod_strings['LBL_LIST_TYPE'];
117 <p><input type="hidden" name="record" value="">
118 $lbl_prospect_list_name <span class="required">$lbl_required_symbol</span><br>
119 <input name='name' type="text" value=""><br>
120 $lbl_list_type <span class="required">$lbl_required_symbol</span><br>
121 <select name="list_type">$list_options</select></p>
126 $javascript = new javascript();
127 $javascript->setFormName($formname);
128 $javascript->setSugarBean(new ProspectList());
129 $javascript->addRequiredFields($prefix);
130 $form .=$javascript->getScript();
131 $mod_strings = $temp_strings;
135 function handleSave($prefix,$redirect=true, $useRequired=false){
138 require_once('include/formbase.php');
141 $focus = new ProspectList();
142 if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))){
145 $focus = populateFromPost($prefix, $focus);
146 if(!$focus->ACLAccess('Save')){
147 ACLController::displayNoAccess(true);
150 if(empty($focus->name)){
153 if ( !isset($focus->assigned_user_id) || $focus->assigned_user_id == '' )
154 $focus->assigned_user_id = $GLOBALS['current_user']->id;
156 $return_id = $focus->save();
158 $GLOBALS['log']->debug("Saved record with id of ".$return_id);
159 handleRedirect($return_id, "ProspectLists");