1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 09:21:34 +02:00
invoiceninja/app/Services/PurchaseOrder/MarkSent.php

50 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2022-06-05 11:41:19 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Services\PurchaseOrder;
use App\Models\PurchaseOrder;
use App\Utils\Ninja;
class MarkSent
{
2022-06-05 11:22:58 +02:00
private $vendor;
private $purchase_order;
2022-06-05 11:22:58 +02:00
public function __construct($vendor, $purchase_order)
{
2022-06-05 11:22:58 +02:00
$this->vendor = $vendor;
$this->purchase_order = $purchase_order;
}
public function run()
{
/* Return immediately if status is not draft */
if ($this->purchase_order->status_id != PurchaseOrder::STATUS_DRAFT) {
return $this->purchase_order;
}
$this->purchase_order->markInvitationsSent();
$this->purchase_order
->service()
->setStatus(PurchaseOrder::STATUS_SENT)
->applyNumber()
// ->adjustBalance($this->purchase_order->amount)
// ->touchPdf()
->save();
return $this->purchase_order;
}
}