mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Minor fixes for project resolution
This commit is contained in:
parent
64aa4fe00f
commit
aa145243c6
@ -24,6 +24,8 @@ class ValidProjectForClient implements Rule
|
|||||||
|
|
||||||
public $input;
|
public $input;
|
||||||
|
|
||||||
|
public $message;
|
||||||
|
|
||||||
public function __construct($input)
|
public function __construct($input)
|
||||||
{
|
{
|
||||||
$this->input = $input;
|
$this->input = $input;
|
||||||
@ -35,15 +37,20 @@ class ValidProjectForClient implements Rule
|
|||||||
*/
|
*/
|
||||||
public function passes($attribute, $value)
|
public function passes($attribute, $value)
|
||||||
{
|
{
|
||||||
|
$this->message = ctrans('texts.project_client_do_not_match');
|
||||||
|
|
||||||
if (empty($this->input['project_id'])) {
|
if (empty($this->input['project_id'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($this->input['project_id'])) {
|
// if (is_string($this->input['project_id'])) {
|
||||||
$this->input['project_id'] = $this->decodePrimaryKey($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'];
|
return $project->client_id == $this->input['client_id'];
|
||||||
}
|
}
|
||||||
@ -53,6 +60,6 @@ class ValidProjectForClient implements Rule
|
|||||||
*/
|
*/
|
||||||
public function message()
|
public function message()
|
||||||
{
|
{
|
||||||
return ctrans('texts.project_client_do_not_match');
|
return $this->message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,6 @@ class CSVImport implements ShouldQueue {
|
|||||||
'company' => $this->company,
|
'company' => $this->company,
|
||||||
];
|
];
|
||||||
|
|
||||||
App::forgetInstance('translator');
|
|
||||||
$t = app('translator');
|
|
||||||
$t->replace(Ninja::transformTranslations($this->company->settings));
|
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new ImportCompleted($this->company, $data);
|
$nmo->mailable = new ImportCompleted($this->company, $data);
|
||||||
$nmo->company = $this->company;
|
$nmo->company = $this->company;
|
||||||
|
@ -13,9 +13,11 @@
|
|||||||
namespace App\Mail\Import;
|
namespace App\Mail\Import;
|
||||||
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
|
||||||
class ImportCompleted extends Mailable
|
class ImportCompleted extends Mailable
|
||||||
{
|
{
|
||||||
@ -45,6 +47,11 @@ class ImportCompleted extends Mailable
|
|||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
App::forgetInstance('translator');
|
||||||
|
$t = app('translator');
|
||||||
|
$t->replace(Ninja::transformTranslations($this->company->settings));
|
||||||
|
|
||||||
$data = array_merge($this->data, [
|
$data = array_merge($this->data, [
|
||||||
'logo' => $this->company->present()->logo(),
|
'logo' => $this->company->present()->logo(),
|
||||||
'settings' => $this->company->settings,
|
'settings' => $this->company->settings,
|
||||||
|
Loading…
Reference in New Issue
Block a user