mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 00:07:31 -04:00 
			
		
		
		
	Merge pull request #4197 from turbo124/v5-stable
Database Schema dump feature
This commit is contained in:
		
						commit
						2cfe9c8f7b
					
				| @ -1 +1 @@ | |||||||
| 5.0.21 | 5.0.22 | ||||||
|  | |||||||
| @ -112,7 +112,7 @@ class CheckData extends Command | |||||||
|                         ->subject('Check-Data: '.strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE)." [{$database}]"); |                         ->subject('Check-Data: '.strtoupper($this->isValid ? Account::RESULT_SUCCESS : Account::RESULT_FAILURE)." [{$database}]"); | ||||||
|             }); |             }); | ||||||
|         } elseif (! $this->isValid) { |         } elseif (! $this->isValid) { | ||||||
|             throw new Exception("Check data failed!!\n".$this->log); |             new Exception("Check data failed!!\n".$this->log); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -325,7 +325,7 @@ class CheckData extends Command | |||||||
|                 $total_amount = $invoice->payments->sum('pivot.amount');  |                 $total_amount = $invoice->payments->sum('pivot.amount');  | ||||||
|                 $total_refund = $invoice->payments->sum('pivot.refunded'); |                 $total_refund = $invoice->payments->sum('pivot.refunded'); | ||||||
| 
 | 
 | ||||||
|                 $total_invoice_payments += ($total_amount - $total_refund); |                  $total_invoice_payments += ($total_amount - $total_refund); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             foreach($client->payments as $payment) |             foreach($client->payments as $payment) | ||||||
| @ -333,7 +333,8 @@ class CheckData extends Command | |||||||
|               $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(\DB::raw('amount')); |               $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(\DB::raw('amount')); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             $total_invoice_payments += $credit_total_applied; |             if($credit_total_applied < 0) | ||||||
|  |                 $total_invoice_payments += $credit_total_applied; //todo this is contentious
 | ||||||
| 
 | 
 | ||||||
|             info("total invoice payments = {$total_invoice_payments} with client paid to date of of {$client->paid_to_date}"); |             info("total invoice payments = {$total_invoice_payments} with client paid to date of of {$client->paid_to_date}"); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -203,6 +203,10 @@ class CreateSingleAccount extends Command | |||||||
| 
 | 
 | ||||||
|             $this->info('creating project for client #'.$client->id); |             $this->info('creating project for client #'.$client->id); | ||||||
|             $this->createProject($client); |             $this->createProject($client); | ||||||
|  | 
 | ||||||
|  |             $this->info('creating credit for client #'.$client->id); | ||||||
|  |             $this->createCredit($client); | ||||||
|  | 
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $this->createGateways($company, $user); |         $this->createGateways($company, $user); | ||||||
| @ -344,11 +348,6 @@ class CreateSingleAccount extends Command | |||||||
| 
 | 
 | ||||||
|     private function createCredit($client) |     private function createCredit($client) | ||||||
|     { |     { | ||||||
|         // for($x=0; $x<$this->count; $x++){
 |  | ||||||
| 
 |  | ||||||
|         //     dispatch(new CreateTestCreditJob($client));
 |  | ||||||
| 
 |  | ||||||
|         // }
 |  | ||||||
|         $faker = \Faker\Factory::create(); |         $faker = \Faker\Factory::create(); | ||||||
| 
 | 
 | ||||||
|         $credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]); |         $credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]); | ||||||
| @ -356,24 +355,9 @@ class CreateSingleAccount extends Command | |||||||
|         $dateable = Carbon::now()->subDays(rand(0, 90)); |         $dateable = Carbon::now()->subDays(rand(0, 90)); | ||||||
|         $credit->date = $dateable; |         $credit->date = $dateable; | ||||||
| 
 | 
 | ||||||
|         $credit->line_items = $this->buildLineItems(rand(1, 10)); |         $credit->line_items = $this->buildCreditItem(); | ||||||
|         $credit->uses_inclusive_taxes = false; |         $credit->uses_inclusive_taxes = false; | ||||||
| 
 | 
 | ||||||
