Skip to content

Commit

Permalink
Removed unused order base status
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Mar 7, 2019
1 parent 3c99d66 commit a10e035
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 77 deletions.
12 changes: 6 additions & 6 deletions lib/mshoplib/config/mshop/order.php
Expand Up @@ -624,9 +624,9 @@
INSERT INTO "mshop_order_base" (
"customerid", "sitecode", "langid", "currencyid",
"price", "costs", "rebate", "tax", "taxflag", "comment",
"status", "mtime", "editor", "siteid", "ctime"
"mtime", "editor", "siteid", "ctime"
) VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
)
'
),
Expand All @@ -635,7 +635,7 @@
UPDATE "mshop_order_base"
SET "customerid" = ?, "sitecode" = ?, "langid" = ?, "currencyid" = ?,
"price" = ?, "costs" = ?, "rebate" = ?, "tax" = ?, "taxflag" = ?,
"comment" = ?, "status" = ?, "mtime" = ?, "editor" = ?
"comment" = ?, "mtime" = ?, "editor" = ?
WHERE "siteid" = ? AND "id" = ?
'
),
Expand All @@ -647,14 +647,14 @@
mordba."price" AS "order.base.price", mordba."costs" AS "order.base.costs",
mordba."rebate" AS "order.base.rebate", mordba."tax" AS "order.base.taxvalue",
mordba."taxflag" AS "order.base.taxflag", mordba."comment" AS "order.base.comment",
mordba."status" AS "order.base.status", mordba."mtime" AS "order.base.mtime",
mordba."editor" AS "order.base.editor", mordba."ctime" AS "order.base.ctime"
mordba."mtime" AS "order.base.mtime", mordba."ctime" AS "order.base.ctime",
mordba."editor" AS "order.base.editor"
FROM "mshop_order_base" AS mordba
:joins
WHERE :cond
GROUP BY mordba."id", mordba."siteid", mordba."sitecode", mordba."customerid",
mordba."langid", mordba."currencyid", mordba."price", mordba."costs",
mordba."rebate", mordba."tax", mordba."taxflag", mordba."comment", mordba."status",
mordba."rebate", mordba."tax", mordba."taxflag", mordba."comment",
mordba."mtime", mordba."editor", mordba."ctime" /*-columns*/ , :columns /*columns-*/
/*-orderby*/ ORDER BY :order /*orderby-*/
LIMIT :size OFFSET :start
Expand Down
1 change: 0 additions & 1 deletion lib/mshoplib/setup/default/schema/order.php
Expand Up @@ -32,7 +32,6 @@
$table->addColumn( 'tax', 'decimal', array( 'precision' => 14, 'scale' => 4 ) );
$table->addColumn( 'taxflag', 'smallint', [] );
$table->addColumn( 'comment', 'text', array( 'length' => 0xfff ) );
$table->addColumn( 'status', 'smallint', [] );
$table->addColumn( 'mtime', 'datetime', [] );
$table->addColumn( 'ctime', 'datetime', [] );
$table->addColumn( 'editor', 'string', array('length' => 255 ) );
Expand Down
2 changes: 1 addition & 1 deletion lib/mshoplib/src/MShop/Order/Item/Base/Iface.php
Expand Up @@ -19,7 +19,7 @@
* @subpackage Order
*/
interface Iface
extends \Aimeos\MW\Observer\Publisher\Iface, \Aimeos\MShop\Common\Item\Iface, \Aimeos\MShop\Common\Item\Status\Iface
extends \Aimeos\MW\Observer\Publisher\Iface, \Aimeos\MShop\Common\Item\Iface
{
/**
* Tests if all necessary items are available to create the order.
Expand Down
39 changes: 2 additions & 37 deletions lib/mshoplib/src/MShop/Order/Item/Base/Standard.php
Expand Up @@ -180,39 +180,6 @@ public function setComment( $comment )
}


/**
* Returns the current status of the order base item.
*
* @return integer Status of the item
*/
public function getStatus()
{
if( isset( $this->values['order.base.status'] ) ) {
return (int) $this->values['order.base.status'];
}

return 1;
}


/**
* Sets the new status of the order base item.
*
* @param integer $value Status of the item
* @return \Aimeos\MShop\Order\Item\Base\Iface Order base item for chaining method calls
*/
public function setStatus( $value )
{
if( (int) $value !== $this->getStatus() )
{
$this->values['order.base.status'] = (int) $value;
$this->modified = true;
}

return $this;
}


/**
* Returns modify date/time of the order item base product.
*
Expand Down Expand Up @@ -407,10 +374,9 @@ public function fromArray( array &$list, $private = false )
switch( $key )
{
case 'order.base.id': !$private ?: $item = $item->setId( $value ); break;
case 'order.base.customerid': !$private ?: $item = $item->setCustomerId( $value ); break;
case 'order.base.languageid': !$private ?: $locale = $locale->setLanguageId( $value ); break;
case 'order.base.comment': $item = $item->setComment( $value ); break;
case 'order.base.customerid': $item = $item->setCustomerId( $value ); break;
case 'order.base.status': $item = $item->setStatus( $value ); break;
case 'order.base.languageid': $locale = $locale->setLanguageId( $value ); break;
default: continue 2;
}

Expand Down Expand Up @@ -442,7 +408,6 @@ public function toArray( $private = false )
'order.base.rebate' => $price->getRebate(),
'order.base.taxvalue' => $price->getTaxValue(),
'order.base.taxflag' => $price->getTaxFlag(),
'order.base.status' => $this->getStatus(),
'order.base.comment' => $this->getComment(),
);

Expand Down
18 changes: 5 additions & 13 deletions lib/mshoplib/src/MShop/Order/Manager/Base/Standard.php
Expand Up @@ -110,13 +110,6 @@ class Standard extends Base
'type' => 'string',
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR,
),
'order.base.status' => array(
'code' => 'order.base.status',
'internalcode' => 'mordba."status"',
'label' => 'Order subscription status',
'type' => 'integer',
'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT,
),
'order.base.ctime' => array(
'code' => 'order.base.ctime',
'internalcode' => 'mordba."ctime"',
Expand Down Expand Up @@ -670,16 +663,15 @@ public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
$stmt->bind( 8, $priceItem->getTaxValue() );
$stmt->bind( 9, $priceItem->getTaxFlag(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$stmt->bind( 10, $item->getComment() );
$stmt->bind( 11, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$stmt->bind( 12, $date ); // mtime
$stmt->bind( 13, $context->getEditor() );
$stmt->bind( 14, $localeItem->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$stmt->bind( 11, $date ); // mtime
$stmt->bind( 12, $context->getEditor() );
$stmt->bind( 13, $localeItem->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );

if( $id !== null ) {
$stmt->bind( 15, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$stmt->bind( 14, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
$item->setId( $id );
} else {
$stmt->bind( 15, $date ); // ctime
$stmt->bind( 14, $date ); // ctime
}

$stmt->execute()->finish();
Expand Down
19 changes: 2 additions & 17 deletions lib/mshoplib/tests/MShop/Order/Item/Base/StandardTest.php
Expand Up @@ -26,7 +26,6 @@ protected function setUp()
'order.base.siteid' => 99,
'order.base.customerid' => 'testuser',
'order.base.comment' => 'this is a comment from unittest',
'order.base.status' => 0,
'order.base.mtime' => '2011-01-01 00:00:02',
'order.base.ctime' => '2011-01-01 00:00:01',
'order.base.editor' => 'unitTestUser'
Expand Down Expand Up @@ -142,30 +141,19 @@ public function testSetComment()
$this->assertTrue( $this->object->isModified() );
}

public function testGetStatus()
{
$this->assertEquals( 0, $this->object->getStatus() );
}

public function testSetStatus()
{
$return = $this->object->setStatus( 1 );

$this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Iface::class, $return );
$this->assertEquals( 1, $this->object->getStatus() );
$this->assertTrue( $this->object->isModified() );
}

public function testGetTimeModified()
{
$this->assertEquals( '2011-01-01 00:00:02', $this->object->getTimeModified() );
}


public function testGetTimeCreated()
{
$this->assertEquals( '2011-01-01 00:00:01', $this->object->getTimeCreated() );
}


public function testGetEditor()
{
$this->assertEquals( 'unitTestUser', $this->object->getEditor() );
Expand All @@ -181,7 +169,6 @@ public function testFromArray()
'order.base.comment' => 'test comment',
'order.base.languageid' => 'de',
'order.base.customerid' => 3,
'order.base.status' => 4,
);

$item = $item->fromArray( $entries, true );
Expand All @@ -191,7 +178,6 @@ public function testFromArray()
$this->assertEquals( $list['order.base.customerid'], $item->getCustomerId() );
$this->assertEquals( $list['order.base.languageid'], $item->getLocale()->getLanguageId() );
$this->assertEquals( $list['order.base.comment'], $item->getComment() );
$this->assertEquals( $list['order.base.status'], $item->getStatus() );
}


Expand All @@ -205,7 +191,6 @@ public function testToArray()
$this->assertEquals( $this->object->getCustomerId(), $list['order.base.customerid'] );
$this->assertEquals( $this->object->getLocale()->getLanguageId(), $list['order.base.languageid'] );
$this->assertEquals( $this->object->getComment(), $list['order.base.comment'] );
$this->assertEquals( $this->object->getStatus(), $list['order.base.status'] );
$this->assertEquals( $this->object->getTimeCreated(), $list['order.base.ctime'] );
$this->assertEquals( $this->object->getTimeModified(), $list['order.base.mtime'] );
$this->assertEquals( $this->object->getEditor(), $list['order.base.editor'] );
Expand Down
2 changes: 0 additions & 2 deletions lib/mshoplib/tests/MShop/Order/Manager/Base/StandardTest.php
Expand Up @@ -169,7 +169,6 @@ public function testSaveUpdateDeleteItem()
$this->assertEquals( $item->getCoupons(), $itemSaved->getCoupons() );
$this->assertEquals( $item->getServices(), $itemSaved->getServices() );
$this->assertEquals( $item->getComment(), $itemSaved->getComment() );
$this->assertEquals( $item->getStatus(), $itemSaved->getStatus() );
$this->assertEquals( $item->getSiteCode(), $itemSaved->getSiteCode() );

$this->assertEquals( $this->editor, $itemSaved->getEditor() );
Expand All @@ -190,7 +189,6 @@ public function testSaveUpdateDeleteItem()
$this->assertEquals( $itemExp->getCoupons(), $itemUpd->getCoupons() );
$this->assertEquals( $itemExp->getServices(), $itemUpd->getServices() );
$this->assertEquals( $itemExp->getComment(), $itemUpd->getComment() );
$this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() );
$this->assertEquals( $itemExp->getSiteCode(), $itemUpd->getSiteCode() );

$this->assertEquals( $this->editor, $itemUpd->getEditor() );
Expand Down

0 comments on commit a10e035

Please sign in to comment.