Add trade_in_type to job order so rider app can differentiate #159
This commit is contained in:
parent
d455a20e70
commit
863bf56453
3 changed files with 44 additions and 1 deletions
|
|
@ -745,6 +745,8 @@ class APIController extends Controller
|
|||
if ($res->isError())
|
||||
return $res->getReturnResponse();
|
||||
|
||||
$trade_in = $req->request->get('trade_in');
|
||||
|
||||
$jo = new JobOrder();
|
||||
$jo->setSource(TransactionOrigin::MOBILE_APP)
|
||||
->setStatus(JOStatus::PENDING)
|
||||
|
|
@ -752,6 +754,7 @@ class APIController extends Controller
|
|||
->setTier1Notes('')
|
||||
->setTier2Notes('')
|
||||
->setDeliveryAddress('Set by mobile application')
|
||||
->setTradeInType($trade_in)
|
||||
// TODO: error check for valid mode of payment
|
||||
->setModeOfPayment($req->request->get('mode_of_payment'));
|
||||
|
||||
|
|
@ -852,7 +855,6 @@ class APIController extends Controller
|
|||
|
||||
// check trade-in
|
||||
// only allow motolite, other, none
|
||||
$trade_in = $req->request->get('trade_in');
|
||||
switch ($trade_in)
|
||||
{
|
||||
case TradeInType::MOTOLITE:
|
||||
|
|
|
|||
|
|
@ -286,6 +286,17 @@ class JobOrderController extends BaseController
|
|||
|
||||
$ierror = $this->invoicePromo($em, $criteria, $req->request->get('invoice_promo'));
|
||||
|
||||
// check for trade in so we can mark it for mobile app
|
||||
foreach ($invoice_items as $item)
|
||||
{
|
||||
// get first trade-in
|
||||
if (!empty($item['trade_in']))
|
||||
{
|
||||
$obj->setTradeInType($item['trade_in']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$ierror)
|
||||
$ierror = $this->invoiceBatteries($em, $criteria, $invoice_items);
|
||||
|
||||
|
|
@ -467,7 +478,20 @@ class JobOrderController extends BaseController
|
|||
$invoice_items = $req->request->get('invoice_items');
|
||||
|
||||
if (!$ierror && !empty($invoice_items))
|
||||
{
|
||||
// check for trade in so we can mark it for mobile app
|
||||
foreach ($invoice_items as $item)
|
||||
{
|
||||
// get first trade-in
|
||||
if (!empty($item['trade_in']))
|
||||
{
|
||||
$obj->setTradeInType($item['trade_in']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$ierror = $this->invoiceBatteries($em, $criteria, $invoice_items);
|
||||
}
|
||||
|
||||
if ($ierror)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -232,6 +232,11 @@ class JobOrder
|
|||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=25, nullable=true)
|
||||
*/
|
||||
protected $trade_in_type;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
|
|
@ -246,6 +251,7 @@ class JobOrder
|
|||
$this->promo_detail = '';
|
||||
|
||||
$this->events = new ArrayCollection();
|
||||
$this->trade_in_type = null;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -636,4 +642,15 @@ class JobOrder
|
|||
{
|
||||
return $this->status == JOStatus::CANCELLED;
|
||||
}
|
||||
|
||||
public function setTradeInType($type)
|
||||
{
|
||||
$this->trade_in_type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTradeInType()
|
||||
{
|
||||
return $this->trade_in_type;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue