Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateDate.php');
function get_body(&$ss, $vardef){
$td = new TemplateDate();
$ss->assign('default_values', array_flip($td->dateStrings));
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/date.tpl');
}
?>

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateDatetimecombo.php');
function get_body(&$ss, $vardef){
$defaultTime = '';
$hours = "";
$minitues = "";
$meridiem = "";
$td = new TemplateDatetimecombo();
$ss->assign('default_values', array_flip($td->dateStrings));
global $timedate;
$user_time_format = $timedate->get_user_time_format();
$show_meridiem = preg_match('/pm$/i', $user_time_format) ? true : false;
if($show_meridiem) {
$ss->assign('default_hours_values', array_flip($td->hoursStrings));
} else {
$ss->assign('default_hours_values', array_flip($td->hoursStrings24));
}
$ss->assign('show_meridiem', $show_meridiem);
$ss->assign('default_minutes_values', array_flip($td->minutesStrings));
$ss->assign('default_meridiem_values', array_flip($td->meridiemStrings));
if(isset($vardef['display_default']) && strstr($vardef['display_default'] , '&')){
$dt = explode("&", $vardef['display_default']); //+1 day&06:00pm
$date = $dt[0];
$defaultTime = $dt[1];
$hours = substr($defaultTime, 0, 2);
$minitues = substr($defaultTime, 3, 2);
$meridiem = substr($defaultTime, 5, 2);
if(!$show_meridiem) {
preg_match('/(am|pm)$/i', $meridiem, $matches);
if(strtolower($matches[0]) == 'am' && $hours == 12) {
$hours = '00';
} else if (strtolower($matches[0]) == 'pm' && $hours != 12) {
$hours += 12;
}
}
$ss->assign('default_date', $date);
}
$ss->assign('default_hours', $hours);
$ss->assign('default_minutes', $minitues);
$ss->assign('default_meridiem', $meridiem);
$ss->assign('defaultTime', $defaultTime);
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/datetimecombo.tpl');
}
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
function get_body(&$ss, $vardef){
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/encrypt.tpl');
}
?>

View File

@@ -0,0 +1,116 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on Jul 18, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
function get_body(&$ss, $vardef){
$multi = false;
if (isset ($vardef['type']) && $vardef['type'] == 'multienum')
$multi = true;
$selected_options = "";
if ($multi && !empty($vardef['default'])) {
$selected_options = unencodeMultienum( $vardef['default']);
} else if (isset($vardef['default'])){
$selected_options = $vardef['default'];
}
if(!isset($edit_mod_strings)){
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
}
if(!empty($_REQUEST['type']) && $_REQUEST['type'] == 'radioenum'){
$edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_RADIO_FIELDS'];
}
$package_strings = array();
if(!empty($_REQUEST['view_package'])){
$view_package = $_REQUEST['view_package'];
if($view_package != 'studio') {
require_once('modules/ModuleBuilder/MB/ModuleBuilder.php');
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($view_package, $_REQUEST['view_module']);
$lang = $GLOBALS['current_language'];
//require_once($package->getPackageDir()."/include/language/$lang.lang.php");
$module->mblanguage->generateAppStrings(false);
$package_strings = $module->mblanguage->appListStrings[$lang.'.lang.php'];
}
}
global $app_list_strings;
$my_list_strings = $app_list_strings;
$my_list_strings = array_merge($my_list_strings, $package_strings);
foreach($my_list_strings as $key=>$value){
if(!is_array($value)){
unset($my_list_strings[$key]);
}
}
$dropdowns = array_keys($my_list_strings);
sort($dropdowns);
$default_dropdowns = array();
if(!empty($vardef['options']) && !empty($my_list_strings[$vardef['options']])){
$default_dropdowns = $my_list_strings[$vardef['options']];
}else{
//since we do not have a default value then we should assign the first one.
$key = $dropdowns[0];
$default_dropdowns = $my_list_strings[$key];
}
$selected_dropdown = '';
if(!empty($vardef['options'])){
$selected_dropdown = $vardef['options'];
}
$show = true;
if(!empty($_REQUEST['refresh_dropdown']))
$show = false;
$ss->assign('dropdowns', $dropdowns);
$ss->assign('default_dropdowns', $default_dropdowns);
$ss->assign('selected_dropdown', $selected_dropdown);
$ss->assign('show', $show);
$ss->assign('selected_options', $selected_options);
$ss->assign('multi', isset($multi) ? $multi: false);
$ss->assign('dropdown_name',(!empty($vardef['options']) ? $vardef['options'] : ''));
require_once('include/JSON.php');
$json = new JSON(JSON_LOOSE_TYPE);
$ss->assign('app_list_strings', "''");
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/enum.tpl');
}
?>

View File

@@ -0,0 +1,54 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function get_body(&$ss, $vardef){
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
$ss->assign('MOD', $edit_mod_strings);
if(!empty($cf))$ss->assign('cf', $cf);
$edValue = '';
if(!empty($vardef['default_value'])) {
$edValue = $vardef['default_value'];
$edValue = str_replace(array("\r\n", "\n"), " ",$edValue);
}
$ss->assign('HTML_EDITOR', $edValue);
$ss->assign('preSave', 'document.popup_form.presave();');
///////////////////////////////////
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/html.tpl');
}
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function get_body(&$ss, $vardef){
$vars = $ss->get_template_vars();
$fields = $vars['module']->mbvardefs->vardefs['fields'];
$fieldOptions = array();
foreach($fields as $id=>$def) {
$fieldOptions[$id] = $def['name'];
}
$ss->assign('fieldOpts', $fieldOptions);
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/iframe.tpl');
}

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function get_body(&$ss, $vardef){
global $app_list_strings;
//$edit_mod_strings = return_module_language($current_language, 'EditCustomFields');
//$edit_mod_strings['COLUMN_TITLE_DEFAULT_VALUE'] = $edit_mod_strings['COLUMN_TITLE_URL'];
$vars = $ss->get_template_vars();
$fields = $vars['module']->mbvardefs->vardefs['fields'];
$fieldOptions = array();
foreach($fields as $id=>$def) {
$fieldOptions[$id] = $def['name'];
}
$ss->assign('fieldOpts', $fieldOptions);
$link_target = !empty($vardef['link_target']) ? $vardef['link_target'] : '_blank';
$ss->assign('TARGET_OPTIONS', get_select_options_with_id($app_list_strings['link_target_dom'], $link_target));
$ss->assign('LINK_TARGET', $link_target);
$ss->assign('LINK_TARGET_LABEL', $app_list_strings['link_target_dom'][$link_target]);
$ss->assign('hideImportable', 'false');
$ss->assign('hideDuplicatable', 'false');
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/image.tpl');
}
?>

View File

@@ -0,0 +1,45 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
$edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_MULTI_SELECT_LIST'];
$multi = 'true';
require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php');
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
function get_body(&$ss, $vardef){
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/parent.tpl');
}
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$edit_mod_strings = return_module_language($GLOBALS['current_language'], 'EditCustomFields');
$edit_mod_strings['LBL_DROP_DOWN_LIST'] = $edit_mod_strings['LBL_RADIO_FIELDS'];
require_once('modules/DynamicFields/templates/Fields/Forms/enum2.php');
?>

View File

@@ -0,0 +1,68 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry)
die ( 'Not A Valid Entry Point' ) ;
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function get_body (&$ss , $vardef)
{
$modules = array ( ) ;
require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php' ;
$relatableModules = array_keys ( DeployedRelationships::findRelatableModules () ) ;
foreach ( $relatableModules as $module )
{
$modules [ $module ] = translate ( 'LBL_MODULE_NAME', $module ) ;
}
foreach ( ACLController::disabledModuleList ( $modules, false, 'list' ) as $disabled_parent_type )
{
unset ( $modules [ $disabled_parent_type ] ) ;
}
unset ( $modules [ "" ] ) ;
unset ( $modules [ 'Activities' ] ) ; // cannot relate to Activities as only Activities' submodules have records; use a Flex Relate instead!
// tyoung bug 18631 - reduce potential confusion when creating a relate custom field for Products - actually points to the Product Catalog, so label it that way in the drop down list
if (isset ( $modules [ 'ProductTemplates' ] ) && $modules [ 'ProductTemplates' ] == 'Product')
$modules [ 'ProductTemplates' ] = translate ( 'LBL_MODULE_NAME', 'ProductTemplates' ) ;
$ss->assign ( 'modules', $modules ) ;
return $ss->fetch ( 'modules/DynamicFields/templates/Fields/Forms/relate.tpl' ) ;
}
?>

