Fixes for quotes

This commit is contained in:
David Bomba 2024-01-24 08:25:28 +11:00
parent c1b8d676c2
commit 26877f905f
5 changed files with 13 additions and 12 deletions

View File

@ -399,7 +399,6 @@ class QuoteController extends BaseController
$quote->service() $quote->service()
->triggeredActions($request); ->triggeredActions($request);
// ->deletePdf();
event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new QuoteWasUpdated($quote, $quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -69,8 +69,11 @@ class UpdateOrCreateProduct implements ShouldQueue
* we do NOT update the product details this short block we * we do NOT update the product details this short block we
* check for the presence of a task_id and/or expense_id * check for the presence of a task_id and/or expense_id
*/ */
$expense_count = count(array_column((array) $this->products, 'expense_id')); // $expense_count = count(array_column((array) $this->products, 'expense_id'));
$task_count = count(array_column((array) $this->products, 'task_id')); // $task_count = count(array_column((array) $this->products, 'task_id'));
$task_count = implode("", array_column((array) $this->products, 'task_id'));
$expense_count = implode("", array_column((array) $this->products, 'expense_id'));
if ($task_count >= 1 || $expense_count >= 1) { if ($task_count >= 1 || $expense_count >= 1) {
return; return;

View File

@ -44,7 +44,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property string|null $po_number * @property string|null $po_number
* @property string|null $date * @property string|null $date
* @property string|null $last_sent_date * @property string|null $last_sent_date
* @property string|null $due_date * @property string|null|Carbon $due_date
* @property string|null $next_send_date * @property string|null $next_send_date
* @property bool $is_deleted * @property bool $is_deleted
* @property object|null $line_items * @property object|null $line_items
@ -164,7 +164,7 @@ class Quote extends BaseModel
protected $casts = [ protected $casts = [
// 'date' => 'date:Y-m-d', // 'date' => 'date:Y-m-d',
// 'due_date' => 'date:Y-m-d', 'due_date' => 'date:Y-m-d',
// 'partial_due_date' => 'date:Y-m-d', // 'partial_due_date' => 'date:Y-m-d',
'line_items' => 'object', 'line_items' => 'object',
'backup' => 'object', 'backup' => 'object',
@ -195,10 +195,10 @@ class Quote extends BaseModel
return $this->dateMutator($value); return $this->dateMutator($value);
} }
public function getDueDateAttribute($value) // public function getDueDateAttribute($value)
{ // {
return $this->dateMutator($value); // return $this->dateMutator($value);
} // }
public function getPartialDueDateAttribute($value) public function getPartialDueDateAttribute($value)
{ {

View File

@ -42,7 +42,6 @@ class MarkSent
->service() ->service()
->setStatus(Quote::STATUS_SENT) ->setStatus(Quote::STATUS_SENT)
->applyNumber() ->applyNumber()
// ->deletePdf()
->save(); ->save();
event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -111,7 +111,7 @@ class QuoteTransformer extends EntityTransformer
'reminder2_sent' => $quote->reminder2_sent ?: '', 'reminder2_sent' => $quote->reminder2_sent ?: '',
'reminder3_sent' => $quote->reminder3_sent ?: '', 'reminder3_sent' => $quote->reminder3_sent ?: '',
'reminder_last_sent' => $quote->reminder_last_sent ?: '', 'reminder_last_sent' => $quote->reminder_last_sent ?: '',
'due_date' => $quote->due_date ?: '', 'due_date' => $quote->due_date ? $quote->due_date->format('Y-m-d') : '',
'terms' => $quote->terms ?: '', 'terms' => $quote->terms ?: '',
'public_notes' => $quote->public_notes ?: '', 'public_notes' => $quote->public_notes ?: '',
'private_notes' => $quote->private_notes ?: '', 'private_notes' => $quote->private_notes ?: '',