CORE-POS/IS4C

View on GitHub
fannie/purchasing/ViewPurchaseOrders.php

Summary

Maintainability
F
1 wk
Test Coverage
F
29%

File ViewPurchaseOrders.php has 1298 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Copyright 2013 Whole Foods Co-op

Severity: Major
Found in fannie/purchasing/ViewPurchaseOrders.php - About 3 days to fix

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

        protected function get_id_view()
        {
            $dbc = $this->connection;
            $dbc->selectDB($this->config->get('OP_DB'));
    
    
    Severity: Major
    Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 day to fix

      ViewPurchaseOrders has 38 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ViewPurchaseOrders extends FannieRESTfulPage 
      {
          protected $header = 'Purchase Orders';
          protected $title = 'Purchase Orders';
      
      
      Severity: Minor
      Found in fannie/purchasing/ViewPurchaseOrders.php - About 5 hrs to fix

        Function get_id_view has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function get_id_view()
            {
                $dbc = $this->connection;
                $dbc->selectDB($this->config->get('OP_DB'));
        
        
        Severity: Minor
        Found in fannie/purchasing/ViewPurchaseOrders.php - About 3 hrs 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

        Method get_orders has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function get_orders($placed, $store=0, $month=0, $year=0)
            {
                $dbc = $this->connection;
                $store = FormLib::get('store', $store);
        
        
        Severity: Major
        Found in fannie/purchasing/ViewPurchaseOrders.php - About 3 hrs to fix

          Method get_id_sendAs_handler has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function get_id_sendAs_handler()
              {
                  if (!file_exists('exporters/'.$this->sendAs.'.php')) {
                      return $this->unknownRequestHandler();
                  }
          Severity: Major
          Found in fannie/purchasing/ViewPurchaseOrders.php - About 3 hrs to fix

            Method receiveUnOrderedItem has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function receiveUnOrderedItem($dbc)
                {
                    echo '<div class="alert alert-danger">SKU not found in order</div>';
                    echo '<table class="table table-bordered">';
                    echo '<tr><th>SKU</th><th>UPC</th><th>Brand</th><th>Description</th>
            Severity: Major
            Found in fannie/purchasing/ViewPurchaseOrders.php - About 2 hrs to fix

              Function get_id_sku_handler has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function get_id_sku_handler()
                  {
                      $dbc = $this->connection;
                      $model = new PurchaseOrderItemsModel($dbc);
                      $model->orderID($this->id);
              Severity: Minor
              Found in fannie/purchasing/ViewPurchaseOrders.php - About 2 hrs 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 csvToHtml has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function csvToHtml($csv)
                  {
                      $lines = explode("\r\n", $csv);
                      $ret = "<table border=\"1\">\n";
                      $para = '';
              Severity: Minor
              Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr 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

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

                  private function receiveOrderedItem($dbc, $model)
                  {
                      echo '<table class="table table-bordered small">';
                      $uid = FannieAuth::getUID($this->current_user);
                      if (!is_array($model)) {
              Severity: Minor
              Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

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

                    protected function get_view()
                    {
                        $init = FormLib::get('init', 'placed');
                
                        $monthOpts = '<option>Last 30 days</option>';
                Severity: Minor
                Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

                  Method get_id_sku_handler has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function get_id_sku_handler()
                      {
                          $dbc = $this->connection;
                          $model = new PurchaseOrderItemsModel($dbc);
                          $model->orderID($this->id);
                  Severity: Minor
                  Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

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

                        protected function get_id_receiveAll_view()
                        {
                            $dbc = FannieDB::getReadOnly($this->config->get('OP_DB'));
                            $poi = new PurchaseOrderItemsModel($dbc);
                            $poi->orderID($this->id);
                    Severity: Minor
                    Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

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

                          protected function get_id_recode_view()
                          {
                              $dbc = $this->connection;
                              $dbc->selectDB($this->config->get('OP_DB'));
                              $model = new PurchaseOrderItemsModel($dbc);
                      Severity: Minor
                      Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

                        Function get_orders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function get_orders($placed, $store=0, $month=0, $year=0)
                            {
                                $dbc = $this->connection;
                                $store = FormLib::get('store', $store);
                        
                        
                        Severity: Minor
                        Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr 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

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

                            protected function post_id_sku_qty_receiveAll_handler()
                            {
                                $dbc = $this->connection;
                                $dbc->selectDB($this->config->get('OP_DB'));
                                $model = new PurchaseOrderItemsModel($dbc);
                        Severity: Minor
                        Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

                          Function get_id_sendAs_handler has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function get_id_sendAs_handler()
                              {
                                  if (!file_exists('exporters/'.$this->sendAs.'.php')) {
                                      return $this->unknownRequestHandler();
                                  }
                          Severity: Minor
                          Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr 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

                          Method post_id_sku_qty_cost_handler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function post_id_sku_qty_cost_handler()
                              {
                                  $dbc = $this->connection;
                                  $model = new PurchaseOrderItemsModel($dbc);
                                  $uid = FannieAuth::getUID($this->current_user);
                          Severity: Minor
                          Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

                            Method get_id_receiveDone_handler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function get_id_receiveDone_handler()
                                {
                                    $prep = $this->connection->prepare("UPDATE
                                        PurchaseOrderItems
                                        SET receivedQty=0,
                            Severity: Minor
                            Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

                              Method csvToHtml has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function csvToHtml($csv)
                                  {
                                      $lines = explode("\r\n", $csv);
                                      $ret = "<table border=\"1\">\n";
                                      $para = '';
                              Severity: Minor
                              Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

                                Method post_id_setPlaced_handler has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function post_id_setPlaced_handler()
                                    {
                                        $this->connection->selectDB($this->config->get('OP_DB'));
                                        $model = new PurchaseOrderModel($this->connection);
                                        $model->orderID($this->id);
                                Severity: Minor
                                Found in fannie/purchasing/ViewPurchaseOrders.php - About 1 hr to fix

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

                                      protected function post_id_sku_qty_receiveAll_handler()
                                      {
                                          $dbc = $this->connection;
                                          $dbc->selectDB($this->config->get('OP_DB'));
                                          $model = new PurchaseOrderItemsModel($dbc);
                                  Severity: Minor
                                  Found in fannie/purchasing/ViewPurchaseOrders.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_setPlaced_handler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function post_id_setPlaced_handler()
                                      {
                                          $this->connection->selectDB($this->config->get('OP_DB'));
                                          $model = new PurchaseOrderModel($this->connection);
                                          $model->orderID($this->id);
                                  Severity: Minor
                                  Found in fannie/purchasing/ViewPurchaseOrders.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_sku_qty_cost_handler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function post_id_sku_qty_cost_handler()
                                      {
                                          $dbc = $this->connection;
                                          $model = new PurchaseOrderItemsModel($dbc);
                                          $uid = FannieAuth::getUID($this->current_user);
                                  Severity: Minor
                                  Found in fannie/purchasing/ViewPurchaseOrders.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 receiveOrderedItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function receiveOrderedItem($dbc, $model)
                                      {
                                          echo '<table class="table table-bordered small">';
                                          $uid = FannieAuth::getUID($this->current_user);
                                          if (!is_array($model)) {
                                  Severity: Minor
                                  Found in fannie/purchasing/ViewPurchaseOrders.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 receiveUnOrderedItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function receiveUnOrderedItem($dbc)
                                      {
                                          echo '<div class="alert alert-danger">SKU not found in order</div>';
                                          echo '<table class="table table-bordered">';
                                          echo '<tr><th>SKU</th><th>UPC</th><th>Brand</th><th>Description</th>
                                  Severity: Minor
                                  Found in fannie/purchasing/ViewPurchaseOrders.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