From 031600a311747f7716fb4f012f1f312f8de27bb7 Mon Sep 17 00:00:00 2001 From: yogeshwar <yogeshwar.g@vtigersolutions.com> Date: Fri, 7 Jun 2024 15:50:22 +0530 Subject: [PATCH] E-All WorkFlows --- data/CRMEntity.php | 1 + includes/runtime/Viewer.php | 2 +- .../Settings/Workflows/AdvanceFilter.tpl | 2 +- .../Workflows/AdvanceFilterCondition.tpl | 17 +++++++++++++---- .../modules/Settings/Workflows/CreateEntity.tpl | 6 +++--- .../v7/modules/Settings/Workflows/EditView.tpl | 2 +- .../Settings/Workflows/FieldExpressions.tpl | 2 +- .../Settings/Workflows/ListViewContents.tpl | 12 ++++++------ .../Workflows/Tasks/VTCreateEventTask.tpl | 4 ++-- .../Workflows/Tasks/VTCreateTodoTask.tpl | 2 +- .../Settings/Workflows/Tasks/VTEmailTask.tpl | 2 +- .../Settings/Workflows/WorkFlowTrigger.tpl | 7 +++++-- modules/Calendar/Activity.php | 4 ++-- .../models/EditTaskRecordStructure.php | 1 + modules/Settings/Workflows/models/Record.php | 9 ++++++--- .../Settings/Workflows/models/TaskRecord.php | 6 +++++- modules/Settings/Workflows/views/EditV7Task.php | 11 ++++++++--- modules/Users/CreateUserPrivilegeFile.php | 1 + .../expression_engine/VTExpressionsManager.inc | 1 + .../tasks/VTCreateEventTask.inc | 6 ++++-- .../tasks/VTCreateTodoTask.inc | 7 +++++-- vtlib/Vtiger/Functions.php | 2 +- 22 files changed, 70 insertions(+), 37 deletions(-) diff --git a/data/CRMEntity.php b/data/CRMEntity.php index c57f45702..ae8239f3b 100644 --- a/data/CRMEntity.php +++ b/data/CRMEntity.php @@ -411,6 +411,7 @@ class CRMEntity { global $current_user, $app_strings; $log->info("function insertIntoEntityTable " . $module . ' vtiger_table name ' . $table_name); global $adb; + global $_FILES; $insertion_mode = $this->mode; $table_name = Vtiger_Util_Helper::validateStringForSql($table_name); $tablekey = $this->tab_name_index[$table_name]; diff --git a/includes/runtime/Viewer.php b/includes/runtime/Viewer.php index 32044100f..d7b41cc89 100644 --- a/includes/runtime/Viewer.php +++ b/includes/runtime/Viewer.php @@ -90,7 +90,7 @@ class Vtiger_Viewer extends Smarty { 'array_map', 'array_key_exists', 'get_class', 'vtlib_array', 'getDuplicatesPreventionMessage', 'htmlentities', 'purifyHtmlEventAttributes', 'getCurrencySymbolandCRate', 'mb_substr', 'isPermitted', 'getEntityName', 'function_exists', 'php7_trim', 'php7_htmlentities', 'strtolower', 'strtoupper', 'str_replace', 'urlencode', 'getTranslatedCurrencyString', 'getTranslatedString', 'is_object', 'is_numeric', - 'php7_sizeof', 'method_exists','implode','mt_rand','substr','in_array'); + 'php7_sizeof', 'method_exists','implode','mt_rand','substr','in_array','array_keys'); foreach ($modifiers as $modifier) { if (function_exists($modifier)) { $this->registerPlugin('modifier', $modifier, $modifier); diff --git a/layouts/v7/modules/Settings/Workflows/AdvanceFilter.tpl b/layouts/v7/modules/Settings/Workflows/AdvanceFilter.tpl index f591d987f..65444206d 100644 --- a/layouts/v7/modules/Settings/Workflows/AdvanceFilter.tpl +++ b/layouts/v7/modules/Settings/Workflows/AdvanceFilter.tpl @@ -53,7 +53,7 @@ <button type="button" class="btn btn-default">{vtranslate('LBL_ADD_CONDITION',$MODULE)}</button> </div> <div class="groupCondition"> - {assign var=GROUP_CONDITION value=$ALL_CONDITION_CRITERIA['condition']} + {assign var=GROUP_CONDITION value=(isset($ALL_CONDITION_CRITERIA['condition'])) ? $ALL_CONDITION_CRITERIA['condition'] : ''} {if empty($GROUP_CONDITION)} {assign var=GROUP_CONDITION value="and"} {/if} diff --git a/layouts/v7/modules/Settings/Workflows/AdvanceFilterCondition.tpl b/layouts/v7/modules/Settings/Workflows/AdvanceFilterCondition.tpl index a018f960a..a46871901 100644 --- a/layouts/v7/modules/Settings/Workflows/AdvanceFilterCondition.tpl +++ b/layouts/v7/modules/Settings/Workflows/AdvanceFilterCondition.tpl @@ -26,7 +26,7 @@ {assign var=columnNameApi value=getCustomViewColumnName} {/if} <option value="{$FIELD_MODEL->$columnNameApi()}" data-fieldtype="{$FIELD_MODEL->getFieldType()}" data-field-name="{$FIELD_NAME}" - {if decode_html($FIELD_MODEL->$columnNameApi()) eq $CONDITION_INFO['columnname']} + {if isset($CONDITION_INFO['columnname']) && decode_html($FIELD_MODEL->$columnNameApi()) eq $CONDITION_INFO['columnname']} {assign var=FIELD_TYPE value=$FIELD_MODEL->getFieldDataType()} {assign var=SELECTED_FIELD_MODEL value=$FIELD_MODEL} {$FIELD_INFO['value'] = decode_html($CONDITION_INFO['value'])} @@ -68,18 +68,27 @@ <span class="conditionComparator col-lg-3 col-md-3 col-sm-3"> <select class="{if empty($NOCHOSEN)}select2{/if} col-lg-12" name="comparator" data-placeholder="{vtranslate('LBL_NONE',$QUALIFIED_MODULE)}"> <option value="none">{vtranslate('LBL_NONE',$MODULE)}</option> - {assign var=ADVANCE_FILTER_OPTIONS value=$ADVANCED_FILTER_OPTIONS_BY_TYPE[$FIELD_TYPE]} - {foreach item=ADVANCE_FILTER_OPTION from=$ADVANCE_FILTER_OPTIONS} + {if isset($FIELD_TYPE)} + {assign var=ADVANCE_FILTER_OPTIONS value=$ADVANCED_FILTER_OPTIONS_BY_TYPE[$FIELD_TYPE]} + {foreach item=ADVANCE_FILTER_OPTION from=$ADVANCE_FILTER_OPTIONS} <option value="{$ADVANCE_FILTER_OPTION}" {if $ADVANCE_FILTER_OPTION === $CONDITION_INFO['comparator']} selected {/if} >{vtranslate($ADVANCED_FILTER_OPTIONS[$ADVANCE_FILTER_OPTION])}</option> {/foreach} + {/if} + </select> </span> <span class="col-lg-4 col-md-4 col-sm-4 fieldUiHolder"> - <input name="{if $SELECTED_FIELD_MODEL}{$SELECTED_FIELD_MODEL->get('name')}{/if}" data-value="value" class="inputElement col-lg-12" type="text" value="{$CONDITION_INFO['value']|escape}" /> + {if isset($CONDITION_INFO['value'])} + {assign var=CONDITIONINFO value=$CONDITION_INFO['value'] } + + {else} + {assign var=CONDITIONINFO value=''} + {/if} + <input name="{if isset($SELECTED_FIELD_MODEL) && $SELECTED_FIELD_MODEL}{$SELECTED_FIELD_MODEL->get('name')}{/if}" data-value="value" class="inputElement col-lg-12" type="text" value="{$CONDITIONINFO|escape}" /> </span> <span class="hide"> <!-- TODO : see if you need to respect CONDITION_INFO condition or / and --> diff --git a/layouts/v7/modules/Settings/Workflows/CreateEntity.tpl b/layouts/v7/modules/Settings/Workflows/CreateEntity.tpl index cc3405b67..bf423fca6 100644 --- a/layouts/v7/modules/Settings/Workflows/CreateEntity.tpl +++ b/layouts/v7/modules/Settings/Workflows/CreateEntity.tpl @@ -10,7 +10,7 @@ {* START YOUR IMPLEMENTATION FROM BELOW. Use {debug} for information *} <input type="hidden" id="fieldValueMapping" name="field_value_mapping" value='{$TASK_OBJECT->field_value_mapping}' /> -<input type="hidden" value="{if $TASK_ID}{$TASK_OBJECT->reference_field}{else}{$REFERENCE_FIELD_NAME}{/if}" name='reference_field' id='reference_field' /> +<input type="hidden" value="{if $TASK_ID}{$TASK_OBJECT->reference_field}{else}{(isset($REFERENCE_FIELD_NAME)) ? $REFERENCE_FIELD_NAME : ''}{/if}" name='reference_field' id='reference_field' /> <div class="conditionsContainer" id="save_fieldvaluemapping"> {if $RELATED_MODULE_MODEL_NAME neq '' && getTabid($RELATED_MODULE_MODEL_NAME)} <div> @@ -56,7 +56,7 @@ {include file="FieldExpressions.tpl"|@vtemplate_path:$QUALIFIED_MODULE RELATED_MODULE_MODEL=$RELATED_MODULE_MODEL MODULE_MODEL=$MODULE_MODEL FIELD_EXPRESSIONS=$FIELD_EXPRESSIONS} {else} - {if $RELATED_MODULE_MODEL} + {if isset($RELATED_MODULE_MODEL) && $RELATED_MODULE_MODEL} <div> <button type="button" class="btn btn-default" id="addFieldBtn">{vtranslate('LBL_ADD_FIELD',$QUALIFIED_MODULE)}</button> </div><br> @@ -94,7 +94,7 @@ {/if} {/if} </div><br> -{if $RELATED_MODULE_MODEL} +{if isset($RELATED_MODULE_MODEL) && $RELATED_MODULE_MODEL} <div class="row form-group basicAddFieldContainer hide"> <span class="col-lg-4"> <select name="fieldname" style="min-width: 250px"> diff --git a/layouts/v7/modules/Settings/Workflows/EditView.tpl b/layouts/v7/modules/Settings/Workflows/EditView.tpl index 6baa61089..428f93906 100644 --- a/layouts/v7/modules/Settings/Workflows/EditView.tpl +++ b/layouts/v7/modules/Settings/Workflows/EditView.tpl @@ -50,7 +50,7 @@ {vtranslate('LBL_TARGET_MODULE', $QUALIFIED_MODULE)} </label> <div class="col-sm-5 controls"> - {if $MODE eq 'edit'} + {if isset($MODE) && $MODE eq 'edit'} <div class="pull-left"> <input type='text' disabled='disabled' class="inputElement" value="{vtranslate($MODULE_MODEL->getName(), $MODULE_MODEL->getName())}" > <input type='hidden' id="module_name" name='module_name' value="{$MODULE_MODEL->get('name')}" > diff --git a/layouts/v7/modules/Settings/Workflows/FieldExpressions.tpl b/layouts/v7/modules/Settings/Workflows/FieldExpressions.tpl index 94cda5d7f..c52ea7623 100644 --- a/layouts/v7/modules/Settings/Workflows/FieldExpressions.tpl +++ b/layouts/v7/modules/Settings/Workflows/FieldExpressions.tpl @@ -35,7 +35,7 @@ {/foreach} </select> </span> - {if $RELATED_MODULE_MODEL neq ''} + {if isset($RELATED_MODULE_MODEL) && $RELATED_MODULE_MODEL neq ''} <span name="{$RELATED_MODULE_MODEL->get('name')}" class="useFieldElement"> {assign var=MODULE_FIELDS value=$RELATED_MODULE_MODEL->getFields()} <select class="useField" data-placeholder="{vtranslate('LBL_USE_FIELD',$QUALIFIED_MODULE)}" style="min-width: 160px;"> diff --git a/layouts/v7/modules/Settings/Workflows/ListViewContents.tpl b/layouts/v7/modules/Settings/Workflows/ListViewContents.tpl index bf9a5aef5..060dff1e5 100644 --- a/layouts/v7/modules/Settings/Workflows/ListViewContents.tpl +++ b/layouts/v7/modules/Settings/Workflows/ListViewContents.tpl @@ -27,7 +27,7 @@ <option value="" data-count='{$MODULES_COUNT['All']}'>{vtranslate('LBL_ALL', $QUALIFIED_MODULE)} {vtranslate('LBL_WORKFLOWS')} </option> {foreach item=MODULE_MODEL key=TAB_ID from=$SUPPORTED_MODULE_MODELS} - <option {if $SOURCE_MODULE eq $MODULE_MODEL->getName()} selected="" {/if} value="{$MODULE_MODEL->getName()}" data-count='{if $MODULES_COUNT[$TAB_ID]}{$MODULES_COUNT[$TAB_ID]}{else}0{/if}'> + <option {if $SOURCE_MODULE eq $MODULE_MODEL->getName()} selected="" {/if} value="{$MODULE_MODEL->getName()}" data-count='{if isset($MODULES_COUNT[$TAB_ID]) && $MODULES_COUNT[$TAB_ID]}{$MODULES_COUNT[$TAB_ID]}{else}0{/if}'> {if $MODULE_MODEL->getName() eq 'Calendar'} {vtranslate('LBL_TASK', $MODULE_MODEL->getName())} {vtranslate('LBL_WORKFLOWS')} {else} @@ -88,11 +88,11 @@ {assign var=LISTVIEW_HEADERNAME value=$LISTVIEW_HEADER->get('name')} {assign var=LAST_COLUMN value=$LISTVIEW_HEADER@last} {if $LISTVIEW_HEADERNAME neq 'summary' && $LISTVIEW_HEADERNAME neq 'module_name'} - <td class="listViewEntryValue {$WIDTHTYPE}" width="{$WIDTH}%" nowrap> + <td class="listViewEntryValue {$WIDTHTYPE}" width="{(isset($WIDTH)) ? $WIDTH : ''}%" nowrap> {if $LISTVIEW_HEADERNAME eq 'test'} {assign var=WORKFLOW_CONDITION value=$LISTVIEW_ENTRY->getConditonDisplayValue()} - {assign var=ALL_CONDITIONS value=$WORKFLOW_CONDITION['All']} - {assign var=ANY_CONDITIONS value=$WORKFLOW_CONDITION['Any']} + {assign var=ALL_CONDITIONS value=(isset($WORKFLOW_CONDITION['All'])) ? $WORKFLOW_CONDITION['All'] : ''} + {assign var=ANY_CONDITIONS value=(isset($WORKFLOW_CONDITION['Any'])) ? $WORKFLOW_CONDITION['Any'] : ''} <span><strong>{vtranslate('All')} : </strong></span> {if is_array($ALL_CONDITIONS) && !empty($ALL_CONDITIONS)} {foreach item=ALL_CONDITION from=$ALL_CONDITIONS name=allCounter} @@ -125,14 +125,14 @@ {/if} </td> {elseif $LISTVIEW_HEADERNAME eq 'module_name' && empty($SOURCE_MODULE)} - <td class="listViewEntryValue {$WIDTHTYPE}" width="{$WIDTH}%" nowrap> + <td class="listViewEntryValue {$WIDTHTYPE}" width="{(isset($WIDTH)) ? $WIDTH : ''}%" nowrap> {assign var="MODULE_ICON_NAME" value="{strtolower($LISTVIEW_ENTRY->get('raw_module_name'))}"} {Vtiger_Module_Model::getModuleIconPath($LISTVIEW_ENTRY->get('raw_module_name'))} </td> {else} {/if} {/foreach} - <td class="listViewEntryValue {$WIDTHTYPE}" width="{$WIDTH}%" nowrap> + <td class="listViewEntryValue {$WIDTHTYPE}" width="{(isset($WIDTH)) ? $WIDTH : ''}%" nowrap> {assign var=ACTIONS value=$LISTVIEW_ENTRY->getActionsDisplayValue()} {if is_array($ACTIONS) && !empty($ACTIONS)} {foreach item=ACTION_COUNT key=ACTION_NAME from=$ACTIONS} diff --git a/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateEventTask.tpl b/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateEventTask.tpl index f67023b31..9d60a98f3 100644 --- a/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateEventTask.tpl +++ b/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateEventTask.tpl @@ -80,7 +80,7 @@ {if $TASK_OBJECT->time neq ''} {assign var=TIME value=$TASK_OBJECT->time} {/if} - <input type="text" class="timepicker-default inputElement" data-format="{$timeFormat}" value="{$START_TIME}" name="startTime" /> + <input type="text" class="timepicker-default inputElement" data-format="{$timeFormat}" value="{(isset($START_TIME)) ? $START_TIME : ''}" name="startTime" /> <span class="input-group-addon"> <i class="fa fa-clock-o"></i> </span> @@ -123,7 +123,7 @@ {if $TASK_OBJECT->time neq ''} {assign var=TIME value=$TASK_OBJECT->time} {/if} - <input type="text" class="timepicker-default inputElement" value="{$END_TIME}" name="endTime" /> + <input type="text" class="timepicker-default inputElement" value="{(isset($END_TIME)) ? $END_TIME : ''}" name="endTime" /> <span class="input-group-addon"> <i class="fa fa-clock-o"></i> </span> diff --git a/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateTodoTask.tpl b/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateTodoTask.tpl index c1149bd40..155ecfa1e 100644 --- a/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateTodoTask.tpl +++ b/layouts/v7/modules/Settings/Workflows/Tasks/VTCreateTodoTask.tpl @@ -77,7 +77,7 @@ {if $TASK_OBJECT->time neq ''} {assign var=TIME value=$TASK_OBJECT->time} {/if} - <input type="text" class="timepicker-default inputElement" value="{$TIME}" name="time" /> + <input type="text" class="timepicker-default inputElement" value="{(isset($TIME)) ? $TIME : ''}" name="time" /> <span class="input-group-addon"> <i class="fa fa-clock-o"></i> </span> diff --git a/layouts/v7/modules/Settings/Workflows/Tasks/VTEmailTask.tpl b/layouts/v7/modules/Settings/Workflows/Tasks/VTEmailTask.tpl index 9a8e0697d..5b31afe24 100644 --- a/layouts/v7/modules/Settings/Workflows/Tasks/VTEmailTask.tpl +++ b/layouts/v7/modules/Settings/Workflows/Tasks/VTEmailTask.tpl @@ -146,7 +146,7 @@ </div> </div> <div class="row from-group"> - {if $EMAIL_TEMPLATES} + {if isset($EMAIL_TEMPLATES) && $EMAIL_TEMPLATES} <div class="col-sm-6 col-xs-6"> <div class="row"> <div class="col-sm-3 col-xs-3">{vtranslate('LBL_EMAIL_TEMPLATES','EmailTemplates')}</div> diff --git a/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl b/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl index 0c41811ba..07c5c284d 100644 --- a/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl +++ b/layouts/v7/modules/Settings/Workflows/WorkFlowTrigger.tpl @@ -98,10 +98,10 @@ <div class='col-sm-3 controls'> <div class="input-group" style="margin-bottom: 3px"> {assign var=specificDate value=Zend_Json::decode($WORKFLOW_MODEL_OBJ->schannualdates)} - {if $specificDate[0] neq ''} + {if isset($specificDate[0]) && $specificDate[0] neq ''} {assign var=specificDate1 value=DateTimeField::convertToUserFormat($specificDate[0])} {/if} - <input type="text" class="dateField form-control" name="schdate" value="{$specificDate1}" data-date-format="{$CURRENT_USER->date_format}" data-rule-required="true"/> + <input type="text" class="dateField form-control" name="schdate" value="{(isset($specificDate1)) ? $specificDate1 : ''}" data-date-format="{$CURRENT_USER->date_format}" data-rule-required="true"/> <span class="input-group-addon"><i class="fa fa-calendar "></i></span> </div> </div> @@ -118,9 +118,12 @@ <div> <input type=hidden id=hiddenAnnualDates value='{$WORKFLOW_MODEL_OBJ->schannualdates}' /> <select multiple class="select2" id='annualDates' name='schannualdates[]' data-rule-required="true" style="min-width: 100px;"> + {if isset($ANNUAL_DATES)} {foreach item=DATES from=$ANNUAL_DATES} <option value="{$DATES}" selected>{$DATES}</option> {/foreach} + {/if} + </select> </div> </div> diff --git a/modules/Calendar/Activity.php b/modules/Calendar/Activity.php index ad8608b92..ee66dbda5 100644 --- a/modules/Calendar/Activity.php +++ b/modules/Calendar/Activity.php @@ -264,7 +264,7 @@ class Activity extends CRMEntity { { global $log; $log->info("in insertIntoReminderTable ".$table_name." module is ".$module); - if($_REQUEST['set_reminder'] == 'Yes') + if(isset($_REQUEST['set_reminder']) && $_REQUEST['set_reminder'] == 'Yes') { unset($_SESSION['next_reminder_time']); $log->debug("set reminder is set"); @@ -292,7 +292,7 @@ class Activity extends CRMEntity { $this->activity_reminder($this->id,$reminder_time,0,$recurid,''); } } - elseif($_REQUEST['set_reminder'] == 'No') + elseif(isset($_REQUEST['set_reminder']) && $_REQUEST['set_reminder'] == 'No') { $this->activity_reminder($this->id,'0',0,$recurid,'delete'); } diff --git a/modules/Settings/Workflows/models/EditTaskRecordStructure.php b/modules/Settings/Workflows/models/EditTaskRecordStructure.php index 0ce9bc522..0a2b1c6e4 100644 --- a/modules/Settings/Workflows/models/EditTaskRecordStructure.php +++ b/modules/Settings/Workflows/models/EditTaskRecordStructure.php @@ -32,6 +32,7 @@ class Settings_Workflows_EditTaskRecordStructure_Model extends Settings_Workflow $taskTypeModel = $this->getTaskRecordModel()->getTaskType(); $taskTypeName = $taskTypeModel->getName(); + $moduleName = ''; if($taskTypeName == 'VTUpdateFieldsTask' || $taskTypeName == "VTCreateEntityTask"){ return parent::getStructure(); } diff --git a/modules/Settings/Workflows/models/Record.php b/modules/Settings/Workflows/models/Record.php index 3ba06e174..6b31cbf6a 100644 --- a/modules/Settings/Workflows/models/Record.php +++ b/modules/Settings/Workflows/models/Record.php @@ -232,7 +232,9 @@ class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model { function transformToAdvancedFilterCondition() { $conditions = $this->get('conditions'); $transformedConditions = array(); - + $firstGroup = array(); + $secondGroup = array(); + $isTimeValue = false; if(!empty($conditions)) { foreach($conditions as $index => $info) { $columnName = $info['fieldname']; @@ -468,7 +470,7 @@ class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model { } $value = $wfCond[$k]['value']; $operation = $wfCond[$k]['operation']; - if($wfCond[$k]['groupjoin'] == 'and') { + if(isset($wfCond[$k]['groupjoin']) && $wfCond[$k]['groupjoin'] == 'and') { $conditionGroup = 'All'; } else { $conditionGroup = 'Any'; @@ -489,7 +491,7 @@ class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model { $value = getUserFullName($value); } else { $groupNameList = getGroupName($value); - $value = $groupNameList[0]; + $value = isset($groupNameList[0]) ? $groupNameList[0] : ''; } } if ($value) { @@ -526,6 +528,7 @@ class Settings_Workflows_Record_Model extends Settings_Vtiger_Record_Model { $tasks = Settings_Workflows_TaskRecord_Model::getAllForWorkflow($this, true); foreach($tasks as $task) { $taskName = $task->getTaskType()->get('tasktypename'); + $actions[$taskName] = isset($actions[$taskName]) ? $actions[$taskName] : null; $actions[$taskName] = $actions[$taskName] + 1; } return $actions; diff --git a/modules/Settings/Workflows/models/TaskRecord.php b/modules/Settings/Workflows/models/TaskRecord.php index ff3e5b3cd..ac6a7a42d 100644 --- a/modules/Settings/Workflows/models/TaskRecord.php +++ b/modules/Settings/Workflows/models/TaskRecord.php @@ -18,6 +18,8 @@ class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model { const TASK_STATUS_ACTIVE = 1; + public $task_type; + public function getId() { return $this->get('task_id'); } @@ -96,7 +98,9 @@ class Settings_Workflows_TaskRecord_Model extends Settings_Vtiger_Record_Model { } public static function getInstance() { - list($taskId, $workflowModel) = func_get_args(); + $args = func_get_args(); + $taskId = $args[0]; + $workflowModel = $args[1]; $db = PearDatabase::getInstance(); $tm = new VTTaskManager($db); $task = $tm->retrieveTask($taskId); diff --git a/modules/Settings/Workflows/views/EditV7Task.php b/modules/Settings/Workflows/views/EditV7Task.php index be514d605..152e6fc06 100644 --- a/modules/Settings/Workflows/views/EditV7Task.php +++ b/modules/Settings/Workflows/views/EditV7Task.php @@ -16,10 +16,10 @@ class Settings_Workflows_EditV7Task_View extends Settings_Vtiger_Index_View { $moduleName = $request->getModule(); $qualifiedModuleName = $request->getModule(false); $taskData = $request->get('taskData'); - + $allFieldoptions = ''; $recordId = $request->get('task_id'); $workflowId = $request->get('for_workflow'); - + $emailFieldoptions = '' ; if ($workflowId) { $workflowModel = Settings_Workflows_Record_Model::getInstance($workflowId); $selectedModule = $workflowModel->getModule(); @@ -155,6 +155,7 @@ class Settings_Workflows_EditV7Task_View extends Settings_Vtiger_Index_View { $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $emailFields = $recordStructureInstance->getAllEmailFields(); + foreach($emailFields as $metaKey => $emailField) { $emailFieldoptions .= '<option value=",$'.$metaKey.'">'.$emailField->get('workflow_columnlabel').'</option>'; } @@ -172,12 +173,16 @@ class Settings_Workflows_EditV7Task_View extends Settings_Vtiger_Index_View { '</option>'; foreach($emailFields as $metaKey => $emailField) { - list($relationFieldName, $rest) = explode(' ', $metaKey); + $metakeys = explode(' ', $metaKey); + $relationFieldName = isset($metakeys[0]) ? $metakeys[0] : ''; + $rest = isset($metakeys[1]) ? $metakeys[1] : ''; + list($relationFieldName, $rest) = $value = '<$'.$metaKey.'>'; if ($nameFields) { $nameFieldValues = ''; foreach (array_keys($nameFields) as $fieldName) { + $relationFieldName = isset($relationFieldName) ? $relationFieldName : ''; if (strstr($fieldName, $relationFieldName) || (php7_count(explode(' ', $metaKey)) === 1 && php7_count(explode(' ', $fieldName)) === 1)) { $fieldName = '$'.$fieldName; $nameFieldValues .= ' '.$fieldName; diff --git a/modules/Users/CreateUserPrivilegeFile.php b/modules/Users/CreateUserPrivilegeFile.php index 6e7f38d70..a7e735692 100644 --- a/modules/Users/CreateUserPrivilegeFile.php +++ b/modules/Users/CreateUserPrivilegeFile.php @@ -1502,6 +1502,7 @@ function constructTwoDimensionalArray($var) foreach ($var as $key => $secarr) { $code .= $key.'=>array('; + if(!is_iterable($secarr))continue; foreach($secarr as $seckey => $secvalue) { $code .= $seckey.'=>'.$secvalue.','; diff --git a/modules/com_vtiger_workflow/expression_engine/VTExpressionsManager.inc b/modules/com_vtiger_workflow/expression_engine/VTExpressionsManager.inc index 7774e8854..e7d863a1a 100644 --- a/modules/com_vtiger_workflow/expression_engine/VTExpressionsManager.inc +++ b/modules/com_vtiger_workflow/expression_engine/VTExpressionsManager.inc @@ -8,6 +8,7 @@ * All Rights Reserved. ******************************************************************************/ require_once("include/events/SqlResultIterator.inc"); +#[\AllowDynamicProperties] class VTExpressionsManager{ function __construct($adb){ $this->adb = $adb; diff --git a/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc b/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc index 333f733ae..b9fb25556 100644 --- a/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc +++ b/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc @@ -241,8 +241,10 @@ class VTCreateEventTask extends VTTask{ } preg_match('/\d\d\d\d-\d\d-\d\d/', $baseDate, $match); $baseDate = strtotime($match[0]); - $date = strftime('%Y-%m-%d', $baseDate+$days*24*60*60* - (strtolower($direction)=='before'?-1:1)); + + $daysOffset = isset($this->direction) ? $days*24*60*60*(strtolower($this->direction)=='before'?-1:1) : 0; + $newTimestamp = $baseDate + $daysOffset; + $date = date('Y-m-d', $newTimestamp); return $date; } diff --git a/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc b/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc index 5d08bb6fc..be7d8c414 100644 --- a/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc +++ b/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc @@ -36,6 +36,7 @@ class VTCreateTodoTask extends VTTask{ public function doTask($entityData){ $moduleName = 'Calendar'; + $baseTime = ''; if(!vtlib_isModuleActive($moduleName)) { return; } @@ -47,7 +48,7 @@ class VTCreateTodoTask extends VTTask{ $baseDate = $entityData->get($this->datefield); $dateTime = explode(' ', $baseDate); - if($dateTime[1]){ + if(isset($dateTime[1]) && $dateTime[1]){ $userFormatDate = DateTimeField::convertToUserTimeZone($baseDate); $baseDate = $userFormatDate->format('Y-m-d H:i:s'); $baseTime = $userFormatDate->format('H:i:s'); @@ -63,7 +64,9 @@ class VTCreateTodoTask extends VTTask{ } preg_match('/\d\d\d\d-\d\d-\d\d/', $baseDate, $match); $baseDate = strtotime($match[0]); - $date = strftime('%Y-%m-%d', $baseDate+$days*24*60*60*(strtolower($this->direction)=='before'?-1:1)); + $daysOffset = $days*24*60*60*(strtolower($this->direction)=='before'?-1:1); + $newTimestamp = $baseDate + $daysOffset; + $date = date('Y-m-d', $newTimestamp); // Added to check if the user/group is active if(!empty($this->assigned_user_id)) { $userExists = $adb->pquery('SELECT 1 FROM vtiger_users WHERE id = ? AND status = ?', array($this->assigned_user_id, 'Active')); diff --git a/vtlib/Vtiger/Functions.php b/vtlib/Vtiger/Functions.php index 7fc4fd107..48deb28e9 100644 --- a/vtlib/Vtiger/Functions.php +++ b/vtlib/Vtiger/Functions.php @@ -425,7 +425,7 @@ class Vtiger_Functions { static function getGroupName($id) { global $adb; - if (!self::$groupIdNameCache[$id]) { + if (!isset(self::$groupIdNameCache[$id]) || !self::$groupIdNameCache[$id]) { $result = $adb->pquery('SELECT groupid, groupname FROM vtiger_groups'); while ($row = $adb->fetch_array($result)) { self::$groupIdNameCache[$row['groupid']] = $row['groupname']; -- GitLab