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

        $('.super'+superID).each(function(){
            pArray.push($(this).find('.newprice').val());
            uArray.push($(this).find('.itemupc').val());
        });
Severity: Major
Found in fannie/item/marginTool.js and 1 other location - About 2 hrs to fix
fannie/item/marginTool.js on lines 69..72

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 84.

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

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

    public function run()
    {
        $dbc = FannieDB::get($this->config->get('OP_DB'));
        $place = $dbc->prepare("UPDATE PurchaseOrder SET placed=1, placedDate=? WHERE orderID=?");
        $map = new AutoOrderMapModel($dbc);
Severity: Major
Found in fannie/cron/tasks/AutoOrderTask.php - About 2 hrs to fix

    Method post_createBatch_handler has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function post_createBatch_handler()
        {
            global $FANNIE_OP_DB;
            $dbc = FannieDB::get($FANNIE_OP_DB);
            try {
    Severity: Major
    Found in fannie/batches/BatchFromSearch.php - About 2 hrs to fix

      Method form_content has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function form_content()
          {
              ob_start();
              ?>
      <form method="get" class="form-horizontal">
      Severity: Major
      Found in fannie/reports/HourlySales/HourlySalesReport.php - About 2 hrs to fix

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

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

          Method receiptHeader has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function receiptHeader($date,$trans) 
              {
                  $totime = strtotime($date);
                  list($emp_no, $reg_no, $trans_no) = explode('-', $trans, 3);
                  $store = FormLib::get('store', false);
          Severity: Major
          Found in fannie/admin/LookupReceipt/RenderReceiptPage.php - About 2 hrs to fix

            Method WFC_New has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function WFC_New($data,$offset=0){
            
            $pdf=new WFC_New_PDF('P','mm','Letter'); //start new instance of PDF
            $pdf->Open(); //open new PDF Document
            $pdf->setTagDate(date("m/d/Y"));
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_New.php - About 2 hrs to fix

              Method formTableHeader has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function formTableHeader()
                  {
                      if (FannieConfig::config('COOP_ID') == 'WFC_Duluth') {
                          $ret = SignsLib::visualSignSelectHTML();
                          $this->addOnloadCommand(SignsLib::visualSignSelectJS());
              Severity: Major
              Found in fannie/admin/labels/FpdfEditorPage.php - About 2 hrs to fix

                Method generateMirrorMeatTag has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function generateMirrorMeatTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
                {
                    $upc = isset($row['upc']) ? $row['upc'] : '';
                    $desc = isset($row['description']) ? $row['description'] : '';
                    $brand = isset($row['brand']) ? $row['brand'] : '';
                Severity: Major
                Found in fannie/admin/labels/pdf_layouts/WFC_MEAT_14UP.php - About 2 hrs to fix

                  Method getTenderTable has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getTenderTable()
                      {
                          $this->connection->selectDB($this->config->get('OP_DB'));
                          $model = new TendersModel($this->connection);
                          
                  Severity: Major
                  Found in fannie/admin/Tenders/TenderEditor.php - About 2 hrs to fix

                    Method generateMirrorNewMeatTag has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function generateMirrorNewMeatTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
                    {
                        $upc = isset($row['upc']) ? $row['upc'] : '';
                        $desc = isset($row['description']) ? $row['description'] : '';
                        $brand = isset($row['brand']) ? $row['brand'] : '';
                    Severity: Major
                    Found in fannie/admin/labels/pdf_layouts/WFC_New_MEAT_14UP.php - About 2 hrs to fix

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

                          public function fetch_report_data()
                          {
                              $items = explode("\n", $this->form->items);
                              $ts1 = strtotime('last tuesday');
                              // -13 => previous wednesday and then back another full week
                      Severity: Major
                      Found in fannie/modules/plugins2.0/FreshDeals/FreshDealsMovementReport.php - About 2 hrs to fix

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

                            protected function post_handler()
                            {
                                try {
                                    $date = $this->form->date;
                                    $orig = $this->form->trans;
                        Severity: Major
                        Found in fannie/modules/plugins2.0/PaycardFix/PaycardFixGeneric.php - About 2 hrs to fix

                          Method get_date_trans_store_handler has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function get_date_trans_store_handler()
                              {
                                  global $FANNIE_OP_DB;
                                  $dbc = FannieDB::get($FANNIE_OP_DB);
                                  $dlog = DTransactionsModel::selectDlog($this->date);
                          Severity: Major
                          Found in fannie/modules/plugins2.0/ReverseTransaction/ReverseTransPage.php - About 2 hrs to fix

                            Method post has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function post($json)
                                {
                                    $dbc = $this->dbc;
                                    $ret = array('error' => false);
                                    $dbc->selectDB($this->config->get('OP_DB'));
                            Severity: Major
                            Found in fannie/modules/plugins2.0/MobileLane/api/item/index.php - About 2 hrs to fix

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

                                  public function run()
                                  {
                                      $aplfile = $this->download($this->URL);
                                      if ($aplfile === false) {
                                          $this->cronMsg('MN APL file is empty or damaged', FannieLogger::ALERT);
                              Severity: Major
                              Found in fannie/modules/plugins2.0/WIC/WicMnAplTask.php - About 2 hrs to fix

                                Method post_id_shares_type_handler has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function post_id_shares_type_handler()
                                    {
                                        global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB, $FANNIE_URL;
                                
                                        $bridge = GumLib::getSetting('posLayer');
                                Severity: Major
                                Found in fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumMainPage.php - About 2 hrs to fix

                                  Method drawPDF has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function drawPDF()
                                      {
                                          $pdf = $this->createPDF();
                                          $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
                                          $basicP = $dbc->prepare("SELECT
                                  Severity: Major
                                  Found in fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns2UpP.php - About 2 hrs to fix

                                    Method send has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function send($incident, $address)
                                        {
                                            if (!OutgoingEmail::available()) {
                                                // can't send
                                                return false;
                                    Severity: Major
                                    Found in fannie/modules/plugins2.0/IncidentTracker/notifiers/AlertDigest.php - About 2 hrs to fix

                                      Method basicPreview has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function basicPreview()
                                          {
                                              $ret = '<h3>Select columns</h3>';
                                              /* show any errors */
                                              if ($this->error_details != 'n/a' && $this->error_details != '') {
                                      Severity: Major
                                      Found in fannie/classlib2.0/FannieUploadPage.php - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language