mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
fix dashbord & using FROM_MAIL_ADDRESS issues
This commit is contained in:
@ -36,7 +36,8 @@ class DashboardController extends Controller
|
||||
$start = Carbon::now();
|
||||
$end = Carbon::now();
|
||||
$terms = explode('-', $fiscalYear);
|
||||
if ($terms[0] < $start->month) {
|
||||
|
||||
if ($terms[0] <= $start->month) {
|
||||
$startDate->month($terms[0])->startOfMonth();
|
||||
$start->month($terms[0])->startOfMonth();
|
||||
$end->month($terms[0])->endOfMonth();
|
||||
@ -93,6 +94,7 @@ class DashboardController extends Controller
|
||||
}
|
||||
|
||||
$start->subMonth()->endOfMonth();
|
||||
|
||||
$salesTotal = Invoice::whereCompany($request->header('company'))
|
||||
->whereBetween(
|
||||
'invoice_date',
|
||||
|
||||
@ -168,10 +168,6 @@ class EstimatesController extends Controller
|
||||
$data['user'] = User::find($userId)->toArray();
|
||||
$data['company'] = Company::find($estimate->company_id);
|
||||
$email = $data['user']['email'];
|
||||
$notificationEmail = CompanySetting::getSetting(
|
||||
'notification_email',
|
||||
$request->header('company')
|
||||
);
|
||||
|
||||
if (!$email) {
|
||||
return response()->json([
|
||||
@ -179,13 +175,13 @@ class EstimatesController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$notificationEmail) {
|
||||
if (!config('mail.from.name')) {
|
||||
return response()->json([
|
||||
'error' => 'notification_email_does_not_exist'
|
||||
'error' => 'from_email_does_not_exist'
|
||||
]);
|
||||
}
|
||||
|
||||
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
|
||||
\Mail::to($email)->send(new EstimatePdf($data));
|
||||
}
|
||||
|
||||
$estimate = Estimate::with([
|
||||
@ -340,10 +336,6 @@ class EstimatesController extends Controller
|
||||
$data['company'] = Company::find($estimate->company_id);
|
||||
|
||||
$email = $data['user']['email'];
|
||||
$notificationEmail = CompanySetting::getSetting(
|
||||
'notification_email',
|
||||
$request->header('company')
|
||||
);
|
||||
|
||||
if (!$email) {
|
||||
return response()->json([
|
||||
@ -351,13 +343,13 @@ class EstimatesController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$notificationEmail) {
|
||||
if (!config('mail.from.name')) {
|
||||
return response()->json([
|
||||
'error' => 'notification_email_does_not_exist'
|
||||
'error' => 'from_email_does_not_exist'
|
||||
]);
|
||||
}
|
||||
|
||||
\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
|
||||
\Mail::to($email)->send(new EstimatePdf($data));
|
||||
|
||||
if ($estimate->status == Estimate::STATUS_DRAFT) {
|
||||
$estimate->status = Estimate::STATUS_SENT;
|
||||
|
||||
@ -167,11 +167,6 @@ class InvoicesController extends Controller
|
||||
$data['user'] = User::find($request->user_id)->toArray();
|
||||
$data['company'] = Company::find($invoice->company_id);
|
||||
|
||||
$notificationEmail = CompanySetting::getSetting(
|
||||
'notification_email',
|
||||
$request->header('company')
|
||||
);
|
||||
|
||||
$email = $data['user']['email'];
|
||||
|
||||
if (!$email) {
|
||||
@ -180,13 +175,13 @@ class InvoicesController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$notificationEmail) {
|
||||
if (!config('mail.from.name')) {
|
||||
return response()->json([
|
||||
'error' => 'notification_email_does_not_exist'
|
||||
'error' => 'from_email_does_not_exist'
|
||||
]);
|
||||
}
|
||||
|
||||
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
|
||||
\Mail::to($email)->send(new invoicePdf($data));
|
||||
}
|
||||
|
||||
$invoice = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])->find($invoice->id);
|
||||
@ -408,10 +403,6 @@ class InvoicesController extends Controller
|
||||
$data['user'] = User::find($userId)->toArray();
|
||||
$data['company'] = Company::find($invoice->company_id);
|
||||
$email = $data['user']['email'];
|
||||
$notificationEmail = CompanySetting::getSetting(
|
||||
'notification_email',
|
||||
$request->header('company')
|
||||
);
|
||||
|
||||
if (!$email) {
|
||||
return response()->json([
|
||||
@ -419,13 +410,13 @@ class InvoicesController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$notificationEmail) {
|
||||
if (!config('mail.from.name')) {
|
||||
return response()->json([
|
||||
'error' => 'notification_email_does_not_exist'
|
||||
'error' => 'from_email_does_not_exist'
|
||||
]);
|
||||
}
|
||||
|
||||
\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
|
||||
\Mail::to($email)->send(new invoicePdf($data));
|
||||
|
||||
if ($invoice->status == Invoice::STATUS_DRAFT) {
|
||||
$invoice->status = Invoice::STATUS_SENT;
|
||||
|
||||
Reference in New Issue
Block a user