mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 14:07:32 -04:00 
			
		
		
		
	Merge pull request #6288 from turbo124/v5-develop
General fixes and improvements
This commit is contained in:
		
						commit
						2e53daa95d
					
				| @ -57,9 +57,6 @@ class PasswordProtection | |||||||
|             $user = false; |             $user = false; | ||||||
|             $google = new Google(); |             $google = new Google(); | ||||||
|             $user = $google->getTokenResponse(request()->header('X-API-OAUTH-PASSWORD')); |             $user = $google->getTokenResponse(request()->header('X-API-OAUTH-PASSWORD')); | ||||||
| 
 |  | ||||||
|             nlog("user"); |  | ||||||
|             nlog($user); |  | ||||||
|              |              | ||||||
|             if (is_array($user)) { |             if (is_array($user)) { | ||||||
|                  |                  | ||||||
| @ -68,8 +65,6 @@ class PasswordProtection | |||||||
|                     'oauth_provider_id'=> 'google' |                     'oauth_provider_id'=> 'google' | ||||||
|                 ]; |                 ]; | ||||||
| 
 | 
 | ||||||
|                 nlog($query); |  | ||||||
| 
 |  | ||||||
|                 //If OAuth and user also has a password set  - check both
 |                 //If OAuth and user also has a password set  - check both
 | ||||||
