mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-21 11:40:56 -04:00
commit
f5cba4702e
@ -9,9 +9,9 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Events\Client;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Design;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Events\Client;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Design;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,5 +45,5 @@ class DesignWasDeleted
|
|||||||
{
|
{
|
||||||
return new PrivateChannel('channel-name');
|
return new PrivateChannel('channel-name');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Events\Client;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Design;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Events\Client;
|
namespace App\Events\Design;
|
||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Design;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,5 +45,5 @@ class DesignWasUpdated
|
|||||||
{
|
{
|
||||||
return new PrivateChannel('channel-name');
|
return new PrivateChannel('channel-name');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -64,22 +64,22 @@ class Handler extends ExceptionHandler
|
|||||||
|
|
||||||
if (app()->bound('sentry') && $this->shouldReport($exception)) {
|
if (app()->bound('sentry') && $this->shouldReport($exception)) {
|
||||||
|
|
||||||
// app('sentry')->configureScope(function (Scope $scope): void {
|
app('sentry')->configureScope(function (Scope $scope): void {
|
||||||
|
|
||||||
// if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
|
if (auth()->guard('contact') && auth()->guard('contact')->user() && auth()->guard('contact')->user()->company->account->report_errors) {
|
||||||
// $scope->setUser([
|
$scope->setUser([
|
||||||
// 'id' => auth()->guard('contact')->user()->company->account->key,
|
'id' => auth()->guard('contact')->user()->company->account->key,
|
||||||
// 'email' => "anonymous@example.com",
|
'email' => "anonymous@example.com",
|
||||||
// 'name' => "Anonymous User",
|
'name' => "Anonymous User",
|
||||||
// ]);
|
]);
|
||||||
// } elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) {
|
} elseif (auth()->guard('user') && auth()->guard('user')->user() && auth()->user()->company() && auth()->user()->company()->account->report_errors) {
|
||||||
// $scope->setUser([
|
$scope->setUser([
|
||||||
// 'id' => auth()->user()->account->key,
|
'id' => auth()->user()->account->key,
|
||||||
// 'email' => "anonymous@example.com",
|
'email' => "anonymous@example.com",
|
||||||
// 'name' => "Anonymous User",
|
'name' => "Anonymous User",
|
||||||
// ]);
|
]);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
app('sentry')->captureException($exception);
|
app('sentry')->captureException($exception);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,16 @@ class StoreClientRequest extends Request
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
foreach (range(0, $documents) as $index) {
|
||||||
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure we have a client name, and that all emails are unique*/
|
/* Ensure we have a client name, and that all emails are unique*/
|
||||||
//$rules['name'] = 'required|min:1';
|
//$rules['name'] = 'required|min:1';
|
||||||
$rules['id_number'] = 'unique:clients,id_number,' . $this->id . ',id,company_id,' . $this->company_id;
|
$rules['id_number'] = 'unique:clients,id_number,' . $this->id . ',id,company_id,' . $this->company_id;
|
||||||
|
@ -41,6 +41,16 @@ class UpdateClientRequest extends Request
|
|||||||
{
|
{
|
||||||
/* Ensure we have a client name, and that all emails are unique*/
|
/* Ensure we have a client name, and that all emails are unique*/
|
||||||
|
|
||||||
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
foreach (range(0, $documents) as $index) {
|
||||||
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000';
|
$rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000';
|
||||||
$rules['industry_id'] = 'integer|nullable';
|
$rules['industry_id'] = 'integer|nullable';
|
||||||
$rules['size_id'] = 'integer|nullable';
|
$rules['size_id'] = 'integer|nullable';
|
||||||
|
@ -98,6 +98,17 @@ class StorePaymentRequest extends Request
|
|||||||
'number' => 'nullable',
|
'number' => 'nullable',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
foreach (range(0, $documents) as $index) {
|
||||||
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,24 @@ class UpdatePaymentRequest extends Request
|
|||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{//min:1 removed, 'required'
|
{//min:1 removed, 'required'
|
||||||
return [
|
$rules = [
|
||||||
'invoices' => ['array',new PaymentAppliedValidAmount,new ValidCreditsPresentRule],
|
'invoices' => ['array',new PaymentAppliedValidAmount,new ValidCreditsPresentRule],
|
||||||
'invoices.*.invoice_id' => 'distinct',
|
'invoices.*.invoice_id' => 'distinct',
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
foreach (range(0, $documents) as $index) {
|
||||||
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function prepareForValidation()
|
protected function prepareForValidation()
|
||||||
|
@ -29,12 +29,23 @@ class StoreProductRequest extends Request
|
|||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
|
||||||
//'product_key' => 'required|unique:products,product_key,null,null,company_id,'.auth()->user()->companyId(),
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
'cost' => 'numeric',
|
$documents = count($this->input('documents'));
|
||||||
'price' => 'numeric',
|
|
||||||
'quantity' => 'numeric',
|
foreach (range(0, $documents) as $index) {
|
||||||
];
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rules['cost'] = 'numeric';
|
||||||
|
$rules['price'] = 'numeric';
|
||||||
|
$rules['quantity'] = 'numeric';
|
||||||
|
|
||||||
|
return $rules;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function prepareForValidation()
|
protected function prepareForValidation()
|
||||||
|
@ -32,12 +32,23 @@ class UpdateProductRequest extends Request
|
|||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
|
||||||
//'product_key' => 'unique:products,product_key,'.$this->product->id.',id,company_id,'.auth()->user()->companyId(),
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
'cost' => 'numeric',
|
$documents = count($this->input('documents'));
|
||||||
'price' => 'numeric',
|
|
||||||
'quantity' => 'numeric',
|
foreach (range(0, $documents) as $index) {
|
||||||
];
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
|
$rules['cost'] = 'numeric';
|
||||||
|
$rules['price'] = 'numeric';
|
||||||
|
$rules['quantity'] = 'numeric';
|
||||||
|
|
||||||
|
return $rules;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,9 +75,21 @@ class StoreQuoteRequest extends Request
|
|||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
$rules = [];
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
|
||||||
'client_id' => 'required|exists:clients,id,company_id,'.auth()->user()->company()->id,
|
$rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
|
||||||
];
|
|
||||||
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
foreach (range(0, $documents) as $index) {
|
||||||
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rules;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,19 @@ class UpdateQuoteRequest extends Request
|
|||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
$rules = [];
|
||||||
'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
|
|
||||||
];
|
if ($this->input('documents') && is_array($this->input('documents'))) {
|
||||||
|
$documents = count($this->input('documents'));
|
||||||
|
|
||||||
|
foreach (range(0, $documents) as $index) {
|
||||||
|
$rules['documents.' . $index] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
} elseif ($this->input('documents')) {
|
||||||
|
$rules['documents'] = 'file|mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function prepareForValidation()
|
protected function prepareForValidation()
|
||||||
|
@ -94,8 +94,8 @@ class UploadFile implements ShouldQueue
|
|||||||
$document->disk = $this->disk;
|
$document->disk = $this->disk;
|
||||||
$document->hash = $this->file->hashName();
|
$document->hash = $this->file->hashName();
|
||||||
$document->size = $this->file->getSize();
|
$document->size = $this->file->getSize();
|
||||||
$document->width = isset($width) ?? null;
|
$document->width = isset($width) ? $width : null;
|
||||||
$document->height = isset($height) ?? null;
|
$document->height = isset($height) ? $height : null;
|
||||||
|
|
||||||
// $preview_path = $this->encodePrimaryKey($this->company->id);
|
// $preview_path = $this->encodePrimaryKey($this->company->id);
|
||||||
// $document->preview = $this->generatePreview($preview_path);
|
// $document->preview = $this->generatePreview($preview_path);
|
||||||
|
@ -15,6 +15,7 @@ use App\Factory\ClientFactory;
|
|||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Repositories\ClientContactRepository;
|
use App\Repositories\ClientContactRepository;
|
||||||
use App\Utils\Traits\GeneratesCounter;
|
use App\Utils\Traits\GeneratesCounter;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,6 +24,8 @@ use Illuminate\Http\Request;
|
|||||||
class ClientRepository extends BaseRepository
|
class ClientRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
use GeneratesCounter;
|
use GeneratesCounter;
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ClientContactRepository
|
* @var ClientContactRepository
|
||||||
*/
|
*/
|
||||||
@ -75,6 +78,9 @@ class ClientRepository extends BaseRepository
|
|||||||
$data['name'] = $client->present()->name();
|
$data['name'] = $client->present()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('documents', $data)) {
|
||||||
|
$this->saveDocuments($data['documents'], $client);
|
||||||
|
}
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ use App\Models\Invoice;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Repositories\CreditRepository;
|
use App\Repositories\CreditRepository;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ use Illuminate\Support\Carbon;
|
|||||||
class PaymentRepository extends BaseRepository
|
class PaymentRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
protected $credit_repo;
|
protected $credit_repo;
|
||||||
|
|
||||||
@ -89,6 +91,9 @@ class PaymentRepository extends BaseRepository
|
|||||||
$payment->status_id = Payment::STATUS_COMPLETED;
|
$payment->status_id = Payment::STATUS_COMPLETED;
|
||||||
$payment->save();
|
$payment->save();
|
||||||
|
|
||||||
|
if (array_key_exists('documents', $data)) {
|
||||||
|
$this->saveDocuments($data['documents'], $payment);
|
||||||
|
}
|
||||||
|
|
||||||
/*Ensure payment number generated*/
|
/*Ensure payment number generated*/
|
||||||
if (!$payment->number || strlen($payment->number) == 0) {
|
if (!$payment->number || strlen($payment->number) == 0) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
|
use App\Utils\Traits\SavesDocuments;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,6 +20,8 @@ use Illuminate\Http\Request;
|
|||||||
*/
|
*/
|
||||||
class ProductRepository extends BaseRepository
|
class ProductRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
|
use SavesDocuments;
|
||||||
|
|
||||||
public function getClassName()
|
public function getClassName()
|
||||||
{
|
{
|
||||||
return Product::class;
|
return Product::class;
|
||||||
@ -34,6 +37,10 @@ class ProductRepository extends BaseRepository
|
|||||||
$product->fill($data);
|
$product->fill($data);
|
||||||
$product->save();
|
$product->save();
|
||||||
|
|
||||||
|
if (array_key_exists('documents', $data)) {
|
||||||
|
$this->saveDocuments($data['documents'], $product);
|
||||||
|
}
|
||||||
|
|
||||||
return $product;
|
return $product;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ class DocumentTransformer extends EntityTransformer
|
|||||||
'assigned_user_id' => $this->encodePrimaryKey($document->assigned_user_id),
|
'assigned_user_id' => $this->encodePrimaryKey($document->assigned_user_id),
|
||||||
'project_id' => $this->encodePrimaryKey($document->project_id),
|
'project_id' => $this->encodePrimaryKey($document->project_id),
|
||||||
'vendor_id' => $this->encodePrimaryKey($document->vendor_id),
|
'vendor_id' => $this->encodePrimaryKey($document->vendor_id),
|
||||||
'url' => (string) $document->url ?: '',
|
'url' => (string) $document->generateUrl() ?: '',
|
||||||
'preview' => (string) $document->preview ?: '',
|
'preview' => (string) $document->preview ?: '',
|
||||||
'name' => (string) $document->name,
|
'name' => (string) $document->name,
|
||||||
'type' => (string) $document->type,
|
'type' => (string) $document->type,
|
||||||
|
@ -5,7 +5,7 @@ return [
|
|||||||
/**
|
/**
|
||||||
* Enable or disable the beacon
|
* Enable or disable the beacon
|
||||||
*/
|
*/
|
||||||
'enabled' => true,
|
'enabled' => env('BEACON_ENABLED', false),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The API endpoint for logs
|
* The API endpoint for logs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user