CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    mod.saveNotes = function(batchID) {
        var dstr = $('#batchNotes').serialize() + '&noteID=' + batchID;
        $.ajax({
            type: 'post',
            data: dstr
Severity: Major
Found in fannie/batches/newbatch/edit.js and 1 other location - About 2 hrs to fix
fannie/batches/newbatch/edit.js on lines 333..340

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File FannieCRUDPage.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*******************************************************************************

    Copyright 2015 Whole Foods Co-op

Severity: Minor
Found in fannie/classlib2.0/FannieCRUDPage.php - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if (isset($item['locAbbr']) && $item['transLimit'] == 0) {
                $pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT);
                $pdf->SetXY($this->left + ($this->width*$column) + 14, $this->top + ($this->height*$row) + ($this->height - 42));
                $pdf->Cell($effective_width, 20, " ".$item['locAbbr'], 0, 1, 'L');
            }
    Severity: Major
    Found in fannie/classlib2.0/item/signage/Compact12UpL.php and 1 other location - About 2 hrs to fix
    fannie/classlib2.0/item/signage/Signage12UpL.php on lines 128..132

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            if (isset($item['locAbbr']) && $item['transLimit'] == 0) {
                $pdf->SetFont($this->alt_font, '', $this->SMALLEST_FONT);
                $pdf->SetXY($this->left + ($this->width*$column) + 14, $this->top + ($this->height*$row) + ($this->height - 33));
                $pdf->Cell($effective_width, 20, " ".$item['locAbbr'], 0, 1, 'L');
            }
    Severity: Major
    Found in fannie/classlib2.0/item/signage/Signage12UpL.php and 1 other location - About 2 hrs to fix
    fannie/classlib2.0/item/signage/Compact12UpL.php on lines 130..134

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 124.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function piJS has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var piJS = (function($) {
        var mod = {};
    
        var extractFields = function(data) {
            var pieces = data.split("^");
    Severity: Major
    Found in fannie/modules/plugins2.0/PIKiller/edit.js - About 2 hrs to fix

      Function salesToday has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var salesToday = (function($) {
          var mod = {};
      
          mod.reloadGraph = function() {
              var url='SalesTodayReport.php?';
      Severity: Major
      Found in fannie/reports/SalesToday/salesToday.js - About 2 hrs to fix

        Method handleResponseVoid has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function handleResponseVoid($authResult)
            {
                $resp = $this->desoapify("CreditTransactionResult",
                    $authResult["response"]);
                $xml = new XmlData($resp);
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/MercuryE2E.php - About 2 hrs to fix

          Method preprocess has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function preprocess()
              {
                  $entered = $this->getInput();
                  if ($entered === false) {
                      return true;
          Severity: Major
          Found in pos/is4c-nf/gui-modules/memlist.php - About 2 hrs to fix

            Method getCCredSubtotals has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static public function getCCredSubtotals($tender, $conn,
                    $programCode='', $table='', $ref='') 
                {
                    global $CORE_LOCAL;
            
            
            Severity: Major
            Found in pos/is4c-nf/plugins/CoopCred/CoopCredLib.php - About 2 hrs to fix

              Method doc has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function doc()
                  {
                      return '
              Use:
              This is one of two "primary" tables dealing with membership
              Severity: Major
              Found in pos/is4c-nf/lib/models/op/CustdataModel.php - About 2 hrs to fix

                Method deptOpenRing has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function deptOpenRing($dept, $price, $discount, $ret)
                    {
                        list($ret, $memberOnly) = $this->memberOnlyDept($dept, $ret);
                        if ($memberOnly === true) {
                            return $ret;
                Severity: Major
                Found in pos/is4c-nf/lib/DeptLib.php - About 2 hrs to fix

                  Method run has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function run()
                      {
                          $dbc = FannieDB::get($this->config->get('OP_DB'));
                          $today = date('Y-m-d');
                          $now = new DateTime();
                  Severity: Major
                  Found in fannie/cron/tasks/PartialBatchTask.php - About 2 hrs to fix

                    Method get_id_view has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function get_id_view()
                        {
                            $this->addScript($this->config->get('URL') . 'src/javascript/chosen/chosen.jquery.min.js');
                            $this->addCssFile($this->config->get('URL') . 'src/javascript/chosen/bootstrap-chosen.css');
                            $this->addScript('edit.js?20180524');
                    Severity: Major
                    Found in fannie/batches/newbatch/EditBatchPage.php - About 2 hrs to fix

                      Method helpContent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function helpContent()
                          {
                              return '<p>Batch types control what kind of change a batch makes and
                                  may also be used for organization. Discount type controls the
                                  batch type\'s behavior. You may have multiple batch types with
                      Severity: Major
                      Found in fannie/batches/BatchTypeEditor.php - About 2 hrs to fix

                        Method fetch_report_data has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function fetch_report_data()
                            {
                                global $FANNIE_OP_DB;
                                $dbc = FannieDB::get($FANNIE_OP_DB);
                        
                        
                        Severity: Major
                        Found in fannie/reports/Store-Specific/WFC/VoterList/VotenetReport.php - About 2 hrs to fix

                          Method fetch_report_data has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function fetch_report_data()
                              {
                                  $dbc = $this->connection;
                                  $dbc->selectDB($this->config->get('OP_DB'));
                                  $date1 = $this->form->date1;
                          Severity: Major
                          Found in fannie/reports/ManufacturerMovement/ManufacturerMovementReport.php - About 2 hrs to fix

                            Method fetch_report_data has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function fetch_report_data()
                                {
                                    $dbc = $this->connection;
                                    $dbc->selectDB($this->config->get('OP_DB'));
                            
                            
                            Severity: Major
                            Found in fannie/reports/Recall/RecallReport.php - About 2 hrs to fix

                              Method post_handler has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function post_handler()
                                  {
                                      $brands = FormLib::get('brand');
                                      $descriptions = FormLib::get('description');
                                      $prices = FormLib::get('price');
                              Severity: Major
                              Found in fannie/admin/labels/ManualSignsPage.php - About 2 hrs to fix

                                Method getPlanSales has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function getPlanSales($weekID)
                                    {
                                        if ($weekID >= 374) {
                                            $prep = $this->connection->prepare("select c.obfCategoryID, m.superID, b.storeID, b.planGoal  
                                                from " . FannieDB::fqn('ObfBudget', 'plugin:ObfDatabaseV2') . " AS b 
                                Severity: Major
                                Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php - About 2 hrs to fix

                                  Method get_illness_view has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function get_illness_view()
                                      {
                                          $this->illness = str_pad($this->illness, 4, '0', STR_PAD_LEFT);
                                          $userP = $this->connection->prepare("SELECT name, real_name FROM " . FannieDB::fqn('Users', 'op') . " WHERE uid=?");
                                          $user = $this->connection->getRow($userP, array($this->illness));
                                  Severity: Major
                                  Found in fannie/modules/plugins2.0/HrWeb/Permissions/PermissionsPage.php - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language