Skip to content

Commit

Permalink
removed some potential PHP Notices by using checks and default values
Browse files Browse the repository at this point in the history
(FrankP contribution)
  • Loading branch information
AlexKay85 committed Oct 9, 2020
1 parent 9a714bd commit 9edfd9d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/fields/DateTimeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public static function __convertToUserFormat($date, $format) {
} elseif ($format == 'yyyy-mm-dd') {
$date[0] = $y . '-' . $m . '-' . $d;
}
if ($date[1] != '') {
if (isset ($date[1]) AND $date[1] != '') {
$userDate = $date[0] . ' ' . $date[1];
} else {
$userDate = $date[0];
Expand Down
1 change: 1 addition & 0 deletions modules/Calendar/actions/ActivityReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public function process(Vtiger_Request $request) {

function getReminders(Vtiger_Request $request) {
$recordModels = Calendar_Module_Model::getCalendarReminder();
$records = array();
foreach($recordModels as $record) {
$records[] = $record->getDisplayableValues();
$record->updateReminderStatus();
Expand Down
5 changes: 4 additions & 1 deletion modules/CustomView/CustomView.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ public function getMeta($module, $user) {
*/
function getViewId($module) {
global $adb, $current_user;
$now_action = vtlib_purify($_REQUEST['action']);
$now_action = '';
if (isset($_REQUEST['action'])) {
$now_action = vtlib_purify($_REQUEST['action']);
}
if (empty($_REQUEST['viewname'])) {
if (isset($_SESSION['lvs'][$module]["viewname"]) && $_SESSION['lvs'][$module]["viewname"] != '') {
$viewid = $_SESSION['lvs'][$module]["viewname"];
Expand Down
2 changes: 1 addition & 1 deletion modules/Vtiger/models/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function getFields() {
$this->fields = array();

// if block does not contains any fields
if(!is_array($moduleFields[$this->id])){
if(!array_key_exists($this->id, $moduleFields) or !is_array($moduleFields[$this->id])){
$moduleFields[$this->id] = array();
}

Expand Down
2 changes: 1 addition & 1 deletion modules/Vtiger/models/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getData(){
}

public function getModule() {
if(!$this->module) {
if(!isset($this->module)) {
$moduleObj = $this->block->module;
//fix for opensource emailTemplate listview break
if(empty($moduleObj)){
Expand Down
7 changes: 6 additions & 1 deletion modules/Vtiger/models/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ public function getRelatedModuleName() {
* @return <String>
*/
public function getRecordCount() {
return $this->recordcount;
if (isset($this->recordcount)) {
return $this->recordcount;
}
else {
return 0;
}
}
}
2 changes: 1 addition & 1 deletion modules/Vtiger/models/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ public function isExportable() {
* @return <Array> list of field models <Vtiger_Field_Model>
*/
public function getSummaryViewFieldsList() {
if (!$this->summaryFields) {
if (!isset($this->summaryFields)) {
$summaryFields = array();
$fields = $this->getFields();
foreach ($fields as $fieldName => $fieldModel) {
Expand Down
1 change: 1 addition & 0 deletions vtlib/Vtiger/Deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ static function getAnnouncements() {
$sql = " select * from vtiger_announcement inner join vtiger_users on vtiger_announcement.creatorid=vtiger_users.id";
$sql.=" AND vtiger_users.is_admin='on' AND vtiger_users.status='Active' AND vtiger_users.deleted = 0";
$result = $adb->pquery($sql, array());
$announcement = '';
for ($i = 0; $i < $adb->num_rows($result); $i++) {
$announce = getUserFullName($adb->query_result($result, $i, 'creatorid')) . ' : ' . $adb->query_result($result, $i, 'announcement') . ' ';
if ($adb->query_result($result, $i, 'announcement') != '')
Expand Down

0 comments on commit 9edfd9d

Please sign in to comment.