1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01: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:
David Bomba 2019-10-24 07:37:20 +11:00 committed by GitHub
parent 9dfa97eedf
commit adfced11d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 26 deletions

View File

@ -271,13 +271,7 @@ class Client extends BaseModel
*/
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)
{
@ -320,12 +314,8 @@ class Client extends BaseModel
//
//Also need to harvest the list of client gateway tokens and present these
//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){
if($method->min_limit !== null && $amount < $method->min_limit)

View File

@ -53,17 +53,17 @@ class CompanyGatewayTransformer extends EntityTransformer
'update_details' => (bool)$company_gateway->update_details,
'config' => (string) $company_gateway->getConfigTransformed(),
'priority_id' => (int)$company_gateway->priority_id,
'min_limit' => (float)$company_gateway->min_limit,
'max_limit' => (float)$company_gateway->max_limit,
'fee_amount' => (float) $company_gateway->fee_amount,
'fee_percent' => (float)$company_gateway->fee_percent,
'min_limit' => (float)$company_gateway->min_limit ?: null,
'max_limit' => (float)$company_gateway->max_limit ?: null,
'fee_amount' => (float) $company_gateway->fee_amount ?: null,
'fee_percent' => (float)$company_gateway->fee_percent ?: null,
'fee_tax_name1' => (string)$company_gateway->fee_tax_name1 ?: '',
'fee_tax_name2' => (string) $company_gateway->fee_tax_name2 ?: '',
'fee_tax_name3' => (string) $company_gateway->fee_tax_name3 ?: '',
'fee_tax_rate1' => (float) $company_gateway->fee_tax_rate1,
'fee_tax_rate2' => (float)$company_gateway->fee_tax_rate2,
'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,
'updated_at' => $company_gateway->updated_at,
'deleted_at' => $company_gateway->deleted_at,

View File

@ -87,6 +87,7 @@ class InvoiceTransformer extends EntityTransformer
'balance' => (float) $invoice->balance ?: '',
'client_id' => (string) $this->encodePrimaryKey($invoice->client_id),
'status_id' => (string) ($invoice->status_id ?: 1),
'design_id' => (string) ($invoice->design_id ?: 1),
'updated_at' => $invoice->updated_at,
'archived_at' => $invoice->deleted_at,
'invoice_number' => $invoice->invoice_number,

View File

@ -84,6 +84,7 @@ class QuoteTransformer extends EntityTransformer
'balance' => (float) $quote->balance ?: '',
'client_id' => (string) $quote->client_id,
'status_id' => (string) ($quote->status_id ?: 1),
'design_id' => (string) ($quote->design_id ?: 1),
'updated_at' => $quote->updated_at,
'archived_at' => $quote->deleted_at,
'quote_number' => $quote->quote_number ?: '',

View File

@ -59,7 +59,6 @@ class Number
*
* @return string The formatted value
*/
//public static function formatMoney($value, $currency, $country, $settings) :string
public static function formatMoney($value, $client) :string
{
$currency = $client->currency();
@ -68,7 +67,7 @@ class Number
$decimal = $currency->decimal_separator;
$precision = $currency->precision;
$code = $currency->code;
$swapSymbol = $client->country->swap_currency_symbol;
$swapSymbol = $currency->swap_currency_symbol;
/* Country settings override client settings */
if ($client->country->thousand_separator)

View File

@ -370,17 +370,17 @@ class CreateUsersTable extends Migration
$table->text('config');
$table->unsignedInteger('priority_id')->default(0);
$table->decimal('min_limit', 13, 2)->default(0);
$table->decimal('max_limit', 13, 2)->default(0);
$table->decimal('fee_amount', 13, 2)->default(0);
$table->decimal('fee_percent', 13, 2)->default(0);
$table->decimal('min_limit', 13, 2)->nullable();
$table->decimal('max_limit', 13, 2)->nullable();
$table->decimal('fee_amount', 13, 2)->nullable();
$table->decimal('fee_percent', 13, 2)->nullable();
$table->string('fee_tax_name1')->nullable();
$table->string('fee_tax_name2')->nullable();
$table->string('fee_tax_name3')->nullable();
$table->decimal('fee_tax_rate1', 13, 2)->nullable();
$table->decimal('fee_tax_rate2', 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->timestamps(6);
@ -402,6 +402,7 @@ class CreateUsersTable extends Migration
$t->unsignedInteger('status_id');
$t->unsignedInteger('recurring_invoice_id')->nullable();
$t->unsignedInteger('design_id')->nullable();
$t->string('invoice_number')->nullable();
$t->float('discount')->default(0);
@ -588,6 +589,7 @@ class CreateUsersTable extends Migration
$t->unsignedInteger('user_id');
$t->unsignedInteger('company_id')->index();
$t->unsignedInteger('status_id');
$t->unsignedInteger('design_id');
$t->string('quote_number')->nullable();
$t->float('discount')->default(0);

View File

@ -31,7 +31,7 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'Pin', 'provider' => 'Pin', 'key' => '0749cb92a6b36c88bd9ff8aabd2efcab', 'fields' => '{"secretKey":"","testMode":false}'],
['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' => '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 Ideal', 'provider' => 'TargetPay_Ideal', 'key' => 'ea3b328bd72d381387281c3bd83bd97c', 'fields' => '{"subAccountId":""}'],
['name' => 'TargetPay Mr Cash', 'provider' => 'TargetPay_Mrcash', 'key' => 'a0035fc0d87c4950fb82c73e2fcb825a', 'fields' => '{"subAccountId":""}'],

View File

@ -25,9 +25,11 @@
<div class="col-lg-12" style="padding-bottom: 10px;">
<!-- Filters / Buttons in here.-->
@if(auth()->user()->client->getCreditCardGateway())
<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>
</div>
@endif
</div>
</div>

View File

@ -25,6 +25,12 @@
{{ $inv->id }} - {{ $inv->amount }}
@endforeach
</table>
@if($invoice->remaining_cycles >=1)
<div class="pull-right">
<button class="btn btn-primary">Cancel</button>
</div>
@endif
</div>
</div>
</div>