|         if (rand(0, 1)) { |  | ||||||
|             $credit->tax_name1 = 'GST'; |  | ||||||
|             $credit->tax_rate1 = 10.00; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (rand(0, 1)) { |  | ||||||
|             $credit->tax_name2 = 'VAT'; |  | ||||||
|             $credit->tax_rate2 = 17.50; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (rand(0, 1)) { |  | ||||||
|             $credit->tax_name3 = 'CA Sales Tax'; |  | ||||||
|             $credit->tax_rate3 = 5; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         $credit->save(); |         $credit->save(); | ||||||
| 
 | 
 | ||||||
|         $invoice_calc = new InvoiceSum($credit); |         $invoice_calc = new InvoiceSum($credit); | ||||||
| @ -428,6 +412,32 @@ class CreateSingleAccount extends Command | |||||||
|         $quote->service()->createInvitations(); |         $quote->service()->createInvitations(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  |     private function buildCreditItem() | ||||||
|  |     { | ||||||
|  |         $line_items = []; | ||||||
|  | 
 | ||||||
|  |             $item = InvoiceItemFactory::create(); | ||||||
|  |             $item->quantity = 1; | ||||||
|  |             $item->cost = 1000; | ||||||
|  | 
 | ||||||
|  |             $product = Product::all()->random(); | ||||||
|  | 
 | ||||||
|  |             $item->cost = (float) $product->cost; | ||||||
|  |             $item->product_key = $product->product_key; | ||||||
|  |             $item->notes = $product->notes; | ||||||
|  |             $item->custom_value1 = $product->custom_value1; | ||||||
|  |             $item->custom_value2 = $product->custom_value2; | ||||||
|  |             $item->custom_value3 = $product->custom_value3; | ||||||
|  |             $item->custom_value4 = $product->custom_value4; | ||||||
|  | 
 | ||||||
|  |             $line_items[] = $item; | ||||||
|  |          | ||||||
|  | 
 | ||||||
|  |         return $line_items; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     private function buildLineItems($count = 1) |     private function buildLineItems($count = 1) | ||||||
|     { |     { | ||||||
|         $line_items = []; |         $line_items = []; | ||||||
|  | |||||||
| @ -17,6 +17,7 @@ use App\Factory\InvoiceFactory; | |||||||
| use App\Factory\InvoiceItemFactory; | use App\Factory\InvoiceItemFactory; | ||||||
| use App\Helpers\Invoice\InvoiceSum; | use App\Helpers\Invoice\InvoiceSum; | ||||||
| use App\Jobs\Company\CreateCompanyPaymentTerms; | use App\Jobs\Company\CreateCompanyPaymentTerms; | ||||||
|  | use App\Jobs\Company\CreateCompanyTaskStatuses; | ||||||
| use App\Jobs\Ninja\CompanySizeCheck; | use App\Jobs\Ninja\CompanySizeCheck; | ||||||
| use App\Jobs\Util\VersionCheck; | use App\Jobs\Util\VersionCheck; | ||||||
| use App\Models\Account; | use App\Models\Account; | ||||||
| @ -175,6 +176,7 @@ class DemoMode extends Command | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         CreateCompanyPaymentTerms::dispatchNow($company, $user); |         CreateCompanyPaymentTerms::dispatchNow($company, $user); | ||||||
|  |         CreateCompanyTaskStatuses::dispatchNow($company, $user); | ||||||
| 
 | 
 | ||||||
|         $company_token = new CompanyToken; |         $company_token = new CompanyToken; | ||||||
|         $company_token->user_id = $user->id; |         $company_token->user_id = $user->id; | ||||||
|  | |||||||
							
								
								
									
										27
									
								
								app/Factory/TaskStatusFactory.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								app/Factory/TaskStatusFactory.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Factory; | ||||||
|  | 
 | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | 
 | ||||||
|  | class TaskStatusFactory | ||||||
|  | { | ||||||
|  |     public static function create(int $company_id, int $user_id) :TaskStatus | ||||||
|  |     { | ||||||
|  |         $task_status = new TaskStatus; | ||||||
|  |         $task_status->user_id = $user_id; | ||||||
|  |         $task_status->company_id = $company_id; | ||||||
|  |         $task_status->name = ''; | ||||||
|  |          | ||||||
|  |         return $task_status; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -187,6 +187,18 @@ class InvoiceSum | |||||||
|         return $this->invoice; |         return $this->invoice; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public function getRecurringInvoice() | ||||||
|  |     { | ||||||
|  |          | ||||||
|  |         $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision); | ||||||
|  |         $this->invoice->total_taxes = $this->getTotalTaxes(); | ||||||
|  |         $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision); | ||||||
|  | 
 | ||||||
|  |         $this->invoice->save(); | ||||||
|  | 
 | ||||||
|  |         return $this->invoice; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Build $this->invoice variables after |      * Build $this->invoice variables after | ||||||
|      * calculations have been performed. |      * calculations have been performed. | ||||||
|  | |||||||
| @ -174,6 +174,18 @@ class InvoiceSumInclusive | |||||||
|         return $this; |         return $this; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public function getRecurringInvoice() | ||||||
|  |     { | ||||||
|  |          | ||||||
|  |         $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision); | ||||||
|  |         $this->invoice->total_taxes = $this->getTotalTaxes(); | ||||||
|  |         $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision); | ||||||
|  | 
 | ||||||
|  |         $this->invoice->save(); | ||||||
|  | 
 | ||||||
|  |         return $this->invoice; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public function getInvoice() |     public function getInvoice() | ||||||
|     { |     { | ||||||
|         //Build invoice values here and return Invoice
 |         //Build invoice values here and return Invoice
 | ||||||
|  | |||||||
| @ -62,40 +62,40 @@ class BaseController extends Controller | |||||||
|           'account', |           'account', | ||||||
|           'token.company_user', |           'token.company_user', | ||||||
|           'company.activities', |           'company.activities', | ||||||
|  |           'company.designs.company', | ||||||
|  |           'company.documents', | ||||||
|           'company.users.company_users', |           'company.users.company_users', | ||||||
|           'company.tax_rates', |  | ||||||
|           'company.groups', |  | ||||||
|           'company.company_gateways.gateway', |  | ||||||
|           'company.clients.contacts', |           'company.clients.contacts', | ||||||
|           'company.clients.gateway_tokens', |           'company.clients.gateway_tokens', | ||||||
|           'company.clients.documents', |           'company.clients.documents', | ||||||
|           'company.products', |           'company.company_gateways.gateway', | ||||||
|           'company.products.documents', |           'company.credits.invitations.contact', | ||||||
|           'company.recurring_invoices', |           'company.credits.invitations.company', | ||||||
|  |           'company.credits.documents', | ||||||
|  |           'company.expenses.documents', | ||||||
|  |           'company.groups', | ||||||
|           'company.invoices.invitations.contact', |           'company.invoices.invitations.contact', | ||||||
|           'company.invoices.invitations.company', |           'company.invoices.invitations.company', | ||||||
|           'company.invoices.documents', |           'company.invoices.documents', | ||||||
|  |           'company.products', | ||||||
|  |           'company.products.documents', | ||||||
|  |           'company.payments.paymentables', | ||||||
|  |           'company.payments.documents', | ||||||
|  |           'company.payment_terms.company', | ||||||
|  |           'company.projects.documents', | ||||||
|           'company.recurring_invoices', |           'company.recurring_invoices', | ||||||
|           'company.recurring_invoices.invitations.contact', |           'company.recurring_invoices.invitations.contact', | ||||||
|           'company.recurring_invoices.invitations.company', |           'company.recurring_invoices.invitations.company', | ||||||
|           'company.recurring_invoices.documents', |           'company.recurring_invoices.documents', | ||||||
|           'company.payments.paymentables', |  | ||||||
|           'company.payments.documents', |  | ||||||
|           'company.quotes.invitations.contact', |           'company.quotes.invitations.contact', | ||||||
|           'company.quotes.invitations.company', |           'company.quotes.invitations.company', | ||||||
|           'company.quotes.documents', |           'company.quotes.documents', | ||||||
|           'company.credits.invitations.contact', |           'company.tasks', | ||||||
|           'company.credits.invitations.company', |  | ||||||
|           'company.credits.documents', |  | ||||||
|           'company.payment_terms.company', |  | ||||||
|           'company.vendors.contacts', |  | ||||||
|           'company.expenses.documents', |  | ||||||
|           'company.tasks.documents', |           'company.tasks.documents', | ||||||
|           'company.projects.documents', |           'company.tax_rates', | ||||||
|           'company.designs.company', |  | ||||||
|           'company.documents', |  | ||||||
|           'company.webhooks', |  | ||||||
|           'company.tokens_hashed', |           'company.tokens_hashed', | ||||||
|  |           'company.vendors.contacts', | ||||||
|  |           'company.webhooks', | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|     private $mini_load = [ |     private $mini_load = [ | ||||||
| @ -202,7 +202,7 @@ class BaseController extends Controller | |||||||
|         $updated_at = date('Y-m-d H:i:s', $updated_at); |         $updated_at = date('Y-m-d H:i:s', $updated_at); | ||||||
| 
 | 
 | ||||||
|         $query->with( |         $query->with( | ||||||
|           [ 'user.company_users', |           [ | ||||||
|             'company' => function ($query) use ($updated_at) { |             'company' => function ($query) use ($updated_at) { | ||||||
|                 $query->whereNotNull('updated_at')->with('documents'); |                 $query->whereNotNull('updated_at')->with('documents'); | ||||||
|             }, |             }, | ||||||
|  | |||||||
| @ -23,6 +23,7 @@ use App\Http\Requests\Company\UpdateCompanyRequest; | |||||||
| use App\Http\Requests\SignupRequest; | use App\Http\Requests\SignupRequest; | ||||||
| use App\Jobs\Company\CreateCompany; | use App\Jobs\Company\CreateCompany; | ||||||
| use App\Jobs\Company\CreateCompanyPaymentTerms; | use App\Jobs\Company\CreateCompanyPaymentTerms; | ||||||
|  | use App\Jobs\Company\CreateCompanyTaskStatuses; | ||||||
| use App\Jobs\Company\CreateCompanyToken; | use App\Jobs\Company\CreateCompanyToken; | ||||||
| use App\Jobs\Ninja\RefundCancelledAccount; | use App\Jobs\Ninja\RefundCancelledAccount; | ||||||
| use App\Jobs\RegisterNewAccount; | use App\Jobs\RegisterNewAccount; | ||||||
| @ -205,6 +206,7 @@ class CompanyController extends BaseController | |||||||
|         $company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account); |         $company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account); | ||||||
| 
 | 
 | ||||||
|         CreateCompanyPaymentTerms::dispatchNow($company, auth()->user()); |         CreateCompanyPaymentTerms::dispatchNow($company, auth()->user()); | ||||||
|  |         CreateCompanyTaskStatuses::dispatchNow($company, auth()->user()); | ||||||
| 
 | 
 | ||||||
|         $company = $this->company_repo->save($request->all(), $company); |         $company = $this->company_repo->save($request->all(), $company); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -122,6 +122,9 @@ class EmailController extends BaseController | |||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|  |         $entity_obj->last_sent_date = now(); | ||||||
|  |         $entity_obj->save(); | ||||||
|  | 
 | ||||||
|         /*Only notify the admin ONCE, not once per contact/invite*/ |         /*Only notify the admin ONCE, not once per contact/invite*/ | ||||||
|         $invitation = $entity_obj->invitations->first(); |         $invitation = $entity_obj->invitations->first(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								app/Http/Controllers/OpenAPI/TaskStatusSchema.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								app/Http/Controllers/OpenAPI/TaskStatusSchema.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * @OA\Schema( | ||||||
|  |  *   schema="TaskStatus", | ||||||
|  |  *   type="object", | ||||||
|  |  *       @OA\Property(property="name", type="string", example="Backlog", description="The task status name"), | ||||||
|  |  *       @OA\Property(property="created_at", type="number", format="integer", example="134341234234", description="Timestamp"), | ||||||
|  |  *       @OA\Property(property="is_deleted", type="boolean", example=true, description="______"), | ||||||
|  |  *       @OA\Property(property="updated_at", type="number", format="integer", example="134341234234", description="Timestamp"), | ||||||
|  |  *       @OA\Property(property="archived_at", type="number", format="integer", example="134341234234", description="Timestamp"), | ||||||
|  |  * ) | ||||||
|  |  */ | ||||||
| @ -196,7 +196,7 @@ class PreviewController extends BaseController | |||||||
|             ->design($design) |             ->design($design) | ||||||
|             ->build(); |             ->build(); | ||||||
| 
 | 
 | ||||||
|         // info($maker->getCompiledHTML(true));
 |         info($maker->getCompiledHTML(true)); | ||||||
| 
 | 
 | ||||||
|         $file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company()); |         $file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company()); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -24,6 +24,7 @@ use App\Models\Project; | |||||||
| use App\Repositories\ProjectRepository; | use App\Repositories\ProjectRepository; | ||||||
| use App\Transformers\ProjectTransformer; | use App\Transformers\ProjectTransformer; | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
|  | use App\Utils\Traits\GeneratesCounter; | ||||||
| use App\Utils\Traits\MakesHash; | use App\Utils\Traits\MakesHash; | ||||||
| use App\Utils\Traits\SavesDocuments; | use App\Utils\Traits\SavesDocuments; | ||||||
| use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||||
| @ -36,6 +37,7 @@ class ProjectController extends BaseController | |||||||
| { | { | ||||||
|     use MakesHash; |     use MakesHash; | ||||||
|     use SavesDocuments; |     use SavesDocuments; | ||||||
|  |     use GeneratesCounter; | ||||||
|      |      | ||||||
|     protected $entity_type = Project::class; |     protected $entity_type = Project::class; | ||||||
| 
 | 
 | ||||||
| @ -353,6 +355,7 @@ class ProjectController extends BaseController | |||||||
|     { |     { | ||||||
|         $project = ProjectFactory::create(auth()->user()->company()->id, auth()->user()->id); |         $project = ProjectFactory::create(auth()->user()->company()->id, auth()->user()->id); | ||||||
|         $project->fill($request->all()); |         $project->fill($request->all()); | ||||||
|  |         $project->number = $this->getNextProjectNumber($request->getClient($request->input('client_id'))); | ||||||
|         $project->save(); |         $project->save(); | ||||||
| 
 | 
 | ||||||
|         if ($request->has('documents')) { |         if ($request->has('documents')) { | ||||||
|  | |||||||
							
								
								
									
										463
									
								
								app/Http/Controllers/TaskStatusController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										463
									
								
								app/Http/Controllers/TaskStatusController.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,463 @@ | |||||||
|  | <?php | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Controllers; | ||||||
|  | 
 | ||||||
|  | use App\Factory\TaskStatusFactory; | ||||||
|  | use App\Http\Requests\TaskStatus\CreateTaskStatusRequest; | ||||||
|  | use App\Http\Requests\TaskStatus\DestroyTaskStatusRequest; | ||||||
|  | use App\Http\Requests\TaskStatus\ShowTaskStatusRequest; | ||||||
|  | use App\Http\Requests\TaskStatus\StoreTaskStatusRequest; | ||||||
|  | use App\Http\Requests\TaskStatus\UpdateTaskStatusRequest; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | use App\Repositories\TaskStatusRepository; | ||||||
|  | use App\Transformers\TaskStatusTransformer; | ||||||
|  | use App\Utils\Traits\MakesHash; | ||||||
|  | use Illuminate\Http\Request; | ||||||
|  | 
 | ||||||
|  | class TaskStatusController extends BaseController | ||||||
|  | { | ||||||
|  |     use MakesHash; | ||||||
|  | 
 | ||||||
|  |     protected $entity_type = TaskStatus::class; | ||||||
|  | 
 | ||||||
|  |     protected $entity_transformer = TaskStatusTransformer::class; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @var TaskStatusRepository | ||||||
|  |      */ | ||||||
|  |     protected $task_status_repo; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * TaskStatusController constructor. | ||||||
|  |      * | ||||||
|  |      * @param      \App\Repositories\TaskStatusRepository  $task_status_repo  The payment term repo | ||||||
|  |      */ | ||||||
|  |     public function __construct(TaskStatusRepository $task_status_repo) | ||||||
|  |     { | ||||||
|  |         parent::__construct(); | ||||||
|  | 
 | ||||||
|  |         $this->task_status_repo = $task_status_repo; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      *      @OA\Get( | ||||||
|  |      *      path="/api/v1/task_status", | ||||||
|  |      *      operationId="getTaskStatuss", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Gets a list of task statuses", | ||||||
|  |      *      description="Lists task statuses", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/index"), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="A list of task statuses", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  | 
 | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function index() | ||||||
|  |     { | ||||||
|  |         $task_status = TaskStatus::whereCompanyId(auth()->user()->company()->id)->orWhere('company_id', null); | ||||||
|  | 
 | ||||||
|  |         return $this->listResponse($task_status); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Show the form for creating a new resource. | ||||||
|  |      * | ||||||
|  |      * @param      \App\Http\Requests\TaskStatus\CreateTaskStatusRequest  $request  The request | ||||||
|  |      * | ||||||
|  |      * @return \Illuminate\Http\Response | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * @OA\Get( | ||||||
|  |      *      path="/api/v1/task_statuses/create", | ||||||
|  |      *      operationId="getTaskStatussCreate", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Gets a new blank TaskStatus object", | ||||||
|  |      *      description="Returns a blank object with default values", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="A blank TaskStatus object", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  |      * | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function create(CreateTaskStatusRequest $request) | ||||||
|  |     { | ||||||
|  |         $task_status = TaskStatusFactory::create(auth()->user()->company()->id, auth()->user()->id); | ||||||
|  | 
 | ||||||
|  |         return $this->itemResponse($task_status); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Store a newly created resource in storage. | ||||||
|  |      * | ||||||
|  |      * @param      \App\Http\Requests\TaskStatus\StoreTaskStatusRequest  $request  The request | ||||||
|  |      * | ||||||
|  |      * @return \Illuminate\Http\Response | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * @OA\Post( | ||||||
|  |      *      path="/api/v1/task_status", | ||||||
|  |      *      operationId="storeTaskStatus", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Adds a TaskStatus", | ||||||
|  |      *      description="Adds a TaskStatusto the system", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\RequestBody( | ||||||
|  |      *         description="The task_status request", | ||||||
|  |      *         required=true, | ||||||
|  |      *         @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *     ), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="Returns the saved TaskStatus object", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  |      * | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function store(StoreTaskStatusRequest $request) | ||||||
|  |     { | ||||||
|  |         $task_status = TaskStatusFactory::create(auth()->user()->company()->id, auth()->user()->id); | ||||||
|  |         $task_status->fill($request->all()); | ||||||
|  |         $task_status->save(); | ||||||
|  | 
 | ||||||
|  |         return $this->itemResponse($task_status->fresh()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @OA\Get( | ||||||
|  |      *      path="/api/v1/task_statuses/{id}", | ||||||
|  |      *      operationId="showTaskStatus", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Shows a TaskStatus Term", | ||||||
|  |      *      description="Displays an TaskStatusby id", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\Parameter( | ||||||
|  |      *          name="id", | ||||||
|  |      *          in="path", | ||||||
|  |      *          description="The TaskStatusHashed ID", | ||||||
|  |      *          example="D2J234DFA", | ||||||
|  |      *          required=true, | ||||||
|  |      *          @OA\Schema( | ||||||
|  |      *              type="string", | ||||||
|  |      *              format="string", | ||||||
|  |      *          ), | ||||||
|  |      *      ), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="Returns the TaskStatusobject", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  |      * | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function show(ShowTaskStatusRequest $request, TaskStatus $task_status) | ||||||
|  |     { | ||||||
|  |         return $this->itemResponse($task_status); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @OA\Get( | ||||||
|  |      *      path="/api/v1/task_statuses/{id}/edit", | ||||||
|  |      *      operationId="editTaskStatuss", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Shows an TaskStatusfor editting", | ||||||
|  |      *      description="Displays an TaskStatusby id", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\Parameter( | ||||||
|  |      *          name="id", | ||||||
|  |      *          in="path", | ||||||
|  |      *          description="The TaskStatusHashed ID", | ||||||
|  |      *          example="D2J234DFA", | ||||||
|  |      *          required=true, | ||||||
|  |      *          @OA\Schema( | ||||||
|  |      *              type="string", | ||||||
|  |      *              format="string", | ||||||
|  |      *          ), | ||||||
|  |      *      ), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="Returns the TaskStatus object", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  |      * | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function edit(EditTaskStatusRequest $request, TaskStatus $payment) | ||||||
|  |     { | ||||||
|  |         return $this->itemResponse($payment); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Update the specified resource in storage. | ||||||
|  |      * | ||||||
|  |      * @param      \App\Http\Requests\TaskStatus\UpdateTaskStatusRequest  $request  The request | ||||||
|  |      * @param      \App\Models\TaskStatus                                  $task_status   The payment term | ||||||
|  |      * | ||||||
|  |      * @return \Illuminate\Http\Response | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * @OA\Put( | ||||||
|  |      *      path="/api/v1/task_statuses/{id}", | ||||||
|  |      *      operationId="updateTaskStatus", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Updates a TaskStatus Term", | ||||||
|  |      *      description="Handles the updating of an TaskStatus Termby id", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\Parameter( | ||||||
|  |      *          name="id", | ||||||
|  |      *          in="path", | ||||||
|  |      *          description="The TaskStatusHashed ID", | ||||||
|  |      *          example="D2J234DFA", | ||||||
|  |      *          required=true, | ||||||
|  |      *          @OA\Schema( | ||||||
|  |      *              type="string", | ||||||
|  |      *              format="string", | ||||||
|  |      *          ), | ||||||
|  |      *      ), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="Returns the TaskStatusobject", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  |      * | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function update(UpdateTaskStatusRequest $request, TaskStatus $task_status) | ||||||
|  |     { | ||||||
|  |         $task_status->fill($request->all()); | ||||||
|  |         $task_status->save(); | ||||||
|  | 
 | ||||||
|  |         return $this->itemResponse($task_status->fresh()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Remove the specified resource from storage. | ||||||
|  |      * | ||||||
|  |      * @param      \App\Http\Requests\TaskStatus\DestroyTaskStatusRequest  $request | ||||||
|  |      * @param      \App\Models\TaskStatus                                   $task_status | ||||||
|  |      * | ||||||
|  |      * @return     \Illuminate\Http\Response | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * @OA\Delete( | ||||||
|  |      *      path="/api/v1/task_statuses/{id}", | ||||||
|  |      *      operationId="deleteTaskStatus", | ||||||
|  |      *      tags={"task_statuss"}, | ||||||
|  |      *      summary="Deletes a TaskStatus Term", | ||||||
|  |      *      description="Handles the deletion of an TaskStatus by id", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/include"), | ||||||
|  |      *      @OA\Parameter( | ||||||
|  |      *          name="id", | ||||||
|  |      *          in="path", | ||||||
|  |      *          description="The TaskStatusHashed ID", | ||||||
|  |      *          example="D2J234DFA", | ||||||
|  |      *          required=true, | ||||||
|  |      *          @OA\Schema( | ||||||
|  |      *              type="string", | ||||||
|  |      *              format="string", | ||||||
|  |      *          ), | ||||||
|  |      *      ), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="Returns a HTTP status", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  |      * | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function destroy(DestroyTaskStatusRequest $request, TaskStatus $task_status) | ||||||
|  |     { | ||||||
|  |         $task_status->delete(); | ||||||
|  | 
 | ||||||
|  |         return response()->json([], 200); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Perform bulk actions on the list view. | ||||||
|  |      * | ||||||
|  |      * @return Collection | ||||||
|  |      * | ||||||
|  |      * | ||||||
|  |      * @OA\Post( | ||||||
|  |      *      path="/api/v1/task_statuses/bulk", | ||||||
|  |      *      operationId="bulkTaskStatuss", | ||||||
|  |      *      tags={"task_status"}, | ||||||
|  |      *      summary="Performs bulk actions on an array of task statuses", | ||||||
|  |      *      description="", | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Api-Token"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/X-Requested-With"), | ||||||
|  |      *      @OA\Parameter(ref="#/components/parameters/index"), | ||||||
|  |      *      @OA\RequestBody( | ||||||
|  |      *         description="TaskStatus Ter,s", | ||||||
|  |      *         required=true, | ||||||
|  |      *         @OA\MediaType( | ||||||
|  |      *             mediaType="application/json", | ||||||
|  |      *             @OA\Schema( | ||||||
|  |      *                 type="array", | ||||||
|  |      *                 @OA\Items( | ||||||
|  |      *                     type="integer", | ||||||
|  |      *                     description="Array of hashed IDs to be bulk 'actioned", | ||||||
|  |      *                     example="[0,1,2,3]", | ||||||
|  |      *                 ), | ||||||
|  |      *             ) | ||||||
|  |      *         ) | ||||||
|  |      *     ), | ||||||
|  |      *      @OA\Response( | ||||||
|  |      *          response=200, | ||||||
|  |      *          description="The TaskStatus Terms response", | ||||||
|  |      *          @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), | ||||||
|  |      *          @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/TaskStatus"), | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *          response=422, | ||||||
|  |      *          description="Validation error", | ||||||
|  |      *          @OA\JsonContent(ref="#/components/schemas/ValidationError"), | ||||||
|  | 
 | ||||||
|  |      *       ), | ||||||
|  |      *       @OA\Response( | ||||||
|  |      *           response="default", | ||||||
|  |      *           description="Unexpected Error", | ||||||
|  |      *           @OA\JsonContent(ref="#/components/schemas/Error"), | ||||||
|  |      *       ), | ||||||
|  |      *     ) | ||||||
|  |      */ | ||||||
|  |     public function bulk() | ||||||
|  |     { | ||||||
|  |         $action = request()->input('action'); | ||||||
|  | 
 | ||||||
|  |         $ids = request()->input('ids'); | ||||||
|  | 
 | ||||||
|  |         $task_status = TaskStatus::withTrashed()->company()->find($this->transformKeys($ids)); | ||||||
|  | 
 | ||||||
|  |         $task_status->each(function ($task_status, $key) use ($action) { | ||||||
|  |             if (auth()->user()->can('edit', $task_status)) { | ||||||
|  |                 $this->task_status_repo->{$action}($task_status); | ||||||
|  |             } | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |         return $this->listResponse(TaskStatus::withTrashed()->whereIn('id', $this->transformKeys($ids))); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -84,9 +84,8 @@ class StoreClientRequest extends Request | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); | 
 | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         //is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!!
 |         //is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!!
 | ||||||
|         if (! property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { |         if (! property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) { | ||||||
| @ -108,29 +107,6 @@ class StoreClientRequest extends Request | |||||||
| 
 | 
 | ||||||
|         $input['settings'] = $settings; |         $input['settings'] = $settings; | ||||||
| 
 | 
 | ||||||
|         if (isset($input['contacts'])) { |  | ||||||
|             foreach ($input['contacts'] as $key => $contact) { |  | ||||||
|                 if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { |  | ||||||
|                     unset($input['contacts'][$key]['id']); |  | ||||||
|                 } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { |  | ||||||
|                     $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 //Filter the client contact password - if it is sent with ***** we should ignore it!
 |  | ||||||
|                 if (isset($contact['password'])) { |  | ||||||
|                     if (strlen($contact['password']) == 0) { |  | ||||||
|                         $input['contacts'][$key]['password'] = ''; |  | ||||||
|                     } else { |  | ||||||
|                         $contact['password'] = str_replace('*', '', $contact['password']); |  | ||||||
| 
 |  | ||||||
|                         if (strlen($contact['password']) == 0) { |  | ||||||
|                             unset($input['contacts'][$key]['password']); |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['country_code'])) { |         if (isset($input['country_code'])) { | ||||||
|             $input['country_id'] = $this->getCountryCode($input['country_code']); |             $input['country_id'] = $this->getCountryCode($input['country_code']); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -95,33 +95,7 @@ class UpdateClientRequest extends Request | |||||||
|             $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); |             $input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['contacts'])) { |  | ||||||
|             foreach ($input['contacts'] as $key => $contact) { |  | ||||||
|                 if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { |  | ||||||
|                     unset($input['contacts'][$key]['id']); |  | ||||||
|                 } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { |  | ||||||
|                     $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 //Filter the client contact password - if it is sent with ***** we should ignore it!
 |  | ||||||
|                 if (isset($contact['password'])) { |  | ||||||
|                     if (strlen($contact['password']) == 0) { |  | ||||||
|                         $input['contacts'][$key]['password'] = ''; |  | ||||||
|                     } else { |  | ||||||
|                         $input['contacts'][$key]['password'] = str_replace('*', '', $contact['password']); |  | ||||||
| 
 |  | ||||||
|                         if (strlen($contact['password']) == 0) { |  | ||||||
|                             unset($input['contacts'][$key]['password']); |  | ||||||
|                         } |  | ||||||
| 
 |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('settings', $input)) { |         if (array_key_exists('settings', $input)) { | ||||||
|             $input['settings'] = $this->filterSaveableSettings($input['settings']); |             $input['settings'] = $this->filterSaveableSettings($input['settings']); | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\ClientPortal; | namespace App\Http\Requests\ClientPortal; | ||||||
| 
 | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use Illuminate\Foundation\Http\FormRequest; | ||||||
| 
 | 
 | ||||||
| class CreatePaymentMethodRequest extends FormRequest | class CreatePaymentMethodRequest extends FormRequest | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ namespace App\Http\Requests\ClientPortal\Documents; | |||||||
| 
 | 
 | ||||||
| use App\Models\Document; | use App\Models\Document; | ||||||
| use App\Utils\Traits\MakesHash; | use App\Utils\Traits\MakesHash; | ||||||
|  | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use Illuminate\Foundation\Http\FormRequest; | ||||||
| 
 | 
 | ||||||
| class ShowDocumentRequest extends FormRequest | class ShowDocumentRequest extends FormRequest | ||||||
|  | |||||||
| @ -1,4 +1,13 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,11 +1,21 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
| use App\Models\Credit; | use App\Models\Credit; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class CreateCreditRequest extends FormRequest | class CreateCreditRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,10 +1,20 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class DestroyCreditRequest extends FormRequest | class DestroyCreditRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,10 +1,20 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class EditCreditRequest extends FormRequest | class EditCreditRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,10 +1,20 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class ShowCreditRequest extends FormRequest | class ShowCreditRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,4 +1,13 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
| @ -6,9 +15,9 @@ use App\Http\ValidationRules\Credit\UniqueCreditNumberRule; | |||||||
| use App\Models\Credit; | use App\Models\Credit; | ||||||
| use App\Utils\Traits\CleanLineItems; | use App\Utils\Traits\CleanLineItems; | ||||||
| use App\Utils\Traits\MakesHash; | use App\Utils\Traits\MakesHash; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class StoreCreditRequest extends FormRequest | class StoreCreditRequest extends Request | ||||||
| { | { | ||||||
|     use MakesHash; |     use MakesHash; | ||||||
|     use CleanLineItems; |     use CleanLineItems; | ||||||
| @ -57,37 +66,7 @@ class StoreCreditRequest extends FormRequest | |||||||
|             $input['design_id'] = $this->decodePrimaryKey($input['design_id']); |             $input['design_id'] = $this->decodePrimaryKey($input['design_id']); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['client_id'] = $this->decodePrimaryKey($input['client_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |  | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['client_contacts'])) { |  | ||||||
|             foreach ($input['client_contacts'] as $key => $contact) { |  | ||||||
|                 if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { |  | ||||||
|                     unset($input['client_contacts'][$key]); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['invitations'])) { |  | ||||||
|             foreach ($input['invitations'] as $key => $value) { |  | ||||||
|                 if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { |  | ||||||
|                     unset($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { |  | ||||||
|                     $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (is_string($input['invitations'][$key]['client_contact_id'])) { |  | ||||||
|                     $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; |         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; | ||||||
|         //$input['line_items'] = json_encode($input['line_items']);
 |         //$input['line_items'] = json_encode($input['line_items']);
 | ||||||
|  | |||||||
| @ -1,13 +1,23 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Credit; | namespace App\Http\Requests\Credit; | ||||||
| 
 | 
 | ||||||
| use App\Utils\Traits\ChecksEntityStatus; | use App\Utils\Traits\ChecksEntityStatus; | ||||||
| use App\Utils\Traits\CleanLineItems; | use App\Utils\Traits\CleanLineItems; | ||||||
| use App\Utils\Traits\MakesHash; | use App\Utils\Traits\MakesHash; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class UpdateCreditRequest extends FormRequest | class UpdateCreditRequest extends Request | ||||||
| { | { | ||||||
|     use MakesHash; |     use MakesHash; | ||||||
|     use CleanLineItems; |     use CleanLineItems; | ||||||
| @ -53,33 +63,7 @@ class UpdateCreditRequest extends FormRequest | |||||||
|     { |     { | ||||||
|         $input = $this->all(); |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['design_id'] = $this->decodePrimaryKey($input['design_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['client_id'])) { |  | ||||||
|             $input['client_id'] = $this->decodePrimaryKey($input['client_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |  | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['invitations'])) { |  | ||||||
|             foreach ($input['invitations'] as $key => $value) { |  | ||||||
|                 if (is_numeric($input['invitations'][$key]['id'])) { |  | ||||||
|                     unset($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (is_string($input['invitations'][$key]['id'])) { |  | ||||||
|                     $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (is_string($input['invitations'][$key]['client_contact_id'])) { |  | ||||||
|                     $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; |         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -12,9 +12,9 @@ | |||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Document; | namespace App\Http\Requests\Document; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class DownloadMultipleDocumentsRequest extends FormRequest | class DownloadMultipleDocumentsRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,12 +1,22 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Expense; | namespace App\Http\Requests\Expense; | ||||||
| 
 | 
 | ||||||
| use App\Models\Expense; | use App\Models\Expense; | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class BulkExpenseRequest extends FormRequest | class BulkExpenseRequest extends Request | ||||||
| { | { | ||||||
|     use BulkOptions; |     use BulkOptions; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ namespace App\Http\Requests\Expense; | |||||||
| use App\DataMapper\ExpenseSettings; | use App\DataMapper\ExpenseSettings; | ||||||
| use App\Http\Requests\Request; | use App\Http\Requests\Request; | ||||||
| use App\Http\ValidationRules\Expense\UniqueExpenseNumberRule; | use App\Http\ValidationRules\Expense\UniqueExpenseNumberRule; | ||||||
|  | use App\Http\ValidationRules\User\RelatedUserRule; | ||||||
| use App\Http\ValidationRules\ValidExpenseGroupSettingsRule; | use App\Http\ValidationRules\ValidExpenseGroupSettingsRule; | ||||||
| use App\Models\Expense; | use App\Models\Expense; | ||||||
| use App\Utils\Traits\MakesHash; | use App\Utils\Traits\MakesHash; | ||||||
| @ -36,23 +37,24 @@ class StoreExpenseRequest extends Request | |||||||
| 
 | 
 | ||||||
|     public function rules() |     public function rules() | ||||||
|     { |     { | ||||||
| 
 |         $rules = []; | ||||||
| 
 | 
 | ||||||
|         $rules['id_number'] = 'unique:expenses,id_number,'.$this->id.',id,company_id,'.$this->company_id; |         $rules['id_number'] = 'unique:expenses,id_number,'.$this->id.',id,company_id,'.$this->company_id; | ||||||
| 
 |  | ||||||
|         $rules['contacts.*.email'] = 'nullable|distinct'; |         $rules['contacts.*.email'] = 'nullable|distinct'; | ||||||
| 
 |  | ||||||
|         $rules['number'] = new UniqueExpenseNumberRule($this->all()); |         $rules['number'] = new UniqueExpenseNumberRule($this->all()); | ||||||
|  |         $rules['client_id'] = 'bail|sometimes|exists:clients,id,company_id,'.auth()->user()->company()->id; | ||||||
| 
 | 
 | ||||||
|         return $rules; | 
 | ||||||
|  |         return $this->globalRules($rules); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     protected function prepareForValidation() |     protected function prepareForValidation() | ||||||
|     { |     { | ||||||
|         // $input = $this->all();
 |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|  |         $input = $this->decodePrimaryKeys($input); | ||||||
| 
 | 
 | ||||||
|         // $this->replace($input);
 |         $this->replace($input); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function messages() |     public function messages() | ||||||
|  | |||||||
| @ -1,12 +1,22 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\ExpenseCategory; | namespace App\Http\Requests\ExpenseCategory; | ||||||
| 
 | 
 | ||||||
| use App\Models\ExpenseCategory; | use App\Models\ExpenseCategory; | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class BulkExpenseCategoryRequest extends FormRequest | class BulkExpenseCategoryRequest extends Request | ||||||
| { | { | ||||||
|     use BulkOptions; |     use BulkOptions; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -63,45 +63,7 @@ class StoreInvoiceRequest extends Request | |||||||
|     { |     { | ||||||
|         $input = $this->all(); |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['design_id'] = $this->decodePrimaryKey($input['design_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { |  | ||||||
|             $input['client_id'] = $this->decodePrimaryKey($input['client_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (array_key_exists('project_id', $input) && is_string($input['project_id'])) { |  | ||||||
|             $input['project_id'] = $this->decodePrimaryKey($input['project_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |  | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['client_contacts'])) { |  | ||||||
|             foreach ($input['client_contacts'] as $key => $contact) { |  | ||||||
|                 if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { |  | ||||||
|                     unset($input['client_contacts'][$key]); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['invitations'])) { |  | ||||||
|             foreach ($input['invitations'] as $key => $value) { |  | ||||||
|                 if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { |  | ||||||
|                     unset($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { |  | ||||||
|                     $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (is_string($input['invitations'][$key]['client_contact_id'])) { |  | ||||||
|                     $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; |         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; | ||||||
|         //$input['line_items'] = json_encode($input['line_items']);
 |         //$input['line_items'] = json_encode($input['line_items']);
 | ||||||
|  | |||||||
| @ -62,35 +62,10 @@ class UpdateInvoiceRequest extends Request | |||||||
|     { |     { | ||||||
|         $input = $this->all(); |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['design_id'] = $this->decodePrimaryKey($input['design_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['client_id'])) { |  | ||||||
|             $input['client_id'] = $this->decodePrimaryKey($input['client_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |  | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if (isset($input['invitations'])) { |  | ||||||
|             foreach ($input['invitations'] as $key => $value) { |  | ||||||
|                 if (array_key_exists('id', $input['invitations'][$key]) && is_numeric($input['invitations'][$key]['id'])) { |  | ||||||
|                     unset($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (array_key_exists('id', $input['invitations'][$key]) && is_string($input['invitations'][$key]['id'])) { |  | ||||||
|                     $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (is_string($input['invitations'][$key]['client_contact_id'])) { |  | ||||||
|                     $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         $input['id'] = $this->invoice->id; |         $input['id'] = $this->invoice->id; | ||||||
|  |          | ||||||
|         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; |         $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; | ||||||
| 
 | 
 | ||||||
|         $this->replace($input); |         $this->replace($input); | ||||||
|  | |||||||
| @ -1,10 +1,20 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Migration; | namespace App\Http\Requests\Migration; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class UploadMigrationFileRequest extends FormRequest | class UploadMigrationFileRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -38,7 +38,7 @@ class StorePaymentRequest extends Request | |||||||
|     { |     { | ||||||
|         $input = $this->all(); |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|         //info(print_r($input,1));
 |        // info(print_r($input,1));
 | ||||||
| 
 | 
 | ||||||
|         $invoices_total = 0; |         $invoices_total = 0; | ||||||
|         $credits_total = 0; |         $credits_total = 0; | ||||||
| @ -77,7 +77,7 @@ class StorePaymentRequest extends Request | |||||||
| 
 | 
 | ||||||
|         if (! isset($input['amount']) || $input['amount'] == 0) { |         if (! isset($input['amount']) || $input['amount'] == 0) { | ||||||
|             //$input['amount'] = $invoices_total - $credits_total;
 |             //$input['amount'] = $invoices_total - $credits_total;
 | ||||||
|             $input['amount'] = $invoices_total; |             $input['amount'] = $invoices_total - $credits_total; //todo the payment amount is always less the credit amount applied
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $input['is_manual'] = true; |         $input['is_manual'] = true; | ||||||
| @ -94,17 +94,15 @@ class StorePaymentRequest extends Request | |||||||
|         $rules = [ |         $rules = [ | ||||||
|             'amount' => 'numeric|required', |             'amount' => 'numeric|required', | ||||||
|             'amount' => [new PaymentAmountsBalanceRule(), new ValidCreditsPresentRule()], |             'amount' => [new PaymentAmountsBalanceRule(), new ValidCreditsPresentRule()], | ||||||
|             //'date' => 'required',
 |  | ||||||
|             'client_id' => 'bail|required|exists:clients,id', |             'client_id' => 'bail|required|exists:clients,id', | ||||||
|             'invoices.*.invoice_id' => 'required|distinct|exists:invoices,id', |             'invoices.*.invoice_id' => 'bail|required|distinct|exists:invoices,id', | ||||||
|             'invoices.*.invoice_id' => new ValidInvoicesRules($this->all()), |             'invoices.*.invoice_id' => new ValidInvoicesRules($this->all()), | ||||||
|             'invoices.*.amount' => 'required', |             'invoices.*.amount' => 'required', | ||||||
|             'credits.*.credit_id' => 'required|exists:credits,id', |             'credits.*.credit_id' => 'bail|required|exists:credits,id', | ||||||
|             'credits.*.credit_id' => new ValidCreditsRules($this->all()), |             'credits.*.credit_id' => new ValidCreditsRules($this->all()), | ||||||
|             'credits.*.amount' => 'required', |             'credits.*.amount' => 'required', | ||||||
|             'invoices' => new ValidPayableInvoicesRule(), |             'invoices' => new ValidPayableInvoicesRule(), | ||||||
|             'number' => 'nullable|unique:payments,number,'.$this->id.',id,company_id,'.$this->company_id, |             'number' => 'bail|nullable|unique:payments,number,'.$this->id.',id,company_id,'.$this->company_id, | ||||||
|             //'number' => 'nullable',
 |  | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         if ($this->input('documents') && is_array($this->input('documents'))) { |         if ($this->input('documents') && is_array($this->input('documents'))) { | ||||||
|  | |||||||
| @ -34,12 +34,13 @@ class UpdatePaymentRequest extends Request | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function rules() |     public function rules() | ||||||
|     {//min:1 removed, 'required'
 |     { | ||||||
|         $rules = [ |          | ||||||
|  |        $rules = [ | ||||||
|  |             'number' => 'nullable|unique:payments,number,'.$this->id.',id,company_id,'.$this->payment->company_id, | ||||||
|             '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', | ||||||
|             'number' => 'nullable|unique:payments,number,'.$this->id.',id,company_id,'.$this->company_id, |  | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         if ($this->input('documents') && is_array($this->input('documents'))) { |         if ($this->input('documents') && is_array($this->input('documents'))) { | ||||||
| @ -59,9 +60,7 @@ class UpdatePaymentRequest extends Request | |||||||
|     { |     { | ||||||
|         $input = $this->all(); |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         if (isset($input['client_id'])) { |         if (isset($input['client_id'])) { | ||||||
|             unset($input['client_id']); |             unset($input['client_id']); | ||||||
| @ -71,18 +70,6 @@ class UpdatePaymentRequest extends Request | |||||||
|             unset($input['amount']); |             unset($input['amount']); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // if (isset($input['type_id'])) {
 |  | ||||||
|         //     unset($input['type_id']);
 |  | ||||||
|         // }
 |  | ||||||
| 
 |  | ||||||
|         // if (isset($input['date'])) {
 |  | ||||||
|         //     unset($input['date']);
 |  | ||||||
|         // }
 |  | ||||||
| 
 |  | ||||||
|         // if (isset($input['transaction_reference'])) {
 |  | ||||||
|         //     unset($input['transaction_reference']);
 |  | ||||||
|         // }
 |  | ||||||
| 
 |  | ||||||
|         if (isset($input['number'])) { |         if (isset($input['number'])) { | ||||||
|             unset($input['number']); |             unset($input['number']); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -1,12 +1,22 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Payments; | namespace App\Http\Requests\Payments; | ||||||
| 
 | 
 | ||||||
| use App\Models\Company; | use App\Models\Company; | ||||||
| use App\Models\CompanyGateway; | use App\Models\CompanyGateway; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class PaymentWebhookRequest extends FormRequest | class PaymentWebhookRequest extends Request | ||||||
| { | { | ||||||
|     public function authorize() |     public function authorize() | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -12,6 +12,7 @@ | |||||||
| namespace App\Http\Requests\Project; | namespace App\Http\Requests\Project; | ||||||
| 
 | 
 | ||||||
| use App\Http\Requests\Request; | use App\Http\Requests\Request; | ||||||
|  | use App\Models\Client; | ||||||
| use App\Models\Project; | use App\Models\Project; | ||||||
| use App\Utils\Traits\MakesHash; | use App\Utils\Traits\MakesHash; | ||||||
| 
 | 
 | ||||||
| @ -51,4 +52,9 @@ class StoreProjectRequest extends Request | |||||||
|          |          | ||||||
|         $this->replace($input); |         $this->replace($input); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public function getClient($client_id) | ||||||
|  |     { | ||||||
|  |         return Client::find($client_id); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -36,6 +36,7 @@ class UpdateRecurringInvoiceRequest extends Request | |||||||
| 
 | 
 | ||||||
|     public function rules() |     public function rules() | ||||||
|     { |     { | ||||||
|  |          | ||||||
|         $rules = []; |         $rules = []; | ||||||
| 
 | 
 | ||||||
|         if ($this->input('documents') && is_array($this->input('documents'))) { |         if ($this->input('documents') && is_array($this->input('documents'))) { | ||||||
| @ -49,7 +50,7 @@ class UpdateRecurringInvoiceRequest extends Request | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if ($this->input('number')) { |         if ($this->input('number')) { | ||||||
|             $rules['number'] = 'unique:recurring_invoices,number,'.$this->id.',id,company_id,'.$this->recurring_invoice->company_id; |             $rules['number'] = 'unique:recurring_invoices,number,'.$this->recurring_invoice->id.',id,company_id,'.$this->recurring_invoice->company_id; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return $rules; |         return $rules; | ||||||
|  | |||||||
| @ -11,10 +11,14 @@ | |||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests; | namespace App\Http\Requests; | ||||||
| 
 | 
 | ||||||
|  | use App\Http\ValidationRules\User\RelatedUserRule; | ||||||
|  | use App\Utils\Traits\MakesHash; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use Illuminate\Foundation\Http\FormRequest; | ||||||
| 
 | 
 | ||||||
| class Request extends FormRequest | class Request extends FormRequest | ||||||
| { | { | ||||||
|  | 	use MakesHash; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the validation rules that apply to the request. |      * Get the validation rules that apply to the request. | ||||||
|      * |      * | ||||||
| @ -24,4 +28,124 @@ class Request extends FormRequest | |||||||
|     { |     { | ||||||
|         return []; |         return []; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     public function globalRules($rules) | ||||||
|  |     { | ||||||
|  |     	$rules = []; | ||||||
|  | 
 | ||||||
|  |     	foreach($this->all() as $key => $value) | ||||||
|  |     	{ | ||||||
|  |     		if(method_exists($this, $key)) | ||||||
|  |     			$rules = $this->{$key}($rules);  | ||||||
|  |     	} | ||||||
|  | 
 | ||||||
|  |     	return $rules; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private function assigned_user_id($rules) | ||||||
|  |     {	 | ||||||
|  |     	$rules['assigned_user_id'] = [ | ||||||
|  |             'bail' ,  | ||||||
|  |             'sometimes',  | ||||||
|  |             'nullable', | ||||||
|  |                 new RelatedUserRule($this->all()) | ||||||
|  |             ]; | ||||||
|  | 
 | ||||||
|  |         return $rules; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private function invoice_id($rules) | ||||||
|  |     { | ||||||
|  |         $rules['invoice_id'] = 'bail|nullable|sometimes|exists:invoices,id,company_id,'.auth()->user()->company()->id.',client_id,'.$this['client_id']; | ||||||
|  | 
 | ||||||
|  |         return $rules; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private function vendor_id($rules) | ||||||
|  |     { | ||||||
|  |         $rules['vendor_id'] = 'bail|sometimes|exists:vendors,id,company_id,'.auth()->user()->company()->id; | ||||||
|  | 
 | ||||||
|  |         return $rules; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public function decodePrimaryKeys($input) | ||||||
|  |     { | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { | ||||||
|  |             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('user_id', $input) && is_string($input['user_id'])) { | ||||||
|  |             $input['user_id'] = $this->decodePrimaryKey($input['user_id']); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('vendor_id', $input) && is_string($input['vendor_id'])) { | ||||||
|  |             $input['vendor_id'] = $this->decodePrimaryKey($input['vendor_id']); | ||||||
|  |         }         | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('client_id', $input) && is_string($input['client_id'])) { | ||||||
|  |             $input['client_id'] = $this->decodePrimaryKey($input['client_id']); | ||||||
|  |         }    | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('invoice_id', $input) && is_string($input['invoice_id'])) { | ||||||
|  |             $input['invoice_id'] = $this->decodePrimaryKey($input['invoice_id']); | ||||||
|  |         }   | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('design_id', $input) && is_string($input['design_id'])) { | ||||||
|  |             $input['design_id'] = $this->decodePrimaryKey($input['design_id']); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (array_key_exists('project_id', $input) && is_string($input['project_id'])) { | ||||||
|  |             $input['project_id'] = $this->decodePrimaryKey($input['project_id']); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (isset($input['client_contacts'])) { | ||||||
|  |             foreach ($input['client_contacts'] as $key => $contact) { | ||||||
|  |                 if (! array_key_exists('send_email', $contact) || ! array_key_exists('id', $contact)) { | ||||||
|  |                     unset($input['client_contacts'][$key]); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (isset($input['invitations'])) { | ||||||
|  |             foreach ($input['invitations'] as $key => $value) { | ||||||
|  |                 if (isset($input['invitations'][$key]['id']) && is_numeric($input['invitations'][$key]['id'])) { | ||||||
|  |                     unset($input['invitations'][$key]['id']); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 if (isset($input['invitations'][$key]['id']) && is_string($input['invitations'][$key]['id'])) { | ||||||
|  |                     $input['invitations'][$key]['id'] = $this->decodePrimaryKey($input['invitations'][$key]['id']); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 if (is_string($input['invitations'][$key]['client_contact_id'])) { | ||||||
|  |                     $input['invitations'][$key]['client_contact_id'] = $this->decodePrimaryKey($input['invitations'][$key]['client_contact_id']); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (isset($input['contacts'])) { | ||||||
|  |             foreach ($input['contacts'] as $key => $contact) { | ||||||
|  |                 if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { | ||||||
|  |                     unset($input['contacts'][$key]['id']); | ||||||
|  |                 } elseif (array_key_exists('id', $contact) && is_string($contact['id'])) { | ||||||
|  |                     $input['contacts'][$key]['id'] = $this->decodePrimaryKey($contact['id']); | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 //Filter the client contact password - if it is sent with ***** we should ignore it!
 | ||||||
|  |                 if (isset($contact['password'])) { | ||||||
|  |                     if (strlen($contact['password']) == 0) { | ||||||
|  |                         $input['contacts'][$key]['password'] = ''; | ||||||
|  |                     } else { | ||||||
|  |                         $contact['password'] = str_replace('*', '', $contact['password']); | ||||||
|  | 
 | ||||||
|  |                         if (strlen($contact['password']) == 0) { | ||||||
|  |                             unset($input['contacts'][$key]['password']); | ||||||
|  |                         } | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |     	return $input; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,10 +1,20 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Setup; | namespace App\Http\Requests\Setup; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class CheckDatabaseRequest extends FormRequest | class CheckDatabaseRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,10 +1,20 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Setup; | namespace App\Http\Requests\Setup; | ||||||
| 
 | 
 | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class CheckMailRequest extends FormRequest | class CheckMailRequest extends Request | ||||||
| { | { | ||||||
|     /** |     /** | ||||||
|      * Determine if the user is authorized to make this request. |      * Determine if the user is authorized to make this request. | ||||||
|  | |||||||
| @ -1,12 +1,22 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Task; | namespace App\Http\Requests\Task; | ||||||
| 
 | 
 | ||||||
| use App\Models\Task; | use App\Models\Task; | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class BulkTaskRequest extends FormRequest | class BulkTaskRequest extends Request | ||||||
| { | { | ||||||
|     use BulkOptions; |     use BulkOptions; | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								app/Http/Requests/TaskStatus/ActionTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Http/Requests/TaskStatus/ActionTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Models\Payment; | ||||||
|  | 
 | ||||||
|  | class ActionTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() : bool | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										28
									
								
								app/Http/Requests/TaskStatus/CreateTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Http/Requests/TaskStatus/CreateTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | 
 | ||||||
|  | class CreateTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() : bool | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										28
									
								
								app/Http/Requests/TaskStatus/DestroyTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Http/Requests/TaskStatus/DestroyTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | 
 | ||||||
|  | class DestroyTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() : bool | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										44
									
								
								app/Http/Requests/TaskStatus/EditTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								app/Http/Requests/TaskStatus/EditTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | 
 | ||||||
|  | class EditTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public function rules() | ||||||
|  |     { | ||||||
|  |         $rules = []; | ||||||
|  | 
 | ||||||
|  |         return $rules; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     protected function prepareForValidation() | ||||||
|  |     { | ||||||
|  |         $input = $this->all(); | ||||||
|  | 
 | ||||||
|  |         //$input['id'] = $this->encodePrimaryKey($input['id']);
 | ||||||
|  | 
 | ||||||
|  |         $this->replace($input); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										28
									
								
								app/Http/Requests/TaskStatus/ShowTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Http/Requests/TaskStatus/ShowTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | 
 | ||||||
|  | class ShowTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() : bool | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										47
									
								
								app/Http/Requests/TaskStatus/StoreTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								app/Http/Requests/TaskStatus/StoreTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,47 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | use App\Utils\Traits\MakesHash; | ||||||
|  | 
 | ||||||
|  | class StoreTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     use MakesHash; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() : bool | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     protected function prepareForValidation() | ||||||
|  |     { | ||||||
|  |         $input = $this->all(); | ||||||
|  | 
 | ||||||
|  |         $this->replace($input); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public function rules() | ||||||
|  |     { | ||||||
|  |         $rules = []; | ||||||
|  | 
 | ||||||
|  |         $rules['name'] ='required|unique:task_statuses,name,null,null,company_id,'.auth()->user()->companyId(); | ||||||
|  | 
 | ||||||
|  |         return $rules; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										42
									
								
								app/Http/Requests/TaskStatus/UpdateTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								app/Http/Requests/TaskStatus/UpdateTaskStatusRequest.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\Requests\TaskStatus; | ||||||
|  | 
 | ||||||
|  | use App\Http\Requests\Request; | ||||||
|  | use App\Utils\Traits\MakesHash; | ||||||
|  | use Illuminate\Validation\Rule; | ||||||
|  | 
 | ||||||
|  | class UpdateTaskStatusRequest extends Request | ||||||
|  | { | ||||||
|  |     use MakesHash; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Determine if the user is authorized to make this request. | ||||||
|  |      * | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function authorize() : bool | ||||||
|  |     { | ||||||
|  |         return auth()->user()->isAdmin(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public function rules() | ||||||
|  |     { | ||||||
|  |         $rules = []; | ||||||
|  | 
 | ||||||
|  |         if ($this->input('name'))  | ||||||
|  |            $rules['name'] = 'unique:task_statuses,name,'.$this->id.',id,company_id,'.$this->task_status->company_id; | ||||||
|  | 
 | ||||||
|  |        return $rules; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -1,11 +1,21 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Token; | namespace App\Http\Requests\Token; | ||||||
| 
 | 
 | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class BulkTokenRequest extends FormRequest | class BulkTokenRequest extends Request | ||||||
| { | { | ||||||
|     use BulkOptions; |     use BulkOptions; | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								app/Http/Requests/Vendor/BulkVendorRequest.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								app/Http/Requests/Vendor/BulkVendorRequest.php
									
									
									
									
										vendored
									
									
								
							| @ -1,12 +1,22 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Vendor; | namespace App\Http\Requests\Vendor; | ||||||
| 
 | 
 | ||||||
| use App\Models\Vendor; | use App\Models\Vendor; | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class BulkVendorRequest extends FormRequest | class BulkVendorRequest extends Request | ||||||
| { | { | ||||||
|     use BulkOptions; |     use BulkOptions; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -50,9 +50,7 @@ class StoreVendorRequest extends Request | |||||||
|     { |     { | ||||||
|         $input = $this->all(); |         $input = $this->all(); | ||||||
| 
 | 
 | ||||||
|         if (array_key_exists('assigned_user_id', $input) && is_string($input['assigned_user_id'])) { |         $input = $this->decodePrimaryKeys($input); | ||||||
|             $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); |  | ||||||
|         } |  | ||||||
|          |          | ||||||
|         $this->replace($input); |         $this->replace($input); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,12 +1,22 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| namespace App\Http\Requests\Webhook; | namespace App\Http\Requests\Webhook; | ||||||
| 
 | 
 | ||||||
| use App\Models\Vendor; | use App\Models\Vendor; | ||||||
| use App\Utils\Traits\BulkOptions; | use App\Utils\Traits\BulkOptions; | ||||||
| use Illuminate\Foundation\Http\FormRequest; | use App\Http\Requests\Request; | ||||||
| 
 | 
 | ||||||
| class BulkWebhookRequest extends FormRequest | class BulkWebhookRequest extends Request | ||||||
| { | { | ||||||
|     use BulkOptions; |     use BulkOptions; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -73,6 +73,9 @@ class PaymentAmountsBalanceRule implements Rule | |||||||
|             return true; |             return true; | ||||||
|         } // if no invoices are present, then this is an unapplied payment, let this pass validation!
 |         } // if no invoices are present, then this is an unapplied payment, let this pass validation!
 | ||||||
| 
 | 
 | ||||||
|  | // info("payment amounts = {$payment_amounts}");
 | ||||||
|  | // info("invoice amounts = {$invoice_amounts}");
 | ||||||
|  | 
 | ||||||
|         return  $payment_amounts >= $invoice_amounts; |         return  $payment_amounts >= $invoice_amounts; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										58
									
								
								app/Http/ValidationRules/User/RelatedUserRule.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								app/Http/ValidationRules/User/RelatedUserRule.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,58 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Http\ValidationRules\User; | ||||||
|  | 
 | ||||||
|  | use App\Libraries\MultiDB; | ||||||
|  | use App\Models\User; | ||||||
|  | use Illuminate\Contracts\Validation\Rule; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Class RelatedUserRule. | ||||||
|  |  */ | ||||||
|  | class RelatedUserRule implements Rule | ||||||
|  | { | ||||||
|  |     public $input; | ||||||
|  | 
 | ||||||
|  |     public function __construct($input) | ||||||
|  |     { | ||||||
|  |         $this->input = $input; | ||||||
|  |     } | ||||||
|  |     /** | ||||||
|  |      * @param string $attribute | ||||||
|  |      * @param mixed $value | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function passes($attribute, $value) | ||||||
|  |     { | ||||||
|  |         return $this->checkUserIsRelated($value); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @return string | ||||||
|  |      */ | ||||||
|  |     public function message() | ||||||
|  |     { | ||||||
|  |         return 'User not associated with this account'; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @param $email | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     private function checkUserIsRelated($user_id) : bool | ||||||
|  |     { | ||||||
|  |         return User::query() | ||||||
|  |                     ->where('id', $user_id) | ||||||
|  |                     ->where('account_id', auth()->user()->company()->account_id) | ||||||
|  |                     ->exists(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -15,6 +15,7 @@ use App\DataMapper\Analytics\AccountCreated as AnalyticsAccountCreated; | |||||||
| use App\Events\Account\AccountCreated; | use App\Events\Account\AccountCreated; | ||||||
| use App\Jobs\Company\CreateCompany; | use App\Jobs\Company\CreateCompany; | ||||||
| use App\Jobs\Company\CreateCompanyPaymentTerms; | use App\Jobs\Company\CreateCompanyPaymentTerms; | ||||||
|  | use App\Jobs\Company\CreateCompanyTaskStatuses; | ||||||
| use App\Jobs\Company\CreateCompanyToken; | use App\Jobs\Company\CreateCompanyToken; | ||||||
| use App\Jobs\User\CreateUser; | use App\Jobs\User\CreateUser; | ||||||
| use App\Models\Account; | use App\Models\Account; | ||||||
| @ -74,6 +75,7 @@ class CreateAccount | |||||||
|         $spaa9f78 = CreateUser::dispatchNow($this->request, $sp794f3f, $sp035a66, true); |         $spaa9f78 = CreateUser::dispatchNow($this->request, $sp794f3f, $sp035a66, true); | ||||||
| 
 | 
 | ||||||
|         CreateCompanyPaymentTerms::dispatchNow($sp035a66, $spaa9f78); |         CreateCompanyPaymentTerms::dispatchNow($sp035a66, $spaa9f78); | ||||||
|  |         CreateCompanyTaskStatuses::dispatchNow($sp035a66, $spaa9f78); | ||||||
| 
 | 
 | ||||||
|         if ($spaa9f78) { |         if ($spaa9f78) { | ||||||
|             auth()->login($spaa9f78, false); |             auth()->login($spaa9f78, false); | ||||||
|  | |||||||
							
								
								
									
										61
									
								
								app/Jobs/Company/CreateCompanyTaskStatuses.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								app/Jobs/Company/CreateCompanyTaskStatuses.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Jobs\Company; | ||||||
|  | 
 | ||||||
|  | use App\DataMapper\CompanySettings; | ||||||
|  | use App\Events\UserSignedUp; | ||||||
|  | use App\Models\Company; | ||||||
|  | use App\Models\PaymentTerm; | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | use App\Utils\Traits\MakesHash; | ||||||
|  | use Illuminate\Foundation\Bus\Dispatchable; | ||||||
|  | use Illuminate\Http\Request; | ||||||
|  | 
 | ||||||
|  | class CreateCompanyTaskStatuses | ||||||
|  | { | ||||||
|  |     use MakesHash; | ||||||
|  |     use Dispatchable; | ||||||
|  | 
 | ||||||
|  |     protected $company; | ||||||
|  | 
 | ||||||
|  |     protected $user; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Create a new job instance. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function __construct($company, $user) | ||||||
|  |     { | ||||||
|  |         $this->company = $company; | ||||||
|  | 
 | ||||||
|  |         $this->user = $user; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Execute the job. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function handle() | ||||||
|  |     { | ||||||
|  |         $task_statuses = [ | ||||||
|  |             ['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], | ||||||
|  |             ['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], | ||||||
|  |             ['name' => ctrans('texts.in_progress'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], | ||||||
|  |             ['name' => ctrans('texts.done'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now()], | ||||||
|  |              | ||||||
|  |         ]; | ||||||
|  | 
 | ||||||
|  |         TaskStatus::insert($task_statuses); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -54,7 +54,7 @@ class RecurringInvoicesCron | |||||||
| 
 | 
 | ||||||
|                 info("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date); |                 info("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date); | ||||||
| 
 | 
 | ||||||
|                 SendRecurring::dispatch($recurring_invoice, $recurring_invoice->company->db); |                 SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db); | ||||||
| 
 | 
 | ||||||
|             }); |             }); | ||||||
| 
 | 
 | ||||||
| @ -74,7 +74,7 @@ class RecurringInvoicesCron | |||||||
| 
 | 
 | ||||||
|                     info("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date); |                     info("Current date = " . now()->format("Y-m-d") . " Recurring date = " .$recurring_invoice->next_send_date); | ||||||
| 
 | 
 | ||||||
|                     SendRecurring::dispatch($recurring_invoice, $recurring_invoice->company->db); |                     SendRecurring::dispatchNow($recurring_invoice, $recurring_invoice->company->db); | ||||||
|      |      | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
|  | |||||||
| @ -109,6 +109,8 @@ class CreateInvoicePdf implements ShouldQueue | |||||||
|             ->design($template) |             ->design($template) | ||||||
|             ->build(); |             ->build(); | ||||||
| 
 | 
 | ||||||
|  |         info($maker->getCompiledHTML()); | ||||||
|  | 
 | ||||||
|         //todo - move this to the client creation stage so we don't keep hitting this unnecessarily
 |         //todo - move this to the client creation stage so we don't keep hitting this unnecessarily
 | ||||||
|         Storage::makeDirectory($path, 0775); |         Storage::makeDirectory($path, 0775); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -95,9 +95,9 @@ class SendRecurring implements ShouldQueue | |||||||
|         if ($this->recurring_invoice->remaining_cycles == 0)  |         if ($this->recurring_invoice->remaining_cycles == 0)  | ||||||
|             $this->recurring_invoice->setCompleted(); |             $this->recurring_invoice->setCompleted(); | ||||||
| 
 | 
 | ||||||
|         info($this->recurring_invoice->next_send_date); |         info("next send date = " . $this->recurring_invoice->next_send_date); | ||||||
|         info($this->recurring_invoice->remaining_cycles); |         info("remaining cycles = " . $this->recurring_invoice->remaining_cycles); | ||||||
|         info($this->recurring_invoice->last_sent_date); |         info("last send date = " . $this->recurring_invoice->last_sent_date); | ||||||
| 
 | 
 | ||||||
|         $this->recurring_invoice->save(); |         $this->recurring_invoice->save(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -93,6 +93,7 @@ class UserEmailChanged extends BaseMailerJob implements ShouldQueue | |||||||
|             'signature' => $this->company->owner()->signature, |             'signature' => $this->company->owner()->signature, | ||||||
|             'logo' => $this->company->present()->logo(), |             'logo' => $this->company->present()->logo(), | ||||||
|             'settings' => $this->settings, |             'settings' => $this->settings, | ||||||
|  |             'whitelabel' => $this->company->account->isPaid() ? true : false, | ||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -46,6 +46,10 @@ class InvoiceEmailedNotification implements ShouldQueue | |||||||
| 
 | 
 | ||||||
|         $first_notification_sent = true; |         $first_notification_sent = true; | ||||||
| 
 | 
 | ||||||
|  |         $invoice = $event->invitation->invoice; | ||||||
|  |         $invoice->last_sent_date = now(); | ||||||
|  |         $invoice->save(); | ||||||
|  | 
 | ||||||
|         foreach ($event->invitation->company->company_users as $company_user) { |         foreach ($event->invitation->company->company_users as $company_user) { | ||||||
|             $user = $company_user->user; |             $user = $company_user->user; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -90,6 +90,7 @@ class EntityPaidObject | |||||||
|             'signature' => $settings->email_signature, |             'signature' => $settings->email_signature, | ||||||
|             'logo' => $this->company->present()->logo(), |             'logo' => $this->company->present()->logo(), | ||||||
|             'settings' => $settings, |             'settings' => $settings, | ||||||
|  |             'whitelabel' => $this->company->account->isPaid() ? true : false, | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         return $data; |         return $data; | ||||||
|  | |||||||
| @ -85,7 +85,7 @@ class EntitySentObject | |||||||
|             'signature' => $settings->email_signature, |             'signature' => $settings->email_signature, | ||||||
|             'logo' => $this->company->present()->logo(), |             'logo' => $this->company->present()->logo(), | ||||||
|             'settings' => $settings, |             'settings' => $settings, | ||||||
| 
 |             'whitelabel' => $this->company->account->isPaid() ? true : false, | ||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -85,7 +85,7 @@ class EntityViewedObject | |||||||
|             'signature' => $settings->email_signature, |             'signature' => $settings->email_signature, | ||||||
|             'logo' => $this->company->present()->logo(), |             'logo' => $this->company->present()->logo(), | ||||||
|             'settings' => $settings, |             'settings' => $settings, | ||||||
| 
 |             'whitelabel' => $this->company->account->isPaid() ? true : false, | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         return $data; |         return $data; | ||||||
|  | |||||||
| @ -77,7 +77,7 @@ class PaymentFailureObject | |||||||
|             'signature' => $signature, |             'signature' => $signature, | ||||||
|             'logo' => $this->company->present()->logo(), |             'logo' => $this->company->present()->logo(), | ||||||
|             'settings' => $this->client->getMergedSettings(), |             'settings' => $this->client->getMergedSettings(), | ||||||
| 
 |             'whitelabel' => $this->company->account->isPaid() ? true : false, | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         return $data; |         return $data; | ||||||
|  | |||||||
| @ -60,6 +60,8 @@ class TemplateEmail extends Mailable | |||||||
|             ->text('email.template.plain', [ |             ->text('email.template.plain', [ | ||||||
|                 'body' => $this->build_email->getBody(), |                 'body' => $this->build_email->getBody(), | ||||||
|                 'footer' => $this->build_email->getFooter(), |                 'footer' => $this->build_email->getFooter(), | ||||||
|  |                 'whitelabel' => $this->client->user->account->isPaid() ? true : false, | ||||||
|  |                 'settings' => $settings, | ||||||
|             ]) |             ]) | ||||||
|             ->view($template_name, [ |             ->view($template_name, [ | ||||||
|                 'body' => $this->build_email->getBody(), |                 'body' => $this->build_email->getBody(), | ||||||
|  | |||||||
| @ -524,7 +524,7 @@ class Client extends BaseModel implements HasLocalePreference | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if($this->company->use_credits_payment == 'option' && $this->service()->getCreditBalance() > 0) { |         if(($this->company->use_credits_payment == 'option' || $this->company->use_credits_payment == 'always') && $this->service()->getCreditBalance() > 0) { | ||||||
|                 $payment_urls[] = [ |                 $payment_urls[] = [ | ||||||
|                     'label' => ctrans('texts.apply_credit'), |                     'label' => ctrans('texts.apply_credit'), | ||||||
|                     'company_gateway_id'  => CompanyGateway::GATEWAY_CREDIT, |                     'company_gateway_id'  => CompanyGateway::GATEWAY_CREDIT, | ||||||
|  | |||||||
| @ -23,7 +23,9 @@ class Expense extends BaseModel | |||||||
| 
 | 
 | ||||||
|     protected $fillable = [ |     protected $fillable = [ | ||||||
|         'client_id', |         'client_id', | ||||||
|  |         'assigned_user_id', | ||||||
|         'vendor_id', |         'vendor_id', | ||||||
|  |         'invoice_id', | ||||||
|         'expense_currency_id', |         'expense_currency_id', | ||||||
|         'date', |         'date', | ||||||
|         'invoice_currency_id', |         'invoice_currency_id', | ||||||
| @ -34,7 +36,7 @@ class Expense extends BaseModel | |||||||
|         'public_notes', |         'public_notes', | ||||||
|         'bank_id', |         'bank_id', | ||||||
|         'transaction_id', |         'transaction_id', | ||||||
|         'expense_category_id', |         'category_id', | ||||||
|         'tax_rate1', |         'tax_rate1', | ||||||
|         'tax_name1', |         'tax_name1', | ||||||
|         'tax_rate2', |         'tax_rate2', | ||||||
|  | |||||||
| @ -27,6 +27,11 @@ class RecurringInvoiceInvitation extends BaseModel | |||||||
| 
 | 
 | ||||||
|     protected $touches = ['recurring_invoice']; |     protected $touches = ['recurring_invoice']; | ||||||
| 
 | 
 | ||||||
|  |     protected $with = [ | ||||||
|  |         'company', | ||||||
|  |         'contact', | ||||||
|  |     ]; | ||||||
|  |      | ||||||
|     public function getEntityType() |     public function getEntityType() | ||||||
|     { |     { | ||||||
|         return self::class; |         return self::class; | ||||||
| @ -71,13 +76,13 @@ class RecurringInvoiceInvitation extends BaseModel | |||||||
| 
 | 
 | ||||||
|     public function markViewed() |     public function markViewed() | ||||||
|     { |     { | ||||||
|         $this->viewed_date = Carbon::now(); |         $this->viewed_date = now(); | ||||||
|         $this->save(); |         $this->save(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function markOpened() |     public function markOpened() | ||||||
|     { |     { | ||||||
|         $this->opened_date = Carbon::now(); |         $this->opened_date = now(); | ||||||
|         $this->save(); |         $this->save(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										34
									
								
								app/Models/TaskStatus.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								app/Models/TaskStatus.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Models; | ||||||
|  | 
 | ||||||
|  | use Illuminate\Database\Eloquent\SoftDeletes; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Class TaskStatus. | ||||||
|  |  */ | ||||||
|  | class TaskStatus extends BaseModel | ||||||
|  | { | ||||||
|  |     use SoftDeletes; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * @var bool | ||||||
|  |      */ | ||||||
|  |     public $timestamps = true; | ||||||
|  |     /** | ||||||
|  |      * @var array | ||||||
|  |      */ | ||||||
|  |     protected $dates = ['deleted_at']; | ||||||
|  | 
 | ||||||
|  |     protected $fillable = ['name']; | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -64,6 +64,8 @@ class Vendor extends BaseModel | |||||||
|     //    'contacts',
 |     //    'contacts',
 | ||||||
|     ]; |     ]; | ||||||
| 
 | 
 | ||||||
|  |     protected $presenter = \App\Models\Presenters\VendorPresenter::class; | ||||||
|  | 
 | ||||||
|     public function getEntityType() |     public function getEntityType() | ||||||
|     { |     { | ||||||
|         return self::class; |         return self::class; | ||||||
|  | |||||||
| @ -51,7 +51,7 @@ class EntityViewedNotification extends Notification implements ShouldQueue | |||||||
|         $this->entity = $invitation->{$entity_name}; |         $this->entity = $invitation->{$entity_name}; | ||||||
|         $this->contact = $invitation->contact; |         $this->contact = $invitation->contact; | ||||||
|         $this->company = $invitation->company; |         $this->company = $invitation->company; | ||||||
|         $this->settings = $this->entity->client->getMergedSettings(); |         $this->settings = $invitation->contact->client->getMergedSettings(); | ||||||
|         $this->is_system = $is_system; |         $this->is_system = $is_system; | ||||||
|         $this->invitation = $invitation; |         $this->invitation = $invitation; | ||||||
|         $this->method = null; |         $this->method = null; | ||||||
|  | |||||||
| @ -124,7 +124,7 @@ class BaseNotification extends Notification implements ShouldQueue | |||||||
|             'logo' => $this->entity->company->present()->logo(), |             'logo' => $this->entity->company->present()->logo(), | ||||||
|             'signature' => $this->settings->email_signature, |             'signature' => $this->settings->email_signature, | ||||||
|             'settings' => $this->settings, |             'settings' => $this->settings, | ||||||
| 
 |             'whitelabel' => $this->entity->company->account->isPaid() ? true : false, | ||||||
|         ]; |         ]; | ||||||
| 
 | 
 | ||||||
|         return $data; |         return $data; | ||||||
|  | |||||||
							
								
								
									
										32
									
								
								app/Policies/TaskStatusPolicy.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Policies/TaskStatusPolicy.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Policies; | ||||||
|  | 
 | ||||||
|  | use App\Models\Payment; | ||||||
|  | use App\Models\User; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Class TaskStatusPolicy. | ||||||
|  |  */ | ||||||
|  | class TaskStatusPolicy extends EntityPolicy | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      *  Checks if the user has create permissions. | ||||||
|  |      * | ||||||
|  |      * @param  User $user | ||||||
|  |      * @return bool | ||||||
|  |      */ | ||||||
|  |     public function create(User $user) : bool | ||||||
|  |     { | ||||||
|  |         return $user->isAdmin() || $user->hasPermission('create_all'); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -31,6 +31,7 @@ use App\Models\Quote; | |||||||
| use App\Models\RecurringInvoice; | use App\Models\RecurringInvoice; | ||||||
| use App\Models\RecurringQuote; | use App\Models\RecurringQuote; | ||||||
| use App\Models\Task; | use App\Models\Task; | ||||||
|  | use App\Models\TaskStatus; | ||||||
| use App\Models\TaxRate; | use App\Models\TaxRate; | ||||||
| use App\Models\User; | use App\Models\User; | ||||||
| use App\Models\Vendor; | use App\Models\Vendor; | ||||||
| @ -55,6 +56,7 @@ use App\Policies\QuotePolicy; | |||||||
| use App\Policies\RecurringInvoicePolicy; | use App\Policies\RecurringInvoicePolicy; | ||||||
| use App\Policies\RecurringQuotePolicy; | use App\Policies\RecurringQuotePolicy; | ||||||
| use App\Policies\TaskPolicy; | use App\Policies\TaskPolicy; | ||||||
|  | use App\Policies\TaskStatusPolicy; | ||||||
| use App\Policies\TaxRatePolicy; | use App\Policies\TaxRatePolicy; | ||||||
| use App\Policies\UserPolicy; | use App\Policies\UserPolicy; | ||||||
| use App\Policies\VendorPolicy; | use App\Policies\VendorPolicy; | ||||||
| @ -92,6 +94,7 @@ class AuthServiceProvider extends ServiceProvider | |||||||
|         RecurringQuote::class => RecurringQuotePolicy::class, |         RecurringQuote::class => RecurringQuotePolicy::class, | ||||||
|         Webhook::class => WebhookPolicy::class, |         Webhook::class => WebhookPolicy::class, | ||||||
|         Task::class => TaskPolicy::class, |         Task::class => TaskPolicy::class, | ||||||
|  |         TaskStatus::class => TaskStatusPolicy::class, | ||||||
|         TaxRate::class => TaxRatePolicy::class, |         TaxRate::class => TaxRatePolicy::class, | ||||||
|         User::class => UserPolicy::class, |         User::class => UserPolicy::class, | ||||||
|         Vendor::class => VendorPolicy::class, |         Vendor::class => VendorPolicy::class, | ||||||
|  | |||||||
| @ -70,21 +70,36 @@ class PaymentRepository extends BaseRepository | |||||||
|      */ |      */ | ||||||
|     private function applyPayment(array $data, Payment $payment): ?Payment |     private function applyPayment(array $data, Payment $payment): ?Payment | ||||||
|     { |     { | ||||||
|  |         $is_existing_payment = true; | ||||||
| 
 | 
 | ||||||
|         //check currencies here and fill the exchange rate data if necessary
 |         //check currencies here and fill the exchange rate data if necessary
 | ||||||
|         if (! $payment->id) { |         if (! $payment->id) { | ||||||
|             $this->processExchangeRates($data, $payment); |             $this->processExchangeRates($data, $payment); | ||||||
| 
 | 
 | ||||||
|  |             $is_existing_payment = false; | ||||||
|  |             $client = Client::find($data['client_id']); | ||||||
|  | 
 | ||||||
|             /*We only update the paid to date ONCE per payment*/ |             /*We only update the paid to date ONCE per payment*/ | ||||||
|             if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { |             if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { | ||||||
|                 if ($data['amount'] == '') { |                 if ($data['amount'] == '') { | ||||||
|                     $data['amount'] = array_sum(array_column($data['invoices'], 'amount')); |                     $data['amount'] = array_sum(array_column($data['invoices'], 'amount')); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 $client = Client::find($data['client_id']); |  | ||||||
| 
 |  | ||||||
|                 $client->service()->updatePaidToDate($data['amount'])->save(); |                 $client->service()->updatePaidToDate($data['amount'])->save(); | ||||||
|  | 
 | ||||||
|             } |             } | ||||||
|  | 
 | ||||||
|  |             if (array_key_exists('credits', $data) && is_array($data['credits']) && count($data['credits']) > 0) { | ||||||
|  | 
 | ||||||
|  |                 $_credit_totals = array_sum(array_column($data['credits'], 'amount')); | ||||||
|  | 
 | ||||||
|  |                 if($data['amount'] == $_credit_totals) | ||||||
|  |                     $data['amount'] = 0; | ||||||
|  |                 else | ||||||
|  |                     $client->service()->updatePaidToDate($_credit_totals)->save(); | ||||||
|  |              | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         /*Fill the payment*/ |         /*Fill the payment*/ | ||||||
| @ -144,25 +159,13 @@ class PaymentRepository extends BaseRepository | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars())); |         if(!$is_existing_payment) | ||||||
|  |             event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars())); | ||||||
| 
 | 
 | ||||||
|         /*info("invoice totals = {$invoice_totals}"); |  | ||||||
|         info("credit totals = {$credit_totals}"); |  | ||||||
|         info("applied totals = " . array_sum(array_column($data['invoices'], 'amount'))); |  | ||||||
|         */ |  | ||||||
|         //$invoice_totals -= $credit_totals;
 |  | ||||||
| 
 | 
 | ||||||
|         ////$payment->amount = $invoice_totals; //creates problems when setting amount like this.
 |  | ||||||
| 
 | 
 | ||||||
|         // if($credit_totals == $payment->amount){
 |          $payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
 | ||||||
|         //     $payment->applied += $credit_totals;
 |         // $payment->applied += $invoice_totals; //wont work because - check tests
 | ||||||
|         // } elseif ($invoice_totals == $payment->amount) {
 |  | ||||||
|         //     $payment->applied += $payment->amount;
 |  | ||||||
|         // } elseif ($invoice_totals < $payment->amount) {
 |  | ||||||
|         //     $payment->applied += $invoice_totals;
 |  | ||||||
|         // }
 |  | ||||||
| 
 |  | ||||||
|         $payment->applied = $invoice_totals; //wont work because - check tests
 |  | ||||||
| 
 | 
 | ||||||
|         $payment->save(); |         $payment->save(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -38,7 +38,7 @@ class RecurringInvoiceRepository extends BaseRepository | |||||||
|                 ->createInvitations() |                 ->createInvitations() | ||||||
|                 ->save(); |                 ->save(); | ||||||
|          |          | ||||||
|         $invoice = $invoice_calc->build()->getInvoice(); |         $invoice = $invoice_calc->build()->getRecurringInvoice(); | ||||||
| 
 | 
 | ||||||
|         return $invoice; |         return $invoice; | ||||||
|     } |     } | ||||||
|  | |||||||
							
								
								
									
										19
									
								
								app/Repositories/TaskStatusRepository.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								app/Repositories/TaskStatusRepository.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Repositories; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Class for task status repository. | ||||||
|  |  */ | ||||||
|  | class TaskStatusRepository extends BaseRepository | ||||||
|  | { | ||||||
|  | } | ||||||
| @ -74,7 +74,14 @@ class ApplyPayment | |||||||
| 
 | 
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         $this->applyPaymentToCredit(); |         $this->credit->balance -= $this->amount_applied; | ||||||
|  | 
 | ||||||
|  |         if((int)$this->credit->balance == 0) | ||||||
|  |             $this->credit->status_id = Credit::STATUS_APPLIED; | ||||||
|  |         else | ||||||
|  |             $this->credit->status_id = Credit::STATUS_PARTIAL; | ||||||
|  | 
 | ||||||
|  |         $this->credit->save(); | ||||||
| 
 | 
 | ||||||
|         $this->addPaymentToLedger(); |         $this->addPaymentToLedger(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -126,7 +126,10 @@ class AutoBillInvoice extends AbstractService | |||||||
|             { |             { | ||||||
|                 $current_credit = Credit::find($credit['credit_id']); |                 $current_credit = Credit::find($credit['credit_id']); | ||||||
|                 $payment->credits()->attach($current_credit->id, ['amount' => $credit['amount']]); |                 $payment->credits()->attach($current_credit->id, ['amount' => $credit['amount']]); | ||||||
|                 $this->applyPaymentToCredit($current_credit, $credit['amount']); |                  | ||||||
|  |                 $current_credit->balance -= $credit['amount']; | ||||||
|  |                 $current_credit->save();  | ||||||
|  |                 // $this->applyPaymentToCredit($current_credit, $credit['amount']);
 | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             $payment->ledger() |             $payment->ledger() | ||||||
|  | |||||||
| @ -168,10 +168,20 @@ class Design extends BaseDesign | |||||||
|         $elements = []; |         $elements = []; | ||||||
| 
 | 
 | ||||||
|         foreach ($variables as $variable) { |         foreach ($variables as $variable) { | ||||||
|             $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'elements' => [ |             $_variable = explode('.', $variable)[1]; | ||||||
|                 ['element' => 'th', 'content' => $variable . '_label'], |             $_customs = ['custom1', 'custom2', 'custom3', 'custom4']; | ||||||
|                 ['element' => 'th', 'content' => $variable], |              | ||||||
|             ]]; |             if (in_array($_variable, $_customs)) { | ||||||
|  |                 $elements[] = ['element' => 'tr', 'elements' => [ | ||||||
|  |                     ['element' => 'th', 'content' => $variable . '_label'], | ||||||
|  |                     ['element' => 'th', 'content' => $variable], | ||||||
|  |                 ]]; | ||||||
|  |             } else { | ||||||
|  |                 $elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'elements' => [ | ||||||
|  |                     ['element' => 'th', 'content' => $variable . '_label'], | ||||||
|  |                     ['element' => 'th', 'content' => $variable], | ||||||
|  |                 ]]; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return $elements; |         return $elements; | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ class CompanyUserTransformer extends EntityTransformer | |||||||
|     protected $defaultIncludes = [ |     protected $defaultIncludes = [ | ||||||
|     //     'account',
 |     //     'account',
 | ||||||
|     //     'company',
 |     //     'company',
 | ||||||
|     //     'user',
 |          'user', | ||||||
|     //     'token'
 |     //     'token'
 | ||||||
|      ]; |      ]; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -80,6 +80,7 @@ class ExpenseTransformer extends EntityTransformer | |||||||
|             'transaction_id' => (string) $expense->transaction_id ?: '', |             'transaction_id' => (string) $expense->transaction_id ?: '', | ||||||
|             //'date' => $expense->date ?: '',
 |             //'date' => $expense->date ?: '',
 | ||||||
|             'expense_date' => $expense->date ?: '', |             'expense_date' => $expense->date ?: '', | ||||||
|  |             'number' => (string)$expense->number ?: '', | ||||||
|             'payment_date' => $expense->payment_date ?: '', |             'payment_date' => $expense->payment_date ?: '', | ||||||
|             'custom_value1' => $expense->custom_value1 ?: '', |             'custom_value1' => $expense->custom_value1 ?: '', | ||||||
|             'custom_value2' => $expense->custom_value2 ?: '', |             'custom_value2' => $expense->custom_value2 ?: '', | ||||||
|  | |||||||
| @ -48,6 +48,7 @@ class ProjectTransformer extends EntityTransformer | |||||||
|             'assigned_user_id' => (string) $this->encodePrimaryKey($project->assigned_user_id), |             'assigned_user_id' => (string) $this->encodePrimaryKey($project->assigned_user_id), | ||||||
|             'client_id' => (string) $this->encodePrimaryKey($project->client_id), |             'client_id' => (string) $this->encodePrimaryKey($project->client_id), | ||||||
|             'name' => $project->name ?: '', |             'name' => $project->name ?: '', | ||||||
|  |             'number' => $project->number, | ||||||
|             'created_at' => (int) $project->created_at, |             'created_at' => (int) $project->created_at, | ||||||
|             'updated_at' => (int) $project->updated_at, |             'updated_at' => (int) $project->updated_at, | ||||||
|             'archived_at' => (int) $project->deleted_at, |             'archived_at' => (int) $project->deleted_at, | ||||||
|  | |||||||
							
								
								
									
										32
									
								
								app/Transformers/TaskStatusTransformer.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								app/Transformers/TaskStatusTransformer.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Transformers; | ||||||
|  | 
 | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | use App\Utils\Traits\MakesHash; | ||||||
|  | 
 | ||||||
|  | class TaskStatusTransformer extends EntityTransformer | ||||||
|  | { | ||||||
|  |     use MakesHash; | ||||||
|  | 
 | ||||||
|  |     public function transform(TaskStatus $task_status) | ||||||
|  |     { | ||||||
|  |         return [ | ||||||
|  |             'id'          => (string) $this->encodePrimaryKey($task_status->id), | ||||||
|  |             'name'        => (string) $task_status->name, | ||||||
|  |             'is_deleted'  => (bool) $task_status->is_deleted, | ||||||
|  |             'created_at'  => (int) $task_status->created_at, | ||||||
|  |             'updated_at'  => (int) $task_status->updated_at, | ||||||
|  |             'archived_at' => (int) $task_status->deleted_at, | ||||||
|  |         ]; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -106,6 +106,7 @@ class VendorTransformer extends EntityTransformer | |||||||
|             'updated_at' => (int) $vendor->updated_at, |             'updated_at' => (int) $vendor->updated_at, | ||||||
|             'archived_at' => (int) $vendor->deleted_at, |             'archived_at' => (int) $vendor->deleted_at, | ||||||
|             'created_at' => (int) $vendor->created_at, |             'created_at' => (int) $vendor->created_at, | ||||||
|  |             'number' => (string)$vendor->number ?: '', | ||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -365,6 +365,8 @@ class HtmlEngine | |||||||
|         $arrKeysLength = array_map('strlen', array_keys($data)); |         $arrKeysLength = array_map('strlen', array_keys($data)); | ||||||
|         array_multisort($arrKeysLength, SORT_DESC, $data); |         array_multisort($arrKeysLength, SORT_DESC, $data); | ||||||
| 
 | 
 | ||||||
|  | //info(print_r($data,1));
 | ||||||
|  |    | ||||||
|         return $data; |         return $data; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,6 +16,7 @@ use App\Models\Credit; | |||||||
| use App\Models\Expense; | use App\Models\Expense; | ||||||
| use App\Models\Invoice; | use App\Models\Invoice; | ||||||
| use App\Models\Payment; | use App\Models\Payment; | ||||||
|  | use App\Models\Project; | ||||||
| use App\Models\Quote; | use App\Models\Quote; | ||||||
| use App\Models\RecurringInvoice; | use App\Models\RecurringInvoice; | ||||||
| use App\Models\Timezone; | use App\Models\Timezone; | ||||||
| @ -225,6 +226,44 @@ trait GeneratesCounter | |||||||
|         return (string) $payment_number; |         return (string) $payment_number; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Project Number Generator. | ||||||
|  |      * @return string The project number | ||||||
|  |      */ | ||||||
|  |     public function getNextProjectNumber(Client $client) :string | ||||||
|  |     { | ||||||
|  | 
 | ||||||
|  |         //Reset counters if enabled
 | ||||||
|  |         $this->resetCounters($client); | ||||||
|  | 
 | ||||||
|  |         $is_client_counter = false; | ||||||
|  | 
 | ||||||
|  |         //todo handle if we have specific client patterns in the future
 | ||||||
|  |         $pattern = $client->company->settings->project_number_pattern; | ||||||
|  | 
 | ||||||
|  |         //Determine if we are using client_counters
 | ||||||
|  |         if (strpos($pattern, 'client_counter') === false) { | ||||||
|  |             $counter = $client->company->settings->project_number_counter; | ||||||
|  |         } else { | ||||||
|  |             $counter = $client->settings->project_number_counter; | ||||||
|  |             $is_client_counter = true; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         //Return a valid counter
 | ||||||
|  |         $pattern = ''; | ||||||
|  |         $padding = $client->getSetting('counter_padding'); | ||||||
|  |         $project_number = $this->checkEntityNumber(Project::class, $client, $counter, $padding, $pattern); | ||||||
|  | 
 | ||||||
|  |         //increment the correct invoice_number Counter (company vs client)
 | ||||||
|  |         if ($is_client_counter) { | ||||||
|  |             $this->incrementCounter($client, 'project_number_counter'); | ||||||
|  |         } else { | ||||||
|  |             $this->incrementCounter($client->company, 'project_number_counter'); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return (string) $project_number; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Gets the next client number. |      * Gets the next client number. | ||||||
|      * |      * | ||||||
| @ -479,6 +518,7 @@ trait GeneratesCounter | |||||||
|         $settings->vendor_number_counter = 1; |         $settings->vendor_number_counter = 1; | ||||||
|         $settings->ticket_number_counter = 1; |         $settings->ticket_number_counter = 1; | ||||||
|         $settings->payment_number_counter = 1; |         $settings->payment_number_counter = 1; | ||||||
|  |         $settings->project_number_counter = 1; | ||||||
|         $settings->task_number_counter = 1; |         $settings->task_number_counter = 1; | ||||||
|         $settings->expense_number_counter = 1; |         $settings->expense_number_counter = 1; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -27,12 +27,11 @@ | |||||||
|         "php": ">=7.3", |         "php": ">=7.3", | ||||||
|         "ext-json": "*", |         "ext-json": "*", | ||||||
|         "asgrim/ofxparser": "^1.2", |         "asgrim/ofxparser": "^1.2", | ||||||
|         "checkout/checkout-sdk-php": "^1.0", |  | ||||||
|         "authorizenet/authorizenet": "^2.0", |         "authorizenet/authorizenet": "^2.0", | ||||||
|  |         "checkout/checkout-sdk-php": "^1.0", | ||||||
|         "cleverit/ubl_invoice": "^1.3", |         "cleverit/ubl_invoice": "^1.3", | ||||||
|         "composer/composer": "^1.10", |         "composer/composer": "^1.10", | ||||||
|         "czproject/git-php": "^3.17", |         "czproject/git-php": "^3.17", | ||||||
|         "turbo124/laravel-gmail": "^5.0", |  | ||||||
|         "doctrine/dbal": "^2.10", |         "doctrine/dbal": "^2.10", | ||||||
|         "fedeisas/laravel-mail-css-inliner": "^3", |         "fedeisas/laravel-mail-css-inliner": "^3", | ||||||
|         "fideloper/proxy": "^4.2", |         "fideloper/proxy": "^4.2", | ||||||
| @ -46,6 +45,7 @@ | |||||||
|         "laravel/slack-notification-channel": "^2.2", |         "laravel/slack-notification-channel": "^2.2", | ||||||
|         "laravel/socialite": "^5", |         "laravel/socialite": "^5", | ||||||
|         "laravel/tinker": "^2.0", |         "laravel/tinker": "^2.0", | ||||||
|  |         "laravel/ui": "^3.0", | ||||||
|         "league/flysystem-aws-s3-v3": "~1.0", |         "league/flysystem-aws-s3-v3": "~1.0", | ||||||
|         "league/flysystem-cached-adapter": "^1.1", |         "league/flysystem-cached-adapter": "^1.1", | ||||||
|         "league/fractal": "^0.17.0", |         "league/fractal": "^0.17.0", | ||||||
| @ -60,8 +60,8 @@ | |||||||
|         "staudenmeir/eloquent-has-many-deep": "^1.11", |         "staudenmeir/eloquent-has-many-deep": "^1.11", | ||||||
|         "stripe/stripe-php": "^7.50", |         "stripe/stripe-php": "^7.50", | ||||||
|         "turbo124/beacon": "^1", |         "turbo124/beacon": "^1", | ||||||
|         "webpatser/laravel-countries": "dev-master#75992ad", |         "turbo124/laravel-gmail": "^5.0", | ||||||
|         "laravel/ui": "^3.0" |         "webpatser/laravel-countries": "dev-master#75992ad" | ||||||
|     }, |     }, | ||||||
|     "require-dev": { |     "require-dev": { | ||||||
|         "anahkiasen/former": "^4.2", |         "anahkiasen/former": "^4.2", | ||||||
|  | |||||||
							
								
								
									
										408
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										408
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -12,7 +12,7 @@ return [ | |||||||
|     'require_https' => env('REQUIRE_HTTPS', true), |     'require_https' => env('REQUIRE_HTTPS', true), | ||||||
|     'app_url' => rtrim(env('APP_URL', ''), '/').'/', |     'app_url' => rtrim(env('APP_URL', ''), '/').'/', | ||||||
|     'app_domain' => env('APP_DOMAIN', ''), |     'app_domain' => env('APP_DOMAIN', ''), | ||||||
|     'app_version' => '5.0.21', |     'app_version' => '5.0.22', | ||||||
|     'minimum_client_version' => '5.0.16', |     'minimum_client_version' => '5.0.16', | ||||||
|     'terms_version' => '1.0.1', |     'terms_version' => '1.0.1', | ||||||
|     'api_secret' => env('API_SECRET', ''), |     'api_secret' => env('API_SECRET', ''), | ||||||
|  | |||||||
							
								
								
									
										38
									
								
								database/factories/TaskStatusFactory.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								database/factories/TaskStatusFactory.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | namespace Database\Factories; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | use App\Models\TaskStatus; | ||||||
|  | use Illuminate\Database\Eloquent\Factories\Factory; | ||||||
|  | use Illuminate\Support\Str; | ||||||
|  | 
 | ||||||
|  | class TaskStatusFactory extends Factory | ||||||
|  | { | ||||||
|  |     /** | ||||||
|  |      * The name of the factory's corresponding model. | ||||||
|  |      * | ||||||
|  |      * @var string | ||||||
|  |      */ | ||||||
|  |     protected $model = TaskStatus::class; | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Define the model's default state. | ||||||
|  |      * | ||||||
|  |      * @return array | ||||||
|  |      */ | ||||||
|  |     public function definition() | ||||||
|  |     { | ||||||
|  |         return [ | ||||||
|  |             'name' => $this->faker->text(7), | ||||||
|  |         ]; | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
| @ -1,4 +1,14 @@ | |||||||
| <?php | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://opensource.org/licenses/AAL | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| use Illuminate\Database\Migrations\Migration; | use Illuminate\Database\Migrations\Migration; | ||||||
| use Illuminate\Database\Schema\Blueprint; | use Illuminate\Database\Schema\Blueprint; | ||||||
|  | |||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user