mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 05:32:39 +01:00
f7650d0692
* Emails * change to user service * refactor emails * refactor emails * refactor emails * refactor emails * emails * emails * emails * emails * emails * emails * emails * emails * emails * emails * Update EmailPayment.php * Update SendEmail.php * Update SendEmail.php * Update SendEmail.php * Update and rename BuildEmail.php to EmailBuilder.php * Create InvoiceEmail * Create QuoteEmail.php * Rename InvoiceEmail to InvoiceEmail.php * Create PaymentEmail.php * Update SendEmail.php * Update SendEmail.php * Update SendEmail.php * Update SendEmail.php * Update InvoiceEmail.php * Update EmailInvoice.php * Update SendEmail.php * Update TemplateEmail.php * Update EmailBuilder.php * Update InvoiceEmail.php * Update QuoteEmail.php * Update PaymentEmail.php * Update InvoiceEmail.php * Update QuoteEmail.php * Update QuoteInvitation.php * Update EmailQuote.php * Update SendEmail.php * Update SendEmail.php * Update PaymentService.php * Update PaymentEmail.php * Update PaymentEmail.php * Update PaymentEmail.php * Update EmailBuilder.php * Update PaymentEmail.php * Update EmailPayment.php * Update SendEmail.php * Update InvoiceService.php * Update SendEmail.php * Update PaymentService.php * Update SendEmail.php * Update QuoteService.php * Update EmailPayment.php Co-authored-by: David Bomba <turbo124@gmail.com>
91 lines
1.8 KiB
PHP
91 lines
1.8 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->run($this->quote);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function markApproved()
|
|
{
|
|
$mark_approved = new MarkApproved($this->quote->client);
|
|
|
|
$this->quote = $mark_approved->run($this->quote);
|
|
|
|
if($this->quote->client->getSetting('auto_convert_quote') === true) {
|
|
$convert_quote = new ConvertQuote($this->quote->client);
|
|
$this->quote = $convert_quote->run($this->quote);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getQuotePdf($contact)
|
|
{
|
|
$get_invoice_pdf = new GetQuotePdf();
|
|
|
|
return $get_invoice_pdf($this->quote, $contact);
|
|
}
|
|
|
|
public function sendEmail($contact)
|
|
{
|
|
$send_email = new SendEmail($this->quote);
|
|
|
|
return $send_email->run(null, $contact);
|
|
}
|
|
|
|
/**
|
|
* Applies the invoice number
|
|
* @return $this InvoiceService object
|
|
*/
|
|
public function applyNumber()
|
|
{
|
|
$apply_number = new ApplyNumber($this->quote->client);
|
|
|
|
$this->quote = $apply_number->run($this->quote);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function markSent()
|
|
{
|
|
$mark_sent = new MarkSent($this->quote->client);
|
|
|
|
$this->quote = $mark_sent->run($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;
|
|
}
|
|
}
|