diff --git a/data/CRMEntity.php b/data/CRMEntity.php index ecc1cfe1f5e050484166309096d0ce1ae5ef8d86..f81a41c2d2bafe595575d3449d3a7972ac792c7f 100644 --- a/data/CRMEntity.php +++ b/data/CRMEntity.php @@ -174,18 +174,25 @@ class CRMEntity { $file_name = $file_details['name']; } - $save_file = 'true'; - //only images are allowed for Image Attachmenttype - $mimeType = vtlib_mime_content_type($file_details['tmp_name']); - $mimeTypeContents = explode('/', $mimeType); - // For contacts and products we are sending attachmentType as value - if ($attachmentType == 'Image' || ($file_details['size'] && $mimeTypeContents[0] == 'image')) { - $save_file = validateImageFile($file_details); - } - if ($save_file == 'false') { - return false; - } + // Check 1 + $save_file = 'true'; + //only images are allowed for Image Attachmenttype + $mimeType = vtlib_mime_content_type($file_details['tmp_name']); + $mimeTypeContents = explode('/', $mimeType); + // For contacts and products we are sending attachmentType as value + if ($attachmentType == 'Image' || ($file_details['size'] && $mimeTypeContents[0] == 'image')) { + $save_file = validateImageFile($file_details); + } + if ($save_file == 'false') { + return false; + } + // Check 2 + $save_file = 'true'; + //only images are allowed for these modules + if ($module == 'Contacts' || $module == 'Products') { + $save_file = validateImageFile($file_details); + } $binFile = sanitizeUploadFileName($file_name, $upload_badext); $current_id = $adb->getUniqueID("vtiger_crmentity"); diff --git a/include/utils/VtlibUtils.php b/include/utils/VtlibUtils.php index 55b571b1733830143d13a98df90f0c826751a753..51b35ba0e2341e08956629c2ba7d40b93f9fb4ba 100644 --- a/include/utils/VtlibUtils.php +++ b/include/utils/VtlibUtils.php @@ -775,4 +775,56 @@ function vtlib_module_icon($modulename){ function vtlib_mime_content_type($filename) { return Vtiger_Functions::mime_content_type($filename); } + +/** + * Function to add settings entry in CRM settings page + * @param string $linkName + * @param string $linkURL + * @param string $blockName + * @return boolean true/false + */ +function vtlib_addSettingsLink($linkName, $linkURL, $blockName = false) { + $success = true; + $db = PearDatabase::getInstance(); + + //Check entry name exist in DB or not + $result = $db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($linkName)); + if ($result && !$db->num_rows($result)) { + $blockId = 0; + if ($blockName) { + $blockId = getSettingsBlockId($blockName);//Check block name exist in DB or not + } + + if (!$blockId) { + $blockName = 'LBL_OTHER_SETTINGS'; + $blockId = getSettingsBlockId($blockName);//Check block name exist in DB or not + } + + //Add block in to DB if not exists + if (!$blockId) { + $blockSeqResult = $db->pquery('SELECT MAX(sequence) AS sequence FROM vtiger_settings_blocks', array()); + if ($db->num_rows($blockSeqResult)) { + $blockId = $db->getUniqueID('vtiger_settings_blocks'); + $blockSequence = $db->query_result($blockSeqResult, 0, 'sequence'); + $db->pquery('INSERT INTO vtiger_settings_blocks(blockid, label, sequence) VALUES(?,?,?)', array($blockId, 'LBL_OTHER_SETTINGS', $blockSequence++)); + } + } + + //Add settings field in to DB + if ($blockId) { + $fieldSeqResult = $db->pquery('SELECT MAX(sequence) AS sequence FROM vtiger_settings_field WHERE blockid=?', array($blockId)); + if ($db->num_rows($fieldSeqResult)) { + $fieldId = $db->getUniqueID('vtiger_settings_field'); + $linkURL = ($linkURL) ? $linkURL : ''; + $fieldSequence = $db->query_result($fieldSeqResult, 0, 'sequence'); + + $db->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence, active, pinned) VALUES(?,?,?,?,?,?,?,?,?)', array($fieldId, $blockId, $entryName, '', $entryName, $linkURL, $fieldSequence++, 0, 0)); + } + } else { + $success = false; + } + } + return $success; +} + ?> \ No newline at end of file diff --git a/languages/en_us/Contacts.php b/languages/en_us/Contacts.php index 73f74509322a3f3f9454433ae02bbe4e40cf288d..e012a599356d7aae6ce54e09082ce58ad9fd1000 100644 --- a/languages/en_us/Contacts.php +++ b/languages/en_us/Contacts.php @@ -8,6 +8,7 @@ * All Rights Reserved. *************************************************************************************/ $languageStrings = array( + // Basic Strings 'Assistant' => 'Assistant', 'Assistant Phone' => 'Assistant Phone', 'Birthdate' => 'Date of Birth',