File EditBatchPage.php
has 1596 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2009,2010 Whole Foods Co-op
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);
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);
- Read upRead up
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';
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);
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');
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'=>'');
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'));
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'=>'');
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;
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 .= '
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);
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);
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);
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');
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);
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());
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 = "
Method preprocess
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function preprocess()
{
// maintain user logins longer
refreshSession();
if (validateUserQuiet('batches')) {
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'));
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);
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);
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'=>'');
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;
- Read upRead up
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'=>'');
- Read upRead up
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);
- Read upRead up
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'));
- Read upRead up
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) {
- Read upRead up
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'=>'');
- Read upRead up
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) {
- Read upRead up
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');
- Read upRead up
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"