mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 19:37:32 -05:00 
			
		
		
		
	
						commit
						09a03bffe9
					
				
							
								
								
									
										2
									
								
								.github/workflows/phpunit.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/phpunit.yml
									
									
									
									
										vendored
									
									
								
							@ -55,7 +55,7 @@ jobs:
 | 
			
		||||
 | 
			
		||||
    - name: Start mysql service
 | 
			
		||||
      run: |
 | 
			
		||||
        sudo /etc/init.d/mysql start
 | 
			
		||||
        sudo systemctl start mysql.service
 | 
			
		||||
    - name: Verify MariaDB connection
 | 
			
		||||
      env:
 | 
			
		||||
        DB_PORT: ${{ job.services.mariadb.ports[3306] }}
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
5.3.35
 | 
			
		||||
5.3.36
 | 
			
		||||
@ -29,7 +29,7 @@ class ContactRegisterController extends Controller
 | 
			
		||||
 | 
			
		||||
    public function showRegisterForm(string $company_key = '')
 | 
			
		||||
    {
 | 
			
		||||
        $key = request()->session()->has('key') ? request()->session()->get('key') : $company_key;
 | 
			
		||||
        $key = request()->session()->has('company_key') ? request()->session()->get('company_key') : $company_key;
 | 
			
		||||
 | 
			
		||||
        $company = Company::where('company_key', $key)->firstOrFail();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -224,7 +224,7 @@ class InvitationController extends Controller
 | 
			
		||||
 | 
			
		||||
        $gateways = $invitation->contact->client->service()->getPaymentMethods($amount);
 | 
			
		||||
 | 
			
		||||
        if(is_array($gateways))
 | 
			
		||||
        if(is_array($gateways) && count($gateways) >=1)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            $data = [
 | 
			
		||||
@ -241,6 +241,11 @@ class InvitationController extends Controller
 | 
			
		||||
            return (new InstantPayment($request))->run();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $entity = 'invoice';
 | 
			
		||||
 | 
			
		||||
        if($invoice && is_array($gateways) && count($gateways) == 0)
 | 
			
		||||
            return redirect()->route('client.invoice.show', ['invoice' => $this->encodePrimaryKey($invitation->invoice_id)]);
 | 
			
		||||
 | 
			
		||||
        abort(404, "Invoice not found");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -30,6 +30,7 @@ use Illuminate\Support\Facades\Storage;
 | 
			
		||||
use Illuminate\View\View;
 | 
			
		||||
use ZipStream\Option\Archive;
 | 
			
		||||
use ZipStream\ZipStream;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
 | 
			
		||||
class InvoiceController extends Controller
 | 
			
		||||
{
 | 
			
		||||
@ -88,6 +89,12 @@ class InvoiceController extends Controller
 | 
			
		||||
     * @param ProcessInvoicesInBulkRequest $request
 | 
			
		||||
     * @return mixed
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public function catch_bulk()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->render('invoices.index');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function bulk(ProcessInvoicesInBulkRequest $request)
 | 
			
		||||
    {
 | 
			
		||||
        $transformed_ids = $this->transformKeys($request->invoices);
 | 
			
		||||
@ -95,7 +102,8 @@ class InvoiceController extends Controller
 | 
			
		||||
        if ($request->input('action') == 'payment') {
 | 
			
		||||
            return $this->makePayment((array) $transformed_ids);
 | 
			
		||||
        } elseif ($request->input('action') == 'download') {
 | 
			
		||||
            return $this->downloadInvoicePDF((array) $transformed_ids);
 | 
			
		||||
            return $this->downloadInvoices((array) $transformed_ids);
 | 
			
		||||
            // return $this->downloadInvoicePDF((array) $transformed_ids);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return redirect()
 | 
			
		||||
@ -103,6 +111,25 @@ class InvoiceController extends Controller
 | 
			
		||||
            ->with('message', ctrans('texts.no_action_provided'));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function downloadInvoices($ids)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $data['invoices'] = Invoice::whereIn('id', $ids)
 | 
			
		||||
                            ->whereClientId(auth()->user()->client->id)
 | 
			
		||||
                            ->withTrashed()
 | 
			
		||||
                            ->get();
 | 
			
		||||
 | 
			
		||||
        if(count($data['invoices']) == 0)
 | 
			
		||||
            return back()->with(['message' => ctrans('texts.no_items_selected')]);
 | 
			
		||||
 | 
			
		||||
        return $this->render('invoices.download', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function download(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
        $transformed_ids = $this->transformKeys($request->invoices);
 | 
			
		||||
        return $this->downloadInvoicePDF((array) $transformed_ids);
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * @param array $ids 
 | 
			
		||||
     * @return Factory|View|RedirectResponse 
 | 
			
		||||
@ -178,6 +205,7 @@ class InvoiceController extends Controller
 | 
			
		||||
    private function downloadInvoicePDF(array $ids)
 | 
			
		||||
    {
 | 
			
		||||
        $invoices = Invoice::whereIn('id', $ids)
 | 
			
		||||
                            ->withTrashed()
 | 
			
		||||
                            ->whereClientId(auth()->user()->client->id)
 | 
			
		||||
                            ->get();
 | 
			
		||||
 | 
			
		||||
@ -193,6 +221,8 @@ class InvoiceController extends Controller
 | 
			
		||||
 | 
			
		||||
           $file = $invoice->service()->getInvoicePdf(auth()->user());
 | 
			
		||||
 | 
			
		||||
           // return response()->download(file_get_contents(public_path($file)));
 | 
			
		||||
 | 
			
		||||
            return response()->streamDownload(function () use($file) {
 | 
			
		||||
                    echo Storage::get($file);
 | 
			
		||||
            },  basename($file), ['Content-Type' => 'application/pdf']);
 | 
			
		||||
 | 
			
		||||
@ -69,6 +69,11 @@ class PaymentController extends Controller
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function catch_process(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
        return $this->render('payments.index');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Presents the payment screen for a given
 | 
			
		||||
     * gateway and payment method.
 | 
			
		||||
 | 
			
		||||
@ -30,6 +30,7 @@ use Illuminate\View\View;
 | 
			
		||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
 | 
			
		||||
use ZipStream\Option\Archive;
 | 
			
		||||
use ZipStream\ZipStream;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
 | 
			
		||||
class QuoteController extends Controller
 | 
			
		||||
{
 | 
			
		||||
@ -58,17 +59,16 @@ class QuoteController extends Controller
 | 
			
		||||
            'quote' => $quote,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $invitation = $quote->invitations()->where('client_contact_id', auth()->user()->id)->first();
 | 
			
		||||
 | 
			
		||||
            $invitation = $quote->invitations()->where('client_contact_id', auth()->user()->id)->first();
 | 
			
		||||
        if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
 | 
			
		||||
 | 
			
		||||
            if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
 | 
			
		||||
            $invitation->markViewed();
 | 
			
		||||
 | 
			
		||||
                $invitation->markViewed();
 | 
			
		||||
 | 
			
		||||
                event(new InvitationWasViewed($quote, $invitation, $quote->company, Ninja::eventVars()));
 | 
			
		||||
                event(new QuoteWasViewed($invitation, $invitation->company, Ninja::eventVars()));
 | 
			
		||||
            
 | 
			
		||||
            }
 | 
			
		||||
            event(new InvitationWasViewed($quote, $invitation, $quote->company, Ninja::eventVars()));
 | 
			
		||||
            event(new QuoteWasViewed($invitation, $invitation->company, Ninja::eventVars()));
 | 
			
		||||
        
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($request->query('mode') === 'fullscreen') {
 | 
			
		||||
            return render('quotes.show-fullscreen', $data);
 | 
			
		||||
@ -82,7 +82,7 @@ class QuoteController extends Controller
 | 
			
		||||
        $transformed_ids = $this->transformKeys($request->quotes);
 | 
			
		||||
 | 
			
		||||
        if ($request->action == 'download') {
 | 
			
		||||
            return $this->downloadQuotePdf((array) $transformed_ids);
 | 
			
		||||
            return $this->downloadQuotes((array) $transformed_ids);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($request->action = 'approve') {
 | 
			
		||||
@ -92,10 +92,32 @@ class QuoteController extends Controller
 | 
			
		||||
        return back();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function downloadQuotes($ids)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $data['quotes'] = Quote::whereIn('id', $ids)
 | 
			
		||||
                            ->whereClientId(auth()->user()->client->id)
 | 
			
		||||
                            ->withTrashed()
 | 
			
		||||
                            ->get();
 | 
			
		||||
 | 
			
		||||
        if(count($data['quotes']) == 0)
 | 
			
		||||
            return back()->with(['message' => ctrans('texts.no_items_selected')]);
 | 
			
		||||
 | 
			
		||||
        return $this->render('quotes.download', $data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function download(Request $request)
 | 
			
		||||
    {
 | 
			
		||||
        $transformed_ids = $this->transformKeys($request->quotes);
 | 
			
		||||
        
 | 
			
		||||
        return $this->downloadQuotePdf((array) $transformed_ids);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function downloadQuotePdf(array $ids)
 | 
			
		||||
    {
 | 
			
		||||
        $quotes = Quote::whereIn('id', $ids)
 | 
			
		||||
            ->whereClientId(auth()->user()->client->id)
 | 
			
		||||
            ->withTrashed()
 | 
			
		||||
            ->get();
 | 
			
		||||
 | 
			
		||||
        if (! $quotes || $quotes->count() == 0) {
 | 
			
		||||
@ -136,6 +158,7 @@ class QuoteController extends Controller
 | 
			
		||||
            ->where('client_id', auth('contact')->user()->client->id)
 | 
			
		||||
            ->where('company_id', auth('contact')->user()->client->company_id)
 | 
			
		||||
            ->where('status_id', Quote::STATUS_SENT)
 | 
			
		||||
            ->withTrashed()
 | 
			
		||||
            ->get();
 | 
			
		||||
 | 
			
		||||
        if (!$quotes || $quotes->count() == 0) {
 | 
			
		||||
 | 
			
		||||
@ -37,7 +37,7 @@ class ContactRegister
 | 
			
		||||
                if(! $company->client_can_register)
 | 
			
		||||
                    abort(400, 'Registration disabled');
 | 
			
		||||
 | 
			
		||||
                    session()->put('key', $company->company_key);
 | 
			
		||||
                    session()->put('company_key', $company->company_key);
 | 
			
		||||
 | 
			
		||||
                return $next($request);
 | 
			
		||||
            }
 | 
			
		||||
@ -56,7 +56,7 @@ class ContactRegister
 | 
			
		||||
                abort(400, 'Registration disabled');
 | 
			
		||||
 | 
			
		||||
           // $request->merge(['key' => $company->company_key]);
 | 
			
		||||
            session()->put('key', $company->company_key);
 | 
			
		||||
            session()->put('company_key', $company->company_key);
 | 
			
		||||
 | 
			
		||||
            return $next($request);
 | 
			
		||||
        }
 | 
			
		||||
@ -71,7 +71,7 @@ class ContactRegister
 | 
			
		||||
                abort(400, 'Registration disabled');
 | 
			
		||||
 | 
			
		||||
            //$request->merge(['key' => $company->company_key]);
 | 
			
		||||
            session()->put('key', $company->company_key);
 | 
			
		||||
            session()->put('company_key', $company->company_key);
 | 
			
		||||
 | 
			
		||||
            return $next($request);
 | 
			
		||||
        }
 | 
			
		||||
@ -85,7 +85,7 @@ class ContactRegister
 | 
			
		||||
                abort(400, 'Registration disabled');
 | 
			
		||||
 | 
			
		||||
            //$request->merge(['key' => $company->company_key]);
 | 
			
		||||
            session()->put('key', $company->company_key);
 | 
			
		||||
            session()->put('company_key', $company->company_key);
 | 
			
		||||
 | 
			
		||||
            return $next($request);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,7 @@ class UrlSetDb
 | 
			
		||||
 | 
			
		||||
            $hashed_db = $hashids->decode($segments[0]);
 | 
			
		||||
 | 
			
		||||
            if(!is_array($hashed_db))
 | 
			
		||||
            if(!is_array($hashed_db) || empty($hashed_db))
 | 
			
		||||
                return response()->json(['message' => 'Invalid confirmation code'], 403);
 | 
			
		||||
 | 
			
		||||
            MultiDB::setDB(MultiDB::DB_PREFIX.str_pad($hashed_db[0], 2, '0', STR_PAD_LEFT));
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@ use App\Models\CompanyGateway;
 | 
			
		||||
use App\Models\PaymentHash;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
use Illuminate\Foundation\Http\FormRequest;
 | 
			
		||||
use App\Libraries\MultiDB;
 | 
			
		||||
 | 
			
		||||
class IbpRequest extends FormRequest
 | 
			
		||||
{
 | 
			
		||||
@ -30,6 +31,8 @@ class IbpRequest extends FormRequest
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize()
 | 
			
		||||
    {
 | 
			
		||||
        MultiDB::findAndSetDbByCompanyKey($this->company_key);
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -47,7 +47,7 @@ class PaymentWebhookRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function getCompanyGateway()
 | 
			
		||||
    {
 | 
			
		||||
        return CompanyGateway::findOrFail($this->decodePrimaryKey($this->company_gateway_id));
 | 
			
		||||
        return CompanyGateway::withTrashed()->findOrFail($this->decodePrimaryKey($this->company_gateway_id));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -51,6 +51,7 @@ class CreateStatementRequest extends Request
 | 
			
		||||
 | 
			
		||||
    public function client(): ?Client
 | 
			
		||||
    {
 | 
			
		||||
        return Client::with('company')->where('id', $this->client_id)->withTrashed()->first();
 | 
			
		||||
        // return Client::without('gateway_tokens','documents','contacts.company',)->where('id', $this->client_id)->withTrashed()->first();
 | 
			
		||||
        return Client::without('company',)->where('id', $this->client_id)->withTrashed()->first();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -126,8 +126,6 @@ class InvoiceTransformer extends BaseTransformer {
 | 
			
		||||
		}
 | 
			
		||||
		$transformed['line_items'] = $line_items;
 | 
			
		||||
 | 
			
		||||
nlog($transformed);
 | 
			
		||||
 | 
			
		||||
		return $transformed;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -105,18 +105,18 @@ class CompanyExport implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
        })->makeHidden(['id'])->all();
 | 
			
		||||
 | 
			
		||||
        $this->export_data['backups'] = $this->company->all_activities()->with('backup')->cursor()->map(function ($activity){
 | 
			
		||||
        // $this->export_data['backups'] = $this->company->all_activities()->with('backup')->cursor()->map(function ($activity){
 | 
			
		||||
 | 
			
		||||
            $backup = $activity->backup;
 | 
			
		||||
        //     $backup = $activity->backup;
 | 
			
		||||
 | 
			
		||||
            if(!$backup)
 | 
			
		||||
                return;
 | 
			
		||||
        //     if(!$backup)
 | 
			
		||||
        //         return;
 | 
			
		||||
 | 
			
		||||
            $backup->activity_id = $this->encodePrimaryKey($backup->activity_id);
 | 
			
		||||
        //     $backup->activity_id = $this->encodePrimaryKey($backup->activity_id);
 | 
			
		||||
 | 
			
		||||
            return $backup;
 | 
			
		||||
        //     return $backup;
 | 
			
		||||
 | 
			
		||||
        })->all();
 | 
			
		||||
        // })->all();
 | 
			
		||||
 | 
			
		||||
        $this->export_data['users'] = $this->company->users()->withTrashed()->cursor()->map(function ($user){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -143,7 +143,7 @@ class CompanyImport implements ShouldQueue
 | 
			
		||||
        'tasks',
 | 
			
		||||
        'payments',
 | 
			
		||||
        'activities',
 | 
			
		||||
        'backups',
 | 
			
		||||
        // 'backups',
 | 
			
		||||
        'company_ledger',
 | 
			
		||||
        'designs',
 | 
			
		||||
        'documents',
 | 
			
		||||
@ -874,20 +874,13 @@ class CompanyImport implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
        $activities = [];
 | 
			
		||||
 | 
			
		||||
        // foreach($this->backup_file->activities as $activity)
 | 
			
		||||
        // foreach((object)$this->getObject("activities") as $obj)
 | 
			
		||||
        // {
 | 
			
		||||
        //     $activity->account_id = $this->account->id;
 | 
			
		||||
        //     $activities[] = $activity;
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
        // $this->backup_file->activities = $activities;
 | 
			
		||||
 | 
			
		||||
        $this->genericNewClassImport(Activity::class, 
 | 
			
		||||
            [
 | 
			
		||||
                'hashed_id',
 | 
			
		||||
                'company_id',
 | 
			
		||||
                'backup',
 | 
			
		||||
                'invitation_id',
 | 
			
		||||
            ], 
 | 
			
		||||
            [
 | 
			
		||||
                ['users' => 'user_id'], 
 | 
			
		||||
@ -903,7 +896,7 @@ class CompanyImport implements ShouldQueue
 | 
			
		||||
                ['quotes' => 'quote_id'],
 | 
			
		||||
                ['subscriptions' => 'subscription_id'],
 | 
			
		||||
                ['recurring_invoices' => 'recurring_invoice_id'],
 | 
			
		||||
                ['invitations' => 'invitation_id'],
 | 
			
		||||
                // ['invitations' => 'invitation_id'],
 | 
			
		||||
            ], 
 | 
			
		||||
            'activities');
 | 
			
		||||
 | 
			
		||||
@ -1438,7 +1431,9 @@ class CompanyImport implements ShouldQueue
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (! array_key_exists($resource, $this->ids)) {
 | 
			
		||||
            // nlog($this->ids);
 | 
			
		||||
             nlog($resource);
 | 
			
		||||
 | 
			
		||||
            nlog($this->ids);
 | 
			
		||||
            
 | 
			
		||||
            $this->sendImportMail("The Import failed due to missing data in the import file. Resource {$resource} not available.");
 | 
			
		||||
            throw new \Exception("Resource {$resource} not available.");
 | 
			
		||||
 | 
			
		||||
@ -28,6 +28,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
 | 
			
		||||
use Illuminate\Queue\InteractsWithQueue;
 | 
			
		||||
use Illuminate\Queue\SerializesModels;
 | 
			
		||||
use Illuminate\Support\Carbon;
 | 
			
		||||
use Illuminate\Support\Facades\App;
 | 
			
		||||
 | 
			
		||||
//@DEPRECATED
 | 
			
		||||
class SendReminders implements ShouldQueue
 | 
			
		||||
@ -284,6 +285,11 @@ class SendReminders implements ShouldQueue
 | 
			
		||||
     */
 | 
			
		||||
    private function setLateFee($invoice, $amount, $percent) :Invoice
 | 
			
		||||
    {
 | 
			
		||||
        App::forgetInstance('translator');
 | 
			
		||||
        $t = app('translator');
 | 
			
		||||
        $t->replace(Ninja::transformTranslations($invoice->client->getMergedSettings()));
 | 
			
		||||
        App::setLocale($invoice->client->locale());
 | 
			
		||||
 | 
			
		||||
        $temp_invoice_balance = $invoice->balance;
 | 
			
		||||
 | 
			
		||||
        if ($amount <= 0 && $percent <= 0) {
 | 
			
		||||
@ -313,8 +319,8 @@ class SendReminders implements ShouldQueue
 | 
			
		||||
        /**Refresh Invoice values*/
 | 
			
		||||
        $invoice = $invoice->calc()->getInvoice();
 | 
			
		||||
 | 
			
		||||
        $this->invoice->client->service()->updateBalance($this->invoice->balance - $temp_invoice_balance)->save();
 | 
			
		||||
        $this->invoice->ledger()->updateInvoiceBalance($this->invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$this->invoice->number}");
 | 
			
		||||
        $invoice->client->service()->updateBalance($invoice->balance - $temp_invoice_balance)->save();
 | 
			
		||||
        $invoice->ledger()->updateInvoiceBalance($invoice->balance - $temp_invoice_balance, "Late Fee Adjustment for invoice {$invoice->number}");
 | 
			
		||||
 | 
			
		||||
        return $invoice;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -83,8 +83,6 @@ class SendRecurring implements ShouldQueue
 | 
			
		||||
                               //->createInvitations() //need to only link invitations to those in the recurring invoice
 | 
			
		||||
                               ->fillDefaults()
 | 
			
		||||
                               ->save();
 | 
			
		||||
            
 | 
			
		||||
            $invoice = $this->createRecurringInvitations($invoice);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
@ -94,6 +92,8 @@ class SendRecurring implements ShouldQueue
 | 
			
		||||
                               ->save();            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $invoice = $this->createRecurringInvitations($invoice);
 | 
			
		||||
 | 
			
		||||
        nlog("updating recurring invoice dates");
 | 
			
		||||
        /* Set next date here to prevent a recurring loop forming */
 | 
			
		||||
        $this->recurring_invoice->next_send_date = $this->recurring_invoice->nextSendDate();
 | 
			
		||||
@ -122,27 +122,30 @@ class SendRecurring implements ShouldQueue
 | 
			
		||||
 | 
			
		||||
        event('eloquent.created: App\Models\Invoice', $invoice);
 | 
			
		||||
 | 
			
		||||
        //Admin notification for recurring invoice sent. 
 | 
			
		||||
        if ($invoice->invitations->count() >= 1 ) {
 | 
			
		||||
            $invoice->entityEmailEvent($invoice->invitations->first(), 'invoice', 'email_template_invoice');
 | 
			
		||||
        }
 | 
			
		||||
    
 | 
			
		||||
        nlog("Invoice {$invoice->number} created");
 | 
			
		||||
 | 
			
		||||
        $invoice->invitations->each(function ($invitation) use ($invoice) {
 | 
			
		||||
            if ($invitation->contact && !$invitation->contact->trashed() && strlen($invitation->contact->email) >=1 && $invoice->client->getSetting('auto_email_invoice')) {
 | 
			
		||||
 | 
			
		||||
                try{
 | 
			
		||||
                    EmailEntity::dispatch($invitation, $invoice->company)->delay(now()->addSeconds(1));
 | 
			
		||||
                }
 | 
			
		||||
                catch(\Exception $e) {
 | 
			
		||||
                    nlog($e->getMessage());
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                nlog("Firing email for invoice {$invoice->number}");
 | 
			
		||||
        if($invoice->client->getSetting('auto_email_invoice'))
 | 
			
		||||
        {
 | 
			
		||||
            //Admin notification for recurring invoice sent. 
 | 
			
		||||
            if ($invoice->invitations->count() >= 1 ) {
 | 
			
		||||
                $invoice->entityEmailEvent($invoice->invitations->first(), 'invoice', 'email_template_invoice');
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    
 | 
			
		||||
        
 | 
			
		||||
            nlog("Invoice {$invoice->number} created");
 | 
			
		||||
 | 
			
		||||
            $invoice->invitations->each(function ($invitation) use ($invoice) {
 | 
			
		||||
                if ($invitation->contact && !$invitation->contact->trashed() && strlen($invitation->contact->email) >=1 && $invoice->client->getSetting('auto_email_invoice')) {
 | 
			
		||||
 | 
			
		||||
                    try{
 | 
			
		||||
                        EmailEntity::dispatch($invitation, $invoice->company)->delay(now()->addSeconds(1));
 | 
			
		||||
                    }
 | 
			
		||||
                    catch(\Exception $e) {
 | 
			
		||||
                        nlog($e->getMessage());
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    nlog("Firing email for invoice {$invoice->number}");
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
 | 
			
		||||
            nlog("attempting to autobill {$invoice->number}");
 | 
			
		||||
            $invoice->service()->autoBill();
 | 
			
		||||
 | 
			
		||||
@ -152,9 +152,11 @@ class ReminderJob implements ShouldQueue
 | 
			
		||||
     */
 | 
			
		||||
    private function setLateFee($invoice, $amount, $percent) :Invoice
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        App::forgetInstance('translator');
 | 
			
		||||
        $t = app('translator');
 | 
			
		||||
        $t->replace(Ninja::transformTranslations($invoice->client->getMergedSettings()));
 | 
			
		||||
        App::setLocale($invoice->client->locale());
 | 
			
		||||
 | 
			
		||||
        $temp_invoice_balance = $invoice->balance;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -222,17 +222,6 @@ class BaseRepository
 | 
			
		||||
        if (array_key_exists('documents', $data)) 
 | 
			
		||||
            $this->saveDocuments($data['documents'], $model);
 | 
			
		||||
 | 
			
		||||
        /* Marks whether the client contact should receive emails based on the send_email property */
 | 
			
		||||
        // if (isset($data['client_contacts'])) {
 | 
			
		||||
        //     foreach ($data['client_contacts'] as $contact) {
 | 
			
		||||
        //         if ($contact['send_email'] == 1 && is_string($contact['id'])) {
 | 
			
		||||
        //             $client_contact = ClientContact::find($this->decodePrimaryKey($contact['id']));
 | 
			
		||||
        //             $client_contact->send_email = true;
 | 
			
		||||
        //             $client_contact->save();
 | 
			
		||||
        //         }
 | 
			
		||||
        //     }
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
        /* If invitations are present we need to filter existing invitations with the new ones */
 | 
			
		||||
        if (isset($data['invitations'])) {
 | 
			
		||||
            $invitations = collect($data['invitations']);
 | 
			
		||||
 | 
			
		||||
@ -77,6 +77,7 @@ class AddGatewayFee extends AbstractService
 | 
			
		||||
        App::forgetInstance('translator');
 | 
			
		||||
        $t = app('translator');
 | 
			
		||||
        $t->replace(Ninja::transformTranslations($this->invoice->company->settings));
 | 
			
		||||
        App::setLocale($this->invoice->client->locale());
 | 
			
		||||
 | 
			
		||||
        $invoice_item = new InvoiceItem;
 | 
			
		||||
        $invoice_item->type_id = '3';
 | 
			
		||||
 | 
			
		||||
@ -621,12 +621,13 @@ class Design extends BaseDesign
 | 
			
		||||
 | 
			
		||||
        $variables = $this->context['pdf_variables']['total_columns'];
 | 
			
		||||
 | 
			
		||||
        /* 'labels' is a protected value - if the user enters labels it attempts to replace this string again - we need to set labels are a protected text label and remove it from the string */
 | 
			
		||||
        $elements = [
 | 
			
		||||
            ['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [
 | 
			
		||||
                ['element' => 'p', 'content' => strtr($_variables['values']['$entity.public_notes'], $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']],
 | 
			
		||||
                ['element' => 'p', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.public_notes']), $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']],
 | 
			
		||||
                ['element' => 'p', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column;'], 'elements' => [
 | 
			
		||||
                    ['element' => 'span', 'content' => '$entity.terms_label: ', 'properties' => ['hidden' => $this->entityVariableCheck('$entity.terms'), 'data-ref' => 'total_table-terms-label', 'style' => 'font-weight: bold; text-align: left; margin-top: 1rem;']],
 | 
			
		||||
                    ['element' => 'span', 'content' => strtr($_variables['values']['$entity.terms'], $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']],
 | 
			
		||||
                    ['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']],
 | 
			
		||||
                ]],
 | 
			
		||||
                ['element' => 'img', 'properties' => ['style' => 'max-width: 50%; height: auto;', 'src' => '$contact.signature', 'id' => 'contact-signature']],
 | 
			
		||||
                ['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start;'], 'elements' => [
 | 
			
		||||
 | 
			
		||||
@ -14,8 +14,8 @@ return [
 | 
			
		||||
    'require_https' => env('REQUIRE_HTTPS', true),
 | 
			
		||||
    'app_url' => rtrim(env('APP_URL', ''), '/'),
 | 
			
		||||
    'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
 | 
			
		||||
    'app_version' => '5.3.35',
 | 
			
		||||
    'app_tag' => '5.3.35',
 | 
			
		||||
    'app_version' => '5.3.36',
 | 
			
		||||
    'app_tag' => '5.3.36',
 | 
			
		||||
    'minimum_client_version' => '5.0.16',
 | 
			
		||||
    'terms_version' => '1.0.1',
 | 
			
		||||
    'api_secret' => env('API_SECRET', ''),
 | 
			
		||||
@ -38,7 +38,7 @@ return [
 | 
			
		||||
    'trusted_proxies' => env('TRUSTED_PROXIES', false),
 | 
			
		||||
    'is_docker' => env('IS_DOCKER', false),
 | 
			
		||||
    'local_download' => env('LOCAL_DOWNLOAD', false),
 | 
			
		||||
    'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://32f01ea994744fa08a0f688769cef78a@sentry.invoicing.co/9'),
 | 
			
		||||
    'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://39389664f3f14969b4c43dadda00a40b@sentry2.invoicing.co/5'),
 | 
			
		||||
    'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
 | 
			
		||||
	'preconfigured_install' => env('PRECONFIGURED_INSTALL',false),
 | 
			
		||||
    'update_secret' => env('UPDATE_SECRET', ''),
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										108
									
								
								phpunit.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								phpunit.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,108 @@
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches:
 | 
			
		||||
      - v5-develop
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches:
 | 
			
		||||
      - v5-develop
 | 
			
		||||
 | 
			
		||||
name: phpunit
 | 
			
		||||
jobs:
 | 
			
		||||
  run:
 | 
			
		||||
    runs-on: ${{ matrix.operating-system }}
 | 
			
		||||
    strategy:
 | 
			
		||||
      matrix:
 | 
			
		||||
        operating-system: ['ubuntu-18.04', 'ubuntu-20.04']
 | 
			
		||||
        php-versions: ['7.3','7.4','8.0']
 | 
			
		||||
        phpunit-versions: ['latest']
 | 
			
		||||
 | 
			
		||||
    env:
 | 
			
		||||
      DB_DATABASE1: ninja
 | 
			
		||||
      DB_USERNAME1: root
 | 
			
		||||
      DB_PASSWORD1: ninja
 | 
			
		||||
      DB_HOST1: '127.0.0.1'
 | 
			
		||||
      DB_DATABASE: ninja
 | 
			
		||||
      DB_USERNAME: root
 | 
			
		||||
      DB_PASSWORD: ninja
 | 
			
		||||
      DB_HOST: '127.0.0.1'
 | 
			
		||||
      BROADCAST_DRIVER: log
 | 
			
		||||
      CACHE_DRIVER: file
 | 
			
		||||
      QUEUE_CONNECTION: sync
 | 
			
		||||
      SESSION_DRIVER: file
 | 
			
		||||
      NINJA_ENVIRONMENT: hosted
 | 
			
		||||
      MULTI_DB_ENABLED: false
 | 
			
		||||
      NINJA_LICENSE: 123456
 | 
			
		||||
      TRAVIS: true
 | 
			
		||||
      MAIL_MAILER: log
 | 
			
		||||
 | 
			
		||||
    services:
 | 
			
		||||
      mariadb:
 | 
			
		||||
        image: mariadb:latest
 | 
			
		||||
        ports:
 | 
			
		||||
          - 32768:3306
 | 
			
		||||
        env:
 | 
			
		||||
          MYSQL_ALLOW_EMPTY_PASSWORD: yes
 | 
			
		||||
          MYSQL_USER: ninja
 | 
			
		||||
          MYSQL_PASSWORD: ninja
 | 
			
		||||
          MYSQL_DATABASE: ninja
 | 
			
		||||
          MYSQL_ROOT_PASSWORD: ninja
 | 
			
		||||
        options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Start mysql service
 | 
			
		||||
      run: |
 | 
			
		||||
        sudo systemctl start mysql.service
 | 
			
		||||
    - name: Verify MariaDB connection
 | 
			
		||||
      env:
 | 
			
		||||
        DB_PORT: ${{ job.services.mariadb.ports[3306] }}
 | 
			
		||||
        DB_PORT1: ${{ job.services.mariadb.ports[3306] }}
 | 
			
		||||
 | 
			
		||||
      run: |
 | 
			
		||||
        while ! mysqladmin ping -h"127.0.0.1" -P"$DB_PORT" --silent; do
 | 
			
		||||
          sleep 1
 | 
			
		||||
        done
 | 
			
		||||
    - name: Setup PHP
 | 
			
		||||
      uses: shivammathur/setup-php@v2
 | 
			
		||||
      with:
 | 
			
		||||
        php-version: ${{ matrix.php-versions }}
 | 
			
		||||
        extensions: mysql, mysqlnd, sqlite3, bcmath, gmp, gd, curl, zip, openssl, mbstring, xml
 | 
			
		||||
 | 
			
		||||
    - uses: actions/checkout@v1
 | 
			
		||||
      with:
 | 
			
		||||
        ref: v5-develop
 | 
			
		||||
        fetch-depth: 1
 | 
			
		||||
 | 
			
		||||
    - name: Copy .env
 | 
			
		||||
      run: |
 | 
			
		||||
        cp .env.ci .env
 | 
			
		||||
    - name: Install composer dependencies
 | 
			
		||||
      run: |
 | 
			
		||||
        composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
        composer install
 | 
			
		||||
    - name: Prepare Laravel Application
 | 
			
		||||
      run: |
 | 
			
		||||
        php artisan key:generate
 | 
			
		||||
        php artisan optimize
 | 
			
		||||
        php artisan cache:clear
 | 
			
		||||
        php artisan config:cache
 | 
			
		||||
    - name: Create DB and schemas
 | 
			
		||||
      run: |
 | 
			
		||||
        mkdir -p database
 | 
			
		||||
        touch database/database.sqlite
 | 
			
		||||
    - name: Migrate Database
 | 
			
		||||
      run: |
 | 
			
		||||
        php artisan migrate:fresh --seed --force && php artisan db:seed --force
 | 
			
		||||
    - name: Prepare JS/CSS assets
 | 
			
		||||
      run: |
 | 
			
		||||
        npm i
 | 
			
		||||
        npm run production
 | 
			
		||||
    - name: Run Testsuite
 | 
			
		||||
      run: |
 | 
			
		||||
        cat .env
 | 
			
		||||
        vendor/bin/phpunit --testdox
 | 
			
		||||
      env:
 | 
			
		||||
        DB_PORT: ${{ job.services.mysql.ports[3306] }}
 | 
			
		||||
 | 
			
		||||
    - name: Run php-cs-fixer
 | 
			
		||||
      run: |
 | 
			
		||||
        vendor/bin/php-cs-fixer fix
 | 
			
		||||
							
								
								
									
										2
									
								
								public/css/app.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								public/css/app.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								public/js/clients/invoices/payment.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								public/js/clients/invoices/payment.js
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,2 @@
 | 
			
		||||
/*! For license information please see payment.js.LICENSE.txt */
 | 
			
		||||
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplayTerms=e,this.shouldDisplaySignature=n,this.termsAccepted=!1,this.submitting=!1}var n,a,i;return n=t,(a=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){e.submitting||(e.handleMethodSelect(t),e.submitting=!0)}))}))}}])&&e(n.prototype,a),i&&e(n,i),t}(),n=document.querySelector('meta[name="require-invoice-signature"]').content,a=document.querySelector('meta[name="show-invoice-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();
 | 
			
		||||
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplayTerms=e,this.shouldDisplaySignature=n,this.termsAccepted=!1,this.submitting=!1}var n,i,a;return n=t,(i=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){this.submitting=!0,document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){e.submitting||e.handleMethodSelect(t)}))}))}}])&&e(n.prototype,i),a&&e(n,a),t}(),n=document.querySelector('meta[name="require-invoice-signature"]').content,i=document.querySelector('meta[name="show-invoice-terms"]').content;new t(Boolean(+n),Boolean(+i)).handle()})();
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
    "/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=cfe5de1cf87a0b01568d",
 | 
			
		||||
    "/js/clients/payments/stripe-ach.js": "/js/clients/payments/stripe-ach.js?id=5e74bc0d346beeb57ee9",
 | 
			
		||||
    "/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=6b79265cbb8c963eef19",
 | 
			
		||||
    "/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=d9132fae12153a6943a6",
 | 
			
		||||
    "/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=2cccf9e51b60a0ab17b8",
 | 
			
		||||
    "/js/clients/payments/stripe-sofort.js": "/js/clients/payments/stripe-sofort.js?id=926c7b9d1ee48bbf786b",
 | 
			
		||||
    "/js/clients/payments/stripe-alipay.js": "/js/clients/payments/stripe-alipay.js?id=1e159400d6a5ca4662c1",
 | 
			
		||||
    "/js/clients/payments/checkout-credit-card.js": "/js/clients/payments/checkout-credit-card.js?id=0b47ce36fe20191adb33",
 | 
			
		||||
@ -37,6 +37,6 @@
 | 
			
		||||
    "/js/clients/payments/stripe-ideal.js": "/js/clients/payments/stripe-ideal.js?id=73ce56676f9252b0cecf",
 | 
			
		||||
    "/js/clients/payments/stripe-przelewy24.js": "/js/clients/payments/stripe-przelewy24.js?id=f3a14f78bec8209c30ba",
 | 
			
		||||
    "/js/clients/payments/stripe-browserpay.js": "/js/clients/payments/stripe-browserpay.js?id=71e49866d66a6d85b88a",
 | 
			
		||||
    "/css/app.css": "/css/app.css?id=6d7f6103a3a7738d363b",
 | 
			
		||||
    "/css/app.css": "/css/app.css?id=5fe248ec24749bdc4086",
 | 
			
		||||
    "/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								resources/js/clients/invoices/payment.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								resources/js/clients/invoices/payment.js
									
									
									
									
										vendored
									
									
								
							@ -68,6 +68,8 @@ class Payment {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    submitForm() {
 | 
			
		||||
        this.submitting = true;
 | 
			
		||||
 | 
			
		||||
        document.getElementById("payment-form").submit();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -99,8 +101,6 @@ class Payment {
 | 
			
		||||
                element.addEventListener("click", () => {
 | 
			
		||||
                    if (!this.submitting) {
 | 
			
		||||
                        this.handleMethodSelect(element)
 | 
			
		||||
 | 
			
		||||
                        this.submitting = true;
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
@ -4340,7 +4340,18 @@ $LANG = array(
 | 
			
		||||
    'no_available_methods' => 'We can\'t find any credit cards on your device. <a href="https://invoiceninja.github.io/docs/payments#apple-pay-google-pay-microsoft-pay" target="_blank" class="underline">Read more about this.</a>',
 | 
			
		||||
    'gocardless_mandate_not_ready' => 'Payment mandate is not ready. Please try again later.',
 | 
			
		||||
    'payment_type_instant_bank_pay' => 'Instant Bank Pay',
 | 
			
		||||
 | 
			
		||||
    'payment_type_iDEAL' => 'iDEAL',
 | 
			
		||||
    'payment_type_Przelewy24' => 'Przelewy24',
 | 
			
		||||
    'payment_type_Mollie Bank Transfer' => 'Bank Transfer',
 | 
			
		||||
    'payment_type_KBC/CBC' => 'KBC/CBC',
 | 
			
		||||
    'payment_type_Instant Bank Pay' => 'Instant Bank Pay',
 | 
			
		||||
    'payment_type_Hosted Page' => 'Hosted Page',
 | 
			
		||||
    'payment_type_GiroPay' => 'GiroPay',
 | 
			
		||||
    'payment_type_EPS' => 'EPS',
 | 
			
		||||
    'payment_type_Direct Debit' => 'Direct Debit',
 | 
			
		||||
    'payment_type_Bancontact' => 'Bancontact',
 | 
			
		||||
    'payment_type_BECS' => 'BECS',
 | 
			
		||||
    'payment_type_ACSS' => 'ACSS',
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
return $LANG;
 | 
			
		||||
 | 
			
		||||
@ -49,8 +49,8 @@
 | 
			
		||||
 | 
			
		||||
      #header, #header-spacer {
 | 
			
		||||
          height: 160px;
 | 
			
		||||
          padding: 3rem;
 | 
			
		||||
          margin-bottom: 3rem;
 | 
			
		||||
          padding: 1rem;
 | 
			
		||||
          margin-bottom: 1rem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .company-name {
 | 
			
		||||
@ -73,7 +73,7 @@
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .logo-client-wrapper {
 | 
			
		||||
        margin: 0 2rem 3rem;
 | 
			
		||||
        margin: 0 2rem 0rem;
 | 
			
		||||
        display: grid;
 | 
			
		||||
        grid-template-columns: 1.5fr 1fr;
 | 
			
		||||
      }
 | 
			
		||||
@ -92,7 +92,7 @@
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .table-wrapper {
 | 
			
		||||
        margin: 3rem 2rem;
 | 
			
		||||
        margin: 0rem 2rem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      [data-ref="table"] {
 | 
			
		||||
@ -149,8 +149,8 @@
 | 
			
		||||
 | 
			
		||||
      #footer, #footer-spacer {
 | 
			
		||||
          height: 220px;
 | 
			
		||||
          padding: 1rem 1.5rem;
 | 
			
		||||
          margin-top: 1rem;
 | 
			
		||||
          padding: 0rem 0rem;
 | 
			
		||||
          margin-top: 0rem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .footer-content {
 | 
			
		||||
@ -161,11 +161,13 @@
 | 
			
		||||
        color: #fff4e9;
 | 
			
		||||
        max-height: 140px;
 | 
			
		||||
        justify-content: space-between;
 | 
			
		||||
        margin-top: 0.5rem;
 | 
			
		||||
        margin-left: 0.5rem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      .footer-company-details-address-wrapper {
 | 
			
		||||
        display: flex;
 | 
			
		||||
        gap: 5px;
 | 
			
		||||
        gap: 0px;
 | 
			
		||||
        margin-right: 60px;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@ -173,8 +175,8 @@
 | 
			
		||||
      #company-details {
 | 
			
		||||
        display: flex;
 | 
			
		||||
        flex-direction: column;
 | 
			
		||||
        margin-top: 2rem;
 | 
			
		||||
        margin-bottom: 2rem;
 | 
			
		||||
        margin-top: 0.5rem;
 | 
			
		||||
        margin-bottom: 0rem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      #company-address > *,
 | 
			
		||||
@ -226,8 +228,8 @@
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      [data-ref="total_table-footer"] {
 | 
			
		||||
          margin-top: 2rem;
 | 
			
		||||
          margin-bottom: 2rem;
 | 
			
		||||
          margin-top: 1rem;
 | 
			
		||||
          margin-bottom: 1rem;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      table {
 | 
			
		||||
@ -348,7 +350,7 @@ $entity_images
 | 
			
		||||
 | 
			
		||||
<div id="footer">
 | 
			
		||||
    <div class="footer-content">
 | 
			
		||||
        <div style="width: 90%">
 | 
			
		||||
        <div style="width: 70%">
 | 
			
		||||
            <p data-ref="total_table-footer">$entity_footer</p>
 | 
			
		||||
 | 
			
		||||
        <script>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										47
									
								
								resources/views/portal/ninja2020/invoices/download.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								resources/views/portal/ninja2020/invoices/download.blade.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.app')
 | 
			
		||||
@section('meta_title', ctrans('texts.view_invoice'))
 | 
			
		||||
 | 
			
		||||
@push('head')
 | 
			
		||||
 | 
			
		||||
@endpush
 | 
			
		||||
 | 
			
		||||
@section('body')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <div class="container mx-auto">
 | 
			
		||||
        <div class="grid grid-cols-6 gap-4">
 | 
			
		||||
            <div class="flex float-right">
 | 
			
		||||
                <form action="{{ route('client.invoices.download') }}" method="post" id="bulkActions">
 | 
			
		||||
                    @foreach($invoices as $invoice)
 | 
			
		||||
                        <input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
 | 
			
		||||
                    @endforeach
 | 
			
		||||
                    @csrf
 | 
			
		||||
                    <button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = true, 5000); return true;" class="button button-primary bg-primary" name="action" value="download">{{ ctrans('texts.download') }}</button>
 | 
			
		||||
                </form>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        @foreach($invoices as $invoice)
 | 
			
		||||
        <div>
 | 
			
		||||
            <dl>
 | 
			
		||||
                @if(!empty($invoice->number) && !is_null($invoice->number))
 | 
			
		||||
                <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
                    <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                        {{ ctrans('texts.invoice_number') }}
 | 
			
		||||
                    </dt>
 | 
			
		||||
                    <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                        {{ $invoice->number }}
 | 
			
		||||
                    </dd>
 | 
			
		||||
                </div>
 | 
			
		||||
                @endif
 | 
			
		||||
            </dl>
 | 
			
		||||
        </div>
 | 
			
		||||
    
 | 
			
		||||
    @endforeach
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('footer')
 | 
			
		||||
@endsection
 | 
			
		||||
@ -28,7 +28,7 @@
 | 
			
		||||
                </button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="mt-3 flex w-full rounded-md shadow-sm sm:mt-0 sm:w-auto">
 | 
			
		||||
                <button @click="document.getElementById('displaySignatureModal').style.display = 'none';" type="button" class="button button-secondary">
 | 
			
		||||
                <button onclick="document.getElementById('displaySignatureModal').style.display = 'none'; setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" type="button" class="button button-secondary">
 | 
			
		||||
                    {{ ctrans('texts.close') }}
 | 
			
		||||
                </button>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,11 @@
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
 | 
			
		||||
            <div class="flex w-full rounded-md shadow-sm sm:ml-3 sm:w-auto">
 | 
			
		||||
                <button type="button" id="accept-terms-button" class="button button-primary bg-primary">
 | 
			
		||||
                <button 
 | 
			
		||||
                    type="button"
 | 
			
		||||
                    id="accept-terms-button" 
 | 
			
		||||
                    onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;"
 | 
			
		||||
                    class="button button-primary bg-primary">
 | 
			
		||||
                    {{ ctrans('texts.i_agree') }}
 | 
			
		||||
                </button>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										46
									
								
								resources/views/portal/ninja2020/quotes/download.blade.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								resources/views/portal/ninja2020/quotes/download.blade.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,46 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.app')
 | 
			
		||||
@section('meta_title', ctrans('texts.view_quote'))
 | 
			
		||||
 | 
			
		||||
@push('head')
 | 
			
		||||
 | 
			
		||||
@endpush
 | 
			
		||||
 | 
			
		||||
@section('body')
 | 
			
		||||
 | 
			
		||||
    <div class="container mx-auto">
 | 
			
		||||
        <div class="grid grid-cols-6 gap-4">
 | 
			
		||||
            <div class="flex float-right">
 | 
			
		||||
                <form action="{{ route('client.quotes.download') }}" method="post" id="bulkActions">
 | 
			
		||||
                    @foreach($quotes as $quote)
 | 
			
		||||
                        <input type="hidden" name="quotes[]" value="{{ $quote->hashed_id }}">
 | 
			
		||||
                    @endforeach
 | 
			
		||||
                    @csrf
 | 
			
		||||
                    <button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = true, 5000); return true;" class="button button-primary bg-primary" name="action" value="download">{{ ctrans('texts.download') }}</button>
 | 
			
		||||
                </form>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        @foreach($quotes as $quote)
 | 
			
		||||
        <div>
 | 
			
		||||
            <dl>
 | 
			
		||||
                @if(!empty($quote->number) && !is_null($quote->number))
 | 
			
		||||
                <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
                    <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                        {{ ctrans('texts.quote_number') }}
 | 
			
		||||
                    </dt>
 | 
			
		||||
                    <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                        {{ $quote->number }}
 | 
			
		||||
                    </dd>
 | 
			
		||||
                </div>
 | 
			
		||||
                @endif
 | 
			
		||||
            </dl>
 | 
			
		||||
        </div>
 | 
			
		||||
    
 | 
			
		||||
    @endforeach
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@section('footer')
 | 
			
		||||
@endsection
 | 
			
		||||
@ -35,6 +35,8 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
 | 
			
		||||
 | 
			
		||||
    Route::get('invoices', 'ClientPortal\InvoiceController@index')->name('invoices.index')->middleware('portal_enabled');
 | 
			
		||||
    Route::post('invoices/payment', 'ClientPortal\InvoiceController@bulk')->name('invoices.bulk');
 | 
			
		||||
    Route::get('invoices/payment', 'ClientPortal\InvoiceController@catch_bulk')->name('invoices.catch_bulk');
 | 
			
		||||
    Route::post('invoices/download', 'ClientPortal\InvoiceController@download')->name('invoices.download');
 | 
			
		||||
    Route::get('invoices/{invoice}', 'ClientPortal\InvoiceController@show')->name('invoice.show');
 | 
			
		||||
    Route::get('invoices/{invoice_invitation}', 'ClientPortal\InvoiceController@show')->name('invoice.show_invitation');
 | 
			
		||||
 | 
			
		||||
@ -43,6 +45,8 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
 | 
			
		||||
    Route::get('recurring_invoices/{recurring_invoice}/request_cancellation', 'ClientPortal\RecurringInvoiceController@requestCancellation')->name('recurring_invoices.request_cancellation');
 | 
			
		||||
 | 
			
		||||
    Route::post('payments/process', 'ClientPortal\PaymentController@process')->name('payments.process');
 | 
			
		||||
    Route::get('payments/process', 'ClientPortal\PaymentController@catch_process')->name('payments.catch_process');
 | 
			
		||||
 | 
			
		||||
    Route::post('payments/credit_response', 'ClientPortal\PaymentController@credit_response')->name('payments.credit_response');
 | 
			
		||||
 | 
			
		||||
    Route::get('payments', 'ClientPortal\PaymentController@index')->name('payments.index')->middleware('portal_enabled');
 | 
			
		||||
@ -66,6 +70,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
 | 
			
		||||
    Route::get('quotes', 'ClientPortal\QuoteController@index')->name('quotes.index')->middleware('portal_enabled');
 | 
			
		||||
    Route::get('quotes/{quote}', 'ClientPortal\QuoteController@show')->name('quote.show');
 | 
			
		||||
    Route::get('quotes/{quote_invitation}', 'ClientPortal\QuoteController@show')->name('quote.show_invitation');
 | 
			
		||||
    Route::post('quotes/download', 'ClientPortal\QuoteController@download')->name('quotes.download');
 | 
			
		||||
 | 
			
		||||
    Route::get('credits', 'ClientPortal\CreditController@index')->name('credits.index');
 | 
			
		||||
    Route::get('credits/{credit}', 'ClientPortal\CreditController@show')->name('credit.show');
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user