@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | /** Function to insert values in vtiger_activity_remainder table for the specified module, |
| 182 | - * @param $table_name -- table name:: Type varchar |
|
| 182 | + * @param string $table_name -- table name:: Type varchar |
|
| 183 | 183 | * @param $module -- module:: Type varchar |
| 184 | 184 | */ |
| 185 | 185 | public function insertIntoReminderTable($table_name, $module, $recurid) |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | // Code included by Jaguar - starts |
| 215 | 215 | /** Function to insert values in vtiger_recurringevents table for the specified tablename,module |
| 216 | - * @param $recurObj -- Recurring Object:: Type varchar |
|
| 216 | + * @param RecurringType $recurObj -- Recurring Object:: Type varchar |
|
| 217 | 217 | */ |
| 218 | 218 | public function insertIntoRecurringTable(& $recurObj) |
| 219 | 219 | { |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | /** |
| 712 | 712 | * Function to get calendar query for outlookplugin |
| 713 | - * @param string $username - User name * return string $query - sql query */ |
|
| 713 | + * @param string $user_name - User name * return string $query - sql query */ |
|
| 714 | 714 | public function get_calendarsforol($user_name) |
| 715 | 715 | { |
| 716 | 716 | $adb = PearDatabase::getInstance(); |
@@ -903,6 +903,9 @@ discard block |
||
| 903 | 903 | return $query; |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | + /** |
|
| 907 | + * @param null|type $tabId |
|
| 908 | + */ |
|
| 906 | 909 | protected function setupTemporaryTable($tableName, $tabId, $user, $parentRole, $userGroups) |
| 907 | 910 | { |
| 908 | 911 | $module = null; |
@@ -821,40 +821,40 @@ |
||
| 821 | 821 | $query = $this->getRelationQuery($module, $secmodule, "vtiger_activity", "activityid", $queryPlanner); |
| 822 | 822 | |
| 823 | 823 | if ($queryPlanner->requireTable("vtiger_crmentityCalendar", $matrix)) { |
| 824 | - $query .=" left join vtiger_crmentity as vtiger_crmentityCalendar on vtiger_crmentityCalendar.crmid=vtiger_activity.activityid and vtiger_crmentityCalendar.deleted=0"; |
|
| 824 | + $query .= " left join vtiger_crmentity as vtiger_crmentityCalendar on vtiger_crmentityCalendar.crmid=vtiger_activity.activityid and vtiger_crmentityCalendar.deleted=0"; |
|
| 825 | 825 | } |
| 826 | 826 | if ($queryPlanner->requireTable("vtiger_contactdetailsCalendar")) { |
| 827 | - $query .=" left join vtiger_contactdetails as vtiger_contactdetailsCalendar on vtiger_contactdetailsCalendar.contactid= vtiger_activity.link"; |
|
| 827 | + $query .= " left join vtiger_contactdetails as vtiger_contactdetailsCalendar on vtiger_contactdetailsCalendar.contactid= vtiger_activity.link"; |
|
| 828 | 828 | } |
| 829 | 829 | if ($queryPlanner->requireTable("vtiger_activitycf")) { |
| 830 | - $query .=" left join vtiger_activitycf on vtiger_activitycf.activityid = vtiger_activity.activityid"; |
|
| 830 | + $query .= " left join vtiger_activitycf on vtiger_activitycf.activityid = vtiger_activity.activityid"; |
|
| 831 | 831 | } |
| 832 | 832 | if ($queryPlanner->requireTable("vtiger_activity_reminder")) { |
| 833 | - $query .=" left join vtiger_activity_reminder on vtiger_activity_reminder.activity_id = vtiger_activity.activityid"; |
|
| 833 | + $query .= " left join vtiger_activity_reminder on vtiger_activity_reminder.activity_id = vtiger_activity.activityid"; |
|
| 834 | 834 | } |
| 835 | 835 | if ($queryPlanner->requireTable("vtiger_recurringevents")) { |
| 836 | - $query .=" left join vtiger_recurringevents on vtiger_recurringevents.activityid = vtiger_activity.activityid"; |
|
| 836 | + $query .= " left join vtiger_recurringevents on vtiger_recurringevents.activityid = vtiger_activity.activityid"; |
|
| 837 | 837 | } |
| 838 | 838 | if ($queryPlanner->requireTable("vtiger_accountRelCalendar")) { |
| 839 | - $query .=" left join vtiger_account as vtiger_accountRelCalendar on vtiger_accountRelCalendar.accountid=vtiger_activity.link"; |
|
| 839 | + $query .= " left join vtiger_account as vtiger_accountRelCalendar on vtiger_accountRelCalendar.accountid=vtiger_activity.link"; |
|
| 840 | 840 | } |
| 841 | 841 | if ($queryPlanner->requireTable("vtiger_leaddetailsRelCalendar")) { |
| 842 | - $query .=" left join vtiger_leaddetails as vtiger_leaddetailsRelCalendar on vtiger_leaddetailsRelCalendar.leadid = vtiger_activity.link"; |
|
| 842 | + $query .= " left join vtiger_leaddetails as vtiger_leaddetailsRelCalendar on vtiger_leaddetailsRelCalendar.leadid = vtiger_activity.link"; |
|
| 843 | 843 | } |
| 844 | 844 | if ($queryPlanner->requireTable("vtiger_troubleticketsRelCalendar")) { |
| 845 | - $query .=" left join vtiger_troubletickets as vtiger_troubleticketsRelCalendar on vtiger_troubleticketsRelCalendar.ticketid = vtiger_activity.process"; |
|
| 845 | + $query .= " left join vtiger_troubletickets as vtiger_troubleticketsRelCalendar on vtiger_troubleticketsRelCalendar.ticketid = vtiger_activity.process"; |
|
| 846 | 846 | } |
| 847 | 847 | if ($queryPlanner->requireTable("vtiger_campaignRelCalendar")) { |
| 848 | - $query .=" left join vtiger_campaign as vtiger_campaignRelCalendar on vtiger_campaignRelCalendar.campaignid = vtiger_activity.process"; |
|
| 848 | + $query .= " left join vtiger_campaign as vtiger_campaignRelCalendar on vtiger_campaignRelCalendar.campaignid = vtiger_activity.process"; |
|
| 849 | 849 | } |
| 850 | 850 | if ($queryPlanner->requireTable("vtiger_groupsCalendar")) { |
| 851 | - $query .=" left join vtiger_groups as vtiger_groupsCalendar on vtiger_groupsCalendar.groupid = vtiger_crmentityCalendar.smownerid"; |
|
| 851 | + $query .= " left join vtiger_groups as vtiger_groupsCalendar on vtiger_groupsCalendar.groupid = vtiger_crmentityCalendar.smownerid"; |
|
| 852 | 852 | } |
| 853 | 853 | if ($queryPlanner->requireTable("vtiger_usersCalendar")) { |
| 854 | - $query .=" left join vtiger_users as vtiger_usersCalendar on vtiger_usersCalendar.id = vtiger_crmentityCalendar.smownerid"; |
|
| 854 | + $query .= " left join vtiger_users as vtiger_usersCalendar on vtiger_usersCalendar.id = vtiger_crmentityCalendar.smownerid"; |
|
| 855 | 855 | } |
| 856 | 856 | if ($queryPlanner->requireTable("vtiger_lastModifiedByCalendar")) { |
| 857 | - $query .=" left join vtiger_users as vtiger_lastModifiedByCalendar on vtiger_lastModifiedByCalendar.id = vtiger_crmentityCalendar.modifiedby "; |
|
| 857 | + $query .= " left join vtiger_users as vtiger_lastModifiedByCalendar on vtiger_lastModifiedByCalendar.id = vtiger_crmentityCalendar.modifiedby "; |
|
| 858 | 858 | } |
| 859 | 859 | if ($queryPlanner->requireTable("vtiger_createdbyCalendar")) { |
| 860 | 860 | $query .= " left join vtiger_users as vtiger_createdbyCalendar on vtiger_createdbyCalendar.id = vtiger_crmentityCalendar.smcreatorid "; |
@@ -111,8 +111,9 @@ discard block |
||
| 111 | 111 | if (isset($this->column_fields['recurringtype']) && $this->column_fields['recurringtype'] != '' && $this->column_fields['recurringtype'] != '--None--') { |
| 112 | 112 | $recur_type = trim($this->column_fields['recurringtype']); |
| 113 | 113 | $recur_data = \vtlib\Functions::getRecurringObjValue(); |
| 114 | - if (is_object($recur_data)) |
|
| 115 | - $this->insertIntoRecurringTable($recur_data); |
|
| 114 | + if (is_object($recur_data)) { |
|
| 115 | + $this->insertIntoRecurringTable($recur_data); |
|
| 116 | + } |
|
| 116 | 117 | } |
| 117 | 118 | |
| 118 | 119 | //Insert into vtiger_activity_remainder table |
@@ -248,10 +249,10 @@ discard block |
||
| 248 | 249 | $sql = 'delete from vtiger_activity_reminder where activity_id=?'; |
| 249 | 250 | $adb->pquery($sql, array($activity_id)); |
| 250 | 251 | $flag = "false"; |
| 251 | - } else |
|
| 252 | - $flag = "false"; |
|
| 253 | - } |
|
| 254 | - else { |
|
| 252 | + } else { |
|
| 253 | + $flag = "false"; |
|
| 254 | + } |
|
| 255 | + } else { |
|
| 255 | 256 | $sql = 'delete from vtiger_activity_reminder where activity_id=?'; |
| 256 | 257 | $adb->pquery($sql, array($activity_id)); |
| 257 | 258 | $sql = 'delete from vtiger_recurringevents where activityid=?'; |
@@ -360,8 +361,9 @@ discard block |
||
| 360 | 361 | */ |
| 361 | 362 | public function getJoinClause($tableName) |
| 362 | 363 | { |
| 363 | - if ($tableName == "vtiger_activity_reminder") |
|
| 364 | - return 'LEFT JOIN'; |
|
| 364 | + if ($tableName == "vtiger_activity_reminder") { |
|
| 365 | + return 'LEFT JOIN'; |
|
| 366 | + } |
|
| 365 | 367 | return parent::getJoinClause($tableName); |
| 366 | 368 | } |
| 367 | 369 | |
@@ -374,10 +376,11 @@ discard block |
||
| 374 | 376 | { |
| 375 | 377 | $log = LoggerManager::getInstance(); |
| 376 | 378 | $log->debug('Entering getSortOrder() method ...'); |
| 377 | - if (AppRequest::has('sorder')) |
|
| 378 | - $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 379 | - else |
|
| 380 | - $sorder = (($_SESSION['ACTIVITIES_SORT_ORDER'] != '') ? ($_SESSION['ACTIVITIES_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 379 | + if (AppRequest::has('sorder')) { |
|
| 380 | + $sorder = $this->db->sql_escape_string(AppRequest::get('sorder')); |
|
| 381 | + } else { |
|
| 382 | + $sorder = (($_SESSION['ACTIVITIES_SORT_ORDER'] != '') ? ($_SESSION['ACTIVITIES_SORT_ORDER']) : ($this->default_sort_order)); |
|
| 383 | + } |
|
| 381 | 384 | $log->debug('Exiting getSortOrder method ...'); |
| 382 | 385 | return $sorder; |
| 383 | 386 | } |
@@ -396,10 +399,11 @@ discard block |
||
| 396 | 399 | $use_default_order_by = $this->default_order_by; |
| 397 | 400 | } |
| 398 | 401 | |
| 399 | - if (AppRequest::has('order_by')) |
|
| 400 | - $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 401 | - else |
|
| 402 | - $order_by = (($_SESSION['ACTIVITIES_ORDER_BY'] != '') ? ($_SESSION['ACTIVITIES_ORDER_BY']) : ($use_default_order_by)); |
|
| 402 | + if (AppRequest::has('order_by')) { |
|
| 403 | + $order_by = $this->db->sql_escape_string(AppRequest::get('order_by')); |
|
| 404 | + } else { |
|
| 405 | + $order_by = (($_SESSION['ACTIVITIES_ORDER_BY'] != '') ? ($_SESSION['ACTIVITIES_ORDER_BY']) : ($use_default_order_by)); |
|
| 406 | + } |
|
| 403 | 407 | $log->debug("Exiting getOrderBy method ..."); |
| 404 | 408 | return $order_by; |
| 405 | 409 | } |
@@ -430,8 +434,9 @@ discard block |
||
| 430 | 434 | $button = ''; |
| 431 | 435 | |
| 432 | 436 | if ($actions) { |
| 433 | - if (is_string($actions)) |
|
| 434 | - $actions = explode(',', strtoupper($actions)); |
|
| 437 | + if (is_string($actions)) { |
|
| 438 | + $actions = explode(',', strtoupper($actions)); |
|
| 439 | + } |
|
| 435 | 440 | if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') { |
| 436 | 441 | $button .= "<input title='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module=$related_module&return_module=$currentModule&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid=$id','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . \includes\Language::translate('LBL_SELECT') . " " . \includes\Language::translate($related_module) . "'> "; |
| 437 | 442 | } |
@@ -447,8 +452,9 @@ discard block |
||
| 447 | 452 | |
| 448 | 453 | $return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset); |
| 449 | 454 | |
| 450 | - if ($return_value === null) |
|
| 451 | - $return_value = []; |
|
| 455 | + if ($return_value === null) { |
|
| 456 | + $return_value = []; |
|
| 457 | + } |
|
| 452 | 458 | $return_value['CUSTOM_BUTTON'] = $button; |
| 453 | 459 | |
| 454 | 460 | $log->debug("Exiting get_contacts method ..."); |
@@ -477,8 +483,9 @@ discard block |
||
| 477 | 483 | $query = sprintf($query, $id); |
| 478 | 484 | $return_data = GetRelatedList('Calendar', 'Users', $focus, $query, $button, $returnset); |
| 479 | 485 | |
| 480 | - if ($return_data === null) |
|
| 481 | - $return_data = []; |
|
| 486 | + if ($return_data === null) { |
|
| 487 | + $return_data = []; |
|
| 488 | + } |
|
| 482 | 489 | $return_data['CUSTOM_BUTTON'] = $button; |
| 483 | 490 | |
| 484 | 491 | $log->debug("Exiting get_users method ..."); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param $userid -- The user Id:: Type integer |
| 57 | 57 | * @param $from_datetime -- The start date Obj :: Type Array |
| 58 | 58 | * @param $to_datetime -- The end date Obj :: Type Array |
| 59 | - * @param $view -- The calendar view :: Type String |
|
| 59 | + * @param string $view -- The calendar view :: Type String |
|
| 60 | 60 | * @returns $list :: Type Array |
| 61 | 61 | */ |
| 62 | 62 | public function readAppointment($userid, &$from_datetime, &$to_datetime, $view) |
@@ -286,6 +286,9 @@ discard block |
||
| 286 | 286 | return ($a->start_time->ts < $b->start_time->ts) ? -1 : 1; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | +/** |
|
| 290 | + * @param string $fldname |
|
| 291 | + */ |
|
| 289 | 292 | function getRoleBasesdPickList($fldname, $exist_val) |
| 290 | 293 | { |
| 291 | 294 | $adb = PearDatabase::getInstance(); |
@@ -169,7 +169,7 @@ |
||
| 169 | 169 | //Get Recurring events |
| 170 | 170 | $q = "SELECT vtiger_activity.*, vtiger_crmentity.*, case when (vtiger_users.user_name not like '') then $userNameSql else vtiger_groups.groupname end as user_name , vtiger_recurringevents.recurringid, vtiger_recurringevents.recurringdate as date_start ,vtiger_recurringevents.recurringtype,vtiger_groups.groupname from vtiger_activity inner join vtiger_crmentity on vtiger_activity.activityid = vtiger_crmentity.crmid inner join vtiger_recurringevents on vtiger_activity.activityid=vtiger_recurringevents.activityid left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid"; |
| 171 | 171 | $q .= getNonAdminAccessControlQuery('Calendar', $current_user); |
| 172 | - $q.=" where vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype not in ('Emails','Task') && (cast(concat(recurringdate, ' ', time_start) as datetime) between ? and ?) "; |
|
| 172 | + $q .= " where vtiger_crmentity.deleted = 0 and vtiger_activity.activitytype not in ('Emails','Task') && (cast(concat(recurringdate, ' ', time_start) as datetime) between ? and ?) "; |
|
| 173 | 173 | |
| 174 | 174 | // User Select Customization |
| 175 | 175 | $q .= $query_filter_prefix; |
@@ -221,13 +221,15 @@ discard block |
||
| 221 | 221 | $que = "select * from vtiger_sharedcalendar where sharedid=? and userid=?"; |
| 222 | 222 | $row = $adb->pquery($que, array($current_user->id, $act_array["smownerid"])); |
| 223 | 223 | $no = $adb->getRowCount($row); |
| 224 | - if ($no > 0) |
|
| 225 | - $this->shared = true; |
|
| 224 | + if ($no > 0) { |
|
| 225 | + $this->shared = true; |
|
| 226 | + } |
|
| 226 | 227 | } |
| 227 | 228 | } |
| 228 | 229 | $this->image_name = $act_array["activitytype"] . ".gif"; |
| 229 | - if (!empty($act_array["recurringid"]) && !empty($act_array["recurringtype"])) |
|
| 230 | - $this->recurring = "Recurring.gif"; |
|
| 230 | + if (!empty($act_array["recurringid"]) && !empty($act_array["recurringtype"])) { |
|
| 231 | + $this->recurring = "Recurring.gif"; |
|
| 232 | + } |
|
| 231 | 233 | |
| 232 | 234 | $this->record = $act_array["activityid"]; |
| 233 | 235 | $date = new DateTimeField($act_array["date_start"] . ' ' . $act_array['time_start']); |
@@ -295,8 +297,9 @@ discard block |
||
| 295 | 297 | $roleid = $current_user->roleid; |
| 296 | 298 | $roleids = Array(); |
| 297 | 299 | $subrole = getRoleSubordinates($roleid); |
| 298 | - if (count($subrole) > 0) |
|
| 299 | - $roleids = $subrole; |
|
| 300 | + if (count($subrole) > 0) { |
|
| 301 | + $roleids = $subrole; |
|
| 302 | + } |
|
| 300 | 303 | array_push($roleids, $roleid); |
| 301 | 304 | |
| 302 | 305 | //here we are checking wheather the table contains the sortorder column .If sortorder is present in the main picklist table, then the role2picklist will be applicable for this table... |
@@ -310,12 +313,14 @@ discard block |
||
| 310 | 313 | $res_val = $adb->pquery($pick_query, array($roleids)); |
| 311 | 314 | $num_val = $adb->num_rows($res_val); |
| 312 | 315 | } |
| 313 | - if ($num_val > 0) |
|
| 316 | + if ($num_val > 0) { |
|
| 317 | + $pick_val = $exist_val; |
|
| 318 | + } else { |
|
| 319 | + $pick_val = \includes\Language::translate('LBL_NOT_ACCESSIBLE'); |
|
| 320 | + } |
|
| 321 | + } else { |
|
| 314 | 322 | $pick_val = $exist_val; |
| 315 | - else |
|
| 316 | - $pick_val = \includes\Language::translate('LBL_NOT_ACCESSIBLE'); |
|
| 317 | - } else |
|
| 318 | - $pick_val = $exist_val; |
|
| 323 | + } |
|
| 319 | 324 | |
| 320 | 325 | return $pick_val; |
| 321 | 326 | } |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * |
| 387 | - * @return Date |
|
| 387 | + * @return string |
|
| 388 | 388 | */ |
| 389 | 389 | public function get_DB_formatted_date() |
| 390 | 390 | { |
@@ -529,10 +529,6 @@ discard block |
||
| 529 | 529 | * This should be used whereever possible |
| 530 | 530 | * |
| 531 | 531 | * @param integer $index - number between 0 to 42 |
| 532 | - * @param string $day - date |
|
| 533 | - * @param string $month - month |
|
| 534 | - * @param string $year - year |
|
| 535 | - * return vt_DateTime obj $datetimevalue |
|
| 536 | 532 | */ |
| 537 | 533 | public function getThisMonthsDayByIndex($index) |
| 538 | 534 | { |
@@ -87,12 +87,15 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function getTodayDatetimebyIndex($index, $day = '', $month = '', $year = '') |
| 89 | 89 | { |
| 90 | - if ($day === '') |
|
| 91 | - $day = $this->day; |
|
| 92 | - if ($month === '') |
|
| 93 | - $month = $this->month; |
|
| 94 | - if ($year === '') |
|
| 95 | - $year = $this->year; |
|
| 90 | + if ($day === '') { |
|
| 91 | + $day = $this->day; |
|
| 92 | + } |
|
| 93 | + if ($month === '') { |
|
| 94 | + $month = $this->month; |
|
| 95 | + } |
|
| 96 | + if ($year === '') { |
|
| 97 | + $year = $this->year; |
|
| 98 | + } |
|
| 96 | 99 | $day_array = array(); |
| 97 | 100 | |
| 98 | 101 | if ($index < 0 || $index > 23) { |
@@ -140,12 +143,15 @@ discard block |
||
| 140 | 143 | */ |
| 141 | 144 | public function getThismonthDaysbyIndex($index, $day = '', $month = '', $year = '') |
| 142 | 145 | { |
| 143 | - if ($day == '') |
|
| 144 | - $day = $index + 1; |
|
| 145 | - if ($month == '') |
|
| 146 | - $month = $this->month; |
|
| 147 | - if ($year == '') |
|
| 148 | - $year = $this->year; |
|
| 146 | + if ($day == '') { |
|
| 147 | + $day = $index + 1; |
|
| 148 | + } |
|
| 149 | + if ($month == '') { |
|
| 150 | + $month = $this->month; |
|
| 151 | + } |
|
| 152 | + if ($year == '') { |
|
| 153 | + $year = $this->year; |
|
| 154 | + } |
|
| 149 | 155 | $month_array = array(); |
| 150 | 156 | $month_array['day'] = $day; |
| 151 | 157 | $month_array['month'] = $month; |
@@ -356,8 +362,9 @@ discard block |
||
| 356 | 362 | } else { |
| 357 | 363 | die("year was not set"); |
| 358 | 364 | } |
| 359 | - if (empty($hour) && $hour !== 0) |
|
| 360 | - $hour = 0; |
|
| 365 | + if (empty($hour) && $hour !== 0) { |
|
| 366 | + $hour = 0; |
|
| 367 | + } |
|
| 361 | 368 | $this->ts = mktime($hour, $minute, $second, $month, $day, $year); |
| 362 | 369 | $this->setDateTime($this->ts); |
| 363 | 370 | } |
@@ -399,10 +406,12 @@ discard block |
||
| 399 | 406 | { |
| 400 | 407 | $hour = $this->z_hour; |
| 401 | 408 | $min = $this->minute; |
| 402 | - if (empty($hour)) |
|
| 403 | - $hour = '00'; |
|
| 404 | - if (empty($min)) |
|
| 405 | - $min = '00'; |
|
| 409 | + if (empty($hour)) { |
|
| 410 | + $hour = '00'; |
|
| 411 | + } |
|
| 412 | + if (empty($min)) { |
|
| 413 | + $min = '00'; |
|
| 414 | + } |
|
| 406 | 415 | return $hour . ':' . $min; |
| 407 | 416 | } |
| 408 | 417 | |
@@ -413,10 +422,11 @@ discard block |
||
| 413 | 422 | */ |
| 414 | 423 | public function get_changed_day($mode) |
| 415 | 424 | { |
| 416 | - if ($mode == 'increment') |
|
| 417 | - $day = $this->day + 1; |
|
| 418 | - else |
|
| 419 | - $day = $this->day - 1; |
|
| 425 | + if ($mode == 'increment') { |
|
| 426 | + $day = $this->day + 1; |
|
| 427 | + } else { |
|
| 428 | + $day = $this->day - 1; |
|
| 429 | + } |
|
| 420 | 430 | $date_data = array('day' => $day, |
| 421 | 431 | 'month' => $this->month, |
| 422 | 432 | 'year' => $this->year |
@@ -432,10 +442,11 @@ discard block |
||
| 432 | 442 | public function get_first_day_of_changed_week($mode) |
| 433 | 443 | { |
| 434 | 444 | $first_day = $this->getThisweekDaysbyIndex(1); |
| 435 | - if ($mode == 'increment') |
|
| 436 | - $day = $first_day->day + 7; |
|
| 437 | - else |
|
| 438 | - $day = $first_day->day - 7; |
|
| 445 | + if ($mode == 'increment') { |
|
| 446 | + $day = $first_day->day + 7; |
|
| 447 | + } else { |
|
| 448 | + $day = $first_day->day - 7; |
|
| 449 | + } |
|
| 439 | 450 | $date_data = array('day' => $day, |
| 440 | 451 | 'month' => $first_day->month, |
| 441 | 452 | 'year' => $first_day->year |
@@ -11,6 +11,10 @@ |
||
| 11 | 11 | class VTJsonCondition |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param VTEntityCache $entityCache |
|
| 16 | + * @param string $id |
|
| 17 | + */ |
|
| 14 | 18 | function evaluate($condition, $entityCache, $id) |
| 15 | 19 | { |
| 16 | 20 | $expr = \includes\utils\Json::decode($condition); |
@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | $i = 0; |
| 25 | 25 | foreach ($expr as $cond) { |
| 26 | 26 | $conditionGroup = $cond['groupid']; |
| 27 | - if (empty($conditionGroup)) |
|
| 28 | - $conditionGroup = 0; |
|
| 27 | + if (empty($conditionGroup)) { |
|
| 28 | + $conditionGroup = 0; |
|
| 29 | + } |
|
| 29 | 30 | preg_match('/(\w+) : \((\w+)\) (\w+)/', $cond['fieldname'], $matches); |
| 30 | 31 | if (count($matches) == 0) { |
| 31 | 32 | $expressionResults[$conditionGroup][$i]['result'] = $this->checkCondition($entityData, $cond); |
@@ -117,8 +118,9 @@ discard block |
||
| 117 | 118 | $data = $entityData->getData(); |
| 118 | 119 | |
| 119 | 120 | $condition = $cond['operation']; |
| 120 | - if (empty($condition)) |
|
| 121 | - return false; |
|
| 121 | + if (empty($condition)) { |
|
| 122 | + return false; |
|
| 123 | + } |
|
| 122 | 124 | if ($cond['fieldname'] == 'date_start' || $cond['fieldname'] == 'due_date') { |
| 123 | 125 | $fieldName = $cond['fieldname']; |
| 124 | 126 | $dateTimePair = array('date_start' => 'time_start', 'due_date' => 'time_end'); |
@@ -238,8 +240,9 @@ discard block |
||
| 238 | 240 | } |
| 239 | 241 | return strpos($fieldValue, $value) !== FALSE; |
| 240 | 242 | case 'does not contain': |
| 241 | - if (empty($value)) |
|
| 242 | - unset($value); |
|
| 243 | + if (empty($value)) { |
|
| 244 | + unset($value); |
|
| 245 | + } |
|
| 243 | 246 | if (is_array($value)) { |
| 244 | 247 | return !in_array($fieldValue, $value); |
| 245 | 248 | } |
@@ -152,6 +152,9 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | + /** |
|
| 156 | + * @param VTTaskType $taskTypeInstance |
|
| 157 | + */ |
|
| 155 | 158 | public function retrieveTemplatePath($moduleName, $taskTypeInstance) |
| 156 | 159 | { |
| 157 | 160 | $taskTemplatePath = $taskTypeInstance->get('templatepath'); |
@@ -226,6 +229,9 @@ discard block |
||
| 226 | 229 | |
| 227 | 230 | var $data; |
| 228 | 231 | |
| 232 | + /** |
|
| 233 | + * @param string $key |
|
| 234 | + */ |
|
| 229 | 235 | public function get($key) |
| 230 | 236 | { |
| 231 | 237 | return $this->data[$key]; |
@@ -11,6 +11,9 @@ discard block |
||
| 11 | 11 | class VTWorkflowApplication |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $action |
|
| 16 | + */ |
|
| 14 | 17 | function __construct($action) |
| 15 | 18 | { |
| 16 | 19 | $this->request; |
@@ -36,6 +39,9 @@ discard block |
||
| 36 | 39 | return $_SERVER["REQUEST_URI"]; |
| 37 | 40 | } |
| 38 | 41 | |
| 42 | + /** |
|
| 43 | + * @return string |
|
| 44 | + */ |
|
| 39 | 45 | function returnUrl() |
| 40 | 46 | { |
| 41 | 47 | return $this->returnUrl; |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | /** |
| 481 | 481 | * Function gets the next trigger for the workflows |
| 482 | 482 | * @global <String> $default_timezone |
| 483 | - * @return type |
|
| 483 | + * @return string|null |
|
| 484 | 484 | */ |
| 485 | 485 | function getNextTriggerTime() |
| 486 | 486 | { |
@@ -525,8 +525,8 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | /** |
| 527 | 527 | * get next trigger time for daily |
| 528 | - * @param type $schTime |
|
| 529 | - * @return time |
|
| 528 | + * @param type $scheduledTime |
|
| 529 | + * @return string |
|
| 530 | 530 | */ |
| 531 | 531 | function getNextTriggerTimeForDaily($scheduledTime) |
| 532 | 532 | { |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | module_name=?, summary=?, test=?, execution_condition=?, defaultworkflow=?, filtersavedinnew=?, |
| 42 | 42 | schtypeid=?, schtime=?, schdayofmonth=?, schdayofweek=?, schannualdates=?, nexttrigger_time=? where workflow_id=?", array($wf->moduleName, $wf->description, $wf->test, $wf->executionCondition, $wf->defaultworkflow, $wf->filtersavedinnew, |
| 43 | 43 | $wf->schtypeid, $wf->schtime, $wf->schdayofmonth, $wf->schdayofweek, $wf->schannualdates, $wf->nexttrigger_time, $wf->id)); |
| 44 | - }else { |
|
| 44 | + } else { |
|
| 45 | 45 | $workflowId = $adb->getUniqueID("com_vtiger_workflows"); |
| 46 | 46 | $workflow->id = $workflowId; |
| 47 | 47 | $wf = $workflow; |
@@ -35,18 +35,20 @@ discard block |
||
| 35 | 35 | $adb = $this->adb; |
| 36 | 36 | if (isset($workflow->id)) { |
| 37 | 37 | $wf = $workflow; |
| 38 | - if ($wf->filtersavedinnew == null) |
|
| 39 | - $wf->filtersavedinnew = 5; |
|
| 38 | + if ($wf->filtersavedinnew == null) { |
|
| 39 | + $wf->filtersavedinnew = 5; |
|
| 40 | + } |
|
| 40 | 41 | $adb->pquery("update com_vtiger_workflows set |
| 41 | 42 | module_name=?, summary=?, test=?, execution_condition=?, defaultworkflow=?, filtersavedinnew=?, |
| 42 | 43 | schtypeid=?, schtime=?, schdayofmonth=?, schdayofweek=?, schannualdates=?, nexttrigger_time=? where workflow_id=?", array($wf->moduleName, $wf->description, $wf->test, $wf->executionCondition, $wf->defaultworkflow, $wf->filtersavedinnew, |
| 43 | 44 | $wf->schtypeid, $wf->schtime, $wf->schdayofmonth, $wf->schdayofweek, $wf->schannualdates, $wf->nexttrigger_time, $wf->id)); |
| 44 | - }else { |
|
| 45 | + } else { |
|
| 45 | 46 | $workflowId = $adb->getUniqueID("com_vtiger_workflows"); |
| 46 | 47 | $workflow->id = $workflowId; |
| 47 | 48 | $wf = $workflow; |
| 48 | - if ($wf->filtersavedinnew == null) |
|
| 49 | - $wf->filtersavedinnew = 5; |
|
| 49 | + if ($wf->filtersavedinnew == null) { |
|
| 50 | + $wf->filtersavedinnew = 5; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | $result = $adb->getColumnNames("com_vtiger_workflows"); |
| 52 | 54 | if (in_array("type", $result)) { |
@@ -155,8 +157,9 @@ discard block |
||
| 155 | 157 | $workflow = $this->getWorkflowInstance($row->type); |
| 156 | 158 | $workflow->setup($row->data); |
| 157 | 159 | |
| 158 | - if (!is_a($workflow, 'Workflow')) |
|
| 159 | - continue; |
|
| 160 | + if (!is_a($workflow, 'Workflow')) { |
|
| 161 | + continue; |
|
| 162 | + } |
|
| 160 | 163 | |
| 161 | 164 | $workflows[$i++] = $workflow; |
| 162 | 165 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * Retrieve a template given it's id |
| 42 | 42 | * |
| 43 | 43 | * @param $templateId The id of the template |
| 44 | - * @return The template object |
|
| 44 | + * @return VTWorkflowTemplate template object |
|
| 45 | 45 | */ |
| 46 | 46 | public function retrieveTemplate($templateId) |
| 47 | 47 | { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * The new workflow will also be added to the database. |
| 64 | 64 | * |
| 65 | - * @param $template The template to use |
|
| 65 | + * @param VTWorkflowTemplate $template The template to use |
|
| 66 | 66 | * @return A workflow object. |
| 67 | 67 | */ |
| 68 | 68 | public function createWorkflow($template) |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * This can be used for exporting templates from one |
| 146 | 146 | * machine to another |
| 147 | 147 | * |
| 148 | - * @return The string dump of the templates. |
|
| 148 | + * @return string string dump of the templates. |
|
| 149 | 149 | */ |
| 150 | 150 | public function dumpAllTemplates() |
| 151 | 151 | { |
@@ -113,8 +113,7 @@ |
||
| 113 | 113 | $adb = $this->adb; |
| 114 | 114 | if (is_numeric($template->id)) {//How do I check whether a member exists in php? |
| 115 | 115 | $templateId = $template->id; |
| 116 | - $adb->pquery("update com_vtiger_workflowtemplates set title=?," + |
|
| 117 | - " module_name=?, template=? where template_id=?", array($template->title, $template->moduleName, |
|
| 116 | + $adb->pquery("update com_vtiger_workflowtemplates set title=?," +" module_name=?, template=? where template_id=?", array($template->title, $template->moduleName, |
|
| 118 | 117 | $template->template, $templateId)); |
| 119 | 118 | return $templateId; |
| 120 | 119 | } else { |
@@ -108,6 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * Insert redirection script |
| 111 | + * @param string $to |
|
| 111 | 112 | */ |
| 112 | 113 | public function redirectTo($to, $message) |
| 113 | 114 | { |
@@ -132,6 +133,9 @@ discard block |
||
| 132 | 133 | * @params :: $modulename - name of the module |
| 133 | 134 | */ |
| 134 | 135 | |
| 136 | + /** |
|
| 137 | + * @param boolean $modulename |
|
| 138 | + */ |
|
| 135 | 139 | public static function checkModuleWorkflow($modulename) |
| 136 | 140 | { |
| 137 | 141 | $adb = PearDatabase::getInstance(); |