mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:07:33 -05:00 
			
		
		
		
	Add design_id to invoice and quote table (#3013)
* Add conditional checks in client portal * Add ability to cancel recurring invoices from client portal * Fixes for types * Add fields to invoice and quote table
This commit is contained in:
		
							parent
							
								
									9dfa97eedf
								
							
						
					
					
						commit
						adfced11d6
					
				@ -271,12 +271,6 @@ class Client extends BaseModel
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function getCreditCardGateway() :?CompanyGateway
 | 
					    public function getCreditCardGateway() :?CompanyGateway
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $company_gateways = $this->getSetting('company_gateways');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* If we have a custom gateway list pass this back first */
 | 
					 | 
				
			||||||
        if($company_gateways)
 | 
					 | 
				
			||||||
            $gateways = $this->company->company_gateways->whereIn('id', $company_gateways);
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        $gateways = $this->company->company_gateways;
 | 
					        $gateways = $this->company->company_gateways;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreach($gateways as $gateway)
 | 
					        foreach($gateways as $gateway)
 | 
				
			||||||
@ -320,11 +314,7 @@ class Client extends BaseModel
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
//Also need to harvest the list of client gateway tokens and present these
 | 
					//Also need to harvest the list of client gateway tokens and present these
 | 
				
			||||||
//for instant payment
 | 
					//for instant payment
 | 
				
			||||||
        $company_gateways = $this->getSetting('company_gateways');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($company_gateways)
 | 
					 | 
				
			||||||
            $gateways = $this->company->company_gateways->whereIn('id', $payment_gateways);
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        $gateways = $this->company->company_gateways;
 | 
					        $gateways = $this->company->company_gateways;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $gateways->filter(function ($method) use ($amount){
 | 
					        $gateways->filter(function ($method) use ($amount){
 | 
				
			||||||
 | 
				
			|||||||
@ -53,17 +53,17 @@ class CompanyGatewayTransformer extends EntityTransformer
 | 
				
			|||||||
            'update_details' => (bool)$company_gateway->update_details,
 | 
					            'update_details' => (bool)$company_gateway->update_details,
 | 
				
			||||||
            'config' => (string) $company_gateway->getConfigTransformed(),
 | 
					            'config' => (string) $company_gateway->getConfigTransformed(),
 | 
				
			||||||
            'priority_id' => (int)$company_gateway->priority_id,
 | 
					            'priority_id' => (int)$company_gateway->priority_id,
 | 
				
			||||||
            'min_limit' => (float)$company_gateway->min_limit,
 | 
					            'min_limit' => (float)$company_gateway->min_limit ?: null,
 | 
				
			||||||
            'max_limit' => (float)$company_gateway->max_limit,
 | 
					            'max_limit' => (float)$company_gateway->max_limit ?: null,
 | 
				
			||||||
            'fee_amount' => (float) $company_gateway->fee_amount,
 | 
					            'fee_amount' => (float) $company_gateway->fee_amount ?: null,
 | 
				
			||||||
            'fee_percent' => (float)$company_gateway->fee_percent,
 | 
					            'fee_percent' => (float)$company_gateway->fee_percent ?: null,
 | 
				
			||||||
            'fee_tax_name1' => (string)$company_gateway->fee_tax_name1 ?: '',
 | 
					            'fee_tax_name1' => (string)$company_gateway->fee_tax_name1 ?: '',
 | 
				
			||||||
            'fee_tax_name2' => (string) $company_gateway->fee_tax_name2 ?: '',
 | 
					            'fee_tax_name2' => (string) $company_gateway->fee_tax_name2 ?: '',
 | 
				
			||||||
            'fee_tax_name3' => (string) $company_gateway->fee_tax_name3 ?: '',
 | 
					            'fee_tax_name3' => (string) $company_gateway->fee_tax_name3 ?: '',
 | 
				
			||||||
            'fee_tax_rate1' => (float) $company_gateway->fee_tax_rate1,
 | 
					            'fee_tax_rate1' => (float) $company_gateway->fee_tax_rate1,
 | 
				
			||||||
            'fee_tax_rate2' => (float)$company_gateway->fee_tax_rate2,
 | 
					            'fee_tax_rate2' => (float)$company_gateway->fee_tax_rate2,
 | 
				
			||||||
            'fee_tax_rate3' => (float)$company_gateway->fee_tax_rate3,
 | 
					            'fee_tax_rate3' => (float)$company_gateway->fee_tax_rate3,
 | 
				
			||||||
            'fee_cap' => (float)$company_gateway->fee_cap,
 | 
					            'fee_cap' => (float)$company_gateway->fee_cap ?: null,
 | 
				
			||||||
            'adjust_fee_percent' => (bool)$company_gateway->adjust_fee_percent,
 | 
					            'adjust_fee_percent' => (bool)$company_gateway->adjust_fee_percent,
 | 
				
			||||||
            'updated_at' => $company_gateway->updated_at,
 | 
					            'updated_at' => $company_gateway->updated_at,
 | 
				
			||||||
            'deleted_at' => $company_gateway->deleted_at,
 | 
					            'deleted_at' => $company_gateway->deleted_at,
 | 
				
			||||||
 | 
				
			|||||||
@ -87,6 +87,7 @@ class InvoiceTransformer extends EntityTransformer
 | 
				
			|||||||
            'balance' => (float) $invoice->balance ?: '',
 | 
					            'balance' => (float) $invoice->balance ?: '',
 | 
				
			||||||
            'client_id' => (string) $this->encodePrimaryKey($invoice->client_id),
 | 
					            'client_id' => (string) $this->encodePrimaryKey($invoice->client_id),
 | 
				
			||||||
            'status_id' => (string) ($invoice->status_id ?: 1),
 | 
					            'status_id' => (string) ($invoice->status_id ?: 1),
 | 
				
			||||||
 | 
					            'design_id' => (string) ($invoice->design_id ?: 1),
 | 
				
			||||||
            'updated_at' => $invoice->updated_at,
 | 
					            'updated_at' => $invoice->updated_at,
 | 
				
			||||||
            'archived_at' => $invoice->deleted_at,
 | 
					            'archived_at' => $invoice->deleted_at,
 | 
				
			||||||
            'invoice_number' => $invoice->invoice_number,
 | 
					            'invoice_number' => $invoice->invoice_number,
 | 
				
			||||||
 | 
				
			|||||||
@ -84,6 +84,7 @@ class QuoteTransformer extends EntityTransformer
 | 
				
			|||||||
            'balance' => (float) $quote->balance ?: '',
 | 
					            'balance' => (float) $quote->balance ?: '',
 | 
				
			||||||
            'client_id' => (string) $quote->client_id,
 | 
					            'client_id' => (string) $quote->client_id,
 | 
				
			||||||
            'status_id' => (string) ($quote->status_id ?: 1),
 | 
					            'status_id' => (string) ($quote->status_id ?: 1),
 | 
				
			||||||
 | 
					            'design_id' => (string) ($quote->design_id ?: 1),
 | 
				
			||||||
            'updated_at' => $quote->updated_at,
 | 
					            'updated_at' => $quote->updated_at,
 | 
				
			||||||
            'archived_at' => $quote->deleted_at,
 | 
					            'archived_at' => $quote->deleted_at,
 | 
				
			||||||
            'quote_number' => $quote->quote_number ?: '',
 | 
					            'quote_number' => $quote->quote_number ?: '',
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,6 @@ class Number
 | 
				
			|||||||
     * 
 | 
					     * 
 | 
				
			||||||
     * @return string           The formatted value
 | 
					     * @return string           The formatted value
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    //public static function formatMoney($value, $currency, $country, $settings) :string
 | 
					 | 
				
			||||||
    public static function formatMoney($value, $client) :string
 | 
					    public static function formatMoney($value, $client) :string
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $currency = $client->currency();
 | 
					        $currency = $client->currency();
 | 
				
			||||||
@ -68,7 +67,7 @@ class Number
 | 
				
			|||||||
        $decimal = $currency->decimal_separator;
 | 
					        $decimal = $currency->decimal_separator;
 | 
				
			||||||
        $precision = $currency->precision;
 | 
					        $precision = $currency->precision;
 | 
				
			||||||
        $code = $currency->code;
 | 
					        $code = $currency->code;
 | 
				
			||||||
        $swapSymbol = $client->country->swap_currency_symbol;
 | 
					        $swapSymbol = $currency->swap_currency_symbol;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Country settings override client settings */
 | 
					            /* Country settings override client settings */
 | 
				
			||||||
            if ($client->country->thousand_separator) 
 | 
					            if ($client->country->thousand_separator) 
 | 
				
			||||||
 | 
				
			|||||||
@ -370,17 +370,17 @@ class CreateUsersTable extends Migration
 | 
				
			|||||||
            $table->text('config');
 | 
					            $table->text('config');
 | 
				
			||||||
            $table->unsignedInteger('priority_id')->default(0);
 | 
					            $table->unsignedInteger('priority_id')->default(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $table->decimal('min_limit', 13, 2)->default(0);
 | 
					            $table->decimal('min_limit', 13, 2)->nullable();
 | 
				
			||||||
            $table->decimal('max_limit', 13, 2)->default(0);
 | 
					            $table->decimal('max_limit', 13, 2)->nullable();
 | 
				
			||||||
            $table->decimal('fee_amount', 13, 2)->default(0);
 | 
					            $table->decimal('fee_amount', 13, 2)->nullable();
 | 
				
			||||||
            $table->decimal('fee_percent', 13, 2)->default(0);
 | 
					            $table->decimal('fee_percent', 13, 2)->nullable();
 | 
				
			||||||
            $table->string('fee_tax_name1')->nullable();
 | 
					            $table->string('fee_tax_name1')->nullable();
 | 
				
			||||||
            $table->string('fee_tax_name2')->nullable();
 | 
					            $table->string('fee_tax_name2')->nullable();
 | 
				
			||||||
            $table->string('fee_tax_name3')->nullable();
 | 
					            $table->string('fee_tax_name3')->nullable();
 | 
				
			||||||
            $table->decimal('fee_tax_rate1', 13, 2)->nullable();
 | 
					            $table->decimal('fee_tax_rate1', 13, 2)->nullable();
 | 
				
			||||||
            $table->decimal('fee_tax_rate2', 13, 2)->nullable();
 | 
					            $table->decimal('fee_tax_rate2', 13, 2)->nullable();
 | 
				
			||||||
            $table->decimal('fee_tax_rate3', 13, 2)->nullable();
 | 
					            $table->decimal('fee_tax_rate3', 13, 2)->nullable();
 | 
				
			||||||
            $table->unsignedInteger('fee_cap')->default(0);
 | 
					            $table->unsignedInteger('fee_cap')->nullable();
 | 
				
			||||||
            $table->boolean('adjust_fee_percent')->default(false);
 | 
					            $table->boolean('adjust_fee_percent')->default(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $table->timestamps(6);
 | 
					            $table->timestamps(6);
 | 
				
			||||||
@ -402,6 +402,7 @@ class CreateUsersTable extends Migration
 | 
				
			|||||||
            $t->unsignedInteger('status_id');
 | 
					            $t->unsignedInteger('status_id');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $t->unsignedInteger('recurring_invoice_id')->nullable();
 | 
					            $t->unsignedInteger('recurring_invoice_id')->nullable();
 | 
				
			||||||
 | 
					            $t->unsignedInteger('design_id')->nullable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $t->string('invoice_number')->nullable();
 | 
					            $t->string('invoice_number')->nullable();
 | 
				
			||||||
            $t->float('discount')->default(0);
 | 
					            $t->float('discount')->default(0);
 | 
				
			||||||
@ -588,6 +589,7 @@ class CreateUsersTable extends Migration
 | 
				
			|||||||
            $t->unsignedInteger('user_id');
 | 
					            $t->unsignedInteger('user_id');
 | 
				
			||||||
            $t->unsignedInteger('company_id')->index();
 | 
					            $t->unsignedInteger('company_id')->index();
 | 
				
			||||||
            $t->unsignedInteger('status_id');
 | 
					            $t->unsignedInteger('status_id');
 | 
				
			||||||
 | 
					            $t->unsignedInteger('design_id');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $t->string('quote_number')->nullable();
 | 
					            $t->string('quote_number')->nullable();
 | 
				
			||||||
            $t->float('discount')->default(0);
 | 
					            $t->float('discount')->default(0);
 | 
				
			||||||
 | 
				
			|||||||
@ -31,7 +31,7 @@ class PaymentLibrariesSeeder extends Seeder
 | 
				
			|||||||
            ['name' => 'Pin', 'provider' => 'Pin', 'key' => '0749cb92a6b36c88bd9ff8aabd2efcab', 'fields' => '{"secretKey":"","testMode":false}'],
 | 
					            ['name' => 'Pin', 'provider' => 'Pin', 'key' => '0749cb92a6b36c88bd9ff8aabd2efcab', 'fields' => '{"secretKey":"","testMode":false}'],
 | 
				
			||||||
            ['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct', 'key' => '4c8f4e5d0f353a122045eb9a60cc0f2d', 'fields' => '{"vendor":"","testMode":false,"referrerId":""}'],
 | 
					            ['name' => 'SagePay Direct', 'provider' => 'SagePay_Direct', 'key' => '4c8f4e5d0f353a122045eb9a60cc0f2d', 'fields' => '{"vendor":"","testMode":false,"referrerId":""}'],
 | 
				
			||||||
            ['name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost', 'key' => '8036a5aadb2bdaafb23502da8790b6a2', 'fields' => '{"merchantId":"","transactionPassword":"","testMode":false}'],
 | 
					            ['name' => 'SecurePay DirectPost', 'provider' => 'SecurePay_DirectPost', 'key' => '8036a5aadb2bdaafb23502da8790b6a2', 'fields' => '{"merchantId":"","transactionPassword":"","testMode":false}'],
 | 
				
			||||||
            ['name' => 'Stripe', 'provider' => 'Stripe', 'sort_order' => 1, 'key' => 'd14dd26a37cecc30fdd65700bfb55b23', 'fields' => '{"apiKey":""}'],
 | 
					            ['name' => 'Stripe', 'provider' => 'Stripe', 'sort_order' => 1, 'key' => 'd14dd26a37cecc30fdd65700bfb55b23', 'fields' => '{"apiKey":"", "publishableKey":""}'],
 | 
				
			||||||
            ['name' => 'TargetPay Direct eBanking', 'provider' => 'TargetPay_Directebanking', 'key' => 'd14dd26a37cdcc30fdd65700bfb55b23', 'fields' => '{"subAccountId":""}'],
 | 
					            ['name' => 'TargetPay Direct eBanking', 'provider' => 'TargetPay_Directebanking', 'key' => 'd14dd26a37cdcc30fdd65700bfb55b23', 'fields' => '{"subAccountId":""}'],
 | 
				
			||||||
            ['name' => 'TargetPay Ideal', 'provider' => 'TargetPay_Ideal', 'key' => 'ea3b328bd72d381387281c3bd83bd97c', 'fields' => '{"subAccountId":""}'],
 | 
					            ['name' => 'TargetPay Ideal', 'provider' => 'TargetPay_Ideal', 'key' => 'ea3b328bd72d381387281c3bd83bd97c', 'fields' => '{"subAccountId":""}'],
 | 
				
			||||||
            ['name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash', 'key' => 'a0035fc0d87c4950fb82c73e2fcb825a', 'fields' => '{"subAccountId":""}'],
 | 
					            ['name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash', 'key' => 'a0035fc0d87c4950fb82c73e2fcb825a', 'fields' => '{"subAccountId":""}'],
 | 
				
			||||||
 | 
				
			|||||||
@ -25,9 +25,11 @@
 | 
				
			|||||||
			<div class="col-lg-12" style="padding-bottom: 10px;">
 | 
								<div class="col-lg-12" style="padding-bottom: 10px;">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				<!-- Filters / Buttons in here.-->
 | 
									<!-- Filters / Buttons in here.-->
 | 
				
			||||||
 | 
					                @if(auth()->user()->client->getCreditCardGateway())
 | 
				
			||||||
				<div id="top_right_buttons" class="pull-right">
 | 
									<div id="top_right_buttons" class="pull-right">
 | 
				
			||||||
                      <a href="{{ route('client.payment_methods.create')}}" class="btn btn-success">{{ ctrans('texts.add_payment_method') }}</a>
 | 
					                      <a href="{{ route('client.payment_methods.create')}}" class="btn btn-success">{{ ctrans('texts.add_payment_method') }}</a>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
					                @endif
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -25,6 +25,12 @@
 | 
				
			|||||||
                        		{{ $inv->id }} - {{ $inv->amount }}
 | 
					                        		{{ $inv->id }} - {{ $inv->amount }}
 | 
				
			||||||
                        	@endforeach
 | 
					                        	@endforeach
 | 
				
			||||||
                        </table>
 | 
					                        </table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        @if($invoice->remaining_cycles >=1)
 | 
				
			||||||
 | 
					                        <div class="pull-right">
 | 
				
			||||||
 | 
					                            <button class="btn btn-primary">Cancel</button>
 | 
				
			||||||
 | 
					                        </div>
 | 
				
			||||||
 | 
					                        @endif
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user