mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for phpstan
This commit is contained in:
parent
5dacc04295
commit
3ef2591b38
@ -130,18 +130,15 @@ class EmailController extends BaseController
|
||||
$mo->subject = strlen($subject) > 3 ? $subject : null;
|
||||
$mo->body = strlen($body) > 3 ? $body : null;
|
||||
$mo->entity_id = $request->input('entity_id');
|
||||
$mo->template = $template; //full template name in use
|
||||
$mo->template = $request->input('template'); //full template name in use
|
||||
$mo->entity_class = $this->resolveClass($entity);
|
||||
$mo->email_template_body = $template;
|
||||
$mo->email_template_subject = str_replace("template", "subject", $template);
|
||||
$mo->email_template_body = $request->input('template');
|
||||
$mo->email_template_subject = str_replace("template", "subject", $request->input('template'));
|
||||
|
||||
if (Ninja::isHosted() && !$entity_obj->company->account->account_sms_verified) {
|
||||
return response(['message' => 'Please verify your account to send emails.'], 400);
|
||||
}
|
||||
|
||||
if ($entity == 'purchaseOrder' || $entity == 'purchase_order' || $template == 'purchase_order' || $entity == 'App\Models\PurchaseOrder') {
|
||||
return $this->sendPurchaseOrder($entity_obj, $data, $template);
|
||||
}
|
||||
|
||||
// if ($entity == 'purchaseOrder' || $entity == 'purchase_order' || $template == 'purchase_order' || $entity == 'App\Models\PurchaseOrder') {
|
||||
// return $this->sendPurchaseOrder($entity_obj, $data, $template);
|
||||
// }
|
||||
|
||||
$entity_obj->invitations->each(function ($invitation) use ($data, $entity_obj, $template, $mo) {
|
||||
if (! $invitation->contact->trashed() && $invitation->contact->email) {
|
||||
|
@ -12,13 +12,16 @@
|
||||
namespace App\Http\Requests\Email;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class SendEmailRequest extends Request
|
||||
{
|
||||
use MakesHash;
|
||||
|
||||
private string $error_message = '';
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
@ -78,7 +81,14 @@ class SendEmailRequest extends Request
|
||||
private function checkUserAbleToSend()
|
||||
{
|
||||
$input = $this->all();
|
||||
|
||||
|
||||
if (Ninja::isHosted() && !auth()->user()->company()->account->account_sms_verified) {
|
||||
$this->error_message = ctrans('texts.authorization_sms_failure');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*Make sure we have all the require ingredients to send a template*/
|
||||
if (array_key_exists('entity', $input) && array_key_exists('entity_id', $input) && is_string($input['entity']) && $input['entity_id']) {
|
||||
$company = auth()->user()->company();
|
||||
@ -96,4 +106,9 @@ class SendEmailRequest extends Request
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function failedAuthorization()
|
||||
{
|
||||
throw new AuthorizationException($this->error_message);
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ class EmailDefaults
|
||||
* Sets the body of the email
|
||||
*/
|
||||
private function setBody(): self
|
||||
{
|
||||
{nlog($this->email->email_object->email_template_body);
|
||||
if ($this->email->email_object->body) {
|
||||
// A Custom Message has been set in the email screen.
|
||||
return $this;
|
||||
|
@ -38,7 +38,8 @@ class SchedulerService
|
||||
*/
|
||||
public function runTask(): void
|
||||
{
|
||||
$this->{$this->scheduler->template}();
|
||||
if(method_exists($this, $this->scheduler->template))
|
||||
$this->{$this->scheduler->template}();
|
||||
}
|
||||
|
||||
private function email_statement()
|
||||
|
@ -5012,6 +5012,8 @@ $LANG = array(
|
||||
'add_stripe' => 'Add Stripe',
|
||||
'invalid_coupon' => 'Invalid Coupon',
|
||||
'no_assigned_tasks' => 'No billable tasks for this project',
|
||||
'authorization_failure' => 'Insufficient permissions to perform this action',
|
||||
'authorization_sms_failure' => 'Please verify your account to send emails.',
|
||||
);
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
parameters:
|
||||
level: 6
|
||||
paths:
|
||||
- app
|
||||
- tests
|
||||
- app
|
||||
- tests
|
||||
|
Loading…
x
Reference in New Issue
Block a user