CORE-POS/IS4C

View on GitHub
fannie/batches/newbatch/EditBatchPage.php

Summary

Maintainability
F
1 wk
Test Coverage
F
40%

File EditBatchPage.php has 1596 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2009,2010 Whole Foods Co-op

Severity: Major
Found in fannie/batches/newbatch/EditBatchPage.php - About 4 days to fix

    Method showBatchDisplay has 425 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function showBatchDisplay($id, $order='natural')
        {
            global $FANNIE_SERVER_DBMS,$FANNIE_URL;
            $dbc = $this->connection;
            $uid = getUID($this->current_user);
    Severity: Major
    Found in fannie/batches/newbatch/EditBatchPage.php - About 2 days to fix

      Function showBatchDisplay has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function showBatchDisplay($id, $order='natural')
          {
              global $FANNIE_SERVER_DBMS,$FANNIE_URL;
              $dbc = $this->connection;
              $uid = getUID($this->current_user);
      Severity: Minor
      Found in fannie/batches/newbatch/EditBatchPage.php - About 1 day to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      EditBatchPage has 43 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class EditBatchPage extends FannieRESTfulPage
      {
          protected $must_authenticate = true;
          protected $auth_classes = array('batches','batches_audited');
          protected $title = 'Sales Batches Tool';
      Severity: Minor
      Found in fannie/batches/newbatch/EditBatchPage.php - About 5 hrs to fix

        Method showPairedBatchDisplay has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function showPairedBatchDisplay($id, $name)
            {
                global $FANNIE_SERVER_DBMS;
                $dbc = $this->connection;
                $uid = getUID($this->current_user);
        Severity: Major
        Found in fannie/batches/newbatch/EditBatchPage.php - About 3 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 post_id_upc_price_qty_handler has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function post_id_upc_price_qty_handler()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
                    $json = array('error'=>0, 'msg'=>'');
            Severity: Minor
            Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

              Method post_id_autotag_handler has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function post_id_autotag_handler()
                  {
                      $dbc = $this->connection;
                      $dbc->selectDB($this->config->get('OP_DB'));
              
              
              Severity: Minor
              Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                Method post_id_trim_handler has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function post_id_trim_handler()
                    {
                        $dbc = $this->connection;
                        $dbc->selectDB($this->config->OP_DB);
                        $ret = array('error'=>0, 'display'=>'');
                Severity: Minor
                Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                  Method delete_id_upc_handler has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function delete_id_upc_handler()
                      {
                          global $FANNIE_OP_DB;
                          $dbc = FannieDB::get($FANNIE_OP_DB);
                          $id = $this->id;
                  Severity: Minor
                  Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                    Method batch_history has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function batch_history($bid)
                        {
                            include('../batchhistory/BatchHistoryPage.php');
                            $modal = '';
                            $modal .= '
                    Severity: Minor
                    Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                      Method checkAllOverlap has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function checkAllOverlap($id)
                          {
                              $dbc = $this->connection;
                              $batch = new BatchesModel($dbc);
                              $batch->batchID($id);
                      Severity: Minor
                      Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                        Method post_id_addUPC_handler has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function post_id_addUPC_handler()
                            {
                                $dbc = $this->connection;
                                $dbc->selectDB($this->config->get('OP_DB'));
                                $upc = trim($this->addUPC);
                        Severity: Minor
                        Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                          Method checkOverlap has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function checkOverlap($id, $upc)
                              {
                                  $dbc = $this->connection;
                                  $batch = new BatchesModel($dbc);
                                  $batch->batchID($id);
                          Severity: Minor
                          Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                            Method pairedTableBody has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function pairedTableBody($dbc, $result, $down=true)
                                {
                                    $colors = array('#ffffff','#ffffcc');
                                    $cur = 0;
                                    $FANNIE_URL = $this->config->get('URL');
                            Severity: Minor
                            Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                              Method post_id_upc_price_handler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function post_id_upc_price_handler()
                                  {
                                      $dbc = $this->connection;
                                      $dbc->selectDB($this->config->get('OP_DB'));
                                      $price = trim($this->price);
                              Severity: Minor
                              Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                Method unitTest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function unitTest($phpunit)
                                    {
                                        $this->id = 1;
                                        $this->paste = 1;
                                        $phpunit->assertEquals(true, $this->get_id_paste_handler());
                                Severity: Minor
                                Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                  Method likeToTable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private static function likeToTable($dbc, $likecode, $salePrice)
                                      {
                                          // singleton prepared statement
                                          if (self::$like_stmt === null) {
                                              $likeQ = "
                                  Severity: Minor
                                  Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

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

                                        public function preprocess()
                                        {
                                            // maintain user logins longer
                                            refreshSession();
                                            if (validateUserQuiet('batches')) {
                                    Severity: Minor
                                    Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                      Method post_id_addLC_handler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function post_id_addLC_handler()
                                          {
                                              $dbc = $this->connection;
                                              $dbc->selectDB($this->config->get('OP_DB'));
                                      
                                      
                                      Severity: Minor
                                      Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                        Method post_id_qualifiers_discount_handler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            protected function post_id_qualifiers_discount_handler()
                                            {
                                                global $FANNIE_OP_DB;
                                                $dbc = FannieDB::get($FANNIE_OP_DB);
                                        
                                        
                                        Severity: Minor
                                        Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                          Method get_id_paste_handler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                              protected function get_id_paste_handler()
                                              {
                                                  $dbc = $this->connection;
                                                  $dbc->selectDB($this->config->get('OP_DB'));
                                                  $uid = getUID($this->current_user);
                                          Severity: Minor
                                          Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                            Method post_id_storeID_handler has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public function post_id_storeID_handler()
                                                {
                                                    $dbc = $this->connection;
                                                    $dbc->selectDB($this->config->OP_DB);
                                                    $ret = array('error'=>0, 'display'=>'');
                                            Severity: Minor
                                            Found in fannie/batches/newbatch/EditBatchPage.php - About 1 hr to fix

                                              Function delete_id_upc_handler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  protected function delete_id_upc_handler()
                                                  {
                                                      global $FANNIE_OP_DB;
                                                      $dbc = FannieDB::get($FANNIE_OP_DB);
                                                      $id = $this->id;
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 55 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function post_id_storeID_handler has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public function post_id_storeID_handler()
                                                  {
                                                      $dbc = $this->connection;
                                                      $dbc->selectDB($this->config->OP_DB);
                                                      $ret = array('error'=>0, 'display'=>'');
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 45 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function post_id_addUPC_handler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  protected function post_id_addUPC_handler()
                                                  {
                                                      $dbc = $this->connection;
                                                      $dbc->selectDB($this->config->get('OP_DB'));
                                                      $upc = trim($this->addUPC);
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 35 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function post_id_autotag_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  protected function post_id_autotag_handler()
                                                  {
                                                      $dbc = $this->connection;
                                                      $dbc->selectDB($this->config->get('OP_DB'));
                                              
                                              
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 25 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function unsaleItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function unsaleItem($upc, $json)
                                                  {
                                                      if (substr($upc,0,2) != 'LC') {
                                                          // take the item off sale if this batch is currently on sale
                                                          if ($this->unsaleUPC($upc) === false) {
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 25 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function post_id_upc_price_qty_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  protected function post_id_upc_price_qty_handler()
                                                  {
                                                      $dbc = $this->connection;
                                                      $dbc->selectDB($this->config->get('OP_DB'));
                                                      $json = array('error'=>0, 'msg'=>'');
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 25 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function repriceItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function repriceItem($upc, $data, $json, $useStores=false)
                                                  {
                                                      if (substr($upc,0,2) != 'LC') {
                                                          // take the item off sale if this batch is currently on sale
                                                          if ($this->repriceUPC($upc,$data,$useStores) === false) {
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 25 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              Function pairedTableBody has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function pairedTableBody($dbc, $result, $down=true)
                                                  {
                                                      $colors = array('#ffffff','#ffffcc');
                                                      $cur = 0;
                                                      $FANNIE_URL = $this->config->get('URL');
                                              Severity: Minor
                                              Found in fannie/batches/newbatch/EditBatchPage.php - About 25 mins to fix

                                              Cognitive Complexity

                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                              A method's cognitive complexity is based on a few simple rules:

                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                              • Code is considered more complex for each "break in the linear flow of the code"
                                              • Code is considered more complex when "flow breaking structures are nested"

                                              Further reading

                                              There are no issues that match your filters.

                                              Category
                                              Status