mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-18 00:53:10 +01:00
Make autobill setting numbers match token settings
This commit is contained in:
parent
919aec2192
commit
d99d81d655
@ -707,10 +707,10 @@ if (!defined('CONTACT_EMAIL')) {
|
|||||||
define('RESELLER_REVENUE_SHARE', 'A');
|
define('RESELLER_REVENUE_SHARE', 'A');
|
||||||
define('RESELLER_LIMITED_USERS', 'B');
|
define('RESELLER_LIMITED_USERS', 'B');
|
||||||
|
|
||||||
define('AUTO_BILL_OFF', 0);
|
define('AUTO_BILL_OFF', 1);
|
||||||
define('AUTO_BILL_OPT_IN', 1);
|
define('AUTO_BILL_OPT_IN', 2);
|
||||||
define('AUTO_BILL_OPT_OUT', 2);
|
define('AUTO_BILL_OPT_OUT', 3);
|
||||||
define('AUTO_BILL_ALWAYS', 3);
|
define('AUTO_BILL_ALWAYS', 4);
|
||||||
|
|
||||||
// These must be lowercase
|
// These must be lowercase
|
||||||
define('PLAN_FREE', 'free');
|
define('PLAN_FREE', 'free');
|
||||||
|
@ -324,7 +324,7 @@ class InvoiceRepository extends BaseRepository
|
|||||||
$invoice->start_date = Utils::toSqlDate($data['start_date']);
|
$invoice->start_date = Utils::toSqlDate($data['start_date']);
|
||||||
$invoice->end_date = Utils::toSqlDate($data['end_date']);
|
$invoice->end_date = Utils::toSqlDate($data['end_date']);
|
||||||
$invoice->client_enable_auto_bill = isset($data['client_enable_auto_bill']) && $data['client_enable_auto_bill'] ? true : false;
|
$invoice->client_enable_auto_bill = isset($data['client_enable_auto_bill']) && $data['client_enable_auto_bill'] ? true : false;
|
||||||
$invoice->auto_bill = isset($data['auto_bill']) ? intval($data['auto_bill']) : 0;
|
$invoice->auto_bill = isset($data['auto_bill']) ? intval($data['auto_bill']) : AUTO_BILL_OFF;
|
||||||
|
|
||||||
if ($invoice->auto_bill < AUTO_BILL_OFF || $invoice->auto_bill > AUTO_BILL_ALWAYS ) {
|
if ($invoice->auto_bill < AUTO_BILL_OFF || $invoice->auto_bill > AUTO_BILL_ALWAYS ) {
|
||||||
$invoice->auto_bill = AUTO_BILL_OFF;
|
$invoice->auto_bill = AUTO_BILL_OFF;
|
||||||
|
@ -78,6 +78,11 @@ class PaymentsChanges extends Migration
|
|||||||
->where('auto_bill', '=', 1)
|
->where('auto_bill', '=', 1)
|
||||||
->update(array('client_enable_auto_bill' => 1, 'auto_bill' => AUTO_BILL_OPT_OUT));
|
->update(array('client_enable_auto_bill' => 1, 'auto_bill' => AUTO_BILL_OPT_OUT));
|
||||||
|
|
||||||
|
\DB::table('invoices')
|
||||||
|
->where('auto_bill', '=', 0)
|
||||||
|
->where('is_recurring', '=', 1)
|
||||||
|
->update(array('auto_bill' => AUTO_BILL_OFF));
|
||||||
|
|
||||||
|
|
||||||
Schema::table('account_gateway_tokens', function($table)
|
Schema::table('account_gateway_tokens', function($table)
|
||||||
{
|
{
|
||||||
@ -113,11 +118,15 @@ class PaymentsChanges extends Migration
|
|||||||
$table->dropColumn('payment_method_id');
|
$table->dropColumn('payment_method_id');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
\DB::table('invoices')
|
||||||
|
->where('auto_bill', '=', AUTO_BILL_OFF)
|
||||||
|
->update(array('auto_bill' => 0));
|
||||||
|
|
||||||
\DB::table('invoices')
|
\DB::table('invoices')
|
||||||
->where(function($query){
|
->where(function($query){
|
||||||
$query->where('auto_bill', '=', AUTO_BILL_ALWAYS);
|
$query->where('auto_bill', '=', AUTO_BILL_ALWAYS);
|
||||||
$query->orwhere(function($query){
|
$query->orwhere(function($query){
|
||||||
$query->where('auto_bill', '!=', AUTO_BILL_OFF);
|
$query->where('auto_bill', '!=', 0);
|
||||||
$query->where('client_enable_auto_bill', '=', 1);
|
$query->where('client_enable_auto_bill', '=', 1);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -166,24 +166,24 @@
|
|||||||
</span>
|
</span>
|
||||||
@if($account->getTokenGatewayId())
|
@if($account->getTokenGatewayId())
|
||||||
<span data-bind="visible: is_recurring()" style="display: none">
|
<span data-bind="visible: is_recurring()" style="display: none">
|
||||||
<div data-bind="visible: !(auto_bill() == 1 && client_enable_auto_bill()) && !(auto_bill() == 2 && !client_enable_auto_bill())" style="display: none">
|
<div data-bind="visible: !(auto_bill() == {{AUTO_BILL_OPT_IN}} && client_enable_auto_bill()) && !(auto_bill() == {{AUTO_BILL_OPT_OUT}} && !client_enable_auto_bill())" style="display: none">
|
||||||
{!! Former::select('auto_bill')
|
{!! Former::select('auto_bill')
|
||||||
->data_bind("value: auto_bill, valueUpdate: 'afterkeydown', event:{change:function(){if(auto_bill()==1)client_enable_auto_bill(0);if(auto_bill()==2)client_enable_auto_bill(1)}}")
|
->data_bind("value: auto_bill, valueUpdate: 'afterkeydown', event:{change:function(){if(auto_bill()==".AUTO_BILL_OPT_IN.")client_enable_auto_bill(0);if(auto_bill()==".AUTO_BILL_OPT_OUT.")client_enable_auto_bill(1)}}")
|
||||||
->options([
|
->options([
|
||||||
0 => trans('texts.off'),
|
AUTO_BILL_OFF => trans('texts.off'),
|
||||||
1 => trans('texts.opt_in'),
|
AUTO_BILL_OPT_IN => trans('texts.opt_in'),
|
||||||
2 => trans('texts.opt_out'),
|
AUTO_BILL_OPT_OUT => trans('texts.opt_out'),
|
||||||
3 => trans('texts.always'),
|
AUTO_BILL_ALWAYS => trans('texts.always'),
|
||||||
]) !!}
|
]) !!}
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="client_enable_auto_bill" data-bind="attr: { value: client_enable_auto_bill() }" />
|
<input type="hidden" name="client_enable_auto_bill" data-bind="attr: { value: client_enable_auto_bill() }" />
|
||||||
<div class="form-group" data-bind="visible: auto_bill() == 1 && client_enable_auto_bill()">
|
<div class="form-group" data-bind="visible: auto_bill() == {{AUTO_BILL_OPT_IN}} && client_enable_auto_bill()">
|
||||||
<div class="col-sm-4 control-label">{{trans('texts.auto_bill')}}</div>
|
<div class="col-sm-4 control-label">{{trans('texts.auto_bill')}}</div>
|
||||||
<div class="col-sm-8" style="padding-top:10px;padding-bottom:9px">
|
<div class="col-sm-8" style="padding-top:10px;padding-bottom:9px">
|
||||||
{{trans('texts.opted_in')}} - <a href="#" data-bind="click:function(){client_enable_auto_bill(false)}">({{trans('texts.disable')}})</a>
|
{{trans('texts.opted_in')}} - <a href="#" data-bind="click:function(){client_enable_auto_bill(false)}">({{trans('texts.disable')}})</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" data-bind="visible: auto_bill() == 2 && !client_enable_auto_bill()">
|
<div class="form-group" data-bind="visible: auto_bill() == {{AUTO_BILL_OPT_OUT}} && !client_enable_auto_bill()">
|
||||||
<div class="col-sm-4 control-label">{{trans('texts.auto_bill')}}</div>
|
<div class="col-sm-4 control-label">{{trans('texts.auto_bill')}}</div>
|
||||||
<div class="col-sm-8" style="padding-top:10px;padding-bottom:9px">
|
<div class="col-sm-8" style="padding-top:10px;padding-bottom:9px">
|
||||||
{{trans('texts.opted_out')}} - <a href="#" data-bind="click:function(){client_enable_auto_bill(true)}">({{trans('texts.enable')}})</a>
|
{{trans('texts.opted_out')}} - <a href="#" data-bind="click:function(){client_enable_auto_bill(true)}">({{trans('texts.enable')}})</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user