1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00
invoiceninja/app/Services/Quote/QuoteService.php
michael-hampton dee99b1a62
Ft quote services (#3310)
* Quote service

* convert quote

* Update Quote.php

* Update Quote.php

* Update MarkApproved.php
2020-02-12 07:57:25 +11:00

77 lines
1.5 KiB
PHP

<?php
namespace App\Services\Quote;
use App\Models\Quote;
class QuoteService
{
protected $quote;
public function __construct($quote)
{
$this->quote = $quote;
}
public function createInvitations()
{
$create_invitation = new CreateInvitations();
$this->quote = $create_invitation($this->quote);
return $this;
}
public function markApproved()
{
$mark_approved = new MarkApproved($this->quote->client);
$this->quote = $mark_approved($this->quote);
if($this->quote->client->getSetting('auto_convert_quote') === true) {
$convert_quote = new ConvertQuote($this->quote->client);
$this->quote = $convert_quote($this->quote);
}
return $this;
}
/**
* Applies the invoice number
* @return $this InvoiceService object
*/
public function applyNumber()
{
$apply_number = new ApplyNumber($this->quote->client);
$this->quote = $apply_number($this->quote);
return $this;
}
public function markSent()
{
$mark_sent = new MarkSent($this->quote->client);
$this->quote = $mark_sent($this->quote);
return $this;
}
public function setStatus($status)
{
$this->quote->status_id = $status;
return $this;
}
/**
* Saves the quote
* @return Quote|null
*/
public function save() : ?Quote
{
$this->quote->save();
return $this->quote;
}
}