mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 08:07:34 -05:00 
			
		
		
		
	Merge pull request #4414 from turbo124/v5-stable
Fixes for sending email user
This commit is contained in:
		
						commit
						e26263f9ef
					
				@ -77,6 +77,8 @@ class BaseMailerJob implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        Config::set('mail.driver', 'gmail');
 | 
					        Config::set('mail.driver', 'gmail');
 | 
				
			||||||
        Config::set('services.gmail.token', $user->oauth_user_token->access_token);
 | 
					        Config::set('services.gmail.token', $user->oauth_user_token->access_token);
 | 
				
			||||||
 | 
					        Config::set('mail.from.address', $user->email);
 | 
				
			||||||
 | 
					        Config::set('mail.from.name', $user->present()->name());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        (new MailServiceProvider(app()))->register();
 | 
					        (new MailServiceProvider(app()))->register();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -77,7 +77,7 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            $mail_obj = (new EntityPaidObject($this->payment))->build();
 | 
					            $mail_obj = (new EntityPaidObject($this->payment))->build();
 | 
				
			||||||
            $mail_obj->from = [$this->user->email, $this->user->present()->name()];
 | 
					            $mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //send email
 | 
					            //send email
 | 
				
			||||||
            Mail::to($this->user->email)
 | 
					            Mail::to($this->user->email)
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,7 @@ class EntitySentMailer extends BaseMailerJob implements ShouldQueue
 | 
				
			|||||||
        $this->setMailDriver();
 | 
					        $this->setMailDriver();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $mail_obj = (new EntitySentObject($this->invitation, $this->entity_type))->build();
 | 
					        $mail_obj = (new EntitySentObject($this->invitation, $this->entity_type))->build();
 | 
				
			||||||
        $mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()];
 | 
					        $mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            Mail::to($this->user->email)
 | 
					            Mail::to($this->user->email)
 | 
				
			||||||
 | 
				
			|||||||
@ -81,7 +81,7 @@ class EntityViewedMailer extends BaseMailerJob implements ShouldQueue
 | 
				
			|||||||
        $this->setMailDriver();
 | 
					        $this->setMailDriver();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $mail_obj = (new EntityViewedObject($this->invitation, $this->entity_type))->build();
 | 
					        $mail_obj = (new EntityViewedObject($this->invitation, $this->entity_type))->build();
 | 
				
			||||||
        $mail_obj->from = [$this->entity->user->email, $this->entity->user->present()->name()];
 | 
					        $mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //send email
 | 
					        //send email
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
				
			|||||||
