YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Consider simplifying this complex logical expression.
Open

        if (($arrInput = \explode(' ', $input, 2)) && 2 === \count($arrInput)) {
            $userModel = User::getUserModel($userId ?? User::getCurrentUserId());
            [$dateInput, $timeInput] = $arrInput;
            [$y, $m, $d] = Fields\Date::explode($dateInput, $userModel->getDetail('date_format'));
            if ('12' === $userModel->getDetail('hour_format')) {
Severity: Major
Found in app/Validator.php - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

                            if (
                                $fieldModel->isViewable()
                                && !($fieldType && $fieldModel->getFieldDataType() !== $fieldType)
                                && (!$relRecord || ($relRecord && !$relRecord->isEmpty($fieldModel->getName())))
                            ) {
    Severity: Major
    Found in app/TextParser.php - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if (!empty($currency) && !empty($currencyData) && $baseCurrency['id'] !== $currency && $inventory->isField('tax') && $inventory->isField('taxmode') && $inventory->isField('currency')) {
                      $RATE = $baseCurrency['conversion_rate'] / $currencyData['conversion_rate'];
                      $html .= '<table class="table-currency-s-two-lang" style="border-collapse:collapse;width:100%;">
                                      <thead>
                                          <tr>
      Severity: Major
      Found in app/TextParser/TableCurrencySTwoLang.php - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                    if (!empty($currency) && !empty($rate) && $baseCurrency['id'] !== $currency && $inventory->isField('tax') && $inventory->isField('taxmode') && $inventory->isField('currency')) {
                        $html .= '<table class="table-currency-summary" style="border-collapse:collapse;width:100%;border:1px solid #ddd;">
                                        <thead>
                                            <tr>
                                                <th colspan="2" style="padding:0px 4px;text-align:center;">
        Severity: Major
        Found in app/TextParser/TableCurrencySummary.php - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if (!$sourceFieldName || !$this->textParser->recordModel || empty($sourceRecordId = $this->textParser->recordModel->get($sourceFieldName))
                      || !\App\Record::isExists($sourceRecordId) || !($recordModel = \Vtiger_Record_Model::getInstanceById($sourceRecordId)) || !$recordModel->isViewable()
                  ) {
                      return [];
                  }
          Severity: Major
          Found in app/TextParser/RelatedRecordsDataFromField.php - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                            if ($fromIp && $byIp && $fromIp !== $byIp && ((!$fromDomain && !$byDomain) || $fromDomain !== $byDomain)) {
                                $row['ip'] = $fromIp;
                                $row['key'] = $key;
                                $row['from'] = $received->getFromName();
                                $row['by'] = $received->getByName();
            Severity: Major
            Found in app/Mail/Rbl.php - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if (!$this->error && ($code = $client->getStatusCode())) {
                          $content = $client->getResponseBody();
                          $this->success = 204 === $code || (\in_array($code, [200, 201]) && $content && (new Config())->setToken(\App\Json::decode($content)));
                      } elseif (409 === $client->getStatusCode() && false !== stripos($this->error, 'app')) {
                          throw new \App\Exceptions\AppException('ERR_RECREATE_APP_ACCESS');
              Severity: Major
              Found in app/YetiForce/Register.php - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if (($active && isset($users[$id]) && 'Active' == $users[$id]['status'] && !$users[$id]['deleted']) || (!$active && isset($users[$id]))) {
                                $isExists = true;
                            }
                Severity: Major
                Found in app/User.php - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if (((3 == $actionId || 4 == $actionId) && 0 != $role->get('previewrelatedrecord')) || ((0 == $actionId || 1 == $actionId) && 0 != $role->get('editrelatedrecord'))) {
                                  $parentRecord = \Users_Privileges_Model::getParentRecord($record, $moduleName, $role->get('previewrelatedrecord'), $actionId);
                                  if ($parentRecord && Record::isExists($parentRecord)) {
                                      $recordMetaData = \vtlib\Functions::getCRMRecordMetadata($parentRecord);
                                      $permissionsRoleForRelatedField = $role->get('permissionsrelatedfield');
                  Severity: Major
                  Found in app/Privilege.php - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if ((!empty($firstItem) && !empty($firstItemModuleModal = \Vtiger_Field_Model::getInstance($firstItem, \Vtiger_Module_Model::getInstance($sourceModule))) && $firstItemModuleModal->isActiveField() && $fieldModel->isActiveField()) && (11 == $firstItemModuleModal->getUIType()) && (1 == $fieldModel->getUIType())) {
                                    unset($fieldName);
                                } else {
                                    $blockIdFieldMap[$fieldModel->getBlockId()][$fieldName] = $fieldModel;
                                    if (!$fieldModel->isActiveField()) {
                    Severity: Major
                    Found in modules/Settings/LayoutEditor/views/Index.php - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {
                                  $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
                                  $eventHandler = new App\EventHandler();
                                  $eventHandler->setRecordModel($recordModel)->setModuleName($moduleName)->setParams($return);
                                  $eventHandler->trigger('MailComposeParamBefore');
                      Severity: Major
                      Found in modules/OSSMail/models/Module.php - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                            if (isset($text[$last]) && $line && !$qLevel
                                                && '-- ' !== $text[$last]
                                                && isset($text[$last][\strlen($text[$last]) - 1]) && ' ' === $text[$last][\strlen($text[$last]) - 1]
                                            ) {
                                                if ($delSp) {
                        Severity: Major
                        Found in modules/OSSMail/models/Record.php - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
                                      $linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
                                          'linktype' => 'DETAIL_VIEW_BASIC',
                                          'linklabel' => 'LBL_SET_RECORD_STATUS',
                                          'linkurl' => '#',
                          Severity: Major
                          Found in modules/Calendar/models/DetailView.php - About 40 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (isset($relations['Products']) || isset($relations['Services']) || isset($relations['OSSOutsourcedServices']) || isset($relations['Assets']) || isset($relations['OSSSoldServices']) || isset($relations['OutsourcedProducts'])) {
                                            $relatedLinks[] = [
                                                'linktype' => 'DETAILVIEWTAB',
                                                'linklabel' => 'LBL_RECORD_SUMMARY_PRODUCTS_SERVICES',
                                                'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showRelatedProductsServices&requestMode=summary',
                            Severity: Major
                            Found in modules/Accounts/models/DetailView.php - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if (!empty($sl) && \App\Record::isExists($sl)) {
                                          $relatedId = $sl;
                                      } elseif (!empty($subprocess) && \App\Record::isExists($subprocess)) {
                                          $relatedId = $subprocess;
                                      } elseif (!empty($process) && \App\Record::isExists($process)) {
                              Severity: Major
                              Found in modules/Notification/models/Record.php - About 40 mins to fix

                                Consider simplifying this complex logical expression.
                                Open

                                            if (isset($relations['Products']) || isset($relations['Services']) || isset($relations['OSSOutsourcedServices']) || isset($relations['Assets']) || isset($relations['OSSSoldServices']) || isset($relations['OutsourcedProducts'])) {
                                                $relatedLinks[] = [
                                                    'linktype' => 'DETAILVIEWTAB',
                                                    'linklabel' => 'LBL_RECORD_SUMMARY_PRODUCTS_SERVICES',
                                                    'linkurl' => $recordModel->getDetailViewUrl() . '&mode=showRelatedProductsServices&requestMode=summary',
                                Severity: Major
                                Found in modules/SSalesProcesses/models/DetailView.php - About 40 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                              if ((empty($item['name']) && empty($item['baseContent'])) && (empty($item['key']) || empty($item['name']) || empty($item['size']) || 50 !== App\TextUtils::getTextLength($item['key']))) {
                                                  throw new \App\Exceptions\Security('ERR_ILLEGAL_FIELD_VALUE||' . $this->getFieldModel()->getName() . '||' . $this->getFieldModel()->getModuleName() . '||' . \App\Json::encode($value), 406);
                                              }
                                  Severity: Major
                                  Found in modules/Vtiger/uitypes/MultiImage.php - About 40 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                if (empty($widgetData[$key])
                                                    || ('all' !== $widgetData[$key] && !isset($accessibleUsers[$widgetData[$key]]) && !isset($accessibleGroups[$widgetData[$key]]))
                                                    || ('all' === $widgetData[$key] && !\in_array($widgetData[$key], $available))) {
                                                    $defaultValue = Settings_WidgetsManagement_Module_Model::getDefaultUserId($widget, false, $defaultValue);
                                                    $widgetData[$key] = empty($defaultValue) ? \App\User::getCurrentUserId() : $defaultValue;
                                    Severity: Major
                                    Found in modules/ModTracker/dashboards/Updates.php - About 40 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                                      if (($url = $recordModel->get($fieldName)) &&
                                                          0 === strpos($url, $meeting->get('url')) &&
                                                          ($expFieldName = $fieldModel->getFieldParams()['exp'] ?? '') &&
                                                          $recordModel->getField($expFieldName) &&
                                                          ($recordModel->isNew() || false !== $recordModel->getPreviousValue($expFieldName))
                                      Severity: Major
                                      Found in modules/Vtiger/handlers/Meetings.php - About 40 mins to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                if (null !== $value && (1 === $value || '1' === $value || 'on' === strtolower($value) || 'yes' === strtolower($value) || true === $value)) {
                                                    return App\Language::translate('LBL_YES', $this->getFieldModel()->getModuleName());
                                                }
                                        Severity: Major
                                        Found in modules/Vtiger/uitypes/Boolean.php - About 40 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language