62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* Module Partial Shipment - Main file
|
|
*
|
|
* @author My Addons <contact@myaddons.io>
|
|
* @copyright 2017 My Addons
|
|
* @license myaddons.io
|
|
* @version 1.0.0
|
|
* @since File available since Release 1.0
|
|
*/
|
|
|
|
class PartialShipmentDetail extends ObjectModel
|
|
{
|
|
/**
|
|
* @var int id partial shipment detail
|
|
*/
|
|
public $id_partial_shipment_detail;
|
|
|
|
/**
|
|
* @var int id partial shipment
|
|
*/
|
|
public $id_partial_shipment;
|
|
|
|
/**
|
|
* @var int order detail id
|
|
*/
|
|
public $id_order_detail;
|
|
|
|
/**
|
|
* @var int quantity
|
|
*/
|
|
public $quantity;
|
|
|
|
/**
|
|
* @var string Date
|
|
*/
|
|
public $date_add;
|
|
|
|
/**
|
|
* @see ObjectModel::$definition
|
|
*/
|
|
public static $definition = array(
|
|
'table' => 'bt_partial_shipment_detail',
|
|
'primary' => 'id_partial_shipment_detail',
|
|
'fields' => array(
|
|
'id_partial_shipment' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
|
'id_order_detail' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
|
'quantity' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
|
|
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'required' => true),
|
|
),
|
|
);
|
|
|
|
public static function getQuantityShippiedByIdOrderDetail($id_order_detail)
|
|
{
|
|
if ($id_order_detail) {
|
|
return Db::getInstance()->getValue('SELECT SUM(`quantity`)
|
|
FROM `'._DB_PREFIX_.'bt_partial_shipment_detail`
|
|
WHERE `id_order_detail` = '.(int)$id_order_detail);
|
|
}
|
|
}
|
|
}
|