@ -91,7 +91,7 @@ class PaymentFailureMailer extends BaseMailerJob implements ShouldQueue
 | 
				
			|||||||
                unset($methods[$key]);
 | 
					                unset($methods[$key]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $mail_obj = (new PaymentFailureObject($this->client, $this->message, $this->amount, $this->company))->build();
 | 
					                $mail_obj = (new PaymentFailureObject($this->client, $this->message, $this->amount, $this->company))->build();
 | 
				
			||||||
                $mail_obj->from = [$this->company->owner()->email, $this->company->owner()->present()->name()];
 | 
					                $mail_obj->from = [config('mail.from.address'), config('mail.from.name')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //send email
 | 
					                //send email
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
 | 
				
			|||||||
@ -200,7 +200,8 @@ class Import implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $this->setInitialCompanyLedgerBalances();
 | 
					        $this->setInitialCompanyLedgerBalances();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        Mail::to($this->user)->send(new MigrationCompleted());
 | 
					        Mail::to($this->user)
 | 
				
			||||||
 | 
					            ->send(new MigrationCompleted());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*After a migration first some basic jobs to ensure the system is up to date*/
 | 
					        /*After a migration first some basic jobs to ensure the system is up to date*/
 | 
				
			||||||
        VersionCheck::dispatch();
 | 
					        VersionCheck::dispatch();
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,7 @@ class EntityNotificationMailer extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->from($this->mail_obj->from[0], $this->mail_obj->from[1])
 | 
					        return $this->from(config('mail.from.address'), config('mail.from.name'))
 | 
				
			||||||
                    ->subject($this->mail_obj->subject)
 | 
					                    ->subject($this->mail_obj->subject)
 | 
				
			||||||
                    ->markdown($this->mail_obj->markdown, $this->mail_obj->data)
 | 
					                    ->markdown($this->mail_obj->markdown, $this->mail_obj->data)
 | 
				
			||||||
                    ->withSwiftMessage(function ($message) {
 | 
					                    ->withSwiftMessage(function ($message) {
 | 
				
			||||||
 | 
				
			|||||||
@ -45,7 +45,7 @@ class BouncedEmail extends Mailable implements ShouldQueue
 | 
				
			|||||||
        $subject = ctrans("texts.notification_{$entity_type}_bounced_subject", ['invoice' => $invoice->number]);
 | 
					        $subject = ctrans("texts.notification_{$entity_type}_bounced_subject", ['invoice' => $invoice->number]);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
            $this->from($invitation->user->email)
 | 
					            $this->from(config('mail.from.name'), config('mail.from.address'))
 | 
				
			||||||
                ->text()
 | 
					                ->text()
 | 
				
			||||||
                ->subject($subject);
 | 
					                ->subject($subject);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,9 @@ class DownloadInvoices extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->subject(ctrans('texts.download_files'))
 | 
					        
 | 
				
			||||||
 | 
					        return $this->from(config('mail.from.name'), config('mail.from.address'))
 | 
				
			||||||
 | 
					            ->subject(ctrans('texts.download_files'))
 | 
				
			||||||
            ->markdown(
 | 
					            ->markdown(
 | 
				
			||||||
                'email.admin.download_files',
 | 
					                'email.admin.download_files',
 | 
				
			||||||
                [
 | 
					                [
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,8 @@ class ExistingMigration extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->view('email.migration.existing');
 | 
					
 | 
				
			||||||
 | 
					        return $this->from(config('mail.from.name'), config('mail.from.address'))
 | 
				
			||||||
 | 
					                    ->view('email.migration.existing');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,6 @@ class InvoiceWasPaid extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->view('email.invoices.paid');
 | 
					        return $this->from(config('mail.from.address'), config('mail.from.name'))->view('email.invoices.paid');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,7 @@ class MigrationCompleted extends Mailable
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $data['settings'] = auth()->user()->company()->settings;
 | 
					        $data['settings'] = auth()->user()->company()->settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->view('email.migration.completed', $data);
 | 
					        return $this->from(config('mail.from.name'), config('mail.from.address'))
 | 
				
			||||||
 | 
					                    ->view('email.migration.completed', $data);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,8 @@ class MigrationFailed extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->from('noreply@invoiceninja.com')
 | 
					        
 | 
				
			||||||
 | 
					        return $this->from(config('mail.from.name'), config('mail.from.address'))
 | 
				
			||||||
                    ->view('email.migration.failed');
 | 
					                    ->view('email.migration.failed');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -27,6 +27,6 @@ class QuoteWasApproved extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->view('email.quotes.approved');
 | 
					        return $this->from(config('mail.from.address'), config('mail.from.name'))->view('email.quotes.approved');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,7 @@ class SupportMessageSent extends Mailable
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $subject = "Customer MSG {$user->present()->name} - [{$plan} - DB:{$company->db}]";
 | 
					        $subject = "Customer MSG {$user->present()->name} - [{$plan} - DB:{$company->db}]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->from(config('mail.from.address')) //todo this needs to be fixed to handle the hosted version
 | 
					        return $this->from(config('mail.from.address'), config('mail.from.name')) //todo this needs to be fixed to handle the hosted version
 | 
				
			||||||
            ->subject($subject)
 | 
					            ->subject($subject)
 | 
				
			||||||
            ->markdown('email.support.message', [
 | 
					            ->markdown('email.support.message', [
 | 
				
			||||||
                'message' => $this->message,
 | 
					                'message' => $this->message,
 | 
				
			||||||
 | 
				
			|||||||
@ -52,7 +52,7 @@ class TemplateEmail extends Mailable
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $company = $this->client->company;
 | 
					        $company = $this->client->company;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->from($this->user->email, $this->user->present()->name());
 | 
					        $this->from(config('mail.from.address'), config('mail.from.name'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (strlen($settings->reply_to_email) > 1) {
 | 
					        if (strlen($settings->reply_to_email) > 1) {
 | 
				
			||||||
            $this->replyTo($settings->reply_to_email, $settings->reply_to_email);
 | 
					            $this->replyTo($settings->reply_to_email, $settings->reply_to_email);
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,7 @@ class TestMailServer extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->from($this->from_email) //todo this needs to be fixed to handle the hosted version
 | 
					        return $this->from(config('mail.from.address'), config('mail.from.name'))
 | 
				
			||||||
            ->subject(ctrans('texts.email'))
 | 
					            ->subject(ctrans('texts.email'))
 | 
				
			||||||
            ->markdown('email.support.message', [
 | 
					            ->markdown('email.support.message', [
 | 
				
			||||||
                'message' => $this->message,
 | 
					                'message' => $this->message,
 | 
				
			||||||
 | 
				
			|||||||
@ -34,7 +34,7 @@ class UserNotificationMailer extends Mailable
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->from($this->mail_obj->from[0], $this->mail_obj->from[1]) //todo
 | 
					        return $this->from(config('mail.from.address'), config('mail.from.name'))
 | 
				
			||||||
                    ->subject($this->mail_obj->subject)
 | 
					                    ->subject($this->mail_obj->subject)
 | 
				
			||||||
                    ->markdown($this->mail_obj->markdown, $this->mail_obj->data)
 | 
					                    ->markdown($this->mail_obj->markdown, $this->mail_obj->data)
 | 
				
			||||||
                    ->withSwiftMessage(function ($message) {
 | 
					                    ->withSwiftMessage(function ($message) {
 | 
				
			||||||
 | 
				
			|||||||
@ -116,9 +116,10 @@ class CreditCard
 | 
				
			|||||||
            'payment_method' => $this->stripe->payment_hash->data->server_response->payment_method,
 | 
					            'payment_method' => $this->stripe->payment_hash->data->server_response->payment_method,
 | 
				
			||||||
            'payment_type' => PaymentType::parseCardType(strtolower($stripe_method->card->brand)),
 | 
					            'payment_type' => PaymentType::parseCardType(strtolower($stripe_method->card->brand)),
 | 
				
			||||||
            'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->server_response->amount, $this->stripe->client->currency()->precision),
 | 
					            'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->server_response->amount, $this->stripe->client->currency()->precision),
 | 
				
			||||||
            'transaction_reference' => $this->stripe->payment_hash->data->server_response->id,
 | 
					            'transaction_reference' => optional($this->stripe->payment_hash->data->payment_intent->charges->data[0])->id,
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['amount' => $data['amount']]);
 | 
					        $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['amount' => $data['amount']]);
 | 
				
			||||||
        $this->stripe->payment_hash->save();
 | 
					        $this->stripe->payment_hash->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -279,7 +279,7 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!$customer) {
 | 
					        if (!$customer) {
 | 
				
			||||||
            throw new Exception('Unable to create gateway customer');
 | 
					            throw new \Exception('Unable to create gateway customer');
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $customer;
 | 
					        return $customer;
 | 
				
			||||||
@ -289,17 +289,16 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->init();
 | 
					        $this->init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /** Response from Stripe SDK/API. */
 | 
				
			||||||
 | 
					        $response = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
            $response = $this->stripe
 | 
					            $response = $this->stripe
 | 
				
			||||||
                ->refunds
 | 
					                ->refunds
 | 
				
			||||||
            ->create(['charge' => $payment->transaction_reference, 'amount' => $amount]);
 | 
					                ->create(['charge' => $payment->transaction_reference, 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision)]);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // $response = $this->gateway
 | 
					 | 
				
			||||||
        //     ->refund(['transactionReference' => $payment->transaction_reference, 'amount' => $amount, 'currency' => $payment->client->getCurrencyCode()])
 | 
					 | 
				
			||||||
        //     ->send();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($response->status == $response::STATUS_SUCCEEDED) {
 | 
					            if ($response->status == $response::STATUS_SUCCEEDED) {
 | 
				
			||||||
            SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),
 | 
					                SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client);
 | 
				
			||||||
            ], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return [
 | 
					                return [
 | 
				
			||||||
                    'transaction_reference' => $response->charge,
 | 
					                    'transaction_reference' => $response->charge,
 | 
				
			||||||
@ -310,8 +309,7 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
                ];
 | 
					                ];
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),
 | 
					            SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client);
 | 
				
			||||||
        ], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return [
 | 
					            return [
 | 
				
			||||||
                'transaction_reference' => null,
 | 
					                'transaction_reference' => null,
 | 
				
			||||||
@ -320,6 +318,19 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
                'description' => $response->failure_reason,
 | 
					                'description' => $response->failure_reason,
 | 
				
			||||||
                'code' => 422,
 | 
					                'code' => 422,
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
 | 
					        } catch (\Exception $e) {
 | 
				
			||||||
 | 
					            SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            info($e->getMessage());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return [
 | 
				
			||||||
 | 
					                'transaction_reference' => null,
 | 
				
			||||||
 | 
					                'transaction_response' => json_encode($response),
 | 
				
			||||||
 | 
					                'success' => false,
 | 
				
			||||||
 | 
					                'description' => $e->getMessage(),
 | 
				
			||||||
 | 
					                'code' => 422,
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function verificationView(ClientGatewayToken $payment_method)
 | 
					    public function verificationView(ClientGatewayToken $payment_method)
 | 
				
			||||||
@ -395,8 +406,8 @@ class StripePaymentDriver extends BaseDriver
 | 
				
			|||||||
     * https://stripe.com/docs/api/payment_methods/detach
 | 
					     * https://stripe.com/docs/api/payment_methods/detach
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param ClientGatewayToken $token
 | 
					     * @param ClientGatewayToken $token
 | 
				
			||||||
* @return void
 | 
					     * @return void
 | 
				
			||||||
*/
 | 
					     */
 | 
				
			||||||
    public function detach(ClientGatewayToken $token)
 | 
					    public function detach(ClientGatewayToken $token)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $stripe = new StripeClient(
 | 
					        $stripe = new StripeClient(
 | 
				
			||||||
 | 
				
			|||||||
@ -73,16 +73,18 @@ class RefundPayment
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($this->refund_data['gateway_refund'] !== false && $this->total_refund > 0) {
 | 
					        if ($this->refund_data['gateway_refund'] !== false && $this->total_refund > 0) {
 | 
				
			||||||
            if ($this->payment->company_gateway) {
 | 
					            if ($this->payment->company_gateway) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $response = $this->payment->company_gateway->driver($this->payment->client)->refund($this->payment, $this->total_refund);
 | 
					                $response = $this->payment->company_gateway->driver($this->payment->client)->refund($this->payment, $this->total_refund);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
                if ($response['success'] == false) {
 | 
					 | 
				
			||||||
                    throw new PaymentRefundFailed();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                $this->payment->refunded += $this->total_refund;
 | 
					                $this->payment->refunded += $this->total_refund;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $this->createActivity($this->payment);
 | 
					                $this->createActivity($this->payment);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if ($response['success'] == false) {
 | 
				
			||||||
 | 
					                    $this->payment->save();
 | 
				
			||||||
 | 
					                    throw new PaymentRefundFailed();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $this->payment->refunded += $this->total_refund;
 | 
					            $this->payment->refunded += $this->total_refund;
 | 
				
			||||||
 | 
				
			|||||||
@ -292,9 +292,18 @@ class Design extends BaseDesign
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $elements = [];
 | 
					        $elements = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Some of column can be aliased. This is simple workaround for these.
 | 
				
			||||||
 | 
					        $aliases = [
 | 
				
			||||||
 | 
					            '$task.product_key' => '$task.service',
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreach ($this->context['pdf_variables']["{$type}_columns"] as $column) {
 | 
					        foreach ($this->context['pdf_variables']["{$type}_columns"] as $column) {
 | 
				
			||||||
 | 
					            if (array_key_exists($column, $aliases)) {
 | 
				
			||||||
 | 
					                $elements[] = ['element' => 'th', 'content' => $aliases[$column] . '_label'];
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
                $elements[] = ['element' => 'th', 'content' => $column . '_label'];
 | 
					                $elements[] = ['element' => 'th', 'content' => $column . '_label'];
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $elements;
 | 
					        return $elements;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@ namespace App\Services\PdfMaker\Designs\Utilities;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Task;
 | 
					use App\Models\Task;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
 | 
					use Carbon\Carbon;
 | 
				
			||||||
use DOMDocument;
 | 
					use DOMDocument;
 | 
				
			||||||
use DOMXPath;
 | 
					use DOMXPath;
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
@ -249,12 +250,19 @@ trait DesignHelpers
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreach ($_logs as $log) {
 | 
					        foreach ($_logs as $log) {
 | 
				
			||||||
 | 
					            $start = Carbon::createFromTimestamp($log[0]);
 | 
				
			||||||
 | 
					            $finish = Carbon::createFromTimestamp($log[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if ($start->isSameDay($finish)) {
 | 
				
			||||||
 | 
					                $logs[] = sprintf('%s: %s - %s', $start->format($this->entity->client->date_format()), $start->format('h:i:s'), $finish->format('h:i:s'));
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
                $logs[] = sprintf(
 | 
					                $logs[] = sprintf(
 | 
				
			||||||
                    '%s - %s',
 | 
					                    '%s - %s',
 | 
				
			||||||
                \Carbon\Carbon::createFromTimestamp($log[0])->format($task->client->date_format() . ' h:i:s'),
 | 
					                    $start->format($this->entity->client->date_format() . ' h:i:s'),
 | 
				
			||||||
                \Carbon\Carbon::createFromTimestamp($log[1])->format($task->client->date_format() . ' h:i:s')
 | 
					                    $finish->format($this->entity->client->date_format() . ' h:i:s')
 | 
				
			||||||
                );
 | 
					                );
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $logs;
 | 
					        return $logs;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -316,6 +316,7 @@ class HtmlEngine
 | 
				
			|||||||
        $data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
 | 
					        $data['$task.tax_name2'] = ['value' => '', 'label' => ctrans('texts.tax')];
 | 
				
			||||||
        $data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
 | 
					        $data['$task.tax_name3'] = ['value' => '', 'label' => ctrans('texts.tax')];
 | 
				
			||||||
        $data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
 | 
					        $data['$task.line_total'] = ['value' => '', 'label' => ctrans('texts.line_total')];
 | 
				
			||||||
 | 
					        $data['$task.service'] = ['value' => '', 'label' => ctrans('texts.service')];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->settings->signature_on_pdf) {
 | 
					        if ($this->settings->signature_on_pdf) {
 | 
				
			||||||
            $data['$contact.signature'] = ['value' => $this->invitation->signature_base64, 'label' => ctrans('texts.signature')];
 | 
					            $data['$contact.signature'] = ['value' => $this->invitation->signature_base64, 'label' => ctrans('texts.signature')];
 | 
				
			||||||
 | 
				
			|||||||
@ -132,7 +132,7 @@ trait AppSetup
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (is_null($position)) {
 | 
					        if (is_null($position)) {
 | 
				
			||||||
            $words_count > 1 ? $env[] = "{$property}=" . '"' . $value . '"' . "\n" : $env[] = "{$property}=" . $value . "\n";
 | 
					            $words_count > 1 ? $env[] = "{$property}=" . '"' . $value . '"' . "\n" : $env[] = "{$property}=" . $value . "\n";
 | 
				
			||||||
        } else if ($words_count > 1) {
 | 
					        } elseif ($words_count > 1) {
 | 
				
			||||||
            $env[$position] = "{$property}=" . '"' . $value . '"' . "\n"; // If value of variable is more than one word, surround with quotes.
 | 
					            $env[$position] = "{$property}=" . '"' . $value . '"' . "\n"; // If value of variable is more than one word, surround with quotes.
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $env[$position] = "{$property}=" . $value . "\n"; // Just a normal variable update, with prexisting keys.
 | 
					            $env[$position] = "{$property}=" . $value . "\n"; // Just a normal variable update, with prexisting keys.
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,7 @@ return [
 | 
				
			|||||||
    'date_time_format' => 'Y-m-d H:i',
 | 
					    'date_time_format' => 'Y-m-d H:i',
 | 
				
			||||||
    'daily_email_limit' => 300,
 | 
					    'daily_email_limit' => 300,
 | 
				
			||||||
    'error_email' => env('ERROR_EMAIL', ''),
 | 
					    'error_email' => env('ERROR_EMAIL', ''),
 | 
				
			||||||
 | 
					    'mailer' => env('MAIL_MAILER',''),
 | 
				
			||||||
    'company_id' => 0,
 | 
					    'company_id' => 0,
 | 
				
			||||||
    'hash_salt' => env('HASH_SALT', ''),
 | 
					    'hash_salt' => env('HASH_SALT', ''),
 | 
				
			||||||
    'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''),
 | 
					    'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''),
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								public/flutter_service_worker.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								public/flutter_service_worker.js
									
									
									
									
										vendored
									
									
								
							@ -3,9 +3,9 @@ const MANIFEST = 'flutter-app-manifest';
 | 
				
			|||||||
const TEMP = 'flutter-temp-cache';
 | 
					const TEMP = 'flutter-temp-cache';
 | 
				
			||||||
const CACHE_NAME = 'flutter-app-cache';
 | 
					const CACHE_NAME = 'flutter-app-cache';
 | 
				
			||||||
const RESOURCES = {
 | 
					const RESOURCES = {
 | 
				
			||||||
  "version.json": "399f70d54a0cf071e6e83bb5382fcdf5",
 | 
					  "version.json": "32afcc2282ccf7746c00708ef0601017",
 | 
				
			||||||
"favicon.ico": "51636d3a390451561744c42188ccd628",
 | 
					"favicon.ico": "51636d3a390451561744c42188ccd628",
 | 
				
			||||||
"main.dart.js": "abbefac6e42c6ac8c46c784c474498bc",
 | 
					"main.dart.js": "93b0d3c3a17ae9148c1dfd198f6b450e",
 | 
				
			||||||
"/": "23224b5e03519aaa87594403d54412cf",
 | 
					"/": "23224b5e03519aaa87594403d54412cf",
 | 
				
			||||||
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
 | 
					"favicon.png": "dca91c54388f52eded692718d5a98b8b",
 | 
				
			||||||
"assets/AssetManifest.json": "ea09ed4b9b8b6c83d6896248aac7c527",
 | 
					"assets/AssetManifest.json": "ea09ed4b9b8b6c83d6896248aac7c527",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										196570
									
								
								public/main.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										196570
									
								
								public/main.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -1 +1 @@
 | 
				
			|||||||
{"app_name":"invoiceninja_flutter","version":"5.0.26","build_number":"26"}
 | 
					{"app_name":"invoiceninja_flutter","version":"5.0.27","build_number":"27"}
 | 
				
			||||||
@ -3214,7 +3214,7 @@ return [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    'checkout_com' => 'Checkout.com',
 | 
					    'checkout_com' => 'Checkout.com',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'footer_label' => 'Copyright © :year Invoice Ninja. All rights reserved.',
 | 
					    'footer_label' => 'Copyright © :year :company. All rights reserved.',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    'credit_card_invalid' => 'Provided credit card number is not valid.',
 | 
					    'credit_card_invalid' => 'Provided credit card number is not valid.',
 | 
				
			||||||
    'month_invalid' => 'Provided month is not valid.',
 | 
					    'month_invalid' => 'Provided month is not valid.',
 | 
				
			||||||
@ -3311,4 +3311,6 @@ return [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    'billing_country' => 'Billing Country',
 | 
					    'billing_country' => 'Billing Country',
 | 
				
			||||||
    'shipping_country' => 'Shipping Country',
 | 
					    'shipping_country' => 'Shipping Country',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    'service' => 'Service',
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
<footer class="bg-white px-4 py-5 shadow px-4 sm:px-6 md:px-8 flex justify-center border border-gray-200 justify-between items-center" x-data="{ privacy: false, tos: false }">
 | 
					<footer class="bg-white px-4 py-5 shadow px-4 sm:px-6 md:px-8 flex justify-center border border-gray-200 justify-between items-center" x-data="{ privacy: false, tos: false }">
 | 
				
			||||||
    <section>
 | 
					    <section>
 | 
				
			||||||
        <span class="text-xs md:text-sm text-gray-700">{{ ctrans('texts.footer_label', ['year' => date('Y')])  }}</span>
 | 
					        <span class="text-xs md:text-sm text-gray-700">{{ ctrans('texts.footer_label', ['company' => auth('contact')->user() ? (auth('contact')->user()->user->account->isPaid() ? auth('contact')->user()->company->present()->name() : 'Invoice Ninja') : 'Invoice Ninja', 'year' => date('Y')])  }}</span>
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        <div class="flex items-center space-x-2">
 | 
					        <div class="flex items-center space-x-2">
 | 
				
			||||||
            @if(strlen($client->getSetting('client_portal_privacy_policy')) > 1)
 | 
					            @if(strlen($client->getSetting('client_portal_privacy_policy')) > 1)
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,8 @@
 | 
				
			|||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
                @endforeach
 | 
					                @endforeach
 | 
				
			||||||
            </nav>
 | 
					            </nav>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            @if(!auth('contact')->user()->user->account->isPaid())
 | 
				
			||||||
            <div class="flex-shrink-0 flex bg-primary p-4 justify-center">
 | 
					            <div class="flex-shrink-0 flex bg-primary p-4 justify-center">
 | 
				
			||||||
                <div class="flex items-center">
 | 
					                <div class="flex items-center">
 | 
				
			||||||
                    <a href="https://www.facebook.com/invoiceninja/">
 | 
					                    <a href="https://www.facebook.com/invoiceninja/">
 | 
				
			||||||
@ -38,6 +40,7 @@
 | 
				
			|||||||
                    </a>
 | 
					                    </a>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					            @endif
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="flex-shrink-0 w-14"></div>
 | 
					        <div class="flex-shrink-0 w-14"></div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,8 @@
 | 
				
			|||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
                @endforeach
 | 
					                @endforeach
 | 
				
			||||||
            </nav>
 | 
					            </nav>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            @if(!auth('contact')->user()->user->account->isPaid())
 | 
				
			||||||
            <div class="flex-shrink-0 flex bg-primary p-4 justify-center">
 | 
					            <div class="flex-shrink-0 flex bg-primary p-4 justify-center">
 | 
				
			||||||
                <div class="flex items-center">
 | 
					                <div class="flex items-center">
 | 
				
			||||||
                    <a href="https://www.facebook.com/invoiceninja/">
 | 
					                    <a href="https://www.facebook.com/invoiceninja/">
 | 
				
			||||||
@ -44,6 +46,7 @@
 | 
				
			|||||||
                    </a>
 | 
					                    </a>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					            @endif
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <div class="flex-shrink-0 w-14"></div>
 | 
					        <div class="flex-shrink-0 w-14"></div>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,6 @@
 | 
				
			|||||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
 | 
					<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <head>
 | 
					    <head>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <!-- Source: https://github.com/invoiceninja/invoiceninja -->
 | 
					 | 
				
			||||||
        <!-- Error: {{ session('error') }} -->
 | 
					        <!-- Error: {{ session('error') }} -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @if (config('services.analytics.tracking_id'))
 | 
					        @if (config('services.analytics.tracking_id'))
 | 
				
			||||||
@ -32,8 +30,15 @@
 | 
				
			|||||||
            </script>
 | 
					            </script>
 | 
				
			||||||
        @endif
 | 
					        @endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- Title -->
 | 
					        <!-- Title -->
 | 
				
			||||||
        <title>@yield('meta_title', 'Invoice Ninja') — {{ config('app.name') }}</title>
 | 
					        @auth()
 | 
				
			||||||
 | 
					            <title>@yield('meta_title', '') — {{ auth('contact')->user()->user->account->isPaid() ? auth('contact')->user()->company->present()->name() : 'Invoice Ninja' }}</title>
 | 
				
			||||||
 | 
					        @endauth
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @guest
 | 
				
			||||||
 | 
					            <title>@yield('meta_title', '') — {{ config('app.name') }}</title>
 | 
				
			||||||
 | 
					        @endguest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <meta charset="utf-8">
 | 
					        <meta charset="utf-8">
 | 
				
			||||||
        <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
					        <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,6 @@
 | 
				
			|||||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
 | 
					<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <head>
 | 
					    <head>
 | 
				
			||||||
 | 
					 | 
				
			||||||
        <!-- Source: https://github.com/invoiceninja/invoiceninja -->
 | 
					 | 
				
			||||||
        <!-- Error: {{ session('error') }} -->
 | 
					        <!-- Error: {{ session('error') }} -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @if (config('services.analytics.tracking_id'))
 | 
					        @if (config('services.analytics.tracking_id'))
 | 
				
			||||||
@ -33,7 +31,13 @@
 | 
				
			|||||||
        @endif
 | 
					        @endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <!-- Title -->
 | 
					        <!-- Title -->
 | 
				
			||||||
        <title>@yield('meta_title', 'Invoice Ninja') | {{ config('app.name') }}</title>
 | 
					        @auth()
 | 
				
			||||||
 | 
					            <title>@yield('meta_title', '') — {{ auth('contact')->user()->user->account->isPaid() ? auth('contact')->user()->company->present()->name() : 'Invoice Ninja' }}</title>
 | 
				
			||||||
 | 
					        @endauth
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        @guest
 | 
				
			||||||
 | 
					            <title>@yield('meta_title', '') — {{ config('app.name') }}</title>
 | 
				
			||||||
 | 
					        @endguest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <meta charset="utf-8">
 | 
					        <meta charset="utf-8">
 | 
				
			||||||
        <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
					        <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user