1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop

This commit is contained in:
David Bomba 2021-11-09 18:55:02 +11:00
commit 43aad784ae
3 changed files with 19 additions and 9 deletions

View File

@ -24,6 +24,8 @@ class ValidProjectForClient implements Rule
public $input;
public $message;
public function __construct($input)
{
$this->input = $input;
@ -35,15 +37,20 @@ class ValidProjectForClient implements Rule
*/
public function passes($attribute, $value)
{
$this->message = ctrans('texts.project_client_do_not_match');
if (empty($this->input['project_id'])) {
return true;
}
if (is_string($this->input['project_id'])) {
$this->input['project_id'] = $this->decodePrimaryKey($this->input['project_id']);
}
// if (is_string($this->input['project_id'])) {
// $this->input['project_id'] = $this->decodePrimaryKey($this->input['project_id']);
// }
$project = Project::findOrFail($this->input['project_id']);
$project = Project::find($this->input['project_id']);
if(!$project)
$this->message = "Project not found";
return $project->client_id == $this->input['client_id'];
}
@ -53,6 +60,6 @@ class ValidProjectForClient implements Rule
*/
public function message()
{
return ctrans('texts.project_client_do_not_match');
return $this->message;
}
}

View File

@ -134,10 +134,6 @@ class CSVImport implements ShouldQueue {
'company' => $this->company,
];
App::forgetInstance('translator');
$t = app('translator');
$t->replace(Ninja::transformTranslations($this->company->settings));
$nmo = new NinjaMailerObject;
$nmo->mailable = new ImportCompleted($this->company, $data);
$nmo->company = $this->company;

View File

@ -13,9 +13,11 @@
namespace App\Mail\Import;
use App\Models\Company;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
class ImportCompleted extends Mailable
{
@ -45,6 +47,11 @@ class ImportCompleted extends Mailable
*/
public function build()
{
App::forgetInstance('translator');
$t = app('translator');
$t->replace(Ninja::transformTranslations($this->company->settings));
$data = array_merge($this->data, [
'logo' => $this->company->present()->logo(),
'settings' => $this->company->settings,