diff --git a/include/Webservices/Create.php b/include/Webservices/Create.php index 394ddf7d304a308ef27dca76c7306d7582c9916c..6c12d905ac5bf52b51fd3b18b0dddb5090bcd11e 100644 --- a/include/Webservices/Create.php +++ b/include/Webservices/Create.php @@ -33,7 +33,7 @@ function vtws_create($elementType, $element, $user) { $handler = new $handlerClass($webserviceObject, $user, $adb, $log); $meta = $handler->getMeta(); - if ($meta->hasWriteAccess() !== true) { + if ($meta->hasCreateAccess() !== true) { throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied"); } diff --git a/include/Webservices/EntityMeta.php b/include/Webservices/EntityMeta.php index ee1af29498212e3abc149521c9d69ec12b3ab56d..68845eafb8dd3fc378c9b24f9866f555817cd5e2 100644 --- a/include/Webservices/EntityMeta.php +++ b/include/Webservices/EntityMeta.php @@ -259,6 +259,7 @@ abstract class EntityMeta{ abstract function hasDeleteAccess(); abstract function hasAccess(); abstract function hasReadAccess(); + abstract function hasCreateAccess(); abstract function hasWriteAccess(); abstract function getEntityName(); abstract function getEntityId(); diff --git a/include/Webservices/VtigerActorOperation.php b/include/Webservices/VtigerActorOperation.php index 8099d3c3bcd4b28b7d33af90e49b14b047e22014..6b26288df78cc051439f65722f146535a33f903d 100644 --- a/include/Webservices/VtigerActorOperation.php +++ b/include/Webservices/VtigerActorOperation.php @@ -245,7 +245,7 @@ class VtigerActorOperation extends WebserviceEntityOperation { $app_strings = VTWS_PreserveGlobal::getGlobal('app_strings'); $current_user = vtws_preserveGlobal('current_user',$this->user);; $label = (isset($app_strings[$elementType]))? $app_strings[$elementType]:$elementType; - $createable = $this->meta->hasWriteAccess(); + $createable = $this->meta->hasCreateAccess(); $updateable = $this->meta->hasWriteAccess(); $deleteable = $this->meta->hasDeleteAccess(); $retrieveable = $this->meta->hasReadAccess(); diff --git a/include/Webservices/VtigerCRMActorMeta.php b/include/Webservices/VtigerCRMActorMeta.php index f36c5513e7a5db545be5247aa3147ad4c057afa8..cab7a7c92adce777c40efba01214b59b86b266f6 100644 --- a/include/Webservices/VtigerCRMActorMeta.php +++ b/include/Webservices/VtigerCRMActorMeta.php @@ -241,7 +241,15 @@ class VtigerCRMActorMeta extends EntityMeta { public function hasReadAccess(){ return true; } - + + public function hasCreateAccess() { + if (is_admin($this->user)) { + return true; + } else { + return false; + } + } + public function hasWriteAccess(){ if(is_admin($this->user)){ return true; diff --git a/include/Webservices/VtigerCRMObjectMeta.php b/include/Webservices/VtigerCRMObjectMeta.php index 46d70feb5448fd7bd7d7d706c38e59acf30dc177..19ee9e0da2ebbf17cf630b1604cd79f86a48ac71 100644 --- a/include/Webservices/VtigerCRMObjectMeta.php +++ b/include/Webservices/VtigerCRMObjectMeta.php @@ -16,7 +16,8 @@ class VtigerCRMObjectMeta extends EntityMeta { private $assign; private $hasAccess; private $hasReadAccess; - private $hasWriteAccess; + private $hasCreateAccess; + private $hasWriteAccess;//Edit Access private $hasDeleteAccess; private $assignUsers; @@ -34,6 +35,7 @@ class VtigerCRMObjectMeta extends EntityMeta { $this->moduleFields = array(); $this->hasAccess = false; $this->hasReadAccess = false; + $this->hasCreateAccess = false; $this->hasWriteAccess = false; $this->hasDeleteAccess = false; $instance = vtws_getModuleInstance($this->webserviceObject); @@ -84,6 +86,7 @@ class VtigerCRMObjectMeta extends EntityMeta { if($active == false){ $this->hasAccess = false; $this->hasReadAccess = false; + $this->hasCreateAccess = false; $this->hasWriteAccess = false; $this->hasDeleteAccess = false; return; @@ -93,6 +96,7 @@ class VtigerCRMObjectMeta extends EntityMeta { if($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0){ $this->hasAccess = true; $this->hasReadAccess = true; + $this->hasCreateAccess = true; $this->hasWriteAccess = true; $this->hasDeleteAccess = true; }else{ @@ -113,6 +117,7 @@ class VtigerCRMObjectMeta extends EntityMeta { if($permission != 1 || $permission != "1"){ $this->hasAccess = true; if($globalactionid == 2 || $globalactionid == "2"){ + $this->hasCreateAccess = true; $this->hasWriteAccess = true; $this->hasDeleteAccess = true; }else{ @@ -158,11 +163,14 @@ class VtigerCRMObjectMeta extends EntityMeta { $this->hasDeleteAccess = true; }else if($operation == 4 || $operation == "4"){ $this->hasReadAccess = true; + }else if($operation == 7 || $operation == "7"){ + $this->hasCreateAccess = true; } } } if(!$standardDefined){ $this->hasReadAccess = true; + $this->hasCreateAccess = true; $this->hasWriteAccess = true; $this->hasDeleteAccess = true; } @@ -183,7 +191,14 @@ class VtigerCRMObjectMeta extends EntityMeta { } return $this->hasWriteAccess; } - + + function hasCreateAccess() { + if(!$this->meta) { + $this->retrieveMeta(); + } + return $this->hasCreateAccess; + } + function hasReadAccess(){ if(!$this->meta){ $this->retrieveMeta(); diff --git a/languages/en_us/Settings/Profiles.php b/languages/en_us/Settings/Profiles.php index f0e9de05228bf45d99b29726ef1e02d7b2db8eae..26c394bf2c730afb2a1c8ec0593d5791a1a49ac2 100644 --- a/languages/en_us/Settings/Profiles.php +++ b/languages/en_us/Settings/Profiles.php @@ -17,10 +17,11 @@ $languageStrings = array( 'LBL_DESCRIPTION' => 'Description', 'LBL_DUPLICATE_RECORD' => 'Duplicate', 'LBL_DUPLICATES_EXIST' => 'Duplicate Profile Exists', - 'LBL_EDIT_ALL_DESC' => 'Can edit all the module\'s information', - 'LBL_EDIT_ALL' => 'Edit All', + 'LBL_EDIT_ALL_DESC' => 'Can edit all the module\'s information', + 'LBL_EDIT_ALL' => 'Edit All', 'LBL_EDIT_PRIVILIGES_FOR_THIS_PROFILE' => 'Edit privileges for this profile', - 'LBL_EDIT_PRVILIGE' => 'Create/Edit', + 'LBL_CREATE_PRVILIGE' => 'Create', + 'LBL_EDIT_PRVILIGE' => 'Edit', 'LBL_EDIT_RECORD' => 'Edit', 'LBL_FIELD_AND_TOOL_PRVILIGES' => 'Field and Tool Privileges', 'LBL_FIELDS' => 'Fields', @@ -32,25 +33,25 @@ $languageStrings = array( 'LBL_READ_ONLY' => 'Read only', 'LBL_TOOLS' => 'Tools', 'LBL_TRANSFER_ROLES_TO_PROFILE' => 'Transfer roles to profile', - 'LBL_VIEW_ALL_DESC' => 'Can view all the module\'s information', - 'LBL_VIEW_ALL' => 'View All', + 'LBL_VIEW_ALL_DESC' => 'Can view all the module\'s information', + 'LBL_VIEW_ALL' => 'View All', 'LBL_VIEW_PRVILIGE' => 'View', 'LBL_WRITE' => 'Write', 'Profiles' => 'Profiles', 'SINGLE_Profiles' => 'Profile', - - 'Import' => 'Import', - 'Export' => 'Export', + + 'Import' => 'Import', + 'Export' => 'Export', 'Merge' => 'Merge', - 'ConvertLead' => 'Convert Lead', - 'DuplicatesHandling' => 'Duplicates Handling', - 'ReceiveIncomingCalls' => 'Receive Incoming Calls', - 'MakeOutgoingCalls' => 'Make Outgoing Calls', - 'Print' => 'Print', - - //Patch provided by http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7884 - //Field names - 'Name' => 'Profile Name', + 'ConvertLead' => 'Convert Lead', + 'DuplicatesHandling' => 'Duplicates Handling', + 'ReceiveIncomingCalls' => 'Receive Incoming Calls', + 'MakeOutgoingCalls' => 'Make Outgoing Calls', + 'Print' => 'Print', + + //Patch provided by http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7884 + //Field names + 'Name' => 'Profile Name', ); $jsLanguageStrings = array( diff --git a/layouts/vlayout/modules/Calendar/CalendarViewPreProcess.tpl b/layouts/vlayout/modules/Calendar/CalendarViewPreProcess.tpl index 490bb8d60737452abea057b3834c21dfcdb7d1ed..a54007762a5b712e80151a9cf90a374a3452410e 100644 --- a/layouts/vlayout/modules/Calendar/CalendarViewPreProcess.tpl +++ b/layouts/vlayout/modules/Calendar/CalendarViewPreProcess.tpl @@ -18,5 +18,8 @@ <div class="span2 row-fluid"> {include file="SideBar.tpl"|vtemplate_path:$MODULE_NAME} </div> + <input type="hidden" class="isRecordCreatable" value="{$IS_RECORD_CREATABLE}"> + <input type="hidden" class="isModuleEditable" value="{$IS_MODULE_EDITABLE}"> + <input type="hidden" class="isModuleDeletable" value="{$IS_MODULE_DELETABLE}"> <div class="contentsDiv span10 marginLeftZero"> {/strip} \ No newline at end of file diff --git a/layouts/vlayout/modules/Calendar/ListViewContents.tpl b/layouts/vlayout/modules/Calendar/ListViewContents.tpl index bed13072c90aad3d492b0143ce5aa35b93fcf343..9f2c3d350bfe28b360c086a0c7526be17f7f806f 100755 --- a/layouts/vlayout/modules/Calendar/ListViewContents.tpl +++ b/layouts/vlayout/modules/Calendar/ListViewContents.tpl @@ -159,7 +159,7 @@ <tr> <td> {assign var=SINGLE_MODULE value="SINGLE_$MODULE"} - {vtranslate('LBL_EQ_ZERO')} {vtranslate($MODULE, $MODULE)} {vtranslate('LBL_FOUND')}.{if $IS_MODULE_EDITABLE} {vtranslate('LBL_CREATE')} <a href="{$MODULE_MODEL->getCreateRecordUrl()}">{vtranslate($SINGLE_MODULE, $MODULE)}</a>{/if} + {vtranslate('LBL_EQ_ZERO')} {vtranslate($MODULE, $MODULE)} {vtranslate('LBL_FOUND')}.{if $IS_RECORD_CREATABLE} {vtranslate('LBL_CREATE')} <a href="{$MODULE_MODEL->getCreateRecordUrl()}">{vtranslate($SINGLE_MODULE, $MODULE)}</a>{/if} </td> </tr> </tbody> diff --git a/layouts/vlayout/modules/Calendar/resources/CalendarView.js b/layouts/vlayout/modules/Calendar/resources/CalendarView.js index 5ef342d316c923d1dda94258eeacae3f6ce77f40..276b3cd3ac7deb932ab81758841c1f1893e7fb8b 100644 --- a/layouts/vlayout/modules/Calendar/resources/CalendarView.js +++ b/layouts/vlayout/modules/Calendar/resources/CalendarView.js @@ -62,17 +62,20 @@ jQuery.Class("Calendar_CalendarView_Js",{ aDeferred.resolve(this.calendarCreateView.clone(true,true)); return aDeferred.promise(); } - var progressInstance = jQuery.progressIndicator(); - this.loadCalendarCreateView().then( - function(data){ - progressInstance.hide(); - thisInstance.calendarCreateView = data; - aDeferred.resolve(data.clone(true,true)); - }, - function(){ - progressInstance.hide(); - } - ); + + if (jQuery('.isRecordCreatable').val()) { + var progressInstance = jQuery.progressIndicator(); + this.loadCalendarCreateView().then( + function(data){ + progressInstance.hide(); + thisInstance.calendarCreateView = data; + aDeferred.resolve(data.clone(true,true)); + }, + function(){ + progressInstance.hide(); + } + ); + } return aDeferred.promise(); }, @@ -501,15 +504,17 @@ jQuery.Class("Calendar_CalendarView_Js",{ var targetElement = jQuery(this).find('.fc-event-time'); var trashElement = jQuery(this).find('a.delete'); if(!trashElement.length) { - if(!targetElement.length) { - targetElement = jQuery(this).find('.fc-event-title'); - targetElement.append('<a class="delete" style="position:absolute;right:1px;" href="javascript:void(0)"><i class="icon-trash icon-white"></i></a>'); - } - else { - if(view.name == 'month') targetElement = jQuery(this).find('.fc-event-inner'); - targetElement.append('<a class="delete" style="position:absolute;right:1px;" href="javascript:void(0)"><i class="icon-trash icon-white"></i></a>'); - } - thisInstance.registerEventDelete(targetElement,calEvent); + if (jQuery('.isModuleDeletable').val()) { + if(!targetElement.length) { + targetElement = jQuery(this).find('.fc-event-title'); + targetElement.append('<a class="delete" style="position:absolute;right:1px;" href="javascript:void(0)"><i class="icon-trash icon-white"></i></a>'); + } + else { + if(view.name == 'month') targetElement = jQuery(this).find('.fc-event-inner'); + targetElement.append('<a class="delete" style="position:absolute;right:1px;" href="javascript:void(0)"><i class="icon-trash icon-white"></i></a>'); + } + thisInstance.registerEventDelete(targetElement,calEvent); + } } else { trashElement.removeClass('hide'); @@ -521,22 +526,29 @@ jQuery.Class("Calendar_CalendarView_Js",{ jQuery(this).find('.delete').addClass('hide'); } } + + if (!jQuery('.isModuleEditable').val()) { + config['editable'] = false; + } + if(typeof customConfig != 'undefined'){ config = jQuery.extend(config,customConfig); } calendarview.fullCalendar(config); - //To create custom button to create event or task - jQuery('<span class="pull-left"><button class="btn addButton">'+ app.vtranslate('LBL_ADD_EVENT_TASK') +'</button></span>') - .prependTo(calendarview.find('.fc-header .fc-header-right')).on('click', 'button', function(e){ - thisInstance.getCalendarCreateView().then(function(data){ - var headerInstance = new Vtiger_Header_Js(); - headerInstance.handleQuickCreateData(data,{callbackFunction:function(data){ - thisInstance.addCalendarEvent(data.result); - }}); - }); + if (jQuery('.isRecordCreatable').val()) { + //To create custom button to create event or task + jQuery('<span class="pull-left"><button class="btn addButton">'+ app.vtranslate('LBL_ADD_EVENT_TASK') +'</button></span>') + .prependTo(calendarview.find('.fc-header .fc-header-right')).on('click', 'button', function(e){ + thisInstance.getCalendarCreateView().then(function(data){ + var headerInstance = new Vtiger_Header_Js(); + headerInstance.handleQuickCreateData(data,{callbackFunction:function(data){ + thisInstance.addCalendarEvent(data.result); + }}); + }); - }) + }) + } jQuery('<span class="pull-right marginLeft5px"><button class="btn"><i id="calendarSettings" class="icon-cog"></i></button></span>') .prependTo(calendarview.find('.fc-header .fc-header-right')).on('click', 'button', function(e){ var params = { diff --git a/layouts/vlayout/modules/Settings/Profiles/DetailView.tpl b/layouts/vlayout/modules/Settings/Profiles/DetailView.tpl index e5799f0b939ce617f908c5c8823e76a7f6c399d2..8f2fa3a0f93654a03b8646a715f8d8b6135df74a 100644 --- a/layouts/vlayout/modules/Settings/Profiles/DetailView.tpl +++ b/layouts/vlayout/modules/Settings/Profiles/DetailView.tpl @@ -58,22 +58,19 @@ <th width="27%" style="border-left: 1px solid #DDD !important;"> {vtranslate('LBL_MODULES', $QUALIFIED_MODULE)} </th> - <th width="11%" style="border-left: 1px solid #DDD !important;"> - <span class="horizontalAlignCenter"> - - {'LBL_VIEW_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} - </span> + <th width="12%" style="border-left: 1px solid #DDD !important; text-align: center;"> + <span>{'LBL_VIEW_PRVILIGE'|vtranslate:$QUALIFIED_MODULE}</span> </th> - <th width="12%" style="border-left: 1px solid #DDD !important;"> - <span class="horizontalAlignCenter" > - - {'LBL_EDIT_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} - </span> + <th width="12%" style="border-left: 1px solid #DDD !important; text-align: center;"> + <span>{'LBL_CREATE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE}</span> + </th> + <th width="12%" style="border-left: 1px solid #DDD !important; text-align: center;"> + <span>{'LBL_EDIT_PRVILIGE'|vtranslate:$QUALIFIED_MODULE}</span> </th> - <th width="11%" style="border-left: 1px solid #DDD !important;"> - <span class="horizontalAlignCenter" >{'LBL_DELETE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE}</span> + <th width="12%" style="border-left: 1px solid #DDD !important; text-align: center;"> + <span>{'LBL_DELETE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE}</span> </th> - <th width="39%" style="border-left: 1px solid #DDD !important;" nowrap="nowrap">{'LBL_FIELD_AND_TOOL_PRVILIGES'|vtranslate:$QUALIFIED_MODULE}</th> + <th width="12%" style="border-left: 1px solid #DDD !important; text-align: center;" nowrap="nowrap">{'LBL_FIELD_AND_TOOL_PRVILIGES'|vtranslate:$QUALIFIED_MODULE}</th> </tr> </thead> <tbody> @@ -83,12 +80,12 @@ <td> <img src="{if $RECORD_MODEL->hasModulePermission($PROFILE_MODULE)}{$ENABLE_IMAGE_PATH}{else}{$DISABLE_IMAGE_PATH}{/if}" class="alignMiddle" /> {$PROFILE_MODULE->get('label')|vtranslate:$PROFILE_MODULE->getName()} </td> - {assign var="BASIC_ACTION_ORDER" value=array(2,0,1)} + {assign var="BASIC_ACTION_ORDER" value=array(2,3,0,1)} {foreach from=$BASIC_ACTION_ORDER item=ACTION_ID} - <td style="border-left: 1px solid #DDD !important;"> + <td style="border-left: 1px solid #DDD !important; text-align: center;"> {assign var="ACTION_MODEL" value=$ALL_BASIC_ACTIONS[$ACTION_ID]} {if !$IS_RESTRICTED_MODULE && $ACTION_MODEL->isModuleEnabled($PROFILE_MODULE)} - <img style="margin-left: 40%" class="alignMiddle" src="{if $RECORD_MODEL->hasModuleActionPermission($PROFILE_MODULE, $ACTION_MODEL)}{$ENABLE_IMAGE_PATH}{else}{$DISABLE_IMAGE_PATH}{/if}" /> + <img class="alignMiddle" src="{if $RECORD_MODEL->hasModuleActionPermission($PROFILE_MODULE, $ACTION_MODEL)}{$ENABLE_IMAGE_PATH}{else}{$DISABLE_IMAGE_PATH}{/if}" /> {/if} </td> {/foreach} diff --git a/layouts/vlayout/modules/Settings/Profiles/EditView.tpl b/layouts/vlayout/modules/Settings/Profiles/EditView.tpl index d814a90cabaec83c9dc4e1cee336832966e7422b..0057cf167f80712261f854a9eb7822e62a6ff3a4 100644 --- a/layouts/vlayout/modules/Settings/Profiles/EditView.tpl +++ b/layouts/vlayout/modules/Settings/Profiles/EditView.tpl @@ -40,7 +40,7 @@ <div class="summaryWidgetContainer"> <label class="checkbox"> <input type="hidden" name="viewall" value="0" /> - <input type="checkbox" name="viewall" {if $RECORD_MODEL->hasGlobalReadPermission()}checked="true"{/if} value="1" /> + <input type="checkbox" name="viewall" {if $RECORD_MODEL->hasGlobalReadPermission()}checked="true"{/if} value="1" /> {vtranslate('LBL_VIEW_ALL',$QUALIFIED_MODULE)} <span style="margin-left:25px"> <i class="icon-info-sign"></i> @@ -49,7 +49,7 @@ </label> <label class="checkbox"> <input type="hidden" name="editall" value="0" /> - <input type="checkbox" name="editall" {if $RECORD_MODEL->hasGlobalWritePermission()}checked="true"{/if} value="1"/> + <input type="checkbox" name="editall" {if $RECORD_MODEL->hasGlobalWritePermission()}checked="true"{/if} value="1"/> {vtranslate('LBL_EDIT_ALL',$QUALIFIED_MODULE)} <span style="margin-left:30px"> <i class="icon-info-sign"></i> @@ -70,6 +70,10 @@ <input {if empty($RECORD_ID) && empty($IS_DUPLICATE_RECORD)} class="alignTop" checked="true" {/if} type="checkbox" id="mainAction4CheckBox" /> {'LBL_VIEW_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} </th> + <th width="14%" style="border-left: 1px solid #DDD !important;"> + <input {if empty($RECORD_ID) && empty($IS_DUPLICATE_RECORD)} class="alignTop" checked="true"{/if} type="checkbox" id="mainAction7CheckBox" /> + {'LBL_CREATE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} + </th> <th width="14%" style="border-left: 1px solid #DDD !important;"> <input {if empty($RECORD_ID) && empty($IS_DUPLICATE_RECORD)} class="alignTop" checked="true"{/if} type="checkbox" id="mainAction1CheckBox" /> {'LBL_EDIT_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} @@ -78,7 +82,7 @@ <input checked="true" class="alignTop" type="checkbox" id="mainAction2CheckBox" /> {'LBL_DELETE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} </th> - <th width="28%" style="border-left: 1px solid #DDD !important;" nowrap="nowrap">{'LBL_FIELD_AND_TOOL_PRVILIGES'|vtranslate:$QUALIFIED_MODULE}</th> + <th width="14%" style="border-left: 1px solid #DDD !important;" nowrap="nowrap">{'LBL_FIELD_AND_TOOL_PRVILIGES'|vtranslate:$QUALIFIED_MODULE}</th> </tr> </thead> <tbody> @@ -91,7 +95,7 @@ <td> <input class="modulesCheckBox alignTop" type="checkbox" name="permissions[{$TABID}][is_permitted]" data-value="{$TABID}" data-module-state="" {if $RECORD_MODEL->hasModulePermission($PROFILE_MODULE)}checked="true"{else} data-module-unchecked="true" {/if}> {$PROFILE_MODULE->get('label')|vtranslate:$PROFILE_MODULE->getName()} </td> - {assign var="BASIC_ACTION_ORDER" value=array(2,0,1)} + {assign var="BASIC_ACTION_ORDER" value=array(2,3,0,1)} {foreach from=$BASIC_ACTION_ORDER item=ORDERID} <td style="border-left: 1px solid #DDD !important;"> {assign var="ACTION_MODEL" value=$ALL_BASIC_ACTIONS[$ORDERID]} diff --git a/layouts/vlayout/modules/Settings/Profiles/EditViewContents.tpl b/layouts/vlayout/modules/Settings/Profiles/EditViewContents.tpl index 5aca8602f3cbe64b39d435b857e08f9a6659529b..9f3fccb3895aadb6bfdd19903f09bf4d457f05d8 100644 --- a/layouts/vlayout/modules/Settings/Profiles/EditViewContents.tpl +++ b/layouts/vlayout/modules/Settings/Profiles/EditViewContents.tpl @@ -30,7 +30,7 @@ <div class="summaryWidgetContainer"> <label class="checkbox"> <input type="hidden" name="viewall" value="0" /> - <input type="checkbox" name="viewall" {if $RECORD_MODEL->hasGlobalReadPermission()}checked="true"{/if} /> + <input type="checkbox" name="viewall" {if $RECORD_MODEL->hasGlobalReadPermission()}checked="true"{/if} /> {vtranslate('LBL_VIEW_ALL',$QUALIFIED_MODULE)} <span style="margin-left:25px"> <i class="icon-info-sign"></i> @@ -39,7 +39,7 @@ </label> <label class="checkbox"> <input type="hidden" name="editall" value="0" /> - <input type="checkbox" name="editall" {if $RECORD_MODEL->hasGlobalWritePermission()}checked="true"{/if} /> + <input type="checkbox" name="editall" {if $RECORD_MODEL->hasGlobalWritePermission()}checked="true"{/if} /> {vtranslate('LBL_EDIT_ALL',$QUALIFIED_MODULE)} <span style="margin-left:30px"> <i class="icon-info-sign"></i> @@ -58,6 +58,10 @@ <input type="checkbox" {if !$RECORD_ID} class="alignTop" checked="true" {/if} id="mainAction4CheckBox" /> {'LBL_VIEW_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} </th> + <th width="14%" style="border-left: 1px solid #DDD !important;"> + <input {if empty($RECORD_ID) && empty($IS_DUPLICATE_RECORD)} class="alignTop" checked="true"{/if} type="checkbox" id="mainAction7CheckBox" /> + {'LBL_CREATE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} + </th> <th width="14%" style="border-left: 1px solid #DDD !important;"> <input {if !$RECORD_ID} class="alignTop" checked="true" {/if} type="checkbox" id="mainAction1CheckBox" /> {'LBL_EDIT_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} @@ -66,7 +70,7 @@ <input checked="true" class="alignTop" type="checkbox" id="mainAction2CheckBox" /> {'LBL_DELETE_PRVILIGE'|vtranslate:$QUALIFIED_MODULE} </th> - <th width="28%" style="border-left: 1px solid #DDD !important;" nowrap="nowrap">{'LBL_FIELD_AND_TOOL_PRVILIGES'|vtranslate:$QUALIFIED_MODULE}</th> + <th width="14%" style="border-left: 1px solid #DDD !important;" nowrap="nowrap">{'LBL_FIELD_AND_TOOL_PRVILIGES'|vtranslate:$QUALIFIED_MODULE}</th> </tr> </thead> <tbody> @@ -79,7 +83,7 @@ <td> <input class="modulesCheckBox alignTop" type="checkbox" name="permissions[{$TABID}][is_permitted]" data-value="{$TABID}" data-module-state="" {if $RECORD_MODEL->hasModulePermission($PROFILE_MODULE)}checked="true"{else} data-module-unchecked="true" {/if}> {$PROFILE_MODULE->get('label')|vtranslate:$PROFILE_MODULE->getName()} </td> - {assign var="BASIC_ACTION_ORDER" value=array(2,0,1)} + {assign var="BASIC_ACTION_ORDER" value=array(2,3,0,1)} {foreach from=$BASIC_ACTION_ORDER item=ORDERID} <td style="border-left: 1px solid #DDD !important;"> {assign var="ACTION_MODEL" value=$ALL_BASIC_ACTIONS[$ORDERID]} diff --git a/layouts/vlayout/modules/Settings/Profiles/resources/Profiles.js b/layouts/vlayout/modules/Settings/Profiles/resources/Profiles.js index b873ba298ed739dd42eb393496399bb562ae010a..1191e556b92f328c9e8e7cbc76589080c8be76b6 100644 --- a/layouts/vlayout/modules/Settings/Profiles/resources/Profiles.js +++ b/layouts/vlayout/modules/Settings/Profiles/resources/Profiles.js @@ -60,8 +60,7 @@ var Settings_Profiles_Js = { var target = jQuery(e.currentTarget); var parent = target.closest('tr'); var checked = target.attr('checked')? true : false; - - if (target.data('action-state') == 'EditView' || target.data('action-state') == 'Delete') { + if (jQuery.inArray(target.data('action-state'), ['EditView', 'Delete', 'CreateView']) != -1) { if (checked) { jQuery('[data-action-state="DetailView"]', parent).attr('checked', 'checked'); jQuery('[data-module-state]', parent).attr('checked', 'checked'); @@ -93,7 +92,7 @@ var Settings_Profiles_Js = { jQuery('[data-module-state]').change(handleModuleSelectionState); jQuery('[data-action-state]').change(handleActionSelectionState); - jQuery('#mainAction1CheckBox,#mainAction2CheckBox').change(selectAllModulesViewAndToolPriviliges); + jQuery('#mainAction1CheckBox,#mainAction2CheckBox,#mainAction7CheckBox').change(selectAllModulesViewAndToolPriviliges); jQuery('[data-togglehandler]').click(toggleEditViewTableRow); jQuery('[data-range]').each(function(index, item) { @@ -116,8 +115,9 @@ var Settings_Profiles_Js = { registerSelectAllModulesEvent : function() { var moduleCheckBoxes = jQuery('.modulesCheckBox'); var viewAction = jQuery('#mainAction4CheckBox'); - var createAction = jQuery('#mainAction1CheckBox'); - var deleteACtion = jQuery('#mainAction2CheckBox'); + var editAction = jQuery('#mainAction1CheckBox'); + var createAction = jQuery('#mainAction7CheckBox'); + var deleteAction = jQuery('#mainAction2CheckBox'); var mainModulesCheckBox = jQuery('#mainModulesCheckBox'); mainModulesCheckBox.on('change',function(e) { var mainCheckBox = jQuery(e.currentTarget); @@ -125,22 +125,25 @@ var Settings_Profiles_Js = { moduleCheckBoxes.attr('checked',true); viewAction.attr('checked',true); createAction.show().attr('checked',true); - deleteACtion.show().attr('checked',true); + editAction.show().attr('checked',true); + deleteAction.show().attr('checked',true); moduleCheckBoxes.trigger('change'); } else { moduleCheckBoxes.attr('checked',false); - moduleCheckBoxes.trigger('change'); viewAction.attr('checked',false); createAction.attr('checked', false); - deleteACtion.attr('checked', false); + editAction.attr('checked', false); + deleteAction.attr('checked', false); + moduleCheckBoxes.trigger('change'); } }); moduleCheckBoxes.on('change',function(){ Settings_Profiles_Js.checkSelectAll(moduleCheckBoxes,mainModulesCheckBox); Settings_Profiles_Js.checkSelectAll(jQuery('.action4CheckBox'),viewAction); - Settings_Profiles_Js.checkSelectAll(jQuery('.action1CheckBox'),createAction); - Settings_Profiles_Js.checkSelectAll(jQuery('.action2CheckBox'),deleteACtion); + Settings_Profiles_Js.checkSelectAll(jQuery('.action7CheckBox'),createAction); + Settings_Profiles_Js.checkSelectAll(jQuery('.action1CheckBox'),editAction); + Settings_Profiles_Js.checkSelectAll(jQuery('.action2CheckBox'),deleteAction); }); }, @@ -167,8 +170,8 @@ var Settings_Profiles_Js = { }, registerSelectAllCreateActionsEvent : function() { - var createActionCheckBoxes = jQuery('.action1CheckBox'); - var mainCreateActionCheckBox = jQuery('#mainAction1CheckBox'); + var createActionCheckBoxes = jQuery('.action7CheckBox'); + var mainCreateActionCheckBox = jQuery('#mainAction7CheckBox'); mainCreateActionCheckBox.on('change',function(e){ var mainCheckBox = jQuery(e.currentTarget); if(mainCheckBox.is(':checked')){ @@ -182,7 +185,23 @@ var Settings_Profiles_Js = { }); }, - + + registerSelectAllEditActionsEvent: function () { + var editActionCheckBoxes = jQuery('.action1CheckBox'); + var mainEditActionCheckBox = jQuery('#mainAction1CheckBox'); + mainEditActionCheckBox.on('change', function (e) { + var mainCheckBox = jQuery(e.currentTarget); + if (mainCheckBox.is(':checked')) { + editActionCheckBoxes.attr('checked', true); + } else { + editActionCheckBoxes.attr('checked', false); + } + }); + editActionCheckBoxes.on('change', function () { + Settings_Profiles_Js.checkSelectAll(editActionCheckBoxes, mainEditActionCheckBox); + }); + }, + registerSelectAllDeleteActionsEvent : function() { var deleteActionCheckBoxes = jQuery('.action2CheckBox'); var mainDeleteActionCheckBox = jQuery('#mainAction2CheckBox'); @@ -223,7 +242,10 @@ var Settings_Profiles_Js = { if(jQuery('[data-module-unchecked]').length > 0){ jQuery('#mainModulesCheckBox').attr('checked',false); } - + + if (jQuery('[data-action7-unchecked]').length <= 0) { + jQuery('#mainAction7CheckBox').attr('checked', true); + } if(jQuery('[data-action4-unchecked]').length <= 0){ jQuery('#mainAction4CheckBox').attr('checked',true); } @@ -345,6 +367,7 @@ var Settings_Profiles_Js = { Settings_Profiles_Js.registerSelectAllModulesEvent(); Settings_Profiles_Js.registerSelectAllViewActionsEvent(); Settings_Profiles_Js.registerSelectAllCreateActionsEvent(); + Settings_Profiles_Js.registerSelectAllEditActionsEvent(); Settings_Profiles_Js.registerSelectAllDeleteActionsEvent(); Settings_Profiles_Js.performSelectAllActionsOnLoad(); Settings_Profiles_Js.registerSubmitEvent(); diff --git a/layouts/vlayout/modules/Vtiger/Comment.tpl b/layouts/vlayout/modules/Vtiger/Comment.tpl index ecedc252687045aa020c6620f5a556ebecae181a..0a865f9451a9be1d906bd4bb951cebd4e0adf0bf 100644 --- a/layouts/vlayout/modules/Vtiger/Comment.tpl +++ b/layouts/vlayout/modules/Vtiger/Comment.tpl @@ -38,72 +38,72 @@ </div> </div> <div class="row-fluid commentActionsContainer"> - - {assign var="REASON_TO_EDIT" value=$COMMENT->get('reasontoedit')} - <div class="row-fluid editedStatus" name="editStatus"> - <div class="row-fluid"> - <span class="{if empty($REASON_TO_EDIT)}hide{/if} span6 editReason"> - <p><small>[ {vtranslate('LBL_EDIT_REASON',$MODULE_NAME)} ] : <span name="editReason" class="textOverflowEllipsis">{nl2br($REASON_TO_EDIT)}</span></small></p> - </span> - {if $COMMENT->getCommentedTime() neq $COMMENT->getModifiedTime()} - <span class="{if empty($REASON_TO_EDIT)}row-fluid{else} span6{/if}"> - <span class="pull-right"> - <p class="muted"><small><em>{vtranslate('LBL_MODIFIED',$MODULE_NAME)}</em></small> <small title="{Vtiger_Util_Helper::formatDateTimeIntoDayString($COMMENT->getModifiedTime())}" class="commentModifiedTime">{Vtiger_Util_Helper::formatDateDiffInStrings($COMMENT->getModifiedTime())}</small></p> - </span> + {if $EDIT_PERMISSION} + {assign var="REASON_TO_EDIT" value=$COMMENT->get('reasontoedit')} + <div class="row-fluid editedStatus" name="editStatus"> + <div class="row-fluid"> + <span class="{if empty($REASON_TO_EDIT)}hide{/if} span6 editReason"> + <p><small>[ {vtranslate('LBL_EDIT_REASON',$MODULE_NAME)} ] : <span name="editReason" class="textOverflowEllipsis">{nl2br($REASON_TO_EDIT)}</span></small></p> </span> - {/if} + {if $COMMENT->getCommentedTime() neq $COMMENT->getModifiedTime()} + <span class="{if empty($REASON_TO_EDIT)}row-fluid{else} span6{/if}"> + <span class="pull-right"> + <p class="muted"><small><em>{vtranslate('LBL_MODIFIED',$MODULE_NAME)}</em></small> <small title="{Vtiger_Util_Helper::formatDateTimeIntoDayString($COMMENT->getModifiedTime())}" class="commentModifiedTime">{Vtiger_Util_Helper::formatDateDiffInStrings($COMMENT->getModifiedTime())}</small></p> + </span> + </span> + {/if} + </div> </div> - </div> + {/if} <div class="row-fluid commentActionsDiv"> - {assign var=COMMENTS_MODULE_MODEL value = Vtiger_Module_Model::getInstance('ModComments')} - <div class="pull-right commentActions"> - {if $CHILDS_ROOT_PARENT_MODEL} - {assign var=CHILDS_ROOT_PARENT_ID value=$CHILDS_ROOT_PARENT_MODEL->getId()} + <div class="pull-right commentActions"> + {if $CHILDS_ROOT_PARENT_MODEL} + {assign var=CHILDS_ROOT_PARENT_ID value=$CHILDS_ROOT_PARENT_MODEL->getId()} + {/if} + <span> + {if $CREATE_PERMISSION} + <a class="cursorPointer replyComment"><i class="icon-share-alt"></i>{vtranslate('LBL_REPLY',$MODULE_NAME)}</a> {/if} - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} - <span> - <a class="cursorPointer replyComment"><i class="icon-share-alt"></i>{vtranslate('LBL_REPLY',$MODULE_NAME)}</a> - {if $CURRENTUSER->getId() eq $COMMENT->get('userid')} - <span style="color:black">|</span> - <a class="cursorPointer editComment feedback"> - {vtranslate('LBL_EDIT',$MODULE_NAME)} - </a> - {/if} - </span> + {if $CURRENTUSER->getId() eq $COMMENT->get('userid') && $EDIT_PERMISSION} + {if $CREATE_PERMISSION} <span style="color:black">|</span> {/if} + <a class="cursorPointer editComment feedback"> + {vtranslate('LBL_EDIT',$MODULE_NAME)} + </a> {/if} - {assign var=CHILD_COMMENTS_COUNT value=$COMMENT->getChildCommentsCount()} - {if $CHILD_COMMENTS_MODEL neq null and ($CHILDS_ROOT_PARENT_ID neq $PARENT_COMMENT_ID)} - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} <span style="color:black">|</span> {/if} - <span class="viewThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> - <a class="cursorPointer viewThread"> - <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} - <img class="alignMiddle" src="{vimage_path('rightArrowSmall.png')}" /> - </a> - </span> - <span class="hide hideThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> - <a class="cursorPointer hideThread"> - <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} - <img class="alignMiddle" src="{vimage_path('downArrowSmall.png')}" /> - </a> - </span> + </span> + {assign var=CHILD_COMMENTS_COUNT value=$COMMENT->getChildCommentsCount()} + {if $CHILD_COMMENTS_MODEL neq null and ($CHILDS_ROOT_PARENT_ID neq $PARENT_COMMENT_ID)} + {if $EDIT_PERMISSION} <span style="color:black">|</span> {/if} + <span class="viewThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> + <a class="cursorPointer viewThread"> + <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} + <img class="alignMiddle" src="{vimage_path('rightArrowSmall.png')}" /> + </a> + </span> + <span class="hide hideThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> + <a class="cursorPointer hideThread"> + <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} + <img class="alignMiddle" src="{vimage_path('downArrowSmall.png')}" /> + </a> + </span> - {elseif $CHILD_COMMENTS_MODEL neq null and ($CHILDS_ROOT_PARENT_ID eq $PARENT_COMMENT_ID)} - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} <span style="color:black">|</span> {/if} - <span class="hide viewThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> - <a class="cursorPointer viewThread"> - <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} - <img class="alignMiddle" src="{vimage_path('rightArrowSmall.png')}" /> - </a> - </span> - <span class="hideThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> - <a class="cursorPointer hideThread"> - <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} - <img class="alignMiddle" src="{vimage_path('downArrowSmall.png')}" /> - </a> - </span> - {/if} - </small></p> - </div> + {elseif $CHILD_COMMENTS_MODEL neq null and ($CHILDS_ROOT_PARENT_ID eq $PARENT_COMMENT_ID)} + {if $CREATE_PERMISSION || $EDIT_PERMISSION} <span style="color:black">|</span> {/if} + <span class="hide viewThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> + <a class="cursorPointer viewThread"> + <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} + <img class="alignMiddle" src="{vimage_path('rightArrowSmall.png')}" /> + </a> + </span> + <span class="hideThreadBlock" data-child-comments-count="{$CHILD_COMMENTS_COUNT}"> + <a class="cursorPointer hideThread"> + <span class="childCommentsCount">{$CHILD_COMMENTS_COUNT}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} + <img class="alignMiddle" src="{vimage_path('downArrowSmall.png')}" /> + </a> + </span> + {/if} + </small></p> + </div> </div> </div> </div> diff --git a/layouts/vlayout/modules/Vtiger/CommentThreadList.tpl b/layouts/vlayout/modules/Vtiger/CommentThreadList.tpl index cfa8bcecb2d9ae1799b27c5ca91e2856d4bfcecd..00263201eaf8a4b35ee3c9f68a7ac9b4d297db01 100644 --- a/layouts/vlayout/modules/Vtiger/CommentThreadList.tpl +++ b/layouts/vlayout/modules/Vtiger/CommentThreadList.tpl @@ -37,60 +37,60 @@ </div> </div> <div class="row-fluid commentActionsContainer"> - - {assign var="REASON_TO_EDIT" value=$COMMENT->get('reasontoedit')} - <div class="row-fluid editedStatus" name="editStatus"> - <div class="row-fluid"> - <p class="span6 marginLeftZero"><small> - <span class="{if empty($REASON_TO_EDIT)}hide{/if} span6 marginLeftZero editReason"> - [ {vtranslate('LBL_EDIT_REASON',$MODULE_NAME)} ] : <span name="editReason" class="textOverflowEllipsis">{nl2br($REASON_TO_EDIT)}</span> - </span> - </small></p> - {if $COMMENT->getCommentedTime() neq $COMMENT->getModifiedTime()} - <span class="{if empty($REASON_TO_EDIT)}row-fluid{else} span6{/if}"> - <span class="pull-right"> - <p class="muted"><small title="{Vtiger_Util_Helper::formatDateTimeIntoDayString($COMMENT->getModifiedTime())}">{Vtiger_Util_Helper::formatDateDiffInStrings($COMMENT->getModifiedTime())}</small></p> - </span> + {if $EDIT_PERMISSION} + {assign var="REASON_TO_EDIT" value=$COMMENT->get('reasontoedit')} + <div class="row-fluid editedStatus" name="editStatus"> + <div class="row-fluid"> + <p class="span6 marginLeftZero"><small> + <span class="{if empty($REASON_TO_EDIT)}hide{/if} span6 marginLeftZero editReason"> + [ {vtranslate('LBL_EDIT_REASON',$MODULE_NAME)} ] : <span name="editReason" class="textOverflowEllipsis">{nl2br($REASON_TO_EDIT)}</span> </span> - {/if} - + </small></p> + {if $COMMENT->getCommentedTime() neq $COMMENT->getModifiedTime()} + <span class="{if empty($REASON_TO_EDIT)}row-fluid{else} span6{/if}"> + <span class="pull-right"> + <p class="muted"><small title="{Vtiger_Util_Helper::formatDateTimeIntoDayString($COMMENT->getModifiedTime())}">{Vtiger_Util_Helper::formatDateDiffInStrings($COMMENT->getModifiedTime())}</small></p> + </span> + </span> + {/if} + + </div> </div> - </div> + {/if} <div class="row-fluid commentActionsDiv"> - {assign var=COMMENTS_MODULE_MODEL value = Vtiger_Module_Model::getInstance('ModComments')} - <span class="pull-right commentActions"> - {assign var=CHILD_COMMENTS_COUNT value=$COMMENT->getChildCommentsCount()} - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} - <span> - <a class="cursorPointer replyComment"> - <i class="icon-share-alt"></i> - {vtranslate('LBL_REPLY',$MODULE_NAME)} - </a> - {if $CURRENTUSER->getId() eq $COMMENT->get('userid')} - <span style="color:black">|</span> - <a class="cursorPointer editComment feedback"> - {vtranslate('LBL_EDIT',$MODULE_NAME)} - </a> - {/if} - </span> + <span class="pull-right commentActions"> + {assign var=CHILD_COMMENTS_COUNT value=$COMMENT->getChildCommentsCount()} + <span> + {if $CREATE_PERMISSION} + <a class="cursorPointer replyComment"> + <i class="icon-share-alt"></i> + {vtranslate('LBL_REPLY',$MODULE_NAME)} + </a> {/if} - {if $CHILD_COMMENTS_COUNT neq 0} - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} <span style="color:black">|</span> {/if} - <span class="hide viewThreadBlock" data-child-comments-count="{$COMMENT->getChildCommentsCount()}"> - <a class="cursorPointer viewThread"> - <span class="childCommentsCount">{$COMMENT->getChildCommentsCount()}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} - <img class="alignMiddle" src="{vimage_path('rightArrowSmall.png')}" /> - </a> - </span> - <span class="hideThreadBlock" data-child-comments-count="{$COMMENT->getChildCommentsCount()}"> - <a class="cursorPointer hideThread"> - <span class="childCommentsCount">{$COMMENT->getChildCommentsCount()}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} - <img class="alignMiddle" src="{vimage_path('downArrowSmall.png')}" /> - </a> - </span> + {if $CURRENTUSER->getId() eq $COMMENT->get('userid') && $EDIT_PERMISSION} + {if $CREATE_PERMISSION} <span style="color:black">|</span> {/if} + <a class="cursorPointer editComment feedback"> + {vtranslate('LBL_EDIT',$MODULE_NAME)} + </a> {/if} </span> + {if $CHILD_COMMENTS_COUNT neq 0} + {if $CREATE_PERMISSION || $EDIT_PERMISSION} <span style="color:black">|</span> {/if} + <span class="hide viewThreadBlock" data-child-comments-count="{$COMMENT->getChildCommentsCount()}"> + <a class="cursorPointer viewThread"> + <span class="childCommentsCount">{$COMMENT->getChildCommentsCount()}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} + <img class="alignMiddle" src="{vimage_path('rightArrowSmall.png')}" /> + </a> + </span> + <span class="hideThreadBlock" data-child-comments-count="{$COMMENT->getChildCommentsCount()}"> + <a class="cursorPointer hideThread"> + <span class="childCommentsCount">{$COMMENT->getChildCommentsCount()}</span> {if $CHILD_COMMENTS_COUNT eq 1}{vtranslate('LBL_REPLY',$MODULE_NAME)}{else}{vtranslate('LBL_REPLIES',$MODULE_NAME)}{/if} + <img class="alignMiddle" src="{vimage_path('downArrowSmall.png')}" /> + </a> + </span> + {/if} + </span> </div> </div> - </div> - </div> + </div> +</div> diff --git a/layouts/vlayout/modules/Vtiger/CommonActions.tpl b/layouts/vlayout/modules/Vtiger/CommonActions.tpl index 8ef98a1f9bf7ebde6578514ce267e78754f1a912..4cb0a213cd4270b71b7f9f2ad2db33ca656efa2e 100644 --- a/layouts/vlayout/modules/Vtiger/CommonActions.tpl +++ b/layouts/vlayout/modules/Vtiger/CommonActions.tpl @@ -67,7 +67,7 @@ <div class="row-fluid"> <div class="span12"> {foreach key=moduleName item=moduleModel from=$MENUS} - {if $moduleModel->isPermitted('EditView')} + {if $moduleModel->isPermitted('CreateView')} {assign var='quickCreateModule' value=$moduleModel->isQuickCreateSupported()} {assign var='singularLabel' value=$moduleModel->getSingularLabelKey()} {if $singularLabel == 'SINGLE_Calendar'} diff --git a/layouts/vlayout/modules/Vtiger/FindDuplicateContents.tpl b/layouts/vlayout/modules/Vtiger/FindDuplicateContents.tpl index 82314b35701f9b4600498d35619f514e8f2b2916..6b52fca0baddedc1bae77ce5786254059e06219e 100644 --- a/layouts/vlayout/modules/Vtiger/FindDuplicateContents.tpl +++ b/layouts/vlayout/modules/Vtiger/FindDuplicateContents.tpl @@ -37,16 +37,20 @@ <table class="table-bordered row-fluid textAlignCenter"> <thead> <tr class="listViewHeaders"> - <th width="5%"> - <input type="checkbox" id="listViewEntriesMainCheckBox" /> - </th> + {if $LISTVIEW_LINKS} + <th width="5%"> + <input type="checkbox" id="listViewEntriesMainCheckBox" /> + </th> + {/if} {foreach item=LISTVIEW_HEADER from=$LISTVIEW_HEADERS} <th nowrap {*if $LISTVIEW_HEADER@last} colspan="2" {/if*}> <a class="listViewHeaderValues">{vtranslate($LISTVIEW_HEADER->get('label'), $MODULE)}</a> </th> {/foreach} - <th>{vtranslate('LBL_MERGE_SELECT', $MODULE)}</th> - <th>{vtranslate('LBL_ACTION', $MODULE)}</th> + {if $IS_MODULE_EDITABLE} + <th>{vtranslate('LBL_MERGE_SELECT', $MODULE)}</th> + <th>{vtranslate('LBL_ACTION', $MODULE)}</th> + {/if} </tr> </thead> {assign var=mergeRecordCount value=0} @@ -55,9 +59,11 @@ {assign var=recordCount value=0} {foreach item=RECORD from=$LISTVIEW_ENTRY name=listview} <tr class="listViewEntries" data-id='{$RECORD.recordid}' id="{$MODULE}_listView_row_{$smarty.foreach.listview.index+1}"> - <td width="5%" style='border-bottom:1px solid #DDD;'> - <input type="checkbox" value="{$RECORD.recordid}" class="listViewEntriesCheckBox"/> - </td> + {if $LISTVIEW_LINKS} + <td width="5%" style='border-bottom:1px solid #DDD;'> + <input type="checkbox" value="{$RECORD.recordid}" class="listViewEntriesCheckBox"/> + </td> + {/if} {assign var=sameRowValues value=true} {foreach item=LISTVIEW_HEADER from=$LISTVIEW_HEADERS} {if $LISTVIEW_HEADER->get('name') eq 'recordid'} @@ -70,13 +76,15 @@ </td> {/if} {/foreach} - <td style='border-bottom:1px solid #DDD;'> - <input type="checkbox" data-id='{$RECORD.recordid}' name="mergeRecord" data-group="{$GROUP_NAME}"/> - </td> - {if $recordCount eq 0} - <td align='center' rowspan="{$groupCount}" style="border-left:1px solid #DDD;border-bottom:1px solid #DDD;vertical-align: middle;text-align: center"> - <input type="button" value="{vtranslate("LBL_MERGE",'Vtiger')}" name="merge" class="btn btn-success" data-group="{$GROUP_NAME}"> - </td> + {if $IS_MODULE_EDITABLE} + <td style='border-bottom:1px solid #DDD;'> + <input type="checkbox" data-id='{$RECORD.recordid}' name="mergeRecord" data-group="{$GROUP_NAME}"/> + </td> + {if $recordCount eq 0} + <td align='center' rowspan="{$groupCount}" style="border-left:1px solid #DDD;border-bottom:1px solid #DDD;vertical-align: middle;text-align: center"> + <input type="button" value="{vtranslate("LBL_MERGE",'Vtiger')}" name="merge" class="btn btn-success" data-group="{$GROUP_NAME}"> + </td> + {/if} {/if} {assign var=recordCount value=$recordCount+1} </tr> diff --git a/layouts/vlayout/modules/Vtiger/ListViewContents.tpl b/layouts/vlayout/modules/Vtiger/ListViewContents.tpl index 3a3e316d6f134ddb8341838585a030d8b0b6698d..3b3d99416e33d0ae99180e3f4e709598b85d30dc 100644 --- a/layouts/vlayout/modules/Vtiger/ListViewContents.tpl +++ b/layouts/vlayout/modules/Vtiger/ListViewContents.tpl @@ -137,7 +137,7 @@ <tr> <td> {assign var=SINGLE_MODULE value="SINGLE_$MODULE"} - {vtranslate('LBL_EQ_ZERO')} {vtranslate($SINGLE_MODULE, $MODULE)} {vtranslate('LBL_FOUND')}.{if $IS_MODULE_EDITABLE} {vtranslate('LBL_CREATE')} <a href="{$MODULE_MODEL->getCreateRecordUrl()}">{vtranslate($SINGLE_MODULE, $MODULE)}</a>{/if} + {vtranslate('LBL_EQ_ZERO')} {vtranslate($SINGLE_MODULE, $MODULE)} {vtranslate('LBL_FOUND')}.{if $IS_RECORD_CREATABLE} {vtranslate('LBL_CREATE')} <a href="{$MODULE_MODEL->getCreateRecordUrl()}">{vtranslate($SINGLE_MODULE, $MODULE)}</a>{/if} </td> </tr> </tbody> diff --git a/layouts/vlayout/modules/Vtiger/MenuBar.tpl b/layouts/vlayout/modules/Vtiger/MenuBar.tpl index 2fdfcdc5ae98c8713b48380fb5feb5958c5436bb..a9e38089e62f752ee11c43326038e3d6b4bf5bfe 100644 --- a/layouts/vlayout/modules/Vtiger/MenuBar.tpl +++ b/layouts/vlayout/modules/Vtiger/MenuBar.tpl @@ -198,7 +198,7 @@ <li id="compactquickCreate"> <div class="CompactQC"> {foreach key=moduleName item=moduleModel from=$MENUS} - {if $moduleModel->isPermitted('EditView')} + {if $moduleModel->isPermitted('CreateView')} {assign var='quickCreateModule' value=$moduleModel->isQuickCreateSupported()} {assign var='singularLabel' value=$moduleModel->getSingularLabelKey()} {if $quickCreateModule == '1'} diff --git a/layouts/vlayout/modules/Vtiger/RecentComments.tpl b/layouts/vlayout/modules/Vtiger/RecentComments.tpl index 5c6380f077c180457a61e42da085e48fed3b9a43..4506357c646d055ab2a0e213fbd3aa6a009f186f 100644 --- a/layouts/vlayout/modules/Vtiger/RecentComments.tpl +++ b/layouts/vlayout/modules/Vtiger/RecentComments.tpl @@ -16,7 +16,9 @@ <div class="commentContainer recentComments"> <div class="commentTitle row-fluid"> - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} + {assign var=CREATE_PERMISSION value=$COMMENTS_MODULE_MODEL->isPermitted('CreateView')} + {assign var=EDIT_PERMISSION value=$COMMENTS_MODULE_MODEL->isPermitted('EditView')} + {if $CREATE_PERMISSION} <div class="addCommentBlock"> <div> <textarea name="commentcontent" class="commentcontent" placeholder="{vtranslate('LBL_ADD_YOUR_COMMENT_HERE', $MODULE_NAME)}" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}"></textarea> @@ -82,22 +84,22 @@ </div> <div class="row-fluid"> <div class="pull-right commentActions"> - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} - <span> + <span> + {if $CREATE_PERMISSION} <a class="cursorPointer replyComment feedback"> <i class="icon-share-alt"></i>{vtranslate('LBL_REPLY',$MODULE_NAME)} </a> - {if $CURRENTUSER->getId() eq $COMMENT->get('userid')} - <span>|</span> - <a class="cursorPointer editComment feedback"> - {vtranslate('LBL_EDIT',$MODULE_NAME)} - </a> - {/if} - </span> - {/if} + {/if} + {if $CURRENTUSER->getId() eq $COMMENT->get('userid') && $EDIT_PERMISSION} + {if $CREATE_PERMISSION} <span>|</span> {/if} + <a class="cursorPointer editComment feedback"> + {vtranslate('LBL_EDIT',$MODULE_NAME)} + </a> + {/if} + </span> <span> {if $PARENT_COMMENT_MODEL neq false or $CHILD_COMMENTS_MODEL neq null} - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} <span>|</span> {/if} + {if $CREATE_PERMISSION || $EDIT_PERMISSION} <span>|</span> {/if} <a href="javascript:void(0);" class="cursorPointer detailViewThread">{vtranslate('LBL_VIEW_THREAD',$MODULE_NAME)}</a> {/if} </span> @@ -119,35 +121,39 @@ </div> </div> {/if} - <div class="hide basicAddCommentBlock"> - <div class="row-fluid"> - <span class="span1"> </span> - <div class="span11"> - <textarea class="commentcontenthidden fullWidthAlways" name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}" placeholder="{vtranslate('LBL_ADD_YOUR_COMMENT_HERE', $MODULE_NAME)}"></textarea> + {if $CREATE_PERMISSION} + <div class="hide basicAddCommentBlock"> + <div class="row-fluid"> + <span class="span1"> </span> + <div class="span11"> + <textarea class="commentcontenthidden fullWidthAlways" name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}" placeholder="{vtranslate('LBL_ADD_YOUR_COMMENT_HERE', $MODULE_NAME)}"></textarea> + </div> </div> - </div> - <div class="pull-right"> - <button class="btn btn-success detailViewSaveComment" type="button" data-mode="add"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> - <a class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> - </div> - </div> - <div class="hide basicEditCommentBlock" style="min-height: 150px;"> - <div class="row-fluid"> - <span class="span1"> </span> - <div class="span11"> - <input type="text" name="reasonToEdit" placeholder="{vtranslate('LBL_REASON_FOR_CHANGING_COMMENT', $MODULE_NAME)}" class="input-block-level"/> + <div class="pull-right"> + <button class="btn btn-success detailViewSaveComment" type="button" data-mode="add"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> + <a class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> </div> </div> - <div class="row-fluid"> - <span class="span1"> </span> - <div class="span11"> - <textarea class="commentcontenthidden fullWidthAlways" name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}"></textarea> + {/if} + {if $EDIT_PERMISSION} + <div class="hide basicEditCommentBlock" style="min-height: 150px;"> + <div class="row-fluid"> + <span class="span1"> </span> + <div class="span11"> + <input type="text" name="reasonToEdit" placeholder="{vtranslate('LBL_REASON_FOR_CHANGING_COMMENT', $MODULE_NAME)}" class="input-block-level"/> + </div> + </div> + <div class="row-fluid"> + <span class="span1"> </span> + <div class="span11"> + <textarea class="commentcontenthidden fullWidthAlways" name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}"></textarea> + </div> + </div> + <div class="pull-right"> + <button class="btn btn-success detailViewSaveComment" type="button" data-mode="edit"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> + <a class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> </div> </div> - <div class="pull-right"> - <button class="btn btn-success detailViewSaveComment" type="button" data-mode="edit"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> - <a class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> - </div> - </div> + {/if} </div> {/strip} \ No newline at end of file diff --git a/layouts/vlayout/modules/Vtiger/RelatedActivities.tpl b/layouts/vlayout/modules/Vtiger/RelatedActivities.tpl index 5bfc7a414a1eebb46d32ab0b5d5de157cb066fc7..e930cc68bc577887959597ee80b65f332c8268ed 100644 --- a/layouts/vlayout/modules/Vtiger/RelatedActivities.tpl +++ b/layouts/vlayout/modules/Vtiger/RelatedActivities.tpl @@ -14,7 +14,13 @@ <div class="summaryWidgetContainer"> <div class="widget_header row-fluid"> <span class="span8"><h4 class="textOverflowEllipsis">{vtranslate('LBL_ACTIVITIES',$MODULE_NAME)}</h4></span> - <span class="span4"><button class="btn pull-right addButton createActivity" data-url="sourceModule={$RECORD->getModuleName()}&sourceRecord={$RECORD->getId()}&relationOperation=true" type="button"><strong>{vtranslate('LBL_ADD',$MODULE_NAME)}</strong></button></span> + <span class="span4"> + {if isPermitted('Calendar', 'CreateView') eq 'yes'} + <button class="btn pull-right addButton createActivity" data-url="sourceModule={$RECORD->getModuleName()}&sourceRecord={$RECORD->getId()}&relationOperation=true" type="button"> + <strong>{vtranslate('LBL_ADD',$MODULE_NAME)}</strong> + </button> + {/if} + </span> </div> <div class="widget_contents"> {if count($ACTIVITIES) neq '0'} @@ -33,16 +39,18 @@ {assign var=MODULE_NAME value=$RECORD->getModuleName()} <input type="hidden" class="activityModule" value="{$RECORD->getModuleName()}"/> <input type="hidden" class="activityType" value="{$RECORD->get('activitytype')}"/> - <div class="pull-right"> - <strong><span class="value">{vtranslate($RECORD->get('status'),$MODULE_NAME)}</span></strong>  - <span class="editStatus cursorPointer"><i class="icon-pencil" title="{vtranslate('LBL_EDIT',$MODULE_NAME)}"></i></span> - <span class="edit hide"> - {assign var=FIELD_MODEL value=$RECORD->getModule()->getField('taskstatus')} - {assign var=FIELD_VALUE value=$FIELD_MODEL->set('fieldvalue', $RECORD->get('status'))} - {include file=vtemplate_path($FIELD_MODEL->getUITypeModel()->getTemplateName(),$MODULE_NAME) FIELD_MODEL=$FIELD_MODEL USER_MODEL=$USER_MODEL MODULE=$MODULE_NAME OCCUPY_COMPLETE_WIDTH='true'} - <input type="hidden" class="fieldname" value='{$FIELD_MODEL->get('name')}' data-prev-value='{$FIELD_MODEL->get('fieldvalue')}' /> - </span> - </div> + {if $EDITVIEW_PERMITTED == 'yes'} + <div class="pull-right"> + <strong><span class="value">{vtranslate($RECORD->get('status'),$MODULE_NAME)}</span></strong>  + <span class="editStatus cursorPointer"><i class="icon-pencil" title="{vtranslate('LBL_EDIT',$MODULE_NAME)}"></i></span> + <span class="edit hide"> + {assign var=FIELD_MODEL value=$RECORD->getModule()->getField('taskstatus')} + {assign var=FIELD_VALUE value=$FIELD_MODEL->set('fieldvalue', $RECORD->get('status'))} + {include file=vtemplate_path($FIELD_MODEL->getUITypeModel()->getTemplateName(),$MODULE_NAME) FIELD_MODEL=$FIELD_MODEL USER_MODEL=$USER_MODEL MODULE=$MODULE_NAME OCCUPY_COMPLETE_WIDTH='true'} + <input type="hidden" class="fieldname" value='{$FIELD_MODEL->get('name')}' data-prev-value='{$FIELD_MODEL->get('fieldvalue')}' /> + </span> + </div> + {/if} </div> {else} {assign var=MODULE_NAME value="Events"} diff --git a/layouts/vlayout/modules/Vtiger/ShowAllComments.tpl b/layouts/vlayout/modules/Vtiger/ShowAllComments.tpl index 3c0854d483dd07fa8c21c805ee0005628aeaf207..5a4acbb7133f61588aceb18f3272c757de2664fc 100644 --- a/layouts/vlayout/modules/Vtiger/ShowAllComments.tpl +++ b/layouts/vlayout/modules/Vtiger/ShowAllComments.tpl @@ -15,7 +15,9 @@ <div class="commentContainer"> <div class="commentTitle row-fluid"> - {if $COMMENTS_MODULE_MODEL->isPermitted('EditView')} + {assign var=CREATE_PERMISSION value=$COMMENTS_MODULE_MODEL->isPermitted('CreateView')} + {assign var=EDIT_PERMISSION value=$COMMENTS_MODULE_MODEL->isPermitted('EditView')} + {if $CREATE_PERMISSION} <div class="addCommentBlock"> <div> <textarea name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}" class="commentcontent" placeholder="{vtranslate('LBL_ADD_YOUR_COMMENT_HERE', $MODULE_NAME)}"></textarea> @@ -30,34 +32,38 @@ <div class="commentsList commentsBody"> {include file='CommentsList.tpl'|@vtemplate_path COMMENT_MODULE_MODEL=$COMMENTS_MODULE_MODEL} </div> - <div class="hide basicAddCommentBlock"> - <div class="row-fluid"> - <span class="span1"> </span> - <div class="span11"> - <textarea class="commentcontenthidden fullWidthAlways" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}" name="commentcontent" placeholder="{vtranslate('LBL_ADD_YOUR_COMMENT_HERE', $MODULE_NAME)}"></textarea> + {if $CREATE_PERMISSION} + <div class="hide basicAddCommentBlock"> + <div class="row-fluid"> + <span class="span1"> </span> + <div class="span11"> + <textarea class="commentcontenthidden fullWidthAlways" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}" name="commentcontent" placeholder="{vtranslate('LBL_ADD_YOUR_COMMENT_HERE', $MODULE_NAME)}"></textarea> + </div> + </div> + <div class="pull-right"> + <button class="btn btn-success saveComment" type="button" data-mode="add"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> + <a class="cursorPointer closeCommentBlock" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> </div> </div> - <div class="pull-right"> - <button class="btn btn-success saveComment" type="button" data-mode="add"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> - <a class="cursorPointer closeCommentBlock" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> - </div> - </div> + {/if} + {if $EDIT_PERMISSION} <div class="hide basicEditCommentBlock" style="min-height: 150px;"> - <div class="row-fluid"> - <span class="span1"> </span> - <div class="span11"> - <input type="text" name="reasonToEdit" placeholder="{vtranslate('LBL_REASON_FOR_CHANGING_COMMENT', $MODULE_NAME)}" class="input-block-level"/> + <div class="row-fluid"> + <span class="span1"> </span> + <div class="span11"> + <input type="text" name="reasonToEdit" placeholder="{vtranslate('LBL_REASON_FOR_CHANGING_COMMENT', $MODULE_NAME)}" class="input-block-level"/> + </div> </div> - </div> - <div class="row-fluid"> - <span class="span1"> </span> - <div class="span11"> - <textarea class="commentcontenthidden fullWidthAlways" name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}"></textarea> + <div class="row-fluid"> + <span class="span1"> </span> + <div class="span11"> + <textarea class="commentcontenthidden fullWidthAlways" name="commentcontent" rows="{$COMMENT_TEXTAREA_DEFAULT_ROWS}"></textarea> + </div> + </div> + <div class="pull-right"> + <button class="btn btn-success saveComment" type="button" data-mode="edit"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> + <a class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> </div> </div> - <div class="pull-right"> - <button class="btn btn-success saveComment" type="button" data-mode="edit"><strong>{vtranslate('LBL_POST', $MODULE_NAME)}</strong></button> - <a class="cursorPointer closeCommentBlock cancelLink" type="reset">{vtranslate('LBL_CANCEL', $MODULE_NAME)}</a> - </div> - </div> + {/if} </div> \ No newline at end of file diff --git a/modules/Calendar/models/ListView.php b/modules/Calendar/models/ListView.php index b189c02da4ecfbb7120603d4d165a496e310dae7..6b1588aec2d4e89cfb4ea3dbda511f2151e8e404 100644 --- a/modules/Calendar/models/ListView.php +++ b/modules/Calendar/models/ListView.php @@ -17,7 +17,7 @@ class Calendar_ListView_Model extends Vtiger_ListView_Model { public function getBasicLinks() { $basicLinks = array(); $moduleModel = $this->getModule(); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); if($createPermission) { $basicLinks[] = array( 'linktype' => 'LISTVIEWBASIC', @@ -43,7 +43,7 @@ class Calendar_ListView_Model extends Vtiger_ListView_Model { */ public function getAdvancedLinks(){ $moduleModel = $this->getModule(); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); $advancedLinks = array(); $importPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'Import'); if($importPermission && $createPermission) { diff --git a/modules/Calendar/views/Calendar.php b/modules/Calendar/views/Calendar.php index 8b0f2ece689d38233071e374ce5a3ac46e7f0211..cd5009b679111d17636dbdf03fb59e615842b311 100644 --- a/modules/Calendar/views/Calendar.php +++ b/modules/Calendar/views/Calendar.php @@ -12,7 +12,12 @@ class Calendar_Calendar_View extends Vtiger_Index_View { public function preProcess(Vtiger_Request $request, $display = true) { $viewer = $this->getViewer($request); - $viewer->assign('MODULE_NAME', $request->getModule()); + $moduleName = $request->getModule(); + $viewer->assign('MODULE_NAME', $moduleName); + $moduleModel = Vtiger_Module_Model::getInstance($moduleName); + $viewer->assign('IS_RECORD_CREATABLE', $moduleModel->isPermitted('CreateView')); + $viewer->assign('IS_MODULE_EDITABLE', $moduleModel->isPermitted('EditView')); + $viewer->assign('IS_MODULE_DELETABLE', $moduleModel->isPermitted('Delete')); parent::preProcess($request, false); if($display) { diff --git a/modules/Campaigns/models/ListView.php b/modules/Campaigns/models/ListView.php index e496ee06d881be5c8ae00792c1618e34d6106937..07d1e2042c5568d8a6e2573ff8eefab6ad61dcdc 100644 --- a/modules/Campaigns/models/ListView.php +++ b/modules/Campaigns/models/ListView.php @@ -24,7 +24,7 @@ class Campaigns_ListView_Model extends Vtiger_ListView_Model { $basicLinks = array(); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); if($createPermission) { $basicLinks[] = array( 'linktype' => 'LISTVIEWBASIC', diff --git a/modules/Documents/Documents.php b/modules/Documents/Documents.php index 163d239e06bbf524de542d9d8a803c376dee0f53..843f8aad5f4f502d07caf7c5f83bbe830f43a4ab 100644 --- a/modules/Documents/Documents.php +++ b/modules/Documents/Documents.php @@ -524,7 +524,7 @@ class Documents extends CRMEntity { */ static function isLinkPermitted($linkData) { $moduleName = "Documents"; - if(vtlib_isModuleActive($moduleName) && isPermitted($moduleName, 'EditView') == 'yes') { + if(vtlib_isModuleActive($moduleName) && isPermitted($moduleName, 'CreateView') == 'yes') { return true; } return false; diff --git a/modules/Documents/models/ListView.php b/modules/Documents/models/ListView.php index 53b7513bde6e9ab9732970740d33c27faaa8e755..a143b80994afdd3a6c6abda0002f1531d4f1cc1a 100644 --- a/modules/Documents/models/ListView.php +++ b/modules/Documents/models/ListView.php @@ -22,7 +22,7 @@ class Documents_ListView_Model extends Vtiger_ListView_Model { $linkTypes = array('LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING'); $links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); if($createPermission) { $basicLinks = array( array( diff --git a/modules/Documents/views/AddFolder.php b/modules/Documents/views/AddFolder.php index 500596016a8d767e1b2ea03a4007ac69a71d1dd8..eed645d58c385b02bd98fd71dfb56215ec30f096 100644 --- a/modules/Documents/views/AddFolder.php +++ b/modules/Documents/views/AddFolder.php @@ -13,7 +13,7 @@ class Documents_AddFolder_View extends Vtiger_IndexAjax_View { public function checkPermission(Vtiger_Request $request) { $moduleName = $request->getModule(); - if(!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + if(!Users_Privileges_Model::isPermitted($moduleName, 'CreateView')) { throw new AppException(vtranslate('LBL_PERMISSION_DENIED', $moduleName)); } } diff --git a/modules/HelpDesk/actions/ConvertFAQ.php b/modules/HelpDesk/actions/ConvertFAQ.php index b64eb2f4f1ebb439b8c5dd2ee9e777e5c6b45f5d..797453abb691b184f73e1dba2cf420f928d9a02f 100644 --- a/modules/HelpDesk/actions/ConvertFAQ.php +++ b/modules/HelpDesk/actions/ConvertFAQ.php @@ -11,7 +11,7 @@ class HelpDesk_ConvertFAQ_Action extends Vtiger_Action_Controller { public function checkPermission(Vtiger_Request $request) { - $recordPermission = Users_Privileges_Model::isPermitted('Faq', 'EditView'); + $recordPermission = Users_Privileges_Model::isPermitted('Faq', 'CreateView'); if(!$recordPermission) { throw new AppException('LBL_PERMISSION_DENIED'); diff --git a/modules/HelpDesk/models/DetailView.php b/modules/HelpDesk/models/DetailView.php index 9212955bc96d3f7923987682a04054429fa9fbbf..22a57bf6d2ea69ca33b7dcec5d4c52a01c581231 100644 --- a/modules/HelpDesk/models/DetailView.php +++ b/modules/HelpDesk/models/DetailView.php @@ -47,7 +47,7 @@ class HelpDesk_DetailView_Model extends Vtiger_DetailView_Model { $documentsInstance = Vtiger_Module_Model::getInstance('Documents'); if($userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'Documents', diff --git a/modules/Inventory/models/ListView.php b/modules/Inventory/models/ListView.php index af9d7e6a99ee91d2bd058b6ab8022260281e0b43..8acb18a7387955c572ded1aa8b0a7af31364d52f 100644 --- a/modules/Inventory/models/ListView.php +++ b/modules/Inventory/models/ListView.php @@ -35,7 +35,7 @@ class Inventory_ListView_Model extends Vtiger_ListView_Model { $basicLinks = array(); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); if($createPermission) { $basicLinks[] = array( 'linktype' => 'LISTVIEWBASIC', diff --git a/modules/Inventory/models/RelationListView.php b/modules/Inventory/models/RelationListView.php index c4665b6ea2582767d5d155bcb6ef6238d41f7db8..561ef7d0f2ce9847c4db5d6037571e04a790de76 100644 --- a/modules/Inventory/models/RelationListView.php +++ b/modules/Inventory/models/RelationListView.php @@ -19,26 +19,28 @@ class Inventory_RelationListView_Model extends Vtiger_RelationListView_Model { } $relatedModel = $relationModel->getRelationModuleModel(); - if($relatedModel->get('label') == 'Calendar'){ - $addLinkList[] = array( - 'linktype' => 'LISTVIEWBASIC', - 'linklabel' => vtranslate('LBL_ADD_TASK'), - 'linkurl' => $this->getCreateTaskRecordUrl(), - 'linkicon' => '', - ); - }else{ - $addLinkList = array( - array( - 'linktype' => 'LISTVIEWBASIC', - 'linklabel' => vtranslate('LBL_ADD')." ".vtranslate($relatedModel->get('label')), - 'linkurl' => $this->getCreateViewUrl(), - 'linkicon' => '', - ) - ); - } - - foreach($addLinkList as $addLink) { - $addLinkModel[] = Vtiger_Link_Model::getInstanceFromValues($addLink); + if ($relatedModel->isPermitted('CreateView')) { + if($relatedModel->get('label') == 'Calendar'){ + $addLinkList[] = array( + 'linktype' => 'LISTVIEWBASIC', + 'linklabel' => vtranslate('LBL_ADD_TASK'), + 'linkurl' => $this->getCreateTaskRecordUrl(), + 'linkicon' => '', + ); + }else{ + $addLinkList = array( + array( + 'linktype' => 'LISTVIEWBASIC', + 'linklabel' => vtranslate('LBL_ADD')." ".vtranslate($relatedModel->get('label')), + 'linkurl' => $this->getCreateViewUrl(), + 'linkicon' => '', + ) + ); + } + + foreach($addLinkList as $addLink) { + $addLinkModel[] = Vtiger_Link_Model::getInstanceFromValues($addLink); + } } return $addLinkModel; } diff --git a/modules/Leads/models/Record.php b/modules/Leads/models/Record.php index a519cce82a09c437cbfc4129832064a29e737387..c56f41381117245236dcab998ac8f3bf75b784bd 100644 --- a/modules/Leads/models/Record.php +++ b/modules/Leads/models/Record.php @@ -59,7 +59,7 @@ class Leads_Record_Model extends Vtiger_Record_Model { $privilegeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); $moduleName = 'Accounts'; - if(!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + if(!Users_Privileges_Model::isPermitted($moduleName, 'CreateView')) { return; } @@ -101,7 +101,7 @@ class Leads_Record_Model extends Vtiger_Record_Model { $privilegeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); $moduleName = 'Contacts'; - if(!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + if(!Users_Privileges_Model::isPermitted($moduleName, 'CreateView')) { return; } @@ -148,7 +148,7 @@ class Leads_Record_Model extends Vtiger_Record_Model { $privilegeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); $moduleName = 'Potentials'; - if(!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + if(!Users_Privileges_Model::isPermitted($moduleName, 'CreateView')) { return; } diff --git a/modules/Potentials/models/DetailView.php b/modules/Potentials/models/DetailView.php index 1b9ca0c459aa36edab8a3014569a4f39160388c0..2e17e7cdb16938273bc34b39240f10510769d08b 100644 --- a/modules/Potentials/models/DetailView.php +++ b/modules/Potentials/models/DetailView.php @@ -23,7 +23,7 @@ class Potentials_DetailView_Model extends Vtiger_DetailView_Model { $invoiceModuleModel = Vtiger_Module_Model::getInstance('Invoice'); $quoteModuleModel = Vtiger_Module_Model::getInstance('Quotes'); - if($currentUserModel->hasModuleActionPermission($invoiceModuleModel->getId(), 'EditView')) { + if($currentUserModel->hasModuleActionPermission($invoiceModuleModel->getId(), 'CreateView')) { $basicActionLink = array( 'linktype' => 'DETAILVIEW', 'linklabel' => vtranslate('LBL_CREATE').' '.vtranslate($invoiceModuleModel->getSingularLabelKey(), 'Invoice'), @@ -32,8 +32,8 @@ class Potentials_DetailView_Model extends Vtiger_DetailView_Model { ); $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink); } - - if($currentUserModel->hasModuleActionPermission($quoteModuleModel->getId(), 'EditView')) { + + if($currentUserModel->hasModuleActionPermission($quoteModuleModel->getId(), 'CreateView')) { $basicActionLink = array( 'linktype' => 'DETAILVIEW', 'linklabel' => vtranslate('LBL_CREATE').' '.vtranslate($quoteModuleModel->getSingularLabelKey(), 'Quotes'), @@ -45,7 +45,7 @@ class Potentials_DetailView_Model extends Vtiger_DetailView_Model { $CalendarActionLinks[] = array(); $CalendarModuleModel = Vtiger_Module_Model::getInstance('Calendar'); - if($currentUserModel->hasModuleActionPermission($CalendarModuleModel->getId(), 'EditView')) { + if($currentUserModel->hasModuleActionPermission($CalendarModuleModel->getId(), 'CreateView')) { $CalendarActionLinks[] = array( 'linktype' => 'DETAILVIEW', 'linklabel' => 'LBL_ADD_EVENT', @@ -79,7 +79,7 @@ class Potentials_DetailView_Model extends Vtiger_DetailView_Model { $documentsInstance = Vtiger_Module_Model::getInstance('Documents'); if($userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'Documents', @@ -93,7 +93,7 @@ class Potentials_DetailView_Model extends Vtiger_DetailView_Model { $contactsInstance = Vtiger_Module_Model::getInstance('Contacts'); if($userPrivilegesModel->hasModuleActionPermission($contactsInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($contactsInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($contactsInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'LBL_RELATED_CONTACTS', @@ -107,7 +107,7 @@ class Potentials_DetailView_Model extends Vtiger_DetailView_Model { $productsInstance = Vtiger_Module_Model::getInstance('Products'); if($userPrivilegesModel->hasModuleActionPermission($productsInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($productsInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($productsInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'LBL_RELATED_PRODUCTS', diff --git a/modules/Products/views/MoreCurrenciesList.php b/modules/Products/views/MoreCurrenciesList.php index 34f87a1498343d1c02498b6294c26474f748cf4a..c4c1fb9313ecd1ac8323273491525ac4ab0351bc 100644 --- a/modules/Products/views/MoreCurrenciesList.php +++ b/modules/Products/views/MoreCurrenciesList.php @@ -14,7 +14,7 @@ class Products_MoreCurrenciesList_View extends Vtiger_IndexAjax_View { public function checkPermission(Vtiger_Request $request) { $moduleName = $request->getModule(); - if (!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + if (!(Users_Privileges_Model::isPermitted($moduleName, 'CreateView') || Users_Privileges_Model::isPermitted($moduleName, 'EditView'))) { throw new AppException(vtranslate('LBL_PERMISSION_DENIED', $moduleName)); } } diff --git a/modules/Settings/Profiles/models/Record.php b/modules/Settings/Profiles/models/Record.php index 2fc1b57da6a75dbb6aa43ec4782b2b584459a5da..10b20aa7a4ac2fcd62816cca84ebad74bd288229 100644 --- a/modules/Settings/Profiles/models/Record.php +++ b/modules/Settings/Profiles/models/Record.php @@ -509,8 +509,8 @@ class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model { foreach ($availableActionIds as $actionId) { if ($actionId === 0) { - //Save action permissions = Permissions of Create/Editview action - $actionPermissions[$actionId] = $actionPermissions[1]; + //Save action permissions = Permissions of Create or Editview action + $actionPermissions[$actionId] = $actionPermissions[1] || $actionPermissions[7]; } else { $actionPermissions[$actionId] = $actionPermissions[$actionId]; } diff --git a/modules/Users/DefaultDataPopulator.php b/modules/Users/DefaultDataPopulator.php index 31538ea5288b96c06d1c02f6213420e13179bf19..97b458c689833d5e671009a36214cf520bfa2991 100644 --- a/modules/Users/DefaultDataPopulator.php +++ b/modules/Users/DefaultDataPopulator.php @@ -1870,6 +1870,7 @@ Should any need arise,please do give us a call.'; $this->db->query("insert into vtiger_actionmapping values(4,'DetailView',0)"); $this->db->query("insert into vtiger_actionmapping values(5,'Import',0)"); $this->db->query("insert into vtiger_actionmapping values(6,'Export',0)"); + $this->db->query("insert into vtiger_actionmapping values(7,'CreateView',0)"); //$this->db->query("insert into vtiger_actionmapping values(7,'AddBusinessCard',0)"); $this->db->query("insert into vtiger_actionmapping values(8,'Merge',0)"); $this->db->query("insert into vtiger_actionmapping values(1,'VendorEditView',1)"); diff --git a/modules/Vtiger/models/Action.php b/modules/Vtiger/models/Action.php index 76ceda4d18d184d1611fbc873c77d422af434993..e14de37f8682596096be1730914b9a0c3bb7f359 100644 --- a/modules/Vtiger/models/Action.php +++ b/modules/Vtiger/models/Action.php @@ -13,7 +13,7 @@ */ class Vtiger_Action_Model extends Vtiger_Base_Model { - static $standardActions = array('0' => 'Save','1' => 'EditView','2' => 'Delete','3' => 'index','4' => 'DetailView'); + static $standardActions = array('0' => 'Save','1' => 'EditView','2' => 'Delete','3' => 'index','4' => 'DetailView', '7' => 'CreateView'); static $nonConfigurableActions = array('Save', 'index', 'SavePriceBook', 'SaveVendor', 'DetailViewAjax', 'PriceBookEditView', 'QuickCreate', 'VendorEditView', 'DeletePriceBook', 'DeleteVendor', 'Popup', 'PriceBookDetailView', diff --git a/modules/Vtiger/models/DetailView.php b/modules/Vtiger/models/DetailView.php index 04184ea2d220e33c1562114cc93643cf4565e6f8..f239259c83c814be60e279128dbb1b4428469b64 100644 --- a/modules/Vtiger/models/DetailView.php +++ b/modules/Vtiger/models/DetailView.php @@ -94,7 +94,7 @@ class Vtiger_DetailView_Model extends Vtiger_Base_Model { $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($deletelinkModel); } - if(Users_Privileges_Model::isPermitted($moduleName, 'EditView', $recordId)) { + if(Users_Privileges_Model::isPermitted($moduleName, 'CreateView', $recordId)) { $duplicateLinkModel = array( 'linktype' => 'DETAILVIEWBASIC', 'linklabel' => 'LBL_DUPLICATE', diff --git a/modules/Vtiger/models/ListView.php b/modules/Vtiger/models/ListView.php index aaa6028f73b2811b53a788ce482c49181437b39c..c249c1ec17935ddf2e71fa12bc2f6d59134487d0 100644 --- a/modules/Vtiger/models/ListView.php +++ b/modules/Vtiger/models/ListView.php @@ -424,7 +424,7 @@ class Vtiger_ListView_Model extends Vtiger_Base_Model { */ public function getAdvancedLinks(){ $moduleModel = $this->getModule(); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); $advancedLinks = array(); $importPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'Import'); if($importPermission && $createPermission) { @@ -475,7 +475,7 @@ class Vtiger_ListView_Model extends Vtiger_Base_Model { public function getBasicLinks(){ $basicLinks = array(); $moduleModel = $this->getModule(); - $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView'); + $createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'CreateView'); if($createPermission) { $basicLinks[] = array( 'linktype' => 'LISTVIEWBASIC', diff --git a/modules/Vtiger/models/RelationListView.php b/modules/Vtiger/models/RelationListView.php index 94803f0d156d9cb771d3fcdfc0ea23205396afd3..bd8b767cc8236efd07a48c5fb88f9252e817e947 100644 --- a/modules/Vtiger/models/RelationListView.php +++ b/modules/Vtiger/models/RelationListView.php @@ -143,34 +143,36 @@ class Vtiger_RelationListView_Model extends Vtiger_Base_Model { } $relatedModel = $relationModel->getRelationModuleModel(); - if($relatedModel->get('label') == 'Calendar'){ - - $addLinkList[] = array( - 'linktype' => 'LISTVIEWBASIC', - 'linklabel' => vtranslate('LBL_ADD_EVENT'), - 'linkurl' => $this->getCreateEventRecordUrl(), - 'linkicon' => '', - ); - $addLinkList[] = array( - 'linktype' => 'LISTVIEWBASIC', - 'linklabel' => vtranslate('LBL_ADD_TASK'), - 'linkurl' => $this->getCreateTaskRecordUrl(), - 'linkicon' => '', - ); - }else{ - $addLinkList = array( - array( - 'linktype' => 'LISTVIEWBASIC', - // NOTE: $relatedModel->get('label') assuming it to be a module name - we need singular label for Add action. - 'linklabel' => vtranslate('LBL_ADD')." ".vtranslate('SINGLE_' . $relatedModel->getName(), $relatedModel->getName()), - 'linkurl' => $this->getCreateViewUrl(), - 'linkicon' => '', - ) - ); - } + if ($relatedModel->isPermitted('CreateView')) { + if($relatedModel->get('label') == 'Calendar'){ + + $addLinkList[] = array( + 'linktype' => 'LISTVIEWBASIC', + 'linklabel' => vtranslate('LBL_ADD_EVENT'), + 'linkurl' => $this->getCreateEventRecordUrl(), + 'linkicon' => '', + ); + $addLinkList[] = array( + 'linktype' => 'LISTVIEWBASIC', + 'linklabel' => vtranslate('LBL_ADD_TASK'), + 'linkurl' => $this->getCreateTaskRecordUrl(), + 'linkicon' => '', + ); + }else{ + $addLinkList = array( + array( + 'linktype' => 'LISTVIEWBASIC', + // NOTE: $relatedModel->get('label') assuming it to be a module name - we need singular label for Add action. + 'linklabel' => vtranslate('LBL_ADD')." ".vtranslate('SINGLE_' . $relatedModel->getName(), $relatedModel->getName()), + 'linkurl' => $this->getCreateViewUrl(), + 'linkicon' => '', + ) + ); + } - foreach($addLinkList as $addLink) { - $addLinkModel[] = Vtiger_Link_Model::getInstanceFromValues($addLink); + foreach($addLinkList as $addLink) { + $addLinkModel[] = Vtiger_Link_Model::getInstanceFromValues($addLink); + } } return $addLinkModel; } diff --git a/modules/Vtiger/views/Edit.php b/modules/Vtiger/views/Edit.php index c7500e7f4b2dfd2262ebbe5dbd9bce7ff7917686..de975fb3847377933b1f64035725a5b57f69f3bd 100644 --- a/modules/Vtiger/views/Edit.php +++ b/modules/Vtiger/views/Edit.php @@ -18,9 +18,12 @@ Class Vtiger_Edit_View extends Vtiger_Index_View { $moduleName = $request->getModule(); $record = $request->get('record'); - $recordPermission = Users_Privileges_Model::isPermitted($moduleName, 'EditView', $record); + $actionName = 'CreateView'; + if ($record && !$request->get('isDuplicate')) { + $actionName = 'EditView'; + } - if(!$recordPermission) { + if(!Users_Privileges_Model::isPermitted($moduleName, $actionName, $record)) { throw new AppException(vtranslate('LBL_PERMISSION_DENIED')); } } diff --git a/modules/Vtiger/views/FindDuplicates.php b/modules/Vtiger/views/FindDuplicates.php index 007822e3a820f87202e13f6b22f64765db4a62b3..f726c7b2e54a8d74b5748864223cadf938efe61e 100644 --- a/modules/Vtiger/views/FindDuplicates.php +++ b/modules/Vtiger/views/FindDuplicates.php @@ -60,13 +60,16 @@ class Vtiger_FindDuplicates_View extends Vtiger_List_View { $module = $request->getModule(); $moduleModel = Vtiger_Module_Model::getInstance($module); - $massActionLink = array( - 'linktype' => 'LISTVIEWBASIC', - 'linklabel' => 'LBL_DELETE', - 'linkurl' => 'Javascript:Vtiger_FindDuplicates_Js.massDeleteRecords("index.php?module='.$module.'&action=MassDelete");', - 'linkicon' => '' - ); - $massActionLinks[] = Vtiger_Link_Model::getInstanceFromValues($massActionLink); + $massActionLinks = array(); + if ($moduleModel->isPermitted('Delete')) { + $massActionLink = array( + 'linktype' => 'LISTVIEWBASIC', + 'linklabel' => 'LBL_DELETE', + 'linkurl' => 'Javascript:Vtiger_FindDuplicates_Js.massDeleteRecords("index.php?module='.$module.'&action=MassDelete");', + 'linkicon' => '' + ); + $massActionLinks[] = Vtiger_Link_Model::getInstanceFromValues($massActionLink); + } $viewer->assign('LISTVIEW_LINKS', $massActionLinks); $viewer->assign('MODULE_MODEL', $moduleModel); @@ -116,6 +119,7 @@ class Vtiger_FindDuplicates_View extends Vtiger_List_View { $viewer->assign('PAGING_MODEL', $pagingModel); $viewer->assign('PAGE_NUMBER',$pageNumber); $viewer->assign('MODULE', $module); + $viewer->assign('IS_MODULE_EDITABLE', $moduleModel->isPermitted('EditView')); $viewer->assign('DUPLICATE_SEARCH_FIELDS', $duplicateSearchFields); $customViewModel = CustomView_Record_Model::getAllFilterByModule($module); diff --git a/modules/Vtiger/views/Import.php b/modules/Vtiger/views/Import.php index cea066b77608c86929f33dc32f34972dd67e1116..4046572bb3c537b1d157fead584ee588492ef349 100644 --- a/modules/Vtiger/views/Import.php +++ b/modules/Vtiger/views/Import.php @@ -84,7 +84,7 @@ class Vtiger_Import_View extends Vtiger_Index_View { $viewer->assign('SUPPORTED_FILE_TYPES', Import_Utils_Helper::getSupportedFileExtensions()); $viewer->assign('SUPPORTED_FILE_ENCODING', Import_Utils_Helper::getSupportedFileEncoding()); $viewer->assign('SUPPORTED_DELIMITERS', Import_Utils_Helper::getSupportedDelimiters()); - $viewer->assign('AUTO_MERGE_TYPES', Import_Utils_Helper::getAutoMergeTypes()); + $viewer->assign('AUTO_MERGE_TYPES', Import_Utils_Helper::getAutoMergeTypes($moduleName)); //Duplicate records handling not supported for inventory moduels $duplicateHandlingNotSupportedModules = getInventoryModules(); diff --git a/modules/Vtiger/views/List.php b/modules/Vtiger/views/List.php index 0f1cdbaba9baba0d1c6d86ec8f90257d7f2affb2..97a3a82186fb62b709ac9d5c66d2cbde669668f1 100644 --- a/modules/Vtiger/views/List.php +++ b/modules/Vtiger/views/List.php @@ -216,6 +216,7 @@ class Vtiger_List_View extends Vtiger_Index_View { } $viewer->assign('LIST_VIEW_MODEL', $listViewModel); $viewer->assign('GROUPS_IDS', Vtiger_Util_Helper::getGroupsIdsForUsers($currentUser->getId())); + $viewer->assign('IS_RECORD_CREATABLE', $listViewModel->getModule()->isPermitted('CreateView')); $viewer->assign('IS_MODULE_EDITABLE', $listViewModel->getModule()->isPermitted('EditView')); $viewer->assign('IS_MODULE_DELETABLE', $listViewModel->getModule()->isPermitted('Delete')); $viewer->assign('SEARCH_DETAILS', $searchParmams); diff --git a/modules/Vtiger/views/QuickCreateAjax.php b/modules/Vtiger/views/QuickCreateAjax.php index 586d8f8927977acfd730648be7bb6e74e7e1a31f..7a0bbcca519cca09fc3453e4897e9af88ce5be65 100644 --- a/modules/Vtiger/views/QuickCreateAjax.php +++ b/modules/Vtiger/views/QuickCreateAjax.php @@ -13,7 +13,7 @@ class Vtiger_QuickCreateAjax_View extends Vtiger_IndexAjax_View { public function checkPermission(Vtiger_Request $request) { $moduleName = $request->getModule(); - if (!(Users_Privileges_Model::isPermitted($moduleName, 'EditView'))) { + if (!(Users_Privileges_Model::isPermitted($moduleName, 'CreateView'))) { throw new AppException(vtranslate('LBL_PERMISSION_DENIED', $moduleName)); } } diff --git a/packages/vtiger/mandatory/Import.zip b/packages/vtiger/mandatory/Import.zip index a5ab5cc482a2ecb9de2f898af15452dc9c48576d..effcae65f41b030ee57f0e61235427d50d0fc555 100644 Binary files a/packages/vtiger/mandatory/Import.zip and b/packages/vtiger/mandatory/Import.zip differ diff --git a/packages/vtiger/mandatory/MailManager.zip b/packages/vtiger/mandatory/MailManager.zip index e76809c693ddbeacf28cf7f32db3027fd9299c10..e71f5343a1281bb51b7980c718503413d7a6421d 100644 Binary files a/packages/vtiger/mandatory/MailManager.zip and b/packages/vtiger/mandatory/MailManager.zip differ diff --git a/packages/vtiger/optional/ModComments.zip b/packages/vtiger/optional/ModComments.zip index 38d0f773a3c661cbd7348f56afbf14a1f71674f6..aff4040abc6ba2367d661e93db524783e602788b 100644 Binary files a/packages/vtiger/optional/ModComments.zip and b/packages/vtiger/optional/ModComments.zip differ diff --git a/packages/vtiger/optional/Projects.zip b/packages/vtiger/optional/Projects.zip index f85a778a156e3ad15481fc4e673bc137a7e374c0..1b959c6144e7007e1bf84012a05653bac82c114f 100644 Binary files a/packages/vtiger/optional/Projects.zip and b/packages/vtiger/optional/Projects.zip differ diff --git a/pkg/vtiger/modules/Import/modules/Import/actions/Data.php b/pkg/vtiger/modules/Import/modules/Import/actions/Data.php index df0779552cb0ced4722c15167ef168075af31bed..f9669098f1d1212044ce313b2258eac94ea13582 100644 --- a/pkg/vtiger/modules/Import/modules/Import/actions/Data.php +++ b/pkg/vtiger/modules/Import/modules/Import/actions/Data.php @@ -435,15 +435,15 @@ class Import_Data_Action extends Vtiger_Action_Controller { } } if ((empty($entityId) || $entityId == 0) && !empty($referenceModuleName)) { - if(isPermitted($referenceModuleName, 'EditView') == 'yes') { - try { - $wsEntityIdInfo = $this->createEntityRecord($referenceModuleName, $entityLabel); - $wsEntityId = $wsEntityIdInfo['id']; - $entityIdComponents = vtws_getIdComponents($wsEntityId); - $entityId = $entityIdComponents[1]; - } catch (Exception $e) { - $entityId = false; - } + if(isPermitted($referenceModuleName, 'CreateView') == 'yes') { + try { + $wsEntityIdInfo = $this->createEntityRecord($referenceModuleName, $entityLabel); + $wsEntityId = $wsEntityIdInfo['id']; + $entityIdComponents = vtws_getIdComponents($wsEntityId); + $entityId = $entityIdComponents[1]; + } catch (Exception $e) { + $entityId = false; + } } } $fieldData[$fieldName] = $entityId; @@ -574,32 +574,32 @@ class Import_Data_Action extends Vtiger_Action_Controller { $fieldData = DataTransform::sanitizeData($fieldData, $moduleMeta); $entityIdInfo = vtws_create($moduleName, $fieldData, $this->user); - $adb = PearDatabase::getInstance(); - $entityIdComponents = vtws_getIdComponents($entityIdInfo['id']); - $recordId = $entityIdComponents[1]; - $entityfields = getEntityFieldNames($moduleName); - switch($moduleName) { - case 'HelpDesk': $entityfields['fieldname'] = array('ticket_title');break; - case 'Documents':$entityfields['fieldname'] = array('notes_title');break; - case 'Documents': $entityfields['fieldname'] = array('notes_title');break; - } - $label = ''; - if(is_array($entityfields['fieldname'])){ - foreach($entityfields['fieldname'] as $field){ - $label .= $fieldData[$field]." "; - } - }else { - $label = $fieldData[$entityfields['fieldname']]; - } + $adb = PearDatabase::getInstance(); + $entityIdComponents = vtws_getIdComponents($entityIdInfo['id']); + $recordId = $entityIdComponents[1]; + $entityfields = getEntityFieldNames($moduleName); + switch($moduleName) { + case 'HelpDesk': $entityfields['fieldname'] = array('ticket_title');break; + case 'Documents':$entityfields['fieldname'] = array('notes_title');break; + case 'Documents': $entityfields['fieldname'] = array('notes_title');break; + } + $label = ''; + if(is_array($entityfields['fieldname'])){ + foreach($entityfields['fieldname'] as $field){ + $label .= $fieldData[$field]." "; + } + }else { + $label = $fieldData[$entityfields['fieldname']]; + } - $label = trim($label); - $adb->pquery('UPDATE vtiger_crmentity SET label=? WHERE crmid=?', array($label, $recordId)); + $label = trim($label); + $adb->pquery('UPDATE vtiger_crmentity SET label=? WHERE crmid=?', array($label, $recordId)); - $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); - $focus = $recordModel->getEntity(); - $focus->id = $recordId; - $focus->column_fields = $fieldData; - $this->entityData[] = VTEntityData::fromCRMEntity($focus); + $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); + $focus = $recordModel->getEntity(); + $focus->id = $recordId; + $focus->column_fields = $fieldData; + $this->entityData[] = VTEntityData::fromCRMEntity($focus); $focus->updateMissingSeqNumber($moduleName); return $entityIdInfo; } diff --git a/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php b/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php index 0b42706ea15da7737ea4b671b1875a4c986b3141..507c6637a2fd4c97dffde0db5f909bea2304d548 100644 --- a/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php +++ b/pkg/vtiger/modules/Import/modules/Import/helpers/Utils.php @@ -44,11 +44,13 @@ class Import_Utils_Helper { return self::$supportedDelimiters; } - public static function getAutoMergeTypes() { - return array( - self::$AUTO_MERGE_IGNORE => 'Skip', - self::$AUTO_MERGE_OVERWRITE => 'Overwrite', - self::$AUTO_MERGE_MERGEFIELDS => 'Merge'); + public static function getAutoMergeTypes($moduleName) { + $mergeTypes = array(self::$AUTO_MERGE_IGNORE => 'Skip'); + if (Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + $mergeTypes[self::$AUTO_MERGE_OVERWRITE] = 'Overwrite'; + $mergeTypes[self::$AUTO_MERGE_MERGEFIELDS] = 'Merge'; + } + return $mergeTypes; } public static function getMaxUploadSize() { diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php b/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php index 0ae0bd9894be9415a5fcf716a4b0009f9619330c..ad9e819e62abea88f9b49fb36aded84804a3496c 100644 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/MailManager.php @@ -105,7 +105,7 @@ class MailManager { static function checkModuleWriteAccessForCurrentUser($module) { global $current_user; - if (isPermitted($module, 'EditView') == "yes" && vtlib_isModuleActive($module)) { + if (isPermitted($module, 'CreateView') == "yes" && vtlib_isModuleActive($module)) { return true; } return false; diff --git a/pkg/vtiger/modules/MailManager/modules/MailManager/views/Relation.php b/pkg/vtiger/modules/MailManager/modules/MailManager/views/Relation.php index 5a6744ed364ff1b8debee7d4536df4591f6f7a0b..bfcfa60d0542e1659b0ead2383885a5dab646471 100755 --- a/pkg/vtiger/modules/MailManager/modules/MailManager/views/Relation.php +++ b/pkg/vtiger/modules/MailManager/modules/MailManager/views/Relation.php @@ -361,6 +361,7 @@ class MailManager_Relation_View extends MailManager_Abstract_View { public function getCurrentUserMailManagerAllowedModules() { $moduleListForCreateRecordFromMail = array('Contacts', 'Accounts', 'Leads', 'HelpDesk', 'Calendar'); + $mailManagerAllowedModules = array(); foreach($moduleListForCreateRecordFromMail as $module) { if(MailManager::checkModuleWriteAccessForCurrentUser($module)) { $mailManagerAllowedModules[] = $module; @@ -376,6 +377,7 @@ class MailManager_Relation_View extends MailManager_Abstract_View { public function linkToAvailableActions() { $moduleListForLinkTo = array('Calendar','HelpDesk','ModComments','Emails'); + $mailManagerAllowedModules = array(); foreach($moduleListForLinkTo as $module) { if(MailManager::checkModuleWriteAccessForCurrentUser($module)) { $mailManagerAllowedModules[] = $module; diff --git a/pkg/vtiger/modules/ModComments/modules/ModComments/views/Edit.php b/pkg/vtiger/modules/ModComments/modules/ModComments/views/Edit.php index 3242ffa59946d138700ef04979322c652cfe312a..b29198a6281a9eb5ed0418589a4a9e8b4dc0c0ec 100644 --- a/pkg/vtiger/modules/ModComments/modules/ModComments/views/Edit.php +++ b/pkg/vtiger/modules/ModComments/modules/ModComments/views/Edit.php @@ -14,7 +14,12 @@ Class ModComments_Edit_View extends Vtiger_Edit_View { $currentUserModel = Users_Record_Model::getCurrentUserModel(); $moduleName = $request->getModule(); $record = $request->get('record'); - if (!empty($record) || !Users_Privileges_Model::isPermitted($moduleName, 'EditView')) { + $actionName = 'CreateView'; + if ($record && !$request->get('isDuplicate')) { + $actionName = 'EditView'; + } + + if(!Users_Privileges_Model::isPermitted($moduleName, $actionName, $record)) { throw new AppException('LBL_PERMISSION_DENIED'); } } diff --git a/pkg/vtiger/modules/Projects/Project/modules/Project/models/DetailView.php b/pkg/vtiger/modules/Projects/Project/modules/Project/models/DetailView.php index f01a2a4907d84a6079306e9c591eec6e0e87c04b..2c6b7db52870664ddfd80c32745d4965e73da578 100644 --- a/pkg/vtiger/modules/Projects/Project/modules/Project/models/DetailView.php +++ b/pkg/vtiger/modules/Projects/Project/modules/Project/models/DetailView.php @@ -21,7 +21,7 @@ class Project_DetailView_Model extends Vtiger_DetailView_Model { $helpDeskInstance = Vtiger_Module_Model::getInstance('HelpDesk'); if($userPrivilegesModel->hasModuleActionPermission($helpDeskInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($helpDeskInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($helpDeskInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'HelpDesk', @@ -35,7 +35,7 @@ class Project_DetailView_Model extends Vtiger_DetailView_Model { $projectMileStoneInstance = Vtiger_Module_Model::getInstance('ProjectMilestone'); if($userPrivilegesModel->hasModuleActionPermission($projectMileStoneInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($projectMileStoneInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($projectMileStoneInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'LBL_MILESTONES', @@ -49,7 +49,7 @@ class Project_DetailView_Model extends Vtiger_DetailView_Model { $projectTaskInstance = Vtiger_Module_Model::getInstance('ProjectTask'); if($userPrivilegesModel->hasModuleActionPermission($projectTaskInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($projectTaskInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($projectTaskInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'LBL_TASKS', @@ -64,7 +64,7 @@ class Project_DetailView_Model extends Vtiger_DetailView_Model { $documentsInstance = Vtiger_Module_Model::getInstance('Documents'); if($userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'DetailView')) { - $createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'EditView'); + $createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'CreateView'); $widgets[] = array( 'linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'Documents', diff --git a/pkg/vtiger/modules/Projects/ProjectTask/modules/ProjectTask/ProjectTask.php b/pkg/vtiger/modules/Projects/ProjectTask/modules/ProjectTask/ProjectTask.php index 2873f4f1e62fe03d2c25ad5304264c2a55730330..703285c6e6e81936bd19a672f7f1f5adc79ea904 100644 --- a/pkg/vtiger/modules/Projects/ProjectTask/modules/ProjectTask/ProjectTask.php +++ b/pkg/vtiger/modules/Projects/ProjectTask/modules/ProjectTask/ProjectTask.php @@ -391,7 +391,7 @@ class ProjectTask extends CRMEntity { */ static function isLinkPermitted($linkData) { $moduleName = "ProjectTask"; - if(vtlib_isModuleActive($moduleName) && isPermitted($moduleName, 'EditView') == 'yes') { + if(vtlib_isModuleActive($moduleName) && isPermitted($moduleName, 'CreateView') == 'yes') { return true; } return false; diff --git a/tabdata.php b/tabdata.php index d3dd4e1109ef0d4705f94b7b9e34cf5e7acac193..96e6c7d888d5d5bc2430a29136a185dc39019ff3 100644 --- a/tabdata.php +++ b/tabdata.php @@ -17,7 +17,7 @@ $tab_seq_array=array('1'=>0,'2'=>0,'3'=>0,'4'=>0,'6'=>0,'7'=>0,'8'=>0,'9'=>0,'10 $tab_ownedby_array=array('1'=>1,'2'=>0,'3'=>1,'4'=>0,'6'=>0,'7'=>0,'8'=>0,'9'=>0,'10'=>1,'13'=>0,'14'=>1,'15'=>1,'16'=>0,'18'=>1,'19'=>1,'20'=>0,'21'=>0,'22'=>0,'23'=>0,'24'=>1,'25'=>1,'26'=>0,'27'=>1,'28'=>1,'29'=>1,); -$action_id_array=array('Save'=>0,'SavePriceBook'=>0,'SaveVendor'=>0,'DetailViewAjax'=>1,'EditView'=>1,'PriceBookEditView'=>1,'QuickCreate'=>1,'VendorEditView'=>1,'Delete'=>2,'DeletePriceBook'=>2,'DeleteVendor'=>2,'index'=>3,'Popup'=>3,'DetailView'=>4,'PriceBookDetailView'=>4,'TagCloud'=>4,'VendorDetailView'=>4,'Import'=>5,'Export'=>6,'Merge'=>8,'ConvertLead'=>9,'DuplicatesHandling'=>10); +$action_id_array=array('Save'=>0,'SavePriceBook'=>0,'SaveVendor'=>0,'DetailViewAjax'=>1,'EditView'=>1,'PriceBookEditView'=>1,'QuickCreate'=>1,'VendorEditView'=>1,'Delete'=>2,'DeletePriceBook'=>2,'DeleteVendor'=>2,'index'=>3,'Popup'=>3,'DetailView'=>4,'PriceBookDetailView'=>4,'TagCloud'=>4,'VendorDetailView'=>4,'Import'=>5,'Export'=>6,'Merge'=>8,'ConvertLead'=>9,'DuplicatesHandling'=>10,'CreateView'=>7); $action_name_array=array(0=>'Save',1=>'EditView',2=>'Delete',3=>'index',4=>'DetailView',5=>'Import',6=>'Export',8=>'Merge',9=>'ConvertLead',10=>'DuplicatesHandling'); ?> \ No newline at end of file diff --git a/wip-migration-split-create-edit-permissions.php b/wip-migration-split-create-edit-permissions.php new file mode 100644 index 0000000000000000000000000000000000000000..96724152ecb5658cca765f616da70e7b40db2eeb --- /dev/null +++ b/wip-migration-split-create-edit-permissions.php @@ -0,0 +1,38 @@ +<?php +/*+********************************************************************************** + * The contents of this file are subject to the vtiger CRM Public License Version 1.0 + * ("License"); You may not use this file except in compliance with the License + * The Original Code is: vtiger CRM Open Source + * The Initial Developer of the Original Code is vtiger. + * Portions created by vtiger are Copyright (C) vtiger. + * All Rights Reserved. + ************************************************************************************/ + +require_once 'include/utils/utils.php'; +$adb = PearDatabase::getInstance(); + +$actionMappingResult = $adb->pquery('SELECT 1 FROM vtiger_actionmapping WHERE actionname=?', array('CreateView')); +if (!$adb->num_rows($actionMappingResult)) { + $adb->pquery('INSERT INTO vtiger_actionmapping VALUES(?, ?, ?)', array(7, 'CreateView', 0)); +} + +$createActionResult = $adb->pquery('SELECT * FROM vtiger_profile2standardpermissions WHERE operation=?', array(1)); +$query = 'INSERT INTO vtiger_profile2standardpermissions VALUES'; +while($rowData = $adb->fetch_array($createActionResult)) { + $tabId = $rowData['tabid']; + $profileId = $rowData['profileid']; + $permissions = $rowData['permissions']; + $query .= "('$profileId', '$tabId', '7', '$permissions'),"; +} +$adb->pquery(trim($query, ','), array()); + +require_once './modules/Users/CreateUserPrivilegeFile.php'; +$usersResult = $adb->pquery('SELECT id FROM vtiger_users', array()); +$numOfRows = $adb->num_rows($usersResult); +$userIdsList = array(); +for($i=0; $i<$numOfRows; $i++) { + $userId = $adb->query_result($usersResult, $i, 'id'); + createUserPrivilegesfile($userId); +} + +echo '<br>Successfully updated create and edit permissions<br>'; \ No newline at end of file