View File

@@ -0,0 +1,60 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
function get_body(&$ss, $vardef){
global $app_list_strings;
//$edit_mod_strings = return_module_language($current_language, 'EditCustomFields');
//$edit_mod_strings['COLUMN_TITLE_DEFAULT_VALUE'] = $edit_mod_strings['COLUMN_TITLE_URL'];
$vars = $ss->get_template_vars();
$fields = $vars['module']->mbvardefs->vardefs['fields'];
$fieldOptions = array();
foreach($fields as $id=>$def) {
$fieldOptions[$id] = $def['name'];
}
$ss->assign('fieldOpts', $fieldOptions);
$link_target = !empty($vardef['link_target']) ? $vardef['link_target'] : '_blank';
$ss->assign('TARGET_OPTIONS', get_select_options_with_id($app_list_strings['link_target_dom'], $link_target));
$ss->assign('LINK_TARGET', $link_target);
$ss->assign('LINK_TARGET_LABEL', $app_list_strings['link_target_dom'][$link_target]);
//_ppd($ss->fetch('modules/DynamicFields/templates/Fields/Forms/url.tpl'));
return $ss->fetch('modules/DynamicFields/templates/Fields/Forms/url.tpl');
}
?>

View File

@@ -0,0 +1,66 @@
<?php
if (! defined ( 'sugarEntry' ) || ! sugarEntry) die ( 'Not A Valid Entry Point' ) ;
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once ('modules/DynamicFields/templates/Fields/TemplateField.php') ;
require_once ('modules/DynamicFields/templates/Fields/TemplateAddressCountry.php') ;
class TemplateAddress extends TemplateField
{
var $type = 'varchar' ;
function save ($df)
{
$this->type = 'varchar' ;
require_once 'modules/ModuleBuilder/parsers/parser.label.php' ;
$parser = new ParserLabel ( $df->getModuleName() , $df->getPackageName() ) ;
foreach ( array ( 'City' , 'State' , 'PostalCode' , 'Country' ) as $addressFieldName )
{
$systemLabel = strtoupper( "LBL_" . $this->name . '_' . $addressFieldName );
$parser->handleSave ( array( "label_" . $systemLabel => $this->label_value . ' ' . $addressFieldName ) , $GLOBALS [ 'current_language' ] ) ;
$addressField = new TemplateField ( ) ;
$addressField->len = ($addressFieldName == 'PostalCode') ? 20 : 100 ;
$addressField->name = $this->name . '_' . strtolower ( $addressFieldName ) ;
$addressField->label = $addressField->vname = $systemLabel ;
$addressField->save ( $df ) ;
}
// finally save the base street address field
parent::save($df);
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
require_once('include/utils/array_utils.php');
class TemplateAddressCountry extends TemplateEnum {
var $group = '';
function get_field_def(){
$def = parent::get_field_def();
$def['group'] = $this->group;
$def['options'] = 'countries_dom';
return $def;
}
}
?>

View File

@@ -0,0 +1,134 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
class TemplateBoolean extends TemplateField{
var $default_value = '0';
var $default = '0';
var $type = 'bool';
function get_db_type(){
if ($GLOBALS['db']->dbType=='oci8') {
return " NUMBER(1) ";
}elseif($GLOBALS['db']->dbType=='mssql'){
return " bit ";
}else{
return " BOOL ";
}
}
//BEGIN BACKWARDS COMPATABILITY
function get_xtpl_edit(){
$name = $this->name;
$returnXTPL = array();
if(!empty($this->help)){
$returnXTPL[$this->name . '_help'] = translate($this->help, $this->bean->module_dir);
}
if(isset($this->bean->$name)){
if(strcmp($this->bean->$name ,'1') ==0 || strcmp($this->bean->$name,'on')==0 || strcmp($this->bean->$name,'yes')==0 || strcmp($this->bean->$name, 'true')==0){
$returnXTPL[$this->name . '_checked'] = 'checked';
$returnXTPL[$this->name] = 'checked';
}
}else{
if(empty($this->bean->id)){
if(!empty($this->default_value)){
if(!(strcmp($this->default_value,'false')==0 || strcmp($this->default_value,'no')==0 || strcmp($this->default_value,'off')==0 )){
$returnXTPL[$this->name . '_checked'] = 'checked';
$returnXTPL[$this->name] = 'checked';
}
}
$returnXTPL[strtoupper($this->name)] = $this->default_value;
}
}
return $returnXTPL;
}
function get_xtpl_search(){
if(!empty($_REQUEST[$this->name])){
$returnXTPL = array();
if($_REQUEST[$this->name] == '1' || $_REQUEST[$this->name] == 'on' || $_REQUEST[$this->name] == 'yes'){
$returnXTPL[$this->name . '_checked'] = 'checked';
$returnXTPL[$this->name] = 'checked';
}
return $returnXTPL;
}
return '';
}
function get_xtpl_detail(){
$name = $this->name;
$returnXTPL = array();
if(!empty($this->help)){
$returnXTPL[$this->name . '_help'] = translate($this->help, $this->bean->module_dir);
}
$returnXTPL[$this->name . '_checked'] = '';
$returnXTPL[$this->name] = '';
if(isset($this->bean->$name)){
if(strcmp($this->bean->$name ,'1') ==0 || strcmp($this->bean->$name,'on')==0 || strcmp($this->bean->$name,'yes')==0 || strcmp($this->bean->$name, 'true')==0){
$returnXTPL[$this->name . '_checked'] = 'checked';
$returnXTPL[$this->name] = 'checked';
}
}
return $returnXTPL;
}
function get_xtpl_list(){
return $this->get_xtpl_edit();
}
}
?>

View File

@@ -0,0 +1,96 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateCurrencyId.php');
class TemplateCurrency extends TemplateText{
var $max_size = 25;
var $len = 26 ;
var $type='currency';
function delete($df){
parent::delete($df);
//currency id
$currency_id = new TemplateCurrencyId();
$currency_id->name = 'currency_id';
$currency_id->delete($df);
}
function save($df){
//the currency field
$this->default = unformat_number($this->default);
$this->default_value = $this->default;
parent::save($df);
//currency id
$currency_id = new TemplateCurrencyId();
$currency_id->name = 'currency_id';
$currency_id->vname = 'LBL_CURRENCY';
$currency_id->label = $currency_id->vname;
$currency_id->save($df);
//$df->addLabel($currency_id->vname);
}
function get_db_type(){
$precision = (!empty($this->precision)) ? $this->precision : 6;
switch($GLOBALS['db']->dbType){
case 'oci8':
if(!empty($this->len))
{
return " number( {$this->len} , $precision )";
}else{
return " number(26,$precision)";
}
case 'mssql':
if(!empty($this->len))
{
return " decimal( {$this->len} , $precision )";
}else{
return " decimal(26,$precision)";
}
default:
if(!empty($this->len))
{
return " decimal( {$this->len} , $precision )";
}else{
return " decimal(26,$precision)";
}
}
}
}
?>

View File

@@ -0,0 +1,62 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateId.php');
class TemplateCurrencyId extends TemplateId{
var $max_size = 25;
var $type='currency_id';
function get_field_def(){
$def = parent::get_field_def();
$def['type'] = 'id';
$def['studio'] = 'visible';
$def['function'] = array('name'=>'getCurrencyDropDown', 'returns'=>'html');
return $def;
}
function save($df){
if(!$df->fieldExists($this->name))
parent::save($df);
}
function delete($df){
if(!$df->fieldExists($this->name))
parent::delete($df);
}
}
?>

View File

@@ -0,0 +1,104 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateDate extends TemplateText{
var $type = 'date';
var $len = '';
var $dateStrings;
function __construct() {
global $app_strings;
$this->dateStrings = array(
$app_strings['LBL_NONE']=>'',
$app_strings['LBL_YESTERDAY']=> '-1 day',
$app_strings['LBL_TODAY']=>'now',
$app_strings['LBL_TOMORROW']=>'+1 day',
$app_strings['LBL_NEXT_WEEK']=> '+1 week',
$app_strings['LBL_NEXT_MONDAY']=>'next monday + 1 day',
$app_strings['LBL_NEXT_FRIDAY']=>'next friday + 1 day',
$app_strings['LBL_TWO_WEEKS']=> '+2 weeks',
$app_strings['LBL_NEXT_MONTH']=> '+1 month',
$app_strings['LBL_FIRST_DAY_OF_NEXT_MONTH']=> 'first of next month', // must handle this non-GNU date string in SugarBean->populateDefaultValues; if we don't this will evaluate to 1969...
$app_strings['LBL_THREE_MONTHS']=> '+3 months', //kbrill Bug #17023
$app_strings['LBL_SIXMONTHS']=> '+6 months',
$app_strings['LBL_NEXT_YEAR']=> '+1 year',
);
}
function get_db_type(){
if($GLOBALS['db']->dbType == 'mssql'){
return " DATETIME ";
} else {
return " DATE ";
}
}
function get_db_default($modify=false){
return '';
}
//BEGIN BACKWARDS COMPATABILITY
function get_xtpl_edit(){
global $timedate;
$name = $this->name;
$returnXTPL = array();
if(!empty($this->help)){
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
}
$returnXTPL['USER_DATEFORMAT'] = $timedate->get_user_date_format();
$returnXTPL['CALENDAR_DATEFORMAT'] = $timedate->get_cal_date_format();
if(isset($this->bean->$name)){
$returnXTPL[strtoupper($this->name)] = $this->bean->$name;
}else{
if(empty($this->bean->id) && !empty($this->default_value) && !empty($this->dateStrings[$this->default_value])){
$returnXTPL[strtoupper($this->name)] = $GLOBALS['timedate']->to_display_date(date($GLOBALS['timedate']->dbDayFormat,strtotime($this->dateStrings[$this->default_value])), false);
}
}
return $returnXTPL;
}
function get_field_def(){
$def = parent::get_field_def();
if(!empty($def['default'])){
$def['display_default'] = $def['default'];
$def['default'] = '';
}
return $def;
}
}
?>

View File

@@ -0,0 +1,182 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateDatetimecombo extends TemplateText{
var $type = 'datetimecombo';
var $len = '';
var $dateStrings = array(
'-none-' => '',
'today'=>'now',
'yesterday'=> '-1 day',
'tomorrow'=>'+1 day',
'next week'=> '+1 week',
'next monday'=>'next monday + 1 day',
'next friday'=>'next friday + 1 day',
'two weeks'=> '+2 weeks',
'next month'=> '+1 month',
'first day of next month'=> 'first of next month', // must handle this non-GNU date string in SugarBean->populateDefaultValues; if we don't this will evaluate to 1969...
'three months'=> '+3 months', //kbrill Bug #17023
'six months'=> '+6 months',
'next year'=> '+1 year',
);
var $hoursStrings = array(
'' => '',
'01' => '01',
'02' => '02',
'03' => '03',
'04' => '04',
'05' => '05',
'06' => '06',
'07' => '07',
'08' => '08',
'09' => '09',
'10' => '10',
'11' => '11',
'12' => '12',
);
var $hoursStrings24 = array(
'' => '',
'00' => '00',
'01' => '01',
'02' => '02',
'03' => '03',
'04' => '04',
'05' => '05',
'06' => '06',
'07' => '07',
'08' => '08',
'09' => '09',
'10' => '10',
'11' => '11',
'12' => '12',
'13' => '13',
'14' => '14',
'15' => '15',
'16' => '16',
'17' => '17',
'18' => '18',
'19' => '19',
'20' => '20',
'21' => '21',
'22' => '22',
'23' => '23',
);
var $minutesStrings = array(
'' => '',
'00' => '00',
'15' => '15',
'30' => '30',
'45' => '45',
);
var $meridiemStrings = array(
'' => '',
'am' => 'am',
'pm' => 'pm',
);
function get_db_type(){
if($GLOBALS['db']->dbType == 'oracle'){
return " DATE ";
} else {
return " DATETIME ";
}
}
function get_db_default($modify=false){
return '';
}
function get_field_def(){
$def = parent::get_field_def();
if($GLOBALS['db']->dbType == 'oracle'){
$def['dbType'] = 'date';
} else {
$def['dbType'] = 'datetime';
}
if(!empty($def['default'])){
$def['display_default'] = $def['default'];
$def['default'] = '';
}
return $def;
}
function save($df){
parent::save($df);
}
function populateFromPost(){
if(!empty($_REQUEST['defaultDate']) && !empty($_REQUEST['defaultTime'])){
$_REQUEST['default'] = $_REQUEST['defaultDate'].'&'.$_REQUEST['defaultTime'];
$defaultTime = $_REQUEST['defaultTime'];
$hours = substr($defaultTime, 0, 2);
$minutes = substr($defaultTime, 3, 2);
$meridiem = substr($defaultTime, 5, 2);
if(empty($meridiem)) {
if($hours == '00') {
$hours = 12;
$meridiem = 'am';
} else if($hours > 12) {
$hours -= 12;
$meridiem = 'pm';
} else {
$meridiem = 'am';
}
$_REQUEST['default'] = $_REQUEST['defaultDate'].'&'.$hours.':'.$minutes.''.$meridiem;
}
}else{
$_REQUEST['default'] = '';
}
unset($_REQUEST['defaultDate']);
unset($_REQUEST['defaultTime']);
foreach($this->vardef_map as $vardef=>$field){
if(isset($_REQUEST[$vardef])){
$this->$vardef = $_REQUEST[$vardef];
if($vardef != $field){
$this->$field = $this->$vardef;
}
}
}
$GLOBALS['log']->debug('populate: '.print_r($this,true));
}
}
?>

View File

@@ -0,0 +1,90 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateDecimal extends TemplateFloat{
var $type = 'decimal';
var $default = null;
var $default_value = null;
function TemplateDecimal(){
$this->vardef_map['precision']='ext1';
}
function get_field_def(){
$def = parent::get_field_def();
return $def;
}
function get_db_type(){
// $GLOBALS['log']->debug('TemplateFloat:get_db_type()'.print_r($this,true));
if ($GLOBALS['db']->dbType=='mysql')
{
$type = " DECIMAL";
if(!empty($this->len))
{
$precision = (!empty($this->precision)) ? $this->precision : 4; // bug 17041 tyoung - mysql requires a precision value if length is specified
$type .= "({$this->len},$precision)";
}
}
elseif ($GLOBALS['db']->dbType=='mssql')
{
$type = " decimal";
if(!empty($this->len))
{
$precision = (!empty($this->precision)) ? $this->precision : 4;
$type .= "({$this->len},$precision)";
}
else
{
$type .= "(11,4)";
}
}
elseif ($GLOBALS['db']->dbType=='oci8')
{
$precision = (!empty($this->precision))? $this->precision: 6;
$type= " NUMBER(30,$precision) ";
}
/**
* FOR ORACLE
* return " NUMBER($this->max_size, $this->precision)";
*/
return $type;
}
}
?>

View File

@@ -0,0 +1,47 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateEmail extends TemplateText{
function get_html_detail(){
return '<a href="mailto:{'. strtoupper($this->name).'}">{'. strtoupper($this->name).'}</a>';
}
}
?>

View File

@@ -0,0 +1,60 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
class TemplateEncrypt extends TemplateField{
var $type='encrypt';
function save($df){
$this->type = 'encrypt';
$this->ext3 = 'varchar';
parent::save($df);
}
function get_field_def(){
$vardef = parent::get_field_def();
$vardef['dbType'] = $this->ext3;
return $vardef;
}
}
?>

View File

@@ -0,0 +1,202 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/utils/array_utils.php');
class TemplateEnum extends TemplateText{
var $max_size = 100;
var $type='enum';
var $ext1 = '';
var $default_value = '';
var $dependency ; // any dependency information
function __construct ()
{
// ensure that the field dependency information is read in from any _REQUEST
$this->localVardefMap = array (
'trigger' => 'trigger',
'action' => 'action' , ) ;
$this->vardef_map = array_merge ( $this->vardef_map , $this->localVardefMap ) ;
}
function populateFromPost ()
{
parent::populateFromPost();
// now convert trigger,action pairs into a dependency array representation
// we expect the dependencies in the following format:
// trigger = [ trigger for action 1 , trigger for action 2 , ... , trigger for action n ]
// action = [ action 1 , action 2 , ... , action n ]
// check first if we have the component parts of a dependency
$dependencyPresent = true ;
foreach ( $this->localVardefMap as $def )
{
$dependencyPresent &= isset ( $this->$def ) ;
}
if ( $dependencyPresent )
{
$dependencies = array () ;
if ( is_array ( $this->trigger ) && is_array ( $this->action ) )
{
for ( $i = 0 ; $i < count ( $this->action ) ; $i++ )
{
$dependencies [ $this->trigger [ $i ] ] = $this->action [ $i ] ;
}
$this->dependency = $dependencies ;
}
else
{
if ( ! is_array ( $this->trigger ) && ! is_array ( $this->action ) )
$this->dependency = array ( $this->trigger => $this->action ) ;
}
// tidy up
unset ( $this->trigger ) ;
unset ( $this->action ) ;
}
}
function get_xtpl_edit(){
$name = $this->name;
$value = '';
if(isset($this->bean->$name)){
$value = $this->bean->$name;
}else{
if(empty($this->bean->id)){
$value= $this->default_value;
}
}
if(!empty($this->help)){
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
}
global $app_list_strings;
$returnXTPL = array();
$returnXTPL[strtoupper($this->name)] = $value;
if(empty($this->ext1)){
$this->ext1 = $this->options;
}
$returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id($app_list_strings[$this->ext1], $value);
return $returnXTPL;
}
function get_xtpl_search(){
$searchFor = '';
if(!empty($_REQUEST[$this->name])){
$searchFor = $_REQUEST[$this->name];
}
global $app_list_strings;
$returnXTPL = array();
$returnXTPL[strtoupper($this->name)] = $searchFor;
if(empty($this->ext1)){
$this->ext1 = $this->options;
}
$returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id(add_blank_option($app_list_strings[$this->ext1]), $searchFor);
return $returnXTPL;
}
function get_db_type(){
if(empty($this->max_size))$this->max_size = 150;
switch($GLOBALS['db']->dbType){
case 'oci8': return " varchar2($this->max_size)";
case 'mssql': return !empty($GLOBALS['db']->isFreeTDS) ? " nvarchar($this->max_size)" : " varchar($this->max_size)";
default: return " varchar($this->max_size)";
}
}
function get_field_def(){
$def = parent::get_field_def();
$def['options'] = !empty($this->options) ? $this->options : $this->ext1;
$def['default'] = !empty($this->default) ? $this->default : $this->default_value;
$def['len'] = $this->max_size;
$def['studio'] = 'visible';
// this class may be extended, so only do the unserialize for genuine TemplateEnums
if (get_class( $this ) == 'TemplateEnum' )
$def['dependency'] = isset($this->ext4)? unserialize(html_entity_decode($this->ext4)) : null ;
return $def;
}
function get_xtpl_detail(){
$name = $this->name;
// awu: custom fields are not being displayed on the detail view because $this->ext1 is always empty, adding this to get the options
if(empty($this->ext1)){
if(!empty($this->options))
$this->ext1 = $this->options;
}
if(isset($this->bean->$name)){
$key = $this->bean->$name;
global $app_list_strings;
if(preg_match('/&amp;/s', $key)) {
$key = str_replace('&amp;', '&', $key);
}
if(isset($app_list_strings[$this->ext1])){
if(isset($app_list_strings[$this->ext1][$key])) {
return $app_list_strings[$this->ext1][$key];
}
if(isset($app_list_strings[$this->ext1][$this->bean->$name])){
return $app_list_strings[$this->ext1][$this->bean->$name];
}
}
}
return '';
}
function save($df){
if (!empty($this->default_value) && is_array($this->default_value)) {
$this->default_value = $this->default_value[0];
}
if (!empty($this->default) && is_array($this->default)) {
$this->default = $this->default[0];
}
if ( get_class( $this ) == 'TemplateEnum' && isset ( $this->dependency ) )
$this->ext4 = serialize ( $this->dependency ) ;
parent::save($df);
}
}
?>

View File

@@ -0,0 +1,471 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$GLOBALS['studioReadOnlyFields'] = array('date_entered'=>1, 'date_modified'=>1, 'created_by'=>1, 'id'=>1, 'modified_user_id'=>1);
class TemplateField{
/*
The view is the context this field will be used in
-edit
-list
-detail
-search
*/
var $view = 'edit';
var $name = '';
var $vname = '';
var $id = '';
var $size = '20';
var $len = '255';
var $required = false;
var $default = null;
var $default_value = null;
var $type = 'varchar';
var $comment = '';
var $bean;
var $ext1 = '';
var $ext2 = '';
var $ext3 = '';
var $ext4 = '';
var $audited= 0;
var $massupdate = 0;
var $importable = 'true' ;
var $duplicate_merge=0;
var $new_field_definition;
var $reportable = true;
var $label_value = '';
var $help = '';
var $vardef_map = array(
'name'=>'name',
'label'=>'vname',
// bug 15801 - need to ALWAYS keep default and default_value consistent as some methods/classes use one, some use another...
'default_value'=>'default',
'default'=>'default_value',
'display_default'=>'default_value',
// 'default_value'=>'default_value',
// 'default'=>'default_value',
'len'=>'len',
'required'=>'required',
'type'=>'type',
'audited'=>'audited',
'massupdate'=>'massupdate',
'options'=>'ext1',
'help'=>'help',
'comments'=>'comment',
'importable'=>'importable',
'duplicate_merge'=>'duplicate_merge',
'duplicate_merge_dom_value'=>'duplicate_merge_dom_value', //bug #14897
'merge_filter'=>'merge_filter',
'reportable' => 'reportable',
'min'=>'ext1',
'max'=>'ext2',
'ext2'=>'ext2',
'ext4'=>'ext4',
//'disable_num_format'=>'ext3',
'ext3'=>'ext3',
'label_value'=>'label_value',
);
/*
HTML FUNCTIONS
*/
function get_html(){
$view = $this->view;
if(!empty($GLOBALS['studioReadOnlyFields'][$this->name]))$view = 'detail';
switch($view){
case 'search':return $this->get_html_search();
case 'edit': return $this->get_html_edit();
case 'list': return $this->get_html_list();
case 'detail': return $this->get_html_detail();
}
}
function set($values){
foreach($values as $name=>$value){
$this->$name = $value;
}
}
function get_html_edit(){
return 'not implemented';
}
function get_html_list(){
return $this->get_html_detail();
}
function get_html_detail(){
return 'not implemented';
}
function get_html_search(){
return $this->get_html_edit();
}
function get_html_label(){
$label = "{MOD." .$this->vname . "}";
if(!empty($GLOBALS['app_strings'][$this->vname])){
$label = "{APP." .$this->label . "}";
}
if($this->view == 'edit' && $this->is_required()){
$label .= '<span class="required">*</span>';
}
if($this->view == 'list'){
if(isset($this->bean)){
if(!empty($this->id)){
$name = $this->bean->table_name . '_cstm.'. $this->name;
$arrow = $this->bean->table_name . '_cstm_'. $this->name;
}else{
$name = $this->bean->table_name . '.'. $this->name;
$arrow = $this->bean->table_name . '_'. $this->name;
}
}else{
$name = $this->name;
$arrow = $name;
}
$label = "<a href='{ORDER_BY}$name' class='listViewThLinkS1'>{MOD.$this->label}{arrow_start}{".$arrow."_arrow}{arrow_end}</a>";
}
return $label;
}
/*
XTPL FUNCTIONS
*/
function get_xtpl($bean = false){
if($bean)
$this->bean = $bean;
$view = $this->view;
if(!empty($GLOBALS['studioReadOnlyFields'][$this->name]))$view = 'detail';
switch($view){
case 'search':return $this->get_xtpl_search();
case 'edit': return $this->get_xtpl_edit();
case 'list': return $this->get_xtpl_list();
case 'detail': return $this->get_xtpl_detail();
}
}
function get_xtpl_edit(){
return '/*not implemented*/';
}
function get_xtpl_list(){
return get_xtpl_detail();
}
function get_xtpl_detail(){
return '/*not implemented*/';
}
function get_xtpl_search(){
//return get_xtpl_edit();
}
function is_required(){
if($this->required){
return true;
}
return false;
}
/*
DB FUNCTIONS
*/
function get_db_type(){
switch($GLOBALS['db']->dbType){
case 'oci8': return " varchar2($this->len)";
case 'mssql': return !empty($GLOBALS['db']->isFreeTDS) ? " nvarchar($this->len)" : " varchar($this->len)";
default: return " varchar($this->len)";
}
}
function get_db_default($modify=false){
$GLOBALS['log']->debug('get_db_default(): default_value='.$this->default_value);
if (!$modify or empty($this->new_field_definition['default_value']) or $this->new_field_definition['default_value'] != $this->default_value ) {
if(!is_null($this->default_value)){ // add a default value if it is not null - we want to set a default even if default_value is '0', which is not null, but which is empty()
if(NULL == trim($this->default_value)){
return " DEFAULT NULL";
}
else {
return " DEFAULT '$this->default_value'";
}
}else{
return '';
}
}
}
/*
* Return the required clause for this field
* Confusingly, when modifying an existing field ($modify=true) there are two exactly opposite cases:
* 1. if called by Studio, only $this->required is set. If set, we return "NOT NULL" otherwise we return "NULL"
* 2. if not called by Studio, $this->required holds the OLD value of required, and new_field_definition['required'] is the NEW
* So if not called by Studio we want to return NULL if required=true (because we are changing FROM this setting)
*/
function get_db_required($modify=false){
// $GLOBALS['log']->debug('get_db_required required='.$this->required." and ".(($modify)?"true":"false")." and ".print_r($this->new_field_definition,true));
$req = "";
if ($modify) {
if (!empty($this->new_field_definition['required'])) {
if ($this->required and $this->new_field_definition['required'] != $this->required) {
$req = " NULL ";
}
}
else
{
$req = ($this->required) ? " NOT NULL " : ''; // bug 17184 tyoung - set required correctly when modifying custom field in Studio
}
}
else
{
if (empty($this->new_field_definition['required']) or $this->new_field_definition['required'] != $this->required ) {
if(!empty($this->required) && $this->required){
$req = " NOT NULL";
}
}
}
return $req;
}
/* function get_db_required($modify=false){
$GLOBALS['log']->debug('get_db_required required='.$this->required." and ".(($modify)?"true":"false")." and ".print_r($this->new_field_definition,true));
if ($modify) {
if (!empty($this->new_field_definition['required'])) {
if ($this->required and $this->new_field_definition['required'] != $this->required) {
return " null ";
}
return "";
}
}
if (empty($this->new_field_definition['required']) or $this->new_field_definition['required'] != $this->required ) {
if(!empty($this->required) && $this->required){
return " NOT NULL";
}
}
return '';
}
*/
/**
* Oracle Support: do not set required constraint if no default value is supplied.
* In this case the default value will be handled by the application/sugarbean.
*/
function get_db_add_alter_table($table)
{
return $GLOBALS['db']->getHelper()->addColumnSQL($table, $this->get_field_def(), true);
}
function get_db_delete_alter_table($table)
{
return $GLOBALS['db']->getHelper()->dropColumnSQL(
$table,
$this->get_field_def()
);
}
/**
* mysql requires the datatype caluse in the alter statment.it will be no-op anyway.
*/
function get_db_modify_alter_table($table){
global $db;
$db_default=$this->get_db_default(true);
$db_required=$this->get_db_required(true);
switch ($GLOBALS['db']->dbType) {
case "mssql":
//Bug 21772: MSSQL handles alters in strange ways. Defer to DBHelpers guidance.
$query = $db->helper->alterColumnSQL($table, $this->get_field_def());
return $query;
break;
case "mysql":
$query="ALTER TABLE $table MODIFY $this->name " .$this->get_db_type();
break;
default:
$query="ALTER TABLE $table MODIFY $this->name " .$this->get_db_type();;
break;
}
if (!empty($db_default) && !empty($db_required)) {
$query .= $db_default . $db_required ;
} else if (!empty($db_default)) {
$query .= $db_default;
}
return $query;
}
/*
* BEAN FUNCTIONS
*
*/
function get_field_def(){
$array = array(
'required'=>$this->convertBooleanValue($this->required),
'source'=>'custom_fields',
'name'=>$this->name,
'vname'=>$this->vname,
'type'=>$this->type,
'massupdate'=>$this->massupdate,
'default'=>$this->default,
'comments'=> (isset($this->comments)) ? $this->comments : '',
'help'=> (isset($this->help)) ? $this->help : '',
'importable'=>$this->importable,
'duplicate_merge'=>$this->duplicate_merge,
'duplicate_merge_dom_value'=> isset($this->duplicate_merge_dom_value) ? $this->duplicate_merge_dom_value : $this->duplicate_merge,
'audited'=>$this->convertBooleanValue($this->audited),
'reportable'=>$this->convertBooleanValue($this->reportable),
);
if(!empty($this->len)){
$array['len'] = $this->len;
}
if(!empty($this->size)){
$array['size'] = $this->size;
}
$this->get_dup_merge_def($array);
return $array;
}
protected function convertBooleanValue($value)
{
if ($value === 'true' || $value === '1' || $value === 1)
return true;
else if ($value === 'false' || $value === '0' || $value === 0)
return false;
else
return $value;
}
/* if the field is duplicate merge enabled this function will return the vardef entry for the same.
*/
function get_dup_merge_def(&$def) {
switch ($def['duplicate_merge_dom_value']) {
case 0:
$def['duplicate_merge']='disabled';
break;
case 1:
$def['duplicate_merge']='enabled';
break;
case 2:
$def['merge_filter']='enabled';
$def['duplicate_merge']='enabled';
break;
case 3:
$def['merge_filter']='selected';
$def['duplicate_merge']='enabled';
break;
case 4:
$def['merge_filter']='enabled';
$def['duplicate_merge']='disabled';
break;
}
}
/*
HELPER FUNCTIONS
*/
function prepare(){
if(empty($this->id)){
$this->id = $this->name;
}
}
/**
* populateFromRow
* This function supports setting the values of all TemplateField instances.
* @param $row The Array key/value pairs from fields_meta_data table
*/
function populateFromRow($row=array()) {
$fmd_to_dyn_map = array('comments' => 'comment', 'require_option' => 'required', 'label' => 'vname',
'mass_update' => 'massupdate', 'max_size' => 'len', 'default_value' => 'default', 'id_name' => 'ext3');
if(!is_array($row)) {
$GLOBALS['log']->error("Error: TemplateField->populateFromRow expecting Array");
}
//Bug 24189: Copy fields from FMD format to Field objects
foreach ($fmd_to_dyn_map as $fmd_key => $dyn_key) {
if (isset($row[$fmd_key])) {
$this->$dyn_key = $row[$fmd_key];
}
}
foreach($row as $key=>$value) {
$this->$key = $value;
}
}
function populateFromPost(){
foreach($this->vardef_map as $vardef=>$field){
if(isset($_REQUEST[$vardef])){
$this->$vardef = $_REQUEST[$vardef];
if($vardef != $field){
$this->$field = $this->$vardef;
}
}
}
$GLOBALS['log']->debug('populate: '.print_r($this,true));
}
function get_additional_defs(){
return array();
}
function delete($df){
$df->deleteField($this);
}
function save($df){
// $GLOBALS['log']->debug('saving field: '.print_r($this,true));
$df->addFieldObject($this);
}
}
?>

View File

@@ -0,0 +1,100 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateFloat extends TemplateText{
var $type = 'float';
var $default = null;
var $default_value = null;
var $len = '18';
var $precision = '8';
function TemplateFloat(){
$this->vardef_map['precision']='ext1';
//$this->vardef_map['precision']='precision';
}
function get_field_def(){
$def = parent::get_field_def();
$def['precision'] = !empty($this->ext1) ? $this->ext1 : $this->precision;
return $def;
}
function get_db_type(){
// $GLOBALS['log']->debug('TemplateFloat:get_db_type()'.print_r($this,true));
if ($GLOBALS['db']->dbType=='mysql')
{
$type = " FLOAT";
if(!empty($this->len))
{
$precision = (!empty($this->precision)) ? $this->precision : 4; // bug 17041 tyoung - mysql requires a precision value if length is specified
$type .= "({$this->len},$precision)";
}
}
elseif ($GLOBALS['db']->dbType=='mssql')
{
$type = " decimal";
if(!empty($this->len))
{
$precision = (!empty($this->precision)) ? $this->precision : 4;
$type .= "({$this->len},$precision)";
}
else
{
$type .= "(11,4)";
}
}
elseif ($GLOBALS['db']->dbType=='oci8')
{
$precision = (!empty($this->precision))? $this->precision: 6;
$type= " NUMBER(30,$precision) ";
}
/**
* FOR ORACLE
* return " NUMBER($this->max_size, $this->precision)";
*/
return $type;
}
function populateFromRow($row=array()) {
parent::populateFromRow($row);
}
}
?>

View File

@@ -0,0 +1,118 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateHTML extends TemplateField{
var $data_type = 'html';
var $type = 'html';
function save($df){
$this->ext3 = 'text';
parent::save($df);
}
function set($values){
parent::set($values);
if(!empty($this->ext4)){
$this->default_value = $this->ext4;
$this->default = $this->ext4;
}
}
function get_html_detail(){
return '<div title="' . strtoupper($this->name . '_HELP'). '" >{'.strtoupper($this->name) . '}</div>';
}
function get_html_edit(){
return $this->get_html_detail();
}
function get_html_list(){
return $this->get_html_detail();
}
function get_html_search(){
return $this->get_html_detail();
}
function get_xtpl_detail(){
return from_html(nl2br($this->ext4));
}
function get_xtpl_edit(){
return $this->get_xtpl_detail();
}
function get_xtpl_list(){
return $this->get_xtpl_detail();
}
function get_xtpl_search(){
return $this->get_xtpl_detail();
}
function get_db_add_alter_table($table){
return '';
}
function get_db_modify_alter_table($table){
return '';
}
function get_db_delete_alter_table($table)
{
return '' ;
}
function get_field_def() {
$def = parent::get_field_def();
if(!empty($this->ext4)){
$def['default_value'] = $this->ext4;
$def['default'] = $this->ext4;
}
$def['studio'] = 'visible';
$def['dbType'] = isset($this->ext3) ? $this->ext3 : 'text' ;
return array_merge($def, $this->get_additional_defs());
}
}
?>

View File

@@ -0,0 +1,63 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateURL.php');
class TemplateIFrame extends TemplateURL{
var $type='iframe';
function get_html_edit(){
$this->prepare();
return "<input type='text' name='". $this->name. "' id='".$this->name."' size='".$this->size."' title='{" . strtoupper($this->name) ."_HELP}' value='{". strtoupper($this->name). "}'>";
}
function get_html_label() {
return "LALALALA";
}
function get_xtpl_detail(){
$value = parent::get_xtpl_detail();
$value .= "BLAH BLAH";
return $value;
}
function get_field_def(){
$def = parent::get_field_def();
$def['height'] = !empty($this->height) ? $this->height : $this->ext4;
return $def;
}
}
?>

View File

@@ -0,0 +1,46 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
class TemplateId extends TemplateField{
var $type='id';
var $len = 36 ;
}
?>

View File

@@ -0,0 +1,83 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateText.php');
class TemplateImage extends TemplateText{
var $type = 'image';
function get_field_def(){
$def = parent::get_field_def();
$def['studio'] = 'visible';
$def['type'] = 'image';
$def['dbType'] = 'varchar';
$def['len']= 255;
if( isset($this->ext1) ) $def[ 'border' ] = $this->ext1 ;
if( isset($this->ext2) ) $def[ 'width' ] = $this->ext2 ;
if( isset($this->ext3) ) $def[ 'height' ] = $this->ext3 ;
if( isset($this->border)) $def[ 'border' ] = $this->border ;
if( isset($this->width) ) $def[ 'width' ] = $this->width ;
if( isset($this->height)) $def[ 'height' ] = $this->height ;
return $def;
}
function __construct()
{
$this->vardef_map['border'] = 'ext1';
$this->vardef_map['width'] = 'ext2';
$this->vardef_map['height'] = 'ext3';
}
function set($values){
parent::set($values);
if(!empty($this->ext1)){
$this->border = $this->ext1;
}
if(!empty($this->ext2)){
$this->width = $this->ext2;
}
if(!empty($this->ext3)){
$this->height = $this->ext3;
}
}
}
?>

View File

@@ -0,0 +1,119 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateInt extends TemplateText{
function __construct(){
//parent::__construct();
$this->vardef_map['autoinc_next'] = 'autoinc_next';
$this->vardef_map['autoinc_start'] = 'autoinc_start';
$this->vardef_map['auto_increment'] = 'auto_increment';
}
var $type = 'int';
function get_html_edit(){
$this->prepare();
return "<input type='text' name='". $this->name. "' id='".$this->name."' title='{" . strtoupper($this->name) ."_HELP}' size='".$this->size."' maxlength='".$this->len."' value='{". strtoupper($this->name). "}'>";
}
function populateFromPost(){
parent::populateFromPost();
if (isset($this->auto_increment))
{
$this->auto_increment = $this->auto_increment == "true" || $this->auto_increment === true;
}
}
function get_field_def(){
$vardef = parent::get_field_def();
$vardef['disable_num_format'] = $this->ext3;
if(!empty($this->ext2)){
$min = (!empty($this->ext1))?$this->ext1:0;
$max = $this->ext2;
$vardef['validation'] = array('type' => 'range', 'min' => $min, 'max' => $max);
}
if(!empty($this->auto_increment))
{
$vardef['auto_increment'] = $this->auto_increment;
if ((empty($this->autoinc_next)) && isset($this->module) && isset($this->module->table_name))
{
global $db;
$helper = $db->gethelper();
$auto = $helper->getAutoIncrement($this->module->table_name, $this->name);
$this->autoinc_next = $vardef['autoinc_next'] = $auto;
}
}
return $vardef;
}
function get_db_type(){
switch($GLOBALS['db']->dbType){
case 'oci8': return ' NUMBER ';
case 'mysql': return (!empty($this->len) && $this->len <= 11 && $this->len > 0)? ' INT(' .$this->len . ')' : ' INT(11) ';
default: return ' INT ';
}
}
function save($df){
$next = false;
if (!empty($this->auto_increment) && (!empty($this->autoinc_next) || !empty($this->autoinc_start)) && isset($this->module))
{
if (!empty($this->autoinc_start) && $this->autoinc_start > $this->autoinc_next)
{
$this->autoinc_next = $this->autoinc_start;
}
if(isset($this->module->table_name)){
global $db;
$helper = $db->gethelper();
//Check that the new value is greater than the old value
$oldNext = $helper->getAutoIncrement($this->module->table_name, $this->name);
if ($this->autoinc_next > $oldNext)
{
$helper->setAutoIncrementStart($this->module->table_name, $this->name, $this->autoinc_next);
}
}
$next = $this->autoinc_next;
$this->autoinc_next = false;
}
parent::save($df);
if ($next)
$this->autoinc_next = $next;
}
}
?>

View File

@@ -0,0 +1,171 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
require_once('include/utils/array_utils.php');
class TemplateMultiEnum extends TemplateEnum{
var $type = 'text';
function get_html_edit(){
$this->prepare();
$xtpl_var = strtoupper( $this->name);
// MFH BUG#13645
return "<input type='hidden' name='". $this->name. "' value='0'><select name='". $this->name . "[]' size='5' title='{" . $xtpl_var ."_HELP}' MULTIPLE=true>{OPTIONS_".$xtpl_var. "}</select>";
}
function get_db_type(){
if ($GLOBALS['db']->dbType=='oci8') {
return " CLOB ";
} else {
return " TEXT ";
}
}
function get_xtpl_edit(){
$name = $this->name;
$value = '';
if(isset($this->bean->$name)){
$value = $this->bean->$name;
}else{
if(empty($this->bean->id)){
$value= $this->default_value;
}
}
if(!empty($this->help)){
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
}
global $app_list_strings;
$returnXTPL = array();
$returnXTPL[strtoupper($this->name)] = str_replace('^,^', ',', $value);
if(empty($this->ext1)){
$this->ext1 = $this->options;
}
$returnXTPL[strtoupper('options_'.$this->name)] = get_select_options_with_id($app_list_strings[$this->ext1], unencodeMultienum( $value));
return $returnXTPL;
}
function prepSave(){
}
function get_xtpl_list(){
return $this->get_xtpl_detail();
}
function get_xtpl_detail(){
$name = $this->name;
$value = '';
if(isset($this->bean->$name)){
$value = $this->bean->$name;
}else{
if(empty($this->bean->id)){
$value= $this->default_value;
}
}
$returnXTPL = array();
if(empty($value)) return $returnXTPL;
global $app_list_strings;
$values = unencodeMultienum( $value);
$translatedValues = array();
foreach($values as $val){
$translated = translate($this->options, '', $val);
if(is_string($translated))$translatedValues[] = $translated;
}
$returnXTPL[strtoupper($this->name)] = implode(', ', $translatedValues);
return $returnXTPL;
}
function get_field_def(){
$def = parent::get_field_def();
if ( isset ( $this->ext4 ) )
{
// turn off error reporting in case we are unpacking a value that hasn't been packed...
// this is kludgy, but unserialize doesn't throw exceptions correctly
$oldErrorReporting = error_reporting ( 0 );
$unpacked = unserialize ( $this->ext4 ) ;
error_reporting ( $oldErrorReporting ) ;
// if we have a new error, then unserialize must have failed => we don't have a packed ext4
// safe to assume that false means the unpack failed, as ext4 will either contain an imploded string of default values, or an array, not a boolean false value
if ( $unpacked === false )
$def [ 'default' ] = $this->ext4 ;
else
{
// we have a packed representation containing one or both of default and dependency
if ( isset ( $unpacked [ 'default' ] ) )
$def [ 'default' ] = $unpacked [ 'default' ] ;
if ( isset ( $unpacked [ 'dependency' ] ) )
$def [ 'dependency' ] = $unpacked [ 'dependency' ] ;
}
}
//$def['default'] = isset($this->ext4)? $this->ext4 : $def['default'];
$def['isMultiSelect'] = true;
unset($def['len']);
return $def;
}
function get_db_default(){
return '';
}
function save($df) {
if ( isset ( $this->default ) )
{
if ( is_array ( $this->default ) )
$this->default = encodeMultienumValue($this->default);
$this->ext4 = ( isset ( $this->dependency ) ) ? serialize ( array ( 'default' => $this->default , 'dependency' => $this->dependency ) ) : $this->default ;
} else
{
if ( isset ( $this->dependency ) )
$this->ext4 = serialize ( array ( 'dependency' => $this->dependency ) ) ;
}
parent::save($df);
}
}
?>

View File

@@ -0,0 +1,106 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
require_once('modules/DynamicFields/templates/Fields/TemplateId.php');
require_once('modules/DynamicFields/templates/Fields/TemplateParentType.php');
class TemplateParent extends TemplateEnum{
var $max_size = 25;
var $type='parent';
function get_field_def(){
$def = parent::get_field_def();
$def['type_name'] = 'parent_type';
$def['id_name'] = 'parent_id';
$def['parent_type'] = 'record_type_display';
$def['source'] = 'non-db';
$def['studio'] = 'visible';
return $def;
}
function delete($df){
parent::delete($df);
//currency id
$parent_type = new TemplateText();
$parent_type->name = 'parent_type';
$parent_type->delete($df);
$parent_id = new TemplateId();
$parent_id->name = 'parent_id';
$parent_id->delete($df);
}
function save($df){
$this->ext1 = 'parent_type_display';
$this->name = 'parent_name';
$this->default_value = '';
parent::save($df); // always save because we may have updates
//save parent_type
$parent_type = new TemplateParentType();
$parent_type->name = 'parent_type';
$parent_type->vname = 'LBL_PARENT_TYPE';
$parent_type->label = $parent_type->vname;
$parent_type->len = 255;
$parent_type->importable = $this->importable;
$parent_type->save($df);
//save parent_name
$parent_id = new TemplateId();
$parent_id->name = 'parent_id';
$parent_id->vname = 'LBL_PARENT_ID';
$parent_id->label = $parent_id->vname;
$parent_id->len = 36;
$parent_id->importable = $this->importable;
$parent_id->save($df);
}
function get_db_add_alter_table($table){
return '';
}
/**
* mysql requires the datatype caluse in the alter statment.it will be no-op anyway.
*/
function get_db_modify_alter_table($table){
return '';
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateParentType extends TemplateText{
var $max_size = 25;
var $type='parent_type';
function get_field_def(){
$def = parent::get_field_def();
$def['dbType'] = 'varchar';
$def['studio'] = 'hidden';
return $def;
}
}
?>

View File

@@ -0,0 +1,50 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplatePhone extends TemplateText{
var $max_size = 25;
var $type='phone';
function get_field_def(){
$def = parent::get_field_def();
$def['dbType'] = 'varchar';
return $def;
}
}
?>

View File

@@ -0,0 +1,135 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateEnum.php');
require_once('include/utils/array_utils.php');
class TemplateRadioEnum extends TemplateEnum{
var $type = 'radioenum';
function get_html_edit(){
$this->prepare();
$xtpl_var = strtoupper( $this->name);
return "{RADIOOPTIONS_".$xtpl_var. "}";
}
function get_field_def(){
$def = parent::get_field_def();
$def['dbType'] = 'enum';
$def['separator'] = '<br>';
return $def;
}
function get_xtpl_edit($add_blank = false){
$name = $this->name;
$value = '';
if(isset($this->bean->$name)){
$value = $this->bean->$name;
}else{
if(empty($this->bean->id)){
$value= $this->default_value;
}
}
if(!empty($this->help)){
$returnXTPL[$this->name . '_help'] = translate($this->help, $this->bean->module_dir);
}
global $app_list_strings;
$returnXTPL = array();
$returnXTPL[strtoupper($this->name)] = $value;
$returnXTPL[strtoupper('RADIOOPTIONS_'.$this->name)] = $this->generateRadioButtons($value, false);
return $returnXTPL;
}
function generateRadioButtons($value = '', $add_blank =false){
global $app_list_strings;
$radiooptions = '';
$keyvalues = $app_list_strings[$this->ext1];
if($add_blank){
$keyvalues = add_blank_option($keyvalues);
}
$help = (!empty($this->help))?"title='". translate($this->help, $this->bean->module_dir) . "'": '';
foreach($keyvalues as $key=>$displayText){
$selected = ($value == $key)?'checked': '';
$radiooptions .= "<input type='radio' id='{$this->name}{$key}' name='$this->name' $help value='$key' $selected><span onclick='document.getElementById(\"{$this->name}{$key}\").checked = true' style='cursor:default' onmousedown='return false;'>$displayText</span><br>\n";
}
return $radiooptions;
}
function get_xtpl_search(){
$searchFor = '';
if(!empty($_REQUEST[$this->name])){
$searchFor = $_REQUEST[$this->name];
}
global $app_list_strings;
$returnXTPL = array();
$returnXTPL[strtoupper($this->name)] = $searchFor;
$returnXTPL[strtoupper('RADIOOPTIONS_'.$this->name)] = $this->generateRadioButtons($searchFor, true);
return $returnXTPL;
}
function get_xtpl_detail(){
$name = $this->name;
if(isset($this->bean->$name)){
global $app_list_strings;
if(isset($app_list_strings[$this->ext1])){
if(isset($app_list_strings[$this->ext1][$this->bean->$name])){
return $app_list_strings[$this->ext1][$this->bean->$name];
}
}
}else{
if(empty($this->bean->id)){
return $this->default_value;
}
}
return '';
}
function get_db_default(){
return '';
}
}
?>

View File

@@ -0,0 +1,254 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
class TemplateRelatedTextField extends TemplateText{
var $type = 'relate';
//ext1 is the name field
//ext2 is the related module
function get_html_edit(){
$this->prepare();
$name = $this->name .'_name';
$value_name = strtoupper('{'.$name.'}');
$id = $this->name ;
$value_id = strtoupper('{'.$id .'}');
return "<input type='text' name='$name' id='$name' size='".$this->size."' readonly value='$value_name'><input type='button' onclick='open_popup(\"{". strtoupper($this->name). "_MODULE}\", 600, 400,\" \", true, false, {ENCODED_". strtoupper($this->name). "_POPUP_REQUEST_DATA})' type='button' class='button' value='{APP.LBL_SELECT_BUTTON_LABEL}' ><input type='hidden' name='$id' value='$value_id'>";
}
function get_html_detail(){
$name = $this->name .'_name';
$value_name = strtoupper('{'.$name.'}');
$id = $this->name ;
$value_id = strtoupper('{'.$id .'}');
return "<a href='index.php?module=$this->ext2&action=DetailView&record={$value_id}'>{$value_name}</a>" ;
}
function get_html_list(){
if(isset($this->bean)){
$name = $this->bean->object_name . '.'. $this->ext1;
}else{
$name = $this->ext1;
}
return '{'. strtoupper($name) . '}';
}
function get_html_search(){
$searchable=array();
$def = $this->bean->field_name_map[$this->name];
if(!empty($def['id_name']) && in_array($def['id_name'], $searchable)){
$name = $def['id_name'];
return "<select size='3' name='{$name}[]' tabindex='1' multiple='multiple'>{".strtoupper($name). "_FILTER}</select>";
}
//return 'NOT AVAILABLE';
return $this->get_html_edit();
}
function get_xtpl_search(){
$searchable=array();
$def = $this->bean->field_name_map[$this->name];
$returnXTPL = array();
if(!empty($def['id_name']) && in_array($def['id_name'], $searchable)){
$name = $def['id_name'];
$team_list = '';
foreach(get_team_array() as $id=>$team){
$selected = '';
if(!empty($_REQUEST[$name]) && is_array($_REQUEST[$name]) && in_array($id, $_REQUEST[$name])){
$selected = 'selected';
}
$team_list .= "<option $selected value='$id'>$team</option>";
}
$returnXTPL[strtoupper($name). '_FILTER'] = $team_list;
} else {
$id = $this->name;
$name = $this->name .'_name';
$module = $this->ext2;
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'search_form',
'field_to_name_array' => array(
'id' => $this->name,
$this->ext1 => $name,
),
);
$json = getJSONobj();
$encoded_popup_request_data = $json->encode($popup_request_data);
$returnXTPL['ENCODED_'.strtoupper($id).'_POPUP_REQUEST_DATA'] = $encoded_popup_request_data;
$returnXTPL[strtoupper($id).'_MODULE'] = $module;
if(isset( $_REQUEST[$name])){
$returnXTPL[strtoupper($name)] = $_REQUEST[$name];
}
if(isset( $_REQUEST[$id])){
$returnXTPL[strtoupper($id)] = $_REQUEST[$id];
}
}
return $returnXTPL;
}
function get_xtpl_edit(){
global $beanList;
$name = $this->name .'_name';
$id = $this->name;
$module = $this->ext2;
$returnXTPL = array();
$popup_request_data = array(
'call_back_function' => 'set_return',
'form_name' => 'EditView',
'field_to_name_array' => array(
'id' => $this->name,
$this->ext1 => $name,
),
);
//$GLOBALS['log']->fatal($this->bean);
$json = getJSONobj();
$encoded_contact_popup_request_data = $json->encode($popup_request_data);
$returnXTPL['ENCODED_'.strtoupper($id).'_POPUP_REQUEST_DATA'] = $encoded_contact_popup_request_data;
$returnXTPL[strtoupper($id).'_MODULE'] = $module;
if(isset($beanList[$module]) && isset($this->bean->$id)){
if(!isset($this->bean->$name)){
$mod_field = $this->ext1;
global $beanFiles;
$class = $beanList[$module];
require_once($beanFiles[$class]);
$mod = new $class();
$mod->retrieve($this->bean->$id);
if(isset($mod->$mod_field)){
$this->bean->$name = $mod->$mod_field;
}
}
$returnXTPL[strtoupper($id)] = $this->bean->$id;
}
if(isset($this->bean->$name)){
$returnXTPL[strtoupper($name)] = $this->bean->$name;
}
if(isset($this->bean->$id)) {
$returnXTPL[strtoupper($id)] = $this->bean->$id;
}
return $returnXTPL;
}
function get_xtpl_detail(){
return $this->get_xtpl_edit();
}
function get_related_info(){
}
function get_field_def(){
$def = parent::get_field_def();
$def['id_name'] = $this->ext3;
$def['ext2'] = $this->ext2;
$def['module'] = $def['ext2'];
//Special case for documents, which use a document_name rather than name
if ($def['module'] == "Documents") {
$def['rname'] = 'document_name';
} else {
$def['rname'] = 'name';
}
$def['quicksearch'] = 'enabled';
$def['studio'] = 'visible';
$def['source'] = 'non-db';
return $def;
}
function delete($df){
parent::delete($df);
$id = new TemplateId();
$id->name = $this->ext3;
$id->delete($df);
}
function save($df){
// create the new ID field associated with this relate field - this will hold the id of the related record
// this field must have a unique name as the name is used when constructing quicksearches and when saving the field
//Check if we have not saved this field so we don't create two ID fields.
//Users should not be able to switch the module after having saved it once.
if (!$df->fieldExists($this->name)) {
$id = new TemplateId();
$id->len = 36;
$id->label = 'LBL_LIST_RELATED_TO';
$count = 0;
$basename = strtolower(get_singular_bean_name($this->ext2)).'_id' ;
$idName = $basename.'_c' ;
while ( $df->fieldExists($idName, 'id') )
{
$idName = $basename.++$count.'_c' ;
}
$id->name = $idName ;
$id->save($df);
// record the id field's name, and save
$this->ext3 = $id->name;
}
parent::save($df);
}
function get_db_add_alter_table($table){
return "";
}
function get_db_delete_alter_table($table) {
return "";
}
function get_db_modify_alter_table($table){
return "";
}
}
?>

View File

@@ -0,0 +1,79 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateField.php');
class TemplateText extends TemplateField{
var $type='varchar';
function get_xtpl_edit(){
$name = $this->name;
$returnXTPL = array();
if(!empty($this->help)){
$returnXTPL[strtoupper($this->name . '_help')] = translate($this->help, $this->bean->module_dir);
}
if(isset($this->bean->$name)){
$returnXTPL[$this->name] = $this->bean->$name;
}else{
if(empty($this->bean->id)){
$returnXTPL[$this->name] = $this->default_value;
}
}
return $returnXTPL;
}
function get_xtpl_search(){
if(!empty($_REQUEST[$this->name])){
return $_REQUEST[$this->name];
}
}
function get_xtpl_detail(){
$name = $this->name;
if(isset($this->bean->$name)){
return $this->bean->$name;
}
return '';
}
}
?>

View File

@@ -0,0 +1,104 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('modules/DynamicFields/templates/Fields/TemplateText.php');
class TemplateTextArea extends TemplateText{
var $type = 'text';
var $len = '';
function __construct()
{
$this->vardef_map['rows'] = 'ext2';
$this->vardef_map['cols'] = 'ext3';
}
function get_db_type(){
if ($GLOBALS['db']->dbType=='oci8') {
return " CLOB ";
} else if(!empty($GLOBALS['db']->isFreeTDS)) {
return " NTEXT ";
} else {
return " TEXT ";
}
}
function set($values){
parent::set($values);
if(!empty($this->ext2)){
$this->rows = $this->ext2;
}
if(!empty($this->ext3)){
$this->cols = $this->ext3;
}
if(!empty($this->ext4)){
$this->default_value = $this->ext4;
}
}
function get_xtpl_detail(){
$name = $this->name;
return nl2br($this->bean->$name);
}
function get_field_def(){
$def = parent::get_field_def();
$def['studio'] = 'visible';
if ( isset ( $this->ext2 ) && isset ($this->ext3))
{
$def[ 'rows' ] = $this->ext2 ;
$def[ 'cols' ] = $this->ext3 ;
}
if (isset( $this->rows ) && isset ($this->cols))
{
$def[ 'rows' ] = $this->rows ;
$def[ 'cols' ] = $this->cols ;
}
return $def;
}
function get_db_default(){
// TEXT columns in MySQL cannot have a DEFAULT value - let the Bean handle it on save
return null; // Bug 16612 - null so that the get_db_default() routine in TemplateField doesn't try to set DEFAULT
}
}
?>

View File

@@ -0,0 +1,71 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class TemplateURL extends TemplateText{
var $type='url';
function get_html_edit(){
$this->prepare();
return "<input type='text' name='". $this->name. "' id='".$this->name."' size='".$this->size."' title='{" . strtoupper($this->name) ."_HELP}' value='{". strtoupper($this->name). "}'>";
}
function get_html_detail(){
$xtpl_var = strtoupper($this->name);
return "<a href='{" . $xtpl_var . "}' target='_blank'>{" . $xtpl_var . "}</a>";
}
function get_xtpl_detail(){
$value = parent::get_xtpl_detail();
if(!empty($value) && substr_count($value, '://') == 0 && substr($value ,0,8) != 'index.php'){
$value = 'http://' . $value;
}
return $value;
}
function get_field_def(){
$def = parent::get_field_def();
//$def['options'] = !empty($this->options) ? $this->options : $this->ext1;
$def['default'] = !empty($this->default) ? $this->default : $this->default_value;
$def['len'] = $this->len;
$def['dbType'] = 'varchar';
$def['gen'] = !empty($this->gen) ? $this->gen : $this->ext3;
$def['link_target'] = !empty($this->link_target) ? $this->link_target : $this->ext4;
return $def;
}
}
?>

View File

@@ -0,0 +1,48 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
// adding custom fields:
if(isset($focus->custom_fields)){
/*
$test is set to focus to increment the reference count
since it appears that the reference count was off by 1
*/
$test =& $focus;
$focus->custom_fields->bean =& $focus;
$focus->custom_fields->populateXTPL($xtpl, 'detail');
}
?>

View File

@@ -0,0 +1,48 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
// adding custom fields:
if(isset($focus->custom_fields)){
/*
$test is set to focus to increment the reference count
since it appears that the reference count was off by 1
*/
$test =& $focus;
$focus->custom_fields->bean =& $focus;
$focus->custom_fields->populateXTPL($xtpl, 'edit');
}
?>