Skip to content

Commit

Permalink
fix(App) eliminate warnings/notice and cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
joebordes committed Jan 30, 2017
1 parent be5f030 commit 362be97
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 24 deletions.
2 changes: 1 addition & 1 deletion include/Webservices/VTQL_Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ function yy_r41(){
$columns[] = $fieldcol[$field];
}
}
if($this->out['where_condition']){
if (!empty($this->out['where_condition'])) {
foreach($this->out['where_condition']['column_names'] as $ind=>$field){
$columns[] = $fieldcol[$field];
}
Expand Down
11 changes: 8 additions & 3 deletions include/utils/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,7 @@ function getRecordValues($id_array,$module) {
$value_pair['disp_value']=$ownername;
} elseif($ui_type ==57) {
$contact_id= $field_values[$j][$fld_name];
$contactname = '';
if($contact_id != '') {
$displayValueArray = getEntityName('Contacts', $contact_id);
if (!empty($displayValueArray)) {
Expand Down Expand Up @@ -3267,7 +3268,7 @@ function getDuplicateRecordsArr($module)
coreBOS_Session::set('dup_nav_start'.$module, 1);
else if(isset($_REQUEST["start"]) && $_REQUEST["start"] != "" && $_SESSION['dup_nav_start'.$module] != $_REQUEST["start"])
coreBOS_Session::set('dup_nav_start'.$module, ListViewSession::getRequestStartPage());
$start = ($_SESSION['dup_nav_start'.$module] != "")?$_SESSION['dup_nav_start'.$module]:1;
$start = (!empty($_SESSION['dup_nav_start'.$module]) ? $_SESSION['dup_nav_start'.$module] : 1);
$navigation_array = getNavigationValues($start, $no_of_rows, $list_max_entries_per_page);
$start_rec = $navigation_array['start'];
$end_rec = $navigation_array['end_val'];
Expand Down Expand Up @@ -4347,8 +4348,12 @@ function getRecordInfoFromID($id){
$setype = $adb->query_result($result, 0, "setype");
$data = getEntityName($setype, $id);
}
$data = array_values($data);
$data = $data[0];
if (count($data)>0) {
$data = array_values($data);
$data = $data[0];
} else {
$data = '';
}
return $data;
}

Expand Down
5 changes: 4 additions & 1 deletion modules/com_vtiger_workflow/VTWorkflowManager.inc
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,11 @@
$workflow->moduleName = $moduleName;
$workflow->executionCondition = self::$ON_EVERY_SAVE;
$workflow->type = 'basic';
$workflow->id = 0;
$workflow->description = '';
$workflow->schtypeid = 0;
$workflow->nexttrigger_time = '';
return $workflow;

}

/**
Expand Down
15 changes: 7 additions & 8 deletions modules/com_vtiger_workflow/WorkFlowScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function queueScheduledWorkflowTasks() {
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
@date_default_timezone_set($adminTimeZone);
$currentTimestamp = date("Y-m-d H:i:s");
$currentTimestamp = date("Y-m-d H:i:s");
@date_default_timezone_set($default_timezone);

$scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
Expand All @@ -88,7 +88,7 @@ public function queueScheduledWorkflowTasks() {
$noOfRecords = count($records);
for ($j = 0; $j < $noOfRecords; ++$j) {
$recordId = $records[$j];
// We need to pass proper module name to get the webservice
// We need to pass proper module name to get the webservice
if($workflow->moduleName == 'Calendar') {
$moduleName = vtws_getCalendarEntityType($recordId);
} else {
Expand All @@ -104,14 +104,13 @@ public function queueScheduledWorkflowTasks() {
if($wfminutes!=null){
$time = time();
$delay=$time;
}
else {
if ($trigger != null) {
$delay = strtotime($data[$trigger['field']]) + $trigger['days'] * 86400;
} else {
$delay = 0;
if ($trigger != null) {
$delay = strtotime($data[$trigger['field']]) + $trigger['days'] * 86400;
} else {
$delay = 0;
}
}
}
if ($task->executeImmediately == true && $wfminutes==null) {
if (empty($task->test) or $task->evaluate($entityCache, $entityData->getId())) {
$task->doTask($entityData);
Expand Down
40 changes: 30 additions & 10 deletions modules/com_vtiger_workflow/editworkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,43 @@ function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_str
}
$smarty->assign('ScheduledWorkflowsCount', $wfs->getScheduledWorkflowsCount());
$smarty->assign('MaxAllowedScheduledWorkflows', $wfs->getMaxAllowedScheduledWorkflows());
$smarty->assign('schdtime_12h',date('h:ia', strtotime(substr($workflow->schtime,0,strrpos($workflow->schtime, ':')))));
$schannualdates = json_decode($workflow->schannualdates);
if (count($schannualdates)>0) {
if (empty($workflow->schtime)) {
$smarty->assign('schdtime_12h',date('h:ia'));
} else {
$smarty->assign('schdtime_12h',date('h:ia', strtotime(substr($workflow->schtime,0,strrpos($workflow->schtime, ':')))));
}
if (!empty($workflow->schannualdates)) {
$schannualdates = json_decode($workflow->schannualdates);
$schannualdates = DateTimeField::convertToUserFormat($schannualdates[0]);
} else {
$schannualdates = '';
}
$smarty->assign('schdate',$schannualdates);
$smarty->assign('selected_days1_31',json_decode($workflow->schdayofmonth));
$smarty->assign('selected_minute_interval',json_decode($workflow->schminuteinterval));
$smarty->assign('dayOfWeek',json_decode($workflow->schdayofweek));
if (empty($workflow->schdayofmonth)) {
$smarty->assign('selected_days1_31','');
} else {
$smarty->assign('selected_days1_31',json_decode($workflow->schdayofmonth));
}
if (empty($workflow->schminuteinterval)) {
$smarty->assign('selected_minute_interval','');
} else {
$smarty->assign('selected_minute_interval',json_decode($workflow->schminuteinterval));
}
if (empty($workflow->schdayofweek)) {
$smarty->assign('dayOfWeek','');
} else {
$smarty->assign('dayOfWeek',json_decode($workflow->schdayofweek));
}
}

if($workflow==null){
$errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
$util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
return;
}
$workflow->test = addslashes($workflow->test);
$workflow->test = !empty($workflow->test) ? addslashes($workflow->test) : '';
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($workflow->id);
$tasks = !empty($workflow->id) ? $tm->getTasksForWorkflow($workflow->id) : array();
$smarty->assign("tasks", $tasks);
$taskTypes = $tm->getTaskTypes($workflow->moduleName);
$smarty->assign("taskTypes", $taskTypes);
Expand All @@ -80,9 +96,13 @@ function vtWorkflowEdit($adb, $request, $requestUrl, $current_language, $app_str
for ($interval=5;$interval<=50;$interval+=5) $intervalrange[$interval]=$interval;
$smarty->assign('days1_31', $dayrange);
$smarty->assign('interval_range',$intervalrange);
$smarty->assign('wfnexttrigger_time',DateTimeField::convertToUserFormat($workflow->nexttrigger_time));
if (empty($workflow->nexttrigger_time)) {
$smarty->assign('wfnexttrigger_time','');
} else {
$smarty->assign('wfnexttrigger_time',DateTimeField::convertToUserFormat($workflow->nexttrigger_time));
}
$smarty->assign("dateFormat", parse_calendardate($current_user->date_format));
$smarty->assign("returnUrl", vtlib_purify($request["return_url"]));
$smarty->assign('returnUrl', isset($request['return_url']) ? vtlib_purify($request['return_url']) : '');
$smarty->assign("APP", $app_strings);
$smarty->assign("MOD", array_merge(
return_module_language($current_language,'Settings'),
Expand Down
2 changes: 1 addition & 1 deletion modules/evvtMenu/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function delMenuBranch($topofbranch) {
$mvalue = vtlib_purify($_REQUEST['mvalue']);
$evvtmenuid = vtlib_purify($_REQUEST['evvtmenuid']);
$mparent = vtlib_purify($_REQUEST['mparent']);
$mpermission = vtlib_purify($_REQUEST['mpermission']);
$mpermission = isset($_REQUEST['mpermission']) ? vtlib_purify($_REQUEST['mpermission']) : '';
if (empty($mpermission)) $mpermission = array();
if($mtype == 'menu') {
$pmenuidrs = $adb->query('select max(mseq) from vtiger_evvtmenu where mparent= 0');
Expand Down

0 comments on commit 362be97

Please sign in to comment.