diff --git a/data/VTEntityDelta.php b/data/VTEntityDelta.php index a0c7bb16f5c1b569fdfa2b7817c658c6945918b7..8251517abc1948d514a7bda3a1d6e7508674d3f3 100644 --- a/data/VTEntityDelta.php +++ b/data/VTEntityDelta.php @@ -112,8 +112,16 @@ class VTEntityDelta extends VTEventHandler { if(empty(self::$oldEntity[$moduleName][$recordId])) { return false; } + $fieldDelta = isset(self::$entityDelta[$moduleName][$recordId][$fieldName]) ? self::$entityDelta[$moduleName][$recordId][$fieldName] :' '; if(is_array($fieldDelta) && isset($fieldDelta['oldValue']) && isset($fieldDelta['currentValue'])) { + + if (!array_key_exists($fieldName, self::$entityDelta[$moduleName][$recordId])) { + return false; + } + $fieldDelta = self::$entityDelta[$moduleName][$recordId][$fieldName]; + if(is_array($fieldDelta)) { + $fieldDelta = array_map('decode_html', $fieldDelta); $result = $fieldDelta['oldValue'] != $fieldDelta['currentValue']; if ($fieldValue !== NULL) { @@ -127,4 +135,4 @@ class VTEntityDelta extends VTEventHandler { } } -?> \ No newline at end of file +?> diff --git a/include/QueryGenerator/EnhancedQueryGenerator.php b/include/QueryGenerator/EnhancedQueryGenerator.php index d842693a30531488b41278f05f83a2770cc33418..74ef79dbaeb87dee4a5a748d34b65a7fc960afe3 100644 --- a/include/QueryGenerator/EnhancedQueryGenerator.php +++ b/include/QueryGenerator/EnhancedQueryGenerator.php @@ -578,7 +578,7 @@ class EnhancedQueryGenerator extends QueryGenerator { foreach ($tableJoinCondition as $fieldName => $conditionInfo) { foreach ($conditionInfo as $tableName => $condition) { - if ($tableList[$tableName]) { + if (isset($tableList[$tableName])) { $tableNameAlias = $tableName.'2'; $condition = str_replace($tableName, $tableNameAlias, $condition); } else { diff --git a/include/Webservices/Create.php b/include/Webservices/Create.php index 369180dc60db9d5858e86185f6376b84e7513bcc..7f5ae9b3e5ac51fd8bfdc82dd3acea48562e60c7 100644 --- a/include/Webservices/Create.php +++ b/include/Webservices/Create.php @@ -64,7 +64,7 @@ function vtws_create($elementType, $element, $user) { throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to access reference type is denied" . $referenceObject->getEntityName()); } - } else if ($element[$fieldName] !== NULL) { + } else if (array_key_exists($fieldName, $element) && $element[$fieldName] !== NULL) { unset($element[$fieldName]); } } @@ -88,4 +88,4 @@ function vtws_create($elementType, $element, $user) { return null; } } -?> \ No newline at end of file +?> diff --git a/include/Webservices/DataTransform.php b/include/Webservices/DataTransform.php index 26460990fe7399a81dfad1a67e461e69de832076..32263fa92cfc368fc929447aee5125f488a4dbfe 100644 --- a/include/Webservices/DataTransform.php +++ b/include/Webservices/DataTransform.php @@ -103,7 +103,7 @@ } $references = $meta->getReferenceFieldDetails(); foreach($references as $field=>$typeList){ - if(strpos($row[$field],'x')!==false){ + if(isset($row[$field]) && strpos($row[$field],'x')!==false){ $row[$field] = vtws_getIdComponents($row[$field]); $row[$field] = $row[$field][1]; } @@ -130,7 +130,7 @@ } } } - if($row["id"]){ + if(isset($row["id"]) && $row["id"]){ unset($row["id"]); } if(isset($row[$meta->getObectIndexColumn()])){ diff --git a/include/Webservices/EntityMeta.php b/include/Webservices/EntityMeta.php index 831eb69b533edd238ec5947c7fd4f5ae52ca4ccc..f449054664f0d3f798e89dc7e6f06fc42af0f3b7 100644 --- a/include/Webservices/EntityMeta.php +++ b/include/Webservices/EntityMeta.php @@ -8,6 +8,7 @@ * All Rights Reserved. *************************************************************************************/ +#[\AllowDynamicProperties] abstract class EntityMeta{ public static $RETRIEVE = "DetailView"; @@ -276,4 +277,4 @@ abstract class EntityMeta{ abstract public function getName($webserviceId); abstract public function isModuleEntity(); } -?> \ No newline at end of file +?> diff --git a/include/Webservices/LineItem/VtigerLineItemMeta.php b/include/Webservices/LineItem/VtigerLineItemMeta.php index 60cda71cac0c412f8ba8b6b3be372fe91154c063..efc67cd4af5d3a8293c1cc5a8227e7747fcfe744 100644 --- a/include/Webservices/LineItem/VtigerLineItemMeta.php +++ b/include/Webservices/LineItem/VtigerLineItemMeta.php @@ -92,7 +92,7 @@ class VtigerLineItemMeta extends VtigerCRMActorMeta { if(in_array($fieldName,$mandatoryFieldList)){ $typeOfData = $fieldType.'~M'; }else if(($dbField->not_null == 1 && $fieldName != 'incrementondel' - && $dbField->primary_key != 1) || $dbField->unique_key == 1){ + && $dbField->primary_key != 1) || (property_exists($dbField, 'unique_key') && $dbField->unique_key == 1)) { $typeOfData = $fieldType.'~M'; }else{ $typeOfData = $fieldType.'~O'; @@ -105,4 +105,4 @@ class VtigerLineItemMeta extends VtigerCRMActorMeta { } } -?> \ No newline at end of file +?> diff --git a/include/Webservices/OperationManager.php b/include/Webservices/OperationManager.php index 949ab248a4951bbc784c03130c3993145b1f3887..d381b48ebe5311022498118dfbf6873fccfe1d50 100644 --- a/include/Webservices/OperationManager.php +++ b/include/Webservices/OperationManager.php @@ -9,7 +9,7 @@ *************************************************************************************/ function setBuiltIn($json){ - $json->useBuiltinEncoderDecoder = true; + Zend_Json::$useBuiltinEncoderDecoder = true; } class OperationManager{ @@ -132,10 +132,10 @@ } function handleType($type,$value){ - $result; - $value = stripslashes($value); + $result = null; + $value = $value ? stripslashes($value) : ""; $type = strtolower($type); - if($this->inParamProcess[$type]){ + if(isset($this->inParamProcess[$type]) && $this->inParamProcess[$type]){ $result = call_user_func($this->inParamProcess[$type],$value); }else{ $result = $value; @@ -210,4 +210,4 @@ } -?> \ No newline at end of file +?> diff --git a/include/Webservices/Update.php b/include/Webservices/Update.php index ce008d80a4cfd36bb5692e51df181381af9d3a2f..76d8b85925c63474daff33b553f3fec7cf9726de 100644 --- a/include/Webservices/Update.php +++ b/include/Webservices/Update.php @@ -71,7 +71,7 @@ throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to access reference type is denied ".$referenceObject->getEntityName()); } - }else if($element[$fieldName] !== NULL){ + }else if(array_key_exists($fieldName, $element) && $element[$fieldName] !== NULL){ unset($element[$fieldName]); } } @@ -93,4 +93,4 @@ return $entity; } -?> \ No newline at end of file +?> diff --git a/include/Webservices/Utils.php b/include/Webservices/Utils.php index 2b0a1f529b2fb7a7817e063f01b78b40a159adbd..08f3ecbb6767230266229012a4166e71ab4ffd01 100644 --- a/include/Webservices/Utils.php +++ b/include/Webservices/Utils.php @@ -139,9 +139,10 @@ function getEmailFieldId($meta, $entityId){ function vtws_getParameter($parameterArray, $paramName,$default=null){ if (!get_magic_quotes_gpc()) { - if(is_array($parameterArray[$paramName])) { + $param = null; + if(isset($parameterArray[$paramName]) && is_array($parameterArray[$paramName])) { $param = array_map('addslashes', $parameterArray[$paramName]); - } else { + } else if (isset($parameterArray[$paramName]) && $parameterArray[$paramName]) { $param = addslashes($parameterArray[$paramName]); } } else { diff --git a/include/Webservices/VTQL_Parser.php b/include/Webservices/VTQL_Parser.php index e970ebccecc261f7f953a47a56a4e8bad7cdea6d..223fc1a8cf6029d577b3d14ce56b8d0ac91d3cf0 100644 --- a/include/Webservices/VTQL_Parser.php +++ b/include/Webservices/VTQL_Parser.php @@ -208,7 +208,7 @@ function buildSelectStmt($sqlDump){ $deletedQuery = $meta->getEntityDeletedQuery(); $accessControlQuery = $meta->getEntityAccessControlQuery(); $this->query = $this->query.' '.$accessControlQuery; - if($sqlDump['where_condition']){ + if(isset($sqlDump['where_condition'])){ // ensure init before use if(!isset($sqlDump['where_condition']['operators'])) $sqlDump['where_condition']['operators'] = array(); @@ -287,7 +287,7 @@ function buildSelectStmt($sqlDump){ $this->query = $this->query.' '.$deletedQuery; - if($sqlDump['orderby']){ + if(isset($sqlDump['orderby'])){ $i=0; $this->query = $this->query.' ORDER BY '; foreach($sqlDump['orderby'] as $ind=>$field){ @@ -302,7 +302,7 @@ function buildSelectStmt($sqlDump){ $this->query .= ' '.$sqlDump['sortOrder']; } } - if($sqlDump['limit']){ + if(isset($sqlDump['limit'])){ $i=0; $offset =false; if(php7_sizeof($sqlDump['limit'])>1){ @@ -1329,7 +1329,7 @@ $this->out['limit'][] = $this->yystack[$this->yyidx + 0]->minor; #line 151 "e:\workspace\nonadmin\pkg\vtiger\extensions\Webservices\VTQL_parser.y" function yy_r41(){ global $adb; -if(!$this->out['meta']){ +if(!isset($this->out['meta'])){ $module = $this->out['moduleName']; $handler = vtws_getModuleHandlerFromName($module,$this->user); $objectMeta = $handler->getMeta(); @@ -1344,7 +1344,7 @@ foreach($this->out['column_list'] as $ind=>$field){ $columns[] = $fieldcol[$field]; } } -if($this->out['where_condition']){ +if(isset($this->out['where_condition']) && isset($this->out['where_condition']['column_names'])){ foreach($this->out['where_condition']['column_names'] as $ind=>$field){ $columns[] = $fieldcol[$field]; } @@ -1362,6 +1362,7 @@ array_push($tables,$tableName); $firstTable = $objectMeta->getEntityBaseTable(); $tabNameIndex = $objectMeta->getEntityTableIndexList(); $firstIndex = $tabNameIndex[$firstTable]; +if (!isset($this->out['defaultJoinConditons'])) $this->out['defaultJoinConditions'] = ''; foreach($tables as $ind=>$table){ if($firstTable!=$table){ if(!isset($tabNameIndex[$table]) && $table == "vtiger_crmentity"){ diff --git a/include/Webservices/VtigerActorOperation.php b/include/Webservices/VtigerActorOperation.php index 6b26288df78cc051439f65722f146535a33f903d..eea1a69f00290caa14fe99eb76b341bb5d91782d 100644 --- a/include/Webservices/VtigerActorOperation.php +++ b/include/Webservices/VtigerActorOperation.php @@ -263,7 +263,7 @@ class VtigerActorOperation extends WebserviceEntityOperation { foreach ($moduleFields as $fieldName=>$webserviceField) { array_push($fields,$this->getDescribeFieldArray($webserviceField)); } - $label = ($app_strings[$this->meta->getObectIndexColumn()])? $app_strings[$this->meta->getObectIndexColumn()]: + $label = isset($app_strings[$this->meta->getObectIndexColumn()])? $app_strings[$this->meta->getObectIndexColumn()]: $this->meta->getObectIndexColumn(); $this->moduleFields = $fields; } @@ -276,7 +276,9 @@ class VtigerActorOperation extends WebserviceEntityOperation { if(isset($app_strings[$fieldLabel])){ $fieldLabel = $app_strings[$fieldLabel]; } - if(strcasecmp($webserviceField->getFieldName(),$this->meta->getObectIndexColumn()) === 0){ + $fieldName = $webserviceField->getFieldName(); + $fieldColumn = $this->meta->getObectIndexColumn(); + if($fieldColumn && strcasecmp($fieldName, $fieldColumn) === 0){ return $this->getIdField($fieldLabel); } @@ -334,4 +336,4 @@ class VtigerActorOperation extends WebserviceEntityOperation { } } -?> \ No newline at end of file +?> diff --git a/include/Webservices/VtigerCRMObject.php b/include/Webservices/VtigerCRMObject.php index 45f472ca0812f228239619f40c41cba2274aa98c..e759f429d6046e90e2b81562dd601f171fc14cdc 100644 --- a/include/Webservices/VtigerCRMObject.php +++ b/include/Webservices/VtigerCRMObject.php @@ -185,7 +185,7 @@ class VtigerCRMObject{ global $adb; $error = false; $adb->startTransaction(); - DeleteEntity($this->getTabName(), $this->getTabName(), $this->instance, $id,$returnid); + DeleteEntity($this->getTabName(), $this->getTabName(), $this->instance, $id,""); $error = $adb->hasFailedTransaction(); $adb->completeTransaction(); return !$error; diff --git a/include/Webservices/VtigerCRMObjectMeta.php b/include/Webservices/VtigerCRMObjectMeta.php index b583b2876d71599d749595ace0da51c548e341b4..09e12f98f3562debc250ad9e4a3aff3ee4ebc16e 100644 --- a/include/Webservices/VtigerCRMObjectMeta.php +++ b/include/Webservices/VtigerCRMObjectMeta.php @@ -223,11 +223,12 @@ class VtigerCRMObjectMeta extends EntityMeta { function hasPermission($operation,$webserviceId){ $idComponents = vtws_getIdComponents($webserviceId); - $id=$idComponents[1]; - - $permitted = isPermitted($this->getTabName(),$operation,$id); - if(strcmp($permitted,"yes")===0){ - return true; + $id=$idComponents ? array_pop($idComponents):null; + if ($id) { + $permitted = isPermitted($this->getTabName(),$operation,$id); + if(strcmp($permitted,"yes")===0){ + return true; + } } return false; } diff --git a/include/Webservices/WebserviceEntityOperation.php b/include/Webservices/WebserviceEntityOperation.php index 876d2d45d8e158ddf39baeb0995b047aab1dc0f8..89f9f6a3a6c0eb3048f19e432de6c87fba3a0836 100644 --- a/include/Webservices/WebserviceEntityOperation.php +++ b/include/Webservices/WebserviceEntityOperation.php @@ -83,7 +83,7 @@ abstract class WebserviceEntityOperation{ break; case 'multipicklist': case 'picklist': $typeDetails["picklistValues"] = $webserviceField->getPicklistDetails($webserviceField); - $typeDetails['defaultValue'] = $typeDetails["picklistValues"][0]['value']; + $typeDetails['defaultValue'] = !empty($typeDetails["picklistValues"]) ? $typeDetails["picklistValues"][0]['value'] : null; break; case 'file': $maxUploadSize = 0; $maxUploadSize = ini_get('upload_max_filesize'); @@ -131,4 +131,4 @@ abstract class WebserviceEntityOperation{ } -?> \ No newline at end of file +?> diff --git a/include/events/VTEntityData.inc b/include/events/VTEntityData.inc index 8a87e4e0f0f1200c77550f3e57996229db00fe5e..d53c8f31a41643bc4a897f1fd780a592ed72aedc 100644 --- a/include/events/VTEntityData.inc +++ b/include/events/VTEntityData.inc @@ -112,7 +112,7 @@ class VTEntityData{ * @return The entity id. */ function getId(){ - return $this->focus->id; + return property_exists($this->focus, "id") ? $this->focus->id : null; } /** diff --git a/include/utils/ListViewUtils.php b/include/utils/ListViewUtils.php index 3ea02a3d5e8f5fc61a4ef0885046b210a3719081..9410005905262a1c5d702402e4b5c8cd73549cb6 100755 --- a/include/utils/ListViewUtils.php +++ b/include/utils/ListViewUtils.php @@ -674,6 +674,9 @@ function decode_emptyspace_html($str){ } function decode_html($str) { + // null or blank + if (!$str) return $str; + global $default_charset; // Direct Popup action or Ajax Popup action should be treated the same. if ((isset($_REQUEST['action']) && $_REQUEST['action'] == 'Popup') || (isset($_REQUEST['file']) && $_REQUEST['file'] == 'Popup')) @@ -694,7 +697,7 @@ function popup_decode_html($str) { //function added to check the text length in the listview. function textlength_check($field_val) { global $listview_max_textlength, $default_charset; - if ($listview_max_textlength && $listview_max_textlength > 0) { + if ($field_val && $listview_max_textlength && $listview_max_textlength > 0) { $temp_val = preg_replace("/(<\/?)(\w+)([^>]*>)/i", "", $field_val); if (function_exists('mb_strlen')) { if (mb_strlen(decode_html($temp_val)) > $listview_max_textlength) { diff --git a/include/utils/VtlibUtils.php b/include/utils/VtlibUtils.php index 06e20bfd7f3cb323625a51db7dd988e76c295fc5..24352abb1c1d0268e28d521776d3712e32b76fc9 100644 --- a/include/utils/VtlibUtils.php +++ b/include/utils/VtlibUtils.php @@ -815,6 +815,7 @@ function strcasecmp_accents_callback() { * @return <String> */ function purifyHtmlEventAttributes($value,$replaceAll = false){ + if (!$value) return $value; $tmp_markers = $office365ImageMarkers = array(); $value = Vtiger_Functions::strip_base64_data($value,true,$tmp_markers); diff --git a/include/utils/utils.php b/include/utils/utils.php index c7e28588e12599457d08ee9ca672dcb68a2d6023..ca897998b55be668bc52dd8554c2dbcf7ac4ce4e 100755 --- a/include/utils/utils.php +++ b/include/utils/utils.php @@ -2439,13 +2439,14 @@ function getRecordGroupId($record) { * Function to delete record from $_SESSION[$moduleName.'_DetailView_Navigation'.$cvId] */ function deleteRecordFromDetailViewNavigationRecords($recordId, $cvId, $moduleName) { - $recordNavigationInfo = Zend_Json::decode($_SESSION[$moduleName . '_DetailView_Navigation' . $cvId]); - if (!empty($recordNavigationInfo) && (php7_count($recordNavigationInfo) != 0)) { + $cachekey = ($moduleName . '_DetailView_Navigation' . $cvId); + $recordNavigationInfo = isset($_SESSION[$cachekey]) ? Zend_Json::decode($_SESSION[$cachekey]) : null; + if ($recordNavigationInfo && (php7_count($recordNavigationInfo) != 0)) { foreach ($recordNavigationInfo as $key => $recordIdList) { $recordIdList = array_diff($recordIdList, array($recordId)); $recordNavigationInfo[$key] = $recordIdList; } - $_SESSION[$moduleName . '_DetailView_Navigation' . $cvId] = Zend_Json::encode($recordNavigationInfo); + $_SESSION[$cachekey] = Zend_Json::encode($recordNavigationInfo); } } diff --git a/includes/runtime/Controller.php b/includes/runtime/Controller.php index 760ca75ff24ac9f0638d6beb8d92502c5c8625c2..a2d8efe07a731e9663e09f9d36c9aa9662196c10 100644 --- a/includes/runtime/Controller.php +++ b/includes/runtime/Controller.php @@ -182,7 +182,10 @@ abstract class Vtiger_View_Controller extends Vtiger_Action_Controller { $viewer->assign('PARENT_MODULE', ''); $viewer->assign('EXTENSION_MODULE', ''); $viewer->assign('moduleName', ''); + $viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->assign('CURRENT_USER_ID', $current_user ? $current_user->id : ""); + $viewer->assign('USER_CURRENCY_SYMBOL', ''); // will be initialized later + $viewer->assign('INVENTORY_MODULES', array()); $viewer->assign('NOTIFIER_URL', ''); $viewer->assign('GLOBAL_SEARCH_VALUE', ''); @@ -205,6 +208,7 @@ abstract class Vtiger_View_Controller extends Vtiger_Action_Controller { $viewer->assign('PRINT_TEMPLATE', ''); $viewer->assign('CLASS_VIEW_ACTION', ''); $viewer->assign('RELATED_MODULE_NAME', ''); + $viewer->assign('MODULE_BASIC_ACTIONS', array()); // Editview $viewer->assign('LEFTPANELHIDE', false); diff --git a/includes/runtime/Viewer.php b/includes/runtime/Viewer.php index 9c64e39d349d56bad69888c7f81664271a341035..da4837c96b063646c047fad3306ada6920e86588 100644 --- a/includes/runtime/Viewer.php +++ b/includes/runtime/Viewer.php @@ -71,12 +71,13 @@ class Vtiger_Viewer extends Smarty { $this->log("URI: $debugViewerURI, TYPE: " . $_SERVER['REQUEST_METHOD']); } + // TODO: Refactor to specific module dependency. $classes = array('Vtiger_MenuStructure_Model', 'Users_Privileges_Model', 'Vtiger_Module_Model', 'Settings_MenuEditor_Module_Model', 'Vtiger_Util_Helper', 'ZEND_JSON', 'Zend_Json', 'Zend_JSON', 'ZEND_json', - 'Vtiger_Theme', 'Users_Record_Model', 'Vtiger_Module_Model', 'Vtiger_Field_Model', + 'Vtiger_Theme', 'Users_Record_Model', 'Vtiger_Module_Model', 'Vtiger_Field_Model', 'Vtiger_Record_Model', 'Settings_Picklist_Module_Model', 'CustomView_Record_Model', 'Vtiger_Extension_View', - 'Vtiger_Tag_Model', + 'Vtiger_Tag_Model', 'Settings_Vtiger_Module_Model', 'PBXManager_Server_Model', 'Vtiger_Functions', 'Users', 'CurrencyField'); foreach ($classes as $clazz) { if (class_exists($clazz)) { @@ -86,9 +87,10 @@ class Vtiger_Viewer extends Smarty { $modifiers = array('vtranslate', 'vtlib_isModuleActive', 'vimage_path', 'strstr', 'stripos', 'strpos', 'date', 'vtemplate_path', 'vresource_url', 'decode_html', 'vtlib_purify', 'php7_count', 'getUserFullName', 'array_flip', 'explode', 'trim', 'array_push', - 'array_map', 'array_key_exists', 'get_class', 'vtlib_array', 'getDuplicatesPreventionMessage', 'htmlentities', + 'array_map', 'array_key_exists', 'get_class', 'vtlib_array', 'getDuplicatesPreventionMessage', 'htmlentities', 'purifyHtmlEventAttributes', 'getCurrencySymbolandCRate', 'mb_substr', 'isPermitted', 'getEntityName', 'function_exists', 'php7_trim', 'php7_htmlentities', - 'strtolower', 'strtoupper', 'str_replace', 'urlencode', 'getTranslatedCurrencyString', 'getTranslatedString', 'is_object', 'is_numeric'); + 'strtolower', 'strtoupper', 'str_replace', 'urlencode', 'getTranslatedCurrencyString', 'getTranslatedString', 'is_object', 'is_numeric', + 'php7_sizeof', 'method_exists'); foreach ($modifiers as $modifier) { if (function_exists($modifier)) { $this->registerPlugin('modifier', $modifier, $modifier); diff --git a/layouts/v7/modules/Documents/CreateDocument.tpl b/layouts/v7/modules/Documents/CreateDocument.tpl index c865415b90025be5c23f11c803dee230a9d547e4..8f505629f8477b289472a927add31eed13806012 100644 --- a/layouts/v7/modules/Documents/CreateDocument.tpl +++ b/layouts/v7/modules/Documents/CreateDocument.tpl @@ -22,9 +22,9 @@ <input type="hidden" name="module" value="{$MODULE}" /> <input type="hidden" name="action" value="SaveAjax" /> <input type="hidden" name="document_source" value="Vtiger" /> - <input type="hidden" name='service' value="{$STORAGE_SERVICE}" /> + <input type="hidden" name='service' value="{if isset($STORAGE_SERVICE)}{$STORAGE_SERVICE}{/if}" /> <input type="hidden" name='type' value="{$FILE_LOCATION_TYPE}" /> - {if $RELATION_OPERATOR eq 'true'} + {if isset($RELATION_OPERATOR) && $RELATION_OPERATOR eq 'true'} <input type="hidden" name="relationOperation" value="{$RELATION_OPERATOR}" /> <input type="hidden" name="sourceModule" value="{$PARENT_MODULE}" /> <input type="hidden" name="sourceRecord" value="{$PARENT_ID}" /> diff --git a/layouts/v7/modules/Documents/ModuleHeader.tpl b/layouts/v7/modules/Documents/ModuleHeader.tpl index 2c3db7718c038360cd4db45c2d3ce908e231ce5c..92ebd4333e60f1c0e56fa73c544bf099a2d91964 100644 --- a/layouts/v7/modules/Documents/ModuleHeader.tpl +++ b/layouts/v7/modules/Documents/ModuleHeader.tpl @@ -41,7 +41,7 @@ <p class="current-filter-name filter-name pull-left cursorPointer" title="{$CVNAME}"> <span class="fa fa-angle-right pull-left" aria-hidden="true"></span><a href='{$MODULE_MODEL->getListViewUrl()}&viewname={$VIEWID}'> {$CVNAME} </a> </p> {/if} {assign var=SINGLE_MODULE_NAME value='SINGLE_'|cat:$MODULE} - {if $RECORD and $REQ->get('view') eq 'Edit'} + {if isset($RECORD) and $REQ->get('view') eq 'Edit'} <p class="current-filter-name filter-name pull-left "><span class="fa fa-angle-right pull-left" aria-hidden="true"></span><a title="{$RECORD->get('label')}"> {vtranslate('LBL_EDITING', $MODULE)} : {$RECORD->get('label')} </a></p> {else if $REQ->get('view') eq 'Edit'} <p class="current-filter-name filter-name pull-left "><span class="fa fa-angle-right pull-left" aria-hidden="true"></span><a> {vtranslate('LBL_ADDING_NEW', $MODULE)} </a></p> diff --git a/layouts/v7/modules/Documents/UploadDocument.tpl b/layouts/v7/modules/Documents/UploadDocument.tpl index ffd5b66fbd1ece61e4c426571f658593fbfdaae5..10ac0db6a61f748d19811a473428c6ee6247d473 100644 --- a/layouts/v7/modules/Documents/UploadDocument.tpl +++ b/layouts/v7/modules/Documents/UploadDocument.tpl @@ -23,7 +23,7 @@ <input type="hidden" name="module" value="{$MODULE}" /> <input type="hidden" name="action" value="SaveAjax" /> <input type="hidden" name="document_source" value="Vtiger" /> - {if $RELATION_OPERATOR eq 'true'} + {if isset($RELATION_OPERATOR) && $RELATION_OPERATOR eq 'true'} <input type="hidden" name="relationOperation" value="{$RELATION_OPERATOR}" /> <input type="hidden" name="sourceModule" value="{$PARENT_MODULE}" /> <input type="hidden" name="sourceRecord" value="{$PARENT_ID}" /> @@ -47,7 +47,7 @@ <div class="fileUploadBtn btn btn-primary"> <span><i class="fa fa-laptop"></i> {vtranslate('LBL_SELECT_FILE_FROM_COMPUTER', $MODULE)}</span> {assign var=FIELD_MODEL value=$FIELD_MODELS['filename']} - <input type="file" name="{$FIELD_MODEL->getFieldName()}" value="{$FIELD_VALUE}" data-rule-required="true" /> + <input type="file" name="{$FIELD_MODEL->getFieldName()}" value="{if isset($FIELD_VALUE)}{$FIELD_VALUE}{/if}" data-rule-required="true" /> </div> <i class="fa fa-info-circle cursorPointer" data-toggle="tooltip" title="{vtranslate('LBL_MAX_UPLOAD_SIZE', $MODULE)} {$MAX_UPLOAD_LIMIT_MB}{vtranslate('MB', $MODULE)}"></i> </div> diff --git a/layouts/v7/modules/Documents/partials/SidebarEssentials.tpl b/layouts/v7/modules/Documents/partials/SidebarEssentials.tpl index 24889f237872717f78dd1c3866180258793cbdb6..29fda74cdb9b329f40cc8abf9da28283c949c7c2 100644 --- a/layouts/v7/modules/Documents/partials/SidebarEssentials.tpl +++ b/layouts/v7/modules/Documents/partials/SidebarEssentials.tpl @@ -152,7 +152,7 @@ <div class="menu-scroller scrollContainer" style="position:relative; top:0; left:0;"> <div class="list-menu-content"> <div id="listViewTagContainer" class="multiLevelTagList" - {if $ALL_CUSTOMVIEW_MODEL} data-view-id="{$ALL_CUSTOMVIEW_MODEL->getId()}" {/if} + {if isset($ALL_CUSTOMVIEW_MODEL)} data-view-id="{$ALL_CUSTOMVIEW_MODEL->getId()}" {/if} data-list-tag-count="{Vtiger_Tag_Model::NUM_OF_TAGS_LIST}"> {foreach item=TAG_MODEL from=$TAGS name=tagCounter} {assign var=TAG_LABEL value=$TAG_MODEL->getName()} diff --git a/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl b/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl index 7b66072dd814057890cb6d36c64c15c0df2ebd9f..6c9a82a0f83ed633634acee5d258b05ff4d5d773 100644 --- a/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl +++ b/layouts/v7/modules/Settings/Vtiger/ModuleHeader.tpl @@ -28,7 +28,8 @@ {/if} {if $MODULE neq 'Vtiger'} {assign var=ALLOWED_MODULES value=","|explode:'Users,Profiles,Groups,Roles,Webforms,Workflows'} - {if $MODULE_MODEL and $MODULE|in_array:$ALLOWED_MODULES} + {assign var=URL value=""} + {if isset($MODULE_MODEL) and $MODULE|in_array:$ALLOWED_MODULES} {if $MODULE eq 'Webforms'} {assign var=URL value=$MODULE_MODEL->getListViewUrl()} {else} @@ -202,7 +203,7 @@ </div> </div> </div> - {if $FIELDS_INFO neq null} + {if isset($FIELDS_INFO) && $FIELDS_INFO neq null} <script type="text/javascript"> var uimeta = (function () { var fieldInfo = {$FIELDS_INFO}; diff --git a/layouts/v7/modules/Settings/Vtiger/SettingsMenuStart.tpl b/layouts/v7/modules/Settings/Vtiger/SettingsMenuStart.tpl index e3781d568e50bc4a41bf25c04c3f9cfa13163c7c..81595158254b3512e546aeea3de9055c1a868145 100644 --- a/layouts/v7/modules/Settings/Vtiger/SettingsMenuStart.tpl +++ b/layouts/v7/modules/Settings/Vtiger/SettingsMenuStart.tpl @@ -24,7 +24,7 @@ <div class="modal-dialog"> </div> </div> -{if $FIELDS_INFO neq null} +{if isset($FIELDS_INFO) && $FIELDS_INFO neq null} <script type="text/javascript"> var uimeta = (function() { var fieldInfo = {$FIELDS_INFO}; diff --git a/layouts/v7/modules/Users/CalendarSettingsDetailView.tpl b/layouts/v7/modules/Users/CalendarSettingsDetailView.tpl index f268a505c8b8e63594eab5e8c8453c8d142edd64..d7f6836e9531dddd26f6442fa44a93431769a5cc 100644 --- a/layouts/v7/modules/Users/CalendarSettingsDetailView.tpl +++ b/layouts/v7/modules/Users/CalendarSettingsDetailView.tpl @@ -12,7 +12,7 @@ {strip} <form id="detailView" data-name-fields='{ZEND_JSON::encode($MODULE_MODEL->getNameFields())}' method="POST"> <div class="contents"> - {foreach key=BLOCK_LABEL_KEY item=FIELD_MODEL_LIST from=$RECORD_STRUCTURE} + {foreach key=BLOCK_LABEL_KEY item=FIELD_MODEL_LIST from=$RECORD_STRUCTURE name=CalendarDetailViewBlockLevelLoop} <div class="block block_{$BLOCK_LABEL_KEY}" data-block="{$BLOCK_LABEL_KEY}"> {assign var=BLOCK value=$BLOCK_LIST[$BLOCK_LABEL_KEY]} {if $BLOCK eq null or $FIELD_MODEL_LIST|@count lte 0}{continue}{/if} @@ -134,7 +134,7 @@ {/if} {/foreach} {* adding additional column for odd number of fields in a block *} - {if $FIELD_MODEL_LIST|@end eq true and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} + {if $smarty.foreach.CalendarDetailViewBlockLevelLoop.last and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} <td class="fieldLabel {$WIDTHTYPE}"></td><td class="{$WIDTHTYPE}"></td> {/if} </tr> @@ -144,4 +144,4 @@ </div> <br> {/foreach} - {/strip} \ No newline at end of file + {/strip} diff --git a/layouts/v7/modules/Users/DetailViewBlockView.tpl b/layouts/v7/modules/Users/DetailViewBlockView.tpl index 18f2528e965f31245df4260364218a0e7b773286..ea4d1a6eccfa7dad01b280fe35d4a0cf6ae94116 100644 --- a/layouts/v7/modules/Users/DetailViewBlockView.tpl +++ b/layouts/v7/modules/Users/DetailViewBlockView.tpl @@ -10,7 +10,7 @@ {strip} <input type=hidden name="timeFormatOptions" data-value='{$DAY_STARTS}' /> <input type='hidden' name='pwd_regex' value= {ZEND_json::encode($PWD_REGEX)} /> - {foreach key=BLOCK_LABEL_KEY item=FIELD_MODEL_LIST from=$RECORD_STRUCTURE} + {foreach key=BLOCK_LABEL_KEY item=FIELD_MODEL_LIST from=$RECORD_STRUCTURE name=DetailViewBlockViewLoop} {if $BLOCK_LABEL_KEY neq 'LBL_CALENDAR_SETTINGS'} {assign var=BLOCK value=$BLOCK_LIST[$BLOCK_LABEL_KEY]} {if $BLOCK eq null or $FIELD_MODEL_LIST|@count lte 0}{continue}{/if} @@ -132,7 +132,7 @@ {/if} {/foreach} {* adding additional column for odd number of fields in a block *} - {if $FIELD_MODEL_LIST|@end eq true and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} + {if $smarty.foreach.DetailViewBlockViewLoop.last and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} <td class="fieldLabel {$WIDTHTYPE}"></td><td class="{$WIDTHTYPE}"></td> {/if} </tr> @@ -143,4 +143,4 @@ <br> {/if} {/foreach} -{/strip} \ No newline at end of file +{/strip} diff --git a/layouts/v7/modules/Vtiger/DetailViewBlockView.tpl b/layouts/v7/modules/Vtiger/DetailViewBlockView.tpl index 0d2e196fd19070e5349e265a38efbbd81947a85d..49729c4c152c19f03a2616e8e1cc2cd60ff7a50d 100644 --- a/layouts/v7/modules/Vtiger/DetailViewBlockView.tpl +++ b/layouts/v7/modules/Vtiger/DetailViewBlockView.tpl @@ -12,7 +12,7 @@ <input type="hidden" name="picklistDependency" value='{Vtiger_Util_Helper::toSafeHTML($PICKIST_DEPENDENCY_DATASOURCE)}' /> {/if} - {foreach key=BLOCK_LABEL_KEY item=FIELD_MODEL_LIST from=$RECORD_STRUCTURE} + {foreach key=BLOCK_LABEL_KEY item=FIELD_MODEL_LIST from=$RECORD_STRUCTURE name=DetailViewBlockViewLoop} {assign var=BLOCK value=$BLOCK_LIST[$BLOCK_LABEL_KEY]} {if $BLOCK eq null or $FIELD_MODEL_LIST|@count lte 0}{continue}{/if} <div class="block block_{$BLOCK_LABEL_KEY}" data-block="{$BLOCK_LABEL_KEY}" data-blockid="{$BLOCK_LIST[$BLOCK_LABEL_KEY]->get('id')}"> @@ -130,7 +130,7 @@ {/if} {/foreach} {* adding additional column for odd number of fields in a block *} - {if $FIELD_MODEL_LIST|@end eq true and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} + {if $smarty.foreach.DetailViewBlockViewLoop.last and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} <td class="fieldLabel {$WIDTHTYPE}"></td><td class="{$WIDTHTYPE}"></td> {/if} </tr> @@ -140,4 +140,4 @@ </div> <br> {/foreach} -{/strip} \ No newline at end of file +{/strip} diff --git a/layouts/v7/modules/Vtiger/ListViewActions.tpl b/layouts/v7/modules/Vtiger/ListViewActions.tpl index 3dc128c91b0ee8954f90e1567d9117eb5cfd269f..17a4d2330aae7ac915b01bad2197ff28725f5002 100644 --- a/layouts/v7/modules/Vtiger/ListViewActions.tpl +++ b/layouts/v7/modules/Vtiger/ListViewActions.tpl @@ -39,7 +39,7 @@ <i class="fa fa-trash"></i> </button> {/if} - {if $commentAction} + {if isset($commentAction)} <button type="button" class="btn btn-default" id="{$MODULE}_listView_massAction_{$commentAction->getLabel()}" onclick="Vtiger_List_Js.triggerMassAction('{$commentAction->getUrl()}')" title="{vtranslate('LBL_COMMENT', $MODULE)}" disabled="disabled"> <i class="fa fa-comment"></i> @@ -98,7 +98,7 @@ {if $PRINT_TEMPLATE} <li class="hide"><a id="{$MODULE}_listView_advancedAction_{Vtiger_Util_Helper::replaceSpaceWithUnderScores($PRINT_TEMPLATE->getLabel())}" {if stripos($PRINT_TEMPLATE->getUrl(), 'javascript:')===0} href="javascript:void(0);" onclick='{$PRINT_TEMPLATE->getUrl()|substr:strlen("javascript:")};'{else} href='{$PRINT_TEMPLATE->getUrl()}' {/if}>{vtranslate($PRINT_TEMPLATE->getLabel(), $MODULE)}</a></li> {/if} - {if $FIND_DUPLICATES_EXISTS} + {if isset($FIND_DUPLICATES_EXISTS)} <li class="hide"><a id="{$MODULE}_listView_advancedAction_MERGE_RECORD" href="javascript:void(0);" onclick='Vtiger_List_Js.triggerMergeRecord()'>{vtranslate('LBL_MERGE_SELECTED_RECORDS', $MODULE)}</a></li> {/if} {foreach item=LISTVIEW_ADVANCEDACTIONS from=$LISTVIEW_LINKS['LISTVIEW']} diff --git a/layouts/v7/modules/Vtiger/ListViewContents.tpl b/layouts/v7/modules/Vtiger/ListViewContents.tpl index dba24cbb1f69ad44baecbfa359326f4f2046d843..2cea24ff8c318058e8254e16e21c942cbedac575 100644 --- a/layouts/v7/modules/Vtiger/ListViewContents.tpl +++ b/layouts/v7/modules/Vtiger/ListViewContents.tpl @@ -11,6 +11,10 @@ {* START YOUR IMPLEMENTATION FROM BELOW. Use {debug} for information *} {include file="PicklistColorMap.tpl"|vtemplate_path:$MODULE} +{if !isset($SELECTED_MENU_CATEGORY)} + {assign var=SELECTED_MENU_CATEGORY value=""} +{/if} + <div class="col-sm-12 col-xs-12 "> {if $MODULE neq 'EmailTemplates' && $SEARCH_MODE_RESULTS neq true} {assign var=LEFTPANELHIDE value=$CURRENT_USER_MODEL->get('leftpanelhide')} diff --git a/layouts/v7/modules/Vtiger/uitypes/String.tpl b/layouts/v7/modules/Vtiger/uitypes/String.tpl index 9ec1f6bea6865e942c03a9f0b8f7f2d158dac0b3..f5facd92be175a7245a05dea9a610297c5de44a3 100644 --- a/layouts/v7/modules/Vtiger/uitypes/String.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/String.tpl @@ -13,7 +13,7 @@ {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()} {assign var="SPECIAL_VALIDATOR" value=$FIELD_MODEL->getValidator()} - {if (!$FIELD_NAME)} + {if !isset($FIELD_NAME)} {assign var="FIELD_NAME" value=$FIELD_MODEL->getFieldName()} {/if} <input id="{$MODULE}_editView_fieldName_{$FIELD_NAME}" type="text" data-fieldname="{$FIELD_NAME}" data-fieldtype="string" class="inputElement {if $FIELD_MODEL->isNameField()}nameField{/if}" name="{$FIELD_NAME}" value="{decode_html($FIELD_MODEL->get('fieldvalue'))|php7_htmlentities}" diff --git a/layouts/v7/modules/Vtiger/uitypes/Text.tpl b/layouts/v7/modules/Vtiger/uitypes/Text.tpl index 9e051d16228add86bde4eacaccd1b17588bd6884..63ce500cf0980aaf1bbe61a6ba68f32141c1ab4c 100644 --- a/layouts/v7/modules/Vtiger/uitypes/Text.tpl +++ b/layouts/v7/modules/Vtiger/uitypes/Text.tpl @@ -12,7 +12,7 @@ {strip} {assign var="FIELD_INFO" value=$FIELD_MODEL->getFieldInfo()} {assign var="SPECIAL_VALIDATOR" value=$FIELD_MODEL->getValidator()} -{if (!$FIELD_NAME)} +{if !isset($FIELD_NAME)} {assign var="FIELD_NAME" value=$FIELD_MODEL->getFieldName()} {/if} {if $FIELD_MODEL->get('uitype') eq '19' || $FIELD_MODEL->get('uitype') eq '20'} diff --git a/layouts/vlayout/modules/Inventory/EditViewBlocks.tpl b/layouts/vlayout/modules/Inventory/EditViewBlocks.tpl index bef3651d3566f3688f311aedc5839111745a0535..d33d3f37534a05d695c8bca7499b2e3b01426df6 100644 --- a/layouts/vlayout/modules/Inventory/EditViewBlocks.tpl +++ b/layouts/vlayout/modules/Inventory/EditViewBlocks.tpl @@ -170,11 +170,11 @@ {/if} {/foreach} {* adding additional column for odd number of fields in a block *} - {if $BLOCK_FIELDS|@end eq true and $BLOCK_FIELDS|@count neq 1 and $COUNTER eq 1} + {if $smarty.foreach.EditViewBlockLevelLoop.last and $BLOCK_FIELDS|@count neq 1 and $COUNTER eq 1} <td class="fieldLabel {$WIDTHTYPE}"></td><td class="{$WIDTHTYPE}"></td> {/if} </tr> </table> <br> {/foreach} -{/strip} \ No newline at end of file +{/strip} diff --git a/layouts/vlayout/modules/Vtiger/DetailViewBlockView.tpl b/layouts/vlayout/modules/Vtiger/DetailViewBlockView.tpl index 7171a71aa949efa10b9f0720def30bd05ddfb1ac..313db2a9d654f87077e5c0b45aa4cb808070fe0a 100644 --- a/layouts/vlayout/modules/Vtiger/DetailViewBlockView.tpl +++ b/layouts/vlayout/modules/Vtiger/DetailViewBlockView.tpl @@ -29,7 +29,7 @@ <tbody {if $IS_HIDDEN} class="hide" {/if}> {assign var=COUNTER value=0} <tr> - {foreach item=FIELD_MODEL key=FIELD_NAME from=$FIELD_MODEL_LIST} + {foreach item=FIELD_MODEL key=FIELD_NAME from=$FIELD_MODEL_LIST name=DetailViewBlockViewLoop} {if !$FIELD_MODEL->isViewableInDetailView()} {continue} {/if} @@ -113,7 +113,7 @@ {/if} {/foreach} {* adding additional column for odd number of fields in a block *} - {if $FIELD_MODEL_LIST|@end eq true and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} + {if $smarty.foreach.DetailViewBlockViewLoop.last and $FIELD_MODEL_LIST|@count neq 1 and $COUNTER eq 1} <td class="fieldLabel {$WIDTHTYPE}"></td><td class="{$WIDTHTYPE}"></td> {/if} </tr> @@ -121,4 +121,4 @@ </table> <br> {/foreach} -{/strip} \ No newline at end of file +{/strip} diff --git a/layouts/vlayout/modules/Vtiger/EditViewBlocks.tpl b/layouts/vlayout/modules/Vtiger/EditViewBlocks.tpl index 1bbaf482a8a701afdeb6e071cc96733d3021faae..f1f46237dca5ed9cbfc97159e3a4180a0bfdd419 100644 --- a/layouts/vlayout/modules/Vtiger/EditViewBlocks.tpl +++ b/layouts/vlayout/modules/Vtiger/EditViewBlocks.tpl @@ -125,7 +125,7 @@ {/if} {/foreach} {* adding additional column for odd number of fields in a block *} - {if $BLOCK_FIELDS|@end eq true and $BLOCK_FIELDS|@count neq 1 and $COUNTER eq 1} + {if $smarty.foreach.EditViewBlockLevelLoop.last and $BLOCK_FIELDS|@count neq 1 and $COUNTER eq 1} <td class="fieldLabel {$WIDTHTYPE}"></td><td class="{$WIDTHTYPE}"></td> {/if} </tr> @@ -133,4 +133,4 @@ </table> <br> {/foreach} -{/strip} \ No newline at end of file +{/strip} diff --git a/modules/Documents/Documents.php b/modules/Documents/Documents.php index d5ddd791404caaca700feaaa58c2249c27cd04b3..b34a3fd32daf0032af78d0d23e6a817d00d12ca9 100644 --- a/modules/Documents/Documents.php +++ b/modules/Documents/Documents.php @@ -95,8 +95,10 @@ class Documents extends CRMEntity { } $filetype_fieldname = $this->getFileTypeFieldName(); $filename_fieldname = $this->getFile_FieldName(); + $filedownloadcount = null; + $filename = null; if($this->column_fields[$filetype_fieldname] == 'I' ){ - if($_FILES[$filename_fieldname]['name'] != ''){ + if(isset($_FILES[$filename_fieldname]) && $_FILES[$filename_fieldname]['name'] != ''){ $errCode=$_FILES[$filename_fieldname]['error']; if($errCode == 0){ foreach($_FILES as $fileindex => $files) @@ -178,7 +180,7 @@ class Documents extends CRMEntity { foreach($_FILES as $fileindex => $files) { - if($files['name'] != '' && $files['size'] > 0) + if($files['name'] != '' && $files['size'] > 0 && isset($_REQUEST[$fileindex.'_hidden'])) { $files['original_name'] = vtlib_purify($_REQUEST[$fileindex.'_hidden']); $file_saved = $this->uploadAndSaveFile($id,$module,$files); @@ -585,4 +587,4 @@ class Documents extends CRMEntity { return $return_value; } } -?> \ No newline at end of file +?> diff --git a/modules/Documents/models/Record.php b/modules/Documents/models/Record.php index 58080280cce843502823b933b21cac4f1c6d32af..411f134379320942a793089b9f99d733d4593303 100644 --- a/modules/Documents/models/Record.php +++ b/modules/Documents/models/Record.php @@ -21,6 +21,7 @@ class Documents_Record_Model extends Vtiger_Record_Model { function getDownloadFileURL($attachmentId = false) { if ($this->get('filelocationtype') == 'I') { $fileDetails = $this->getFileDetails(); + if (!isset($fileDetails['attachmentsid'])) $fileDetails['attachmentsid'] = ''; return 'index.php?module='. $this->getModuleName() .'&action=DownloadFile&record='. $this->getId() .'&fileid='. $fileDetails['attachmentsid']; } else { return $this->get('filename'); @@ -133,4 +134,4 @@ class Documents_Record_Model extends Vtiger_Record_Model { return $value; } -} \ No newline at end of file +} diff --git a/modules/Documents/views/List.php b/modules/Documents/views/List.php index d61c444ee23808f6ca306a63326b7e21f4c432fa..ea7387a26f041a08c4089e5c84a0b951c238612a 100644 --- a/modules/Documents/views/List.php +++ b/modules/Documents/views/List.php @@ -93,7 +93,7 @@ class Documents_List_View extends Vtiger_List_View { $orderBy = ''; $sortOrder = ''; } - if(empty($listHeaders)) { + if(empty($listHeaders) && $orderParams && isset($orderParams['list_headers'])) { $listHeaders = $orderParams['list_headers']; } if(empty($orderBy) && empty($searchValue) && empty($pageNumber)) { @@ -233,16 +233,16 @@ class Documents_List_View extends Vtiger_List_View { } $viewer->assign('PAGE_NUMBER',$pageNumber); - if(!$this->moduleFieldStructure) { + if(!isset($this->moduleFieldStructure)) { $recordStructure = Vtiger_RecordStructure_Model::getInstanceForModule($listViewModel->getModule(), Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_FILTER); $this->moduleFieldStructure = $recordStructure->getStructure(); } $currentUser = Users_Record_Model::getCurrentUserModel(); - if(!$this->tags) { + if(!isset($this->tags)) { $this->tags = Vtiger_Tag_Model::getAllAccessible($currentUser->id, $moduleName); } - if(!$this->allUserTags) { + if(!isset($this->allUserTags)) { $this->allUserTags = Vtiger_Tag_Model::getAllUserTags($currentUser->getId()); } diff --git a/modules/Documents/views/QuickCreateAjax.php b/modules/Documents/views/QuickCreateAjax.php index 856e0c5458f0c68930c47b3233753171376d49c8..b2f0f81fceb7c8cb19ef68f43108eb7ce72b9204 100644 --- a/modules/Documents/views/QuickCreateAjax.php +++ b/modules/Documents/views/QuickCreateAjax.php @@ -81,7 +81,7 @@ class Documents_QuickCreateAjax_View extends Vtiger_IndexAjax_View { $viewer->assign('RELATION_OPERATOR', $relationOperation); $viewer->assign('PARENT_MODULE', $request->get('sourceModule')); $viewer->assign('PARENT_ID', $request->get('sourceRecord')); - if ($relationFieldName) { + if (isset($relationFieldName)) { $viewer->assign('RELATION_FIELD_NAME', $relationFieldName); } } @@ -118,4 +118,4 @@ class Documents_QuickCreateAjax_View extends Vtiger_IndexAjax_View { return $jsScriptInstances; } -} \ No newline at end of file +} diff --git a/modules/Settings/Vtiger/models/Module.php b/modules/Settings/Vtiger/models/Module.php index aa26e3527f8c1eed34b0cfce5a8fbc43200c5b69..4a9f38848cee583f5d7351c8daeebfb261f416cb 100644 --- a/modules/Settings/Vtiger/models/Module.php +++ b/modules/Settings/Vtiger/models/Module.php @@ -18,6 +18,7 @@ class Settings_Vtiger_Module_Model extends Vtiger_Base_Model { var $listFields = array('name' => 'Name', 'description' => 'Description'); var $nameFields = array('name'); var $name = 'Vtiger'; + var $listFieldModels = null; public function getName($includeParentIfExists = false) { if($includeParentIfExists) { @@ -105,7 +106,7 @@ class Settings_Vtiger_Module_Model extends Vtiger_Base_Model { * @return Settings_Vtiger_Module_Model instance */ public static function getInstance() { - list($name) = func_get_args(); + list($name) = func_num_args() > 0 ? func_get_args() : ""; if(empty($name)){ $name='Settings:Vtiger'; } @@ -155,7 +156,7 @@ class Settings_Vtiger_Module_Model extends Vtiger_Base_Model { $qualifiedModuleName = $request->getModule(false); $arrayParams = array(); - $whereCondition .= "linkto LIKE ? "; + $whereCondition = "linkto LIKE ? "; $arrayParams[] = "%$moduleName%"; if ($moduleName != 'LanguageEditor') { $whereCondition .= "AND (linkto LIKE '%parent=Settings%' OR linkto LIKE '%parenttab=Settings%')"; diff --git a/modules/Settings/Vtiger/views/List.php b/modules/Settings/Vtiger/views/List.php index b4a265c199dc41e7a9baa6cb46bffad45ccedea3..13857c5dd041a4b84c90fb91aafcda41406530c2 100644 --- a/modules/Settings/Vtiger/views/List.php +++ b/modules/Settings/Vtiger/views/List.php @@ -12,6 +12,8 @@ class Settings_Vtiger_List_View extends Settings_Vtiger_Index_View { protected $listViewEntries = false; protected $listViewHeaders = false; protected $listviewinitcalled = false; + protected $listViewLinks = array(); + protected $pagingModel = null; function __construct() { parent::__construct(); diff --git a/modules/Users/models/Record.php b/modules/Users/models/Record.php index 035e2b4990be62507b3a31fb8de01ca99ddab0d5..0308b1739a918d5a593258f7bbb8d6d00286177f 100644 --- a/modules/Users/models/Record.php +++ b/modules/Users/models/Record.php @@ -732,7 +732,8 @@ class Users_Record_Model extends Vtiger_Record_Model { public function isAccountOwner() { $db = PearDatabase::getInstance(); $query = 'SELECT is_owner FROM vtiger_users WHERE id = ?'; - $isOwner = $db->query_result($db->pquery($query, array($this->getId())), 0, 'is_owner'); + $rs = $db->pquery($query, array($this->getId())); + $isOwner = $db->query_result($rs, 0, 'is_owner'); if($isOwner == 1) { return true; } diff --git a/modules/Vtiger/helpers/Util.php b/modules/Vtiger/helpers/Util.php index f793b582a8da26151e4f1b4b239943921d711d4d..57b862f53c3b65675e6382bbfe7a857feb3a63de 100644 --- a/modules/Vtiger/helpers/Util.php +++ b/modules/Vtiger/helpers/Util.php @@ -105,7 +105,7 @@ class Vtiger_Util_Helper { */ public static function toSafeHTML($input) { global $default_charset; - return htmlentities($input, ENT_QUOTES, $default_charset); + return $input ? htmlentities($input, ENT_QUOTES, $default_charset) : $input; } /** diff --git a/modules/Vtiger/models/Field.php b/modules/Vtiger/models/Field.php index 82ad26d1e102e377bca183a337cd505c4fcf936f..ab3a9af5209ae83018d225a9c80ed475970ea2c1 100644 --- a/modules/Vtiger/models/Field.php +++ b/modules/Vtiger/models/Field.php @@ -1347,7 +1347,7 @@ class Vtiger_Field_Model extends Vtiger_Field { } public function hasDefaultValue() { - return ($this->defaultvalue !== null && trim($this->defaultvalue) === '') ? false : true; + return !$this->defaultvalue || trim($this->defaultvalue) == '' ? false : true; } public function isActiveField() { diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index f9c137232aff0a435e0a5b71c50f9f910fed95e8..dde52a193ee31cf3754fe4e3bc8a4335bab7d972 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -1691,6 +1691,7 @@ class Vtiger_Functions { $result = $adb->pquery($query, array($crmid)); $noofrows = $adb->num_rows($result); if ($noofrows) { + $attachmentIds = array(); for ($i = 0; $i < $noofrows; $i++) { $attachmentIds[] = vtws_getId($WsEntityId,$adb->query_result($result, $i, 'attachmentsid')); } @@ -1715,6 +1716,9 @@ class Vtiger_Functions { * if mark will be true, then we are keeping the strip details in the $markers variable */ public static function strip_base64_data ($input, $mark = false, &$markers = null) { + if (!$input) { + return $input; + } if ($markers === null) { $markers = array(); } @@ -1789,6 +1793,9 @@ class Vtiger_Functions { * if mark will be true, then we are keeping the strip details in the $markers variable */ public static function stripInlineOffice365Image ($input, $mark = false, &$markers = null) { + if (!$input) { + return $input; + } if ($markers === null) { $markers = array(); }