|                 if ($existing_user = MultiDB::hasUser($query) && auth()->user()->company()->oauth_password_required && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { |                 if ($existing_user = MultiDB::hasUser($query) && auth()->user()->company()->oauth_password_required && auth()->user()->has_password && Hash::check(auth()->user()->password, $request->header('X-API-PASSWORD'))) { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -48,6 +48,9 @@ class CreateCompanyTaskStatuses | |||||||
| 
 | 
 | ||||||
|         MultiDB::setDb($this->company->db); |         MultiDB::setDb($this->company->db); | ||||||
|          |          | ||||||
|  |         if(TaskStatus::where('company_id', $this->company->id)->count() > 0) | ||||||
|  |             return; | ||||||
|  |          | ||||||
|         $task_statuses = [ |         $task_statuses = [ | ||||||
|             ['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 1], |             ['name' => ctrans('texts.backlog'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 1], | ||||||
|             ['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 2], |             ['name' => ctrans('texts.ready_to_do'), 'company_id' => $this->company->id, 'user_id' => $this->user->id, 'created_at' => now(), 'updated_at' => now(), 'status_order' => 2], | ||||||
|  | |||||||
| @ -430,8 +430,6 @@ class Import implements ShouldQueue | |||||||
| 
 | 
 | ||||||
|     private function transformCompanyData(array $data): array |     private function transformCompanyData(array $data): array | ||||||
|     { |     { | ||||||
|         nlog("pre transformed"); |  | ||||||
|         nlog($data['settings']); |  | ||||||
| 
 | 
 | ||||||
|         $company_settings = CompanySettings::defaults(); |         $company_settings = CompanySettings::defaults(); | ||||||
| 
 | 
 | ||||||
| @ -454,9 +452,7 @@ class Import implements ShouldQueue | |||||||
| 
 | 
 | ||||||
|             $data['settings'] = $company_settings; |             $data['settings'] = $company_settings; | ||||||
|         } |         } | ||||||
|          | 
 | ||||||
|         nlog("transformed Settings"); |  | ||||||
|         nlog($data['settings']); |  | ||||||
| 
 | 
 | ||||||
|         return $data; |         return $data; | ||||||
|     } |     } | ||||||
|  | |||||||
							
								
								
									
										76
									
								
								app/Jobs/Util/RefreshPdfs.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								app/Jobs/Util/RefreshPdfs.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,76 @@ | |||||||
|  | <?php | ||||||
|  | /** | ||||||
|  |  * Invoice Ninja (https://invoiceninja.com). | ||||||
|  |  * | ||||||
|  |  * @link https://github.com/invoiceninja/invoiceninja source repository | ||||||
|  |  * | ||||||
|  |  * @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com) | ||||||
|  |  * | ||||||
|  |  * @license https://www.elastic.co/licensing/elastic-license | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | namespace App\Jobs\Util; | ||||||
|  | 
 | ||||||
|  | use App\Jobs\Entity\CreateEntityPdf; | ||||||
|  | use App\Jobs\Util\UnlinkFile; | ||||||
|  | use App\Libraries\MultiDB; | ||||||
|  | use App\Models\Account; | ||||||
|  | use App\Models\Company; | ||||||
|  | use App\Models\CreditInvitation; | ||||||
|  | use App\Models\InvoiceInvitation; | ||||||
|  | use App\Models\QuoteInvitation; | ||||||
|  | use App\Utils\Ninja; | ||||||
|  | use Illuminate\Bus\Queueable; | ||||||
|  | use Illuminate\Contracts\Queue\ShouldQueue; | ||||||
|  | use Illuminate\Foundation\Bus\Dispatchable; | ||||||
|  | use Illuminate\Queue\InteractsWithQueue; | ||||||
|  | use Illuminate\Queue\SerializesModels; | ||||||
|  | use Illuminate\Support\Facades\DB; | ||||||
|  | use Illuminate\Support\Facades\Storage; | ||||||
|  | 
 | ||||||
|  | class RefreshPdfs implements ShouldQueue | ||||||
|  | { | ||||||
|  |     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||||||
|  | 
 | ||||||
|  |     public $company; | ||||||
|  | 
 | ||||||
|  |     public function __construct(Company $company) | ||||||
|  |     { | ||||||
|  |         $this->company = $company; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Execute the job. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     public function handle() | ||||||
|  |     { | ||||||
|  | 
 | ||||||
|  |         MultiDB::setDb($this->company->db); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         InvoiceInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) { | ||||||
|  |              | ||||||
|  |             nlog("generating invoice pdf for {$invitation->invoice_id}"); | ||||||
|  |             CreateEntityPdf::dispatch($invitation); | ||||||
|  | 
 | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |         QuoteInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) { | ||||||
|  |              | ||||||
|  |             nlog("generating quote pdf for {$invitation->quote_id}"); | ||||||
|  |             CreateEntityPdf::dispatch($invitation); | ||||||
|  |              | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |         CreditInvitation::where('company_id', $this->company->id)->cursor()->each(function ($invitation) { | ||||||
|  |              | ||||||
|  |             nlog("generating credit pdf for {$invitation->credit_id}"); | ||||||
|  |             CreateEntityPdf::dispatch($invitation); | ||||||
|  |              | ||||||
|  |         }); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -940,7 +940,7 @@ class SubscriptionService | |||||||
|                 'subscription' => $this->subscription->hashed_id, |                 'subscription' => $this->subscription->hashed_id, | ||||||
|                 'recurring_invoice' => $recurring_invoice_hashed_id, |                 'recurring_invoice' => $recurring_invoice_hashed_id, | ||||||
|                 'client' => $invoice->client->hashed_id, |                 'client' => $invoice->client->hashed_id, | ||||||
|                 'contact' => $invoice->client->primary_contact()->first()->hashed_id, |                 'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->contacts->first() : false, | ||||||
|                 'invoice' => $invoice->hashed_id, |                 'invoice' => $invoice->hashed_id, | ||||||
|             ]; |             ]; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -48,18 +48,28 @@ | |||||||
|                             @endif |                             @endif | ||||||
| 
 | 
 | ||||||
|                             <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> |                             <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> | ||||||
|  |                                 @if($invoice->po_number) | ||||||
|  |                                 <dt class="text-sm font-medium leading-5 text-gray-500"> | ||||||
|  |                                     {{ ctrans('texts.po_number') }} | ||||||
|  |                                 </dt> | ||||||
|  |                                 <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> | ||||||
|  |                                     {{ $invoice->po_number }} | ||||||
|  |                                 </dd> | ||||||
|  |                                 @elseif($invoice->public_notes) | ||||||
|  |                                 <dt class="text-sm font-medium leading-5 text-gray-500"> | ||||||
|  |                                     {{ ctrans('texts.public_notes') }} | ||||||
|  |                                 </dt> | ||||||
|  |                                 <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> | ||||||
|  |                                     {{ $invoice->public_notes }} | ||||||
|  |                                 </dd> | ||||||
|  |                                 @else | ||||||
|                                 <dt class="text-sm font-medium leading-5 text-gray-500"> |                                 <dt class="text-sm font-medium leading-5 text-gray-500"> | ||||||
|                                     {{ ctrans('texts.invoice_date') }} |                                     {{ ctrans('texts.invoice_date') }} | ||||||
|                                 </dt> |                                 </dt> | ||||||
|                                 <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> |                                 <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> | ||||||
|                                     @if($invoice->po_number) |                                     {{ $invoice->date }} | ||||||
|                                         {{ $invoice->po_number }} |  | ||||||
|                                     @elseif($invoice->public_notes) |  | ||||||
|                                         {{ $invoice->public_notes }} |  | ||||||
|                                     @else |  | ||||||
|                                         {{ $invoice->date}} |  | ||||||
|                                     @endif |  | ||||||
|                                 </dd> |                                 </dd> | ||||||
|  |                                 @endif | ||||||
|                             </div> |                             </div> | ||||||
| 
 | 
 | ||||||
|                             @if(!empty($invoice->due_date) && !is_null($invoice->due_date)) |                             @if(!empty($invoice->due_date) && !is_null($invoice->due_date)) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user