mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	Localize payment dates
This commit is contained in:
		
							parent
							
								
									d2f54bb11b
								
							
						
					
					
						commit
						98706698d2
					
				@ -88,7 +88,7 @@ class StorePaymentRequest extends Request
 | 
				
			|||||||
        // $input['is_manual'] = true;
 | 
					        // $input['is_manual'] = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! isset($input['date'])) {
 | 
					        if (! isset($input['date'])) {
 | 
				
			||||||
            $input['date'] = now()->format('Y-m-d');
 | 
					            $input['date'] = now()->addSeconds(auth()->user()->company->timezone()->utc_offset)->format('Y-m-d');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->replace($input);
 | 
					        $this->replace($input);
 | 
				
			||||||
 | 
				
			|||||||
@ -320,7 +320,7 @@ class BaseDriver extends AbstractPaymentDriver
 | 
				
			|||||||
        $payment->company_gateway_id = $this->company_gateway->id;
 | 
					        $payment->company_gateway_id = $this->company_gateway->id;
 | 
				
			||||||
        $payment->status_id = $status;
 | 
					        $payment->status_id = $status;
 | 
				
			||||||
        $payment->currency_id = $this->client->getSetting('currency_id');
 | 
					        $payment->currency_id = $this->client->getSetting('currency_id');
 | 
				
			||||||
        $payment->date = Carbon::now();
 | 
					        $payment->date = Carbon::now()->addSeconds($this->client->company->timezone()->utc_offset)->format('Y-m-d');
 | 
				
			||||||
        $payment->gateway_type_id = $data['gateway_type_id'];
 | 
					        $payment->gateway_type_id = $data['gateway_type_id'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $client_contact = $this->getContact();
 | 
					        $client_contact = $this->getContact();
 | 
				
			||||||
 | 
				
			|||||||
@ -119,7 +119,7 @@ class CreditService
 | 
				
			|||||||
        $payment->type_id = PaymentType::CREDIT;
 | 
					        $payment->type_id = PaymentType::CREDIT;
 | 
				
			||||||
        $payment->is_manual = true;
 | 
					        $payment->is_manual = true;
 | 
				
			||||||
        $payment->currency_id = $this->credit->client->getSetting('currency_id');
 | 
					        $payment->currency_id = $this->credit->client->getSetting('currency_id');
 | 
				
			||||||
        $payment->date = now();
 | 
					        $payment->date = now()->addSeconds($this->credit->company->timezone()->utc_offset)->format('Y-m-d');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $payment->saveQuietly();
 | 
					        $payment->saveQuietly();
 | 
				
			||||||
        $payment->number = $payment->client->getNextPaymentNumber($payment->client, $payment);
 | 
					        $payment->number = $payment->client->getNextPaymentNumber($payment->client, $payment);
 | 
				
			||||||
 | 
				
			|||||||
@ -179,7 +179,7 @@ class AutoBillInvoice extends AbstractService
 | 
				
			|||||||
        $payment->applied = $amount;
 | 
					        $payment->applied = $amount;
 | 
				
			||||||
        $payment->client_id = $this->invoice->client_id;
 | 
					        $payment->client_id = $this->invoice->client_id;
 | 
				
			||||||
        $payment->currency_id = $this->invoice->client->getSetting('currency_id');
 | 
					        $payment->currency_id = $this->invoice->client->getSetting('currency_id');
 | 
				
			||||||
        $payment->date = now();
 | 
					        $payment->date = now()->addSeconds($this->invoice->company->timezone()->utc_offset)->format('Y-m-d');
 | 
				
			||||||
        $payment->status_id = Payment::STATUS_COMPLETED;
 | 
					        $payment->status_id = Payment::STATUS_COMPLETED;
 | 
				
			||||||
        $payment->type_id = PaymentType::CREDIT;
 | 
					        $payment->type_id = PaymentType::CREDIT;
 | 
				
			||||||
        $payment->service()->applyNumber()->save();
 | 
					        $payment->service()->applyNumber()->save();
 | 
				
			||||||
 | 
				
			|||||||
@ -71,6 +71,7 @@ class MarkPaid extends AbstractService
 | 
				
			|||||||
        $payment->is_manual = true;
 | 
					        $payment->is_manual = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->invoice->company->timezone()) {
 | 
					        if ($this->invoice->company->timezone()) {
 | 
				
			||||||
 | 
					            nlog($this->invoice->company->timezone()->utc_offset);
 | 
				
			||||||
            $payment->date = now()->addSeconds($this->invoice->company->timezone()->utc_offset)->format('Y-m-d');
 | 
					            $payment->date = now()->addSeconds($this->invoice->company->timezone()->utc_offset)->format('Y-m-d');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user