order creation

This commit is contained in:
Etienne Roudeix
2013-09-19 15:11:54 +02:00
parent 66536d0b31
commit 61fab3a62a
24 changed files with 410 additions and 98 deletions

View File

@@ -1653,8 +1653,18 @@ abstract class Order implements ActiveRecordInterface
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
}
$db = Propel::getServiceContainer()->getAdapter(OrderTableMap::DATABASE_NAME);
$dbMap = Propel::getServiceContainer()->getDatabaseMap(OrderTableMap::DATABASE_NAME);
$tableName = OrderTableMap::TABLE_NAME;
if ($db->useQuoteIdentifier()) {
$tableName = $db->quoteIdentifierTable($tableName);
}
$sql = sprintf(
'INSERT INTO order (%s) VALUES (%s)',
'INSERT INTO %s (%s) VALUES (%s)',
$tableName,
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);

View File

@@ -150,7 +150,7 @@ class OrderStatusTableMap extends TableMap
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', false, 45, null);
$this->addColumn('CODE', 'Code', 'VARCHAR', true, 45, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()

View File

@@ -215,7 +215,7 @@ class OrderTableMap extends TableMap
$this->addForeignKey('CUSTOMER_ID', 'CustomerId', 'INTEGER', 'customer', 'ID', true, null, null);
$this->addForeignKey('INVOICE_ORDER_ADDRESS_ID', 'InvoiceOrderAddressId', 'INTEGER', 'order_address', 'ID', true, null, null);
$this->addForeignKey('DELIVERY_ORDER_ADDRESS_ID', 'DeliveryOrderAddressId', 'INTEGER', 'order_address', 'ID', true, null, null);
$this->addColumn('INVOICE_DATE', 'InvoiceDate', 'DATE', true, null, null);
$this->addColumn('INVOICE_DATE', 'InvoiceDate', 'DATE', false, null, null);
$this->addForeignKey('CURRENCY_ID', 'CurrencyId', 'INTEGER', 'currency', 'ID', true, null, null);
$this->addColumn('CURRENCY_RATE', 'CurrencyRate', 'FLOAT', true, null, null);
$this->addColumn('TRANSACTION_REF', 'TransactionRef', 'VARCHAR', false, 100, null);

View File

@@ -2,13 +2,26 @@
namespace Thelia\Model;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Core\Event\OrderEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Model\Base\Order as BaseOrder;
class Order extends BaseOrder
{
use \Thelia\Model\Tools\ModelEventDispatcherTrait;
public $chosenDeliveryAddress = null;
public $chosenInvoiceAddress = null;
/**
* {@inheritDoc}
*/
/*public function postInsert(ConnectionInterface $con = null)
{
$this->dispatchEvent(TheliaEvents::ORDER_SET_REFERENCE, new OrderEvent($this));
}*/
/**
* calculate the total amount
*

View File

@@ -4,6 +4,11 @@ namespace Thelia\Model;
use Thelia\Model\Base\OrderStatus as BaseOrderStatus;
class OrderStatus extends BaseOrderStatus {
class OrderStatus extends BaseOrderStatus
{
const CODE_NOT_PAID = "not_paid";
const CODE_PAID = "paid";
const CODE_PROCESSED = "processed";
const CODE_SENT = "sent";
const CODE_CANCELED = "canceled";
}