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