1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Working on shipping address

This commit is contained in:
Hillel Coren 2017-11-20 16:44:28 +02:00
parent ebedbf8809
commit 461916a334
3 changed files with 34 additions and 35 deletions

View File

@ -407,32 +407,29 @@ class BasePaymentDriver
} }
// update the address info // update the address info
if ($this->accountGateway->update_address) { $client = $this->client();
$client = $this->client();
if ($this->accountGateway->show_address) { if ($this->accountGateway->show_address && $this->accountGateway->update_address) {
$client->address1 = trim($this->input['address1']); $client->address1 = trim($this->input['address1']);
$client->address2 = trim($this->input['address2']); $client->address2 = trim($this->input['address2']);
$client->city = trim($this->input['city']); $client->city = trim($this->input['city']);
$client->state = trim($this->input['state']); $client->state = trim($this->input['state']);
$client->postal_code = trim($this->input['postal_code']); $client->postal_code = trim($this->input['postal_code']);
$client->country_id = trim($this->input['country_id']); $client->country_id = trim($this->input['country_id']);
}
if ($this->accountGateway->show_shipping_address) {
$client->shipping_address1 = trim($this->input['shipping_address1']);
$client->shipping_address2 = trim($this->input['shipping_address2']);
$client->shipping_city = trim($this->input['shipping_city']);
$client->shipping_state = trim($this->input['shipping_state']);
$client->shipping_postal_code = trim($this->input['shipping_postal_code']);
$client->shipping_country_id = trim($this->input['shipping_country_id']);
}
} }
if (! $this->accountGateway->show_address || ! $this->accountGateway->update_address) { if ($this->accountGateway->show_shipping_address) {
return; $client->shipping_address1 = trim($this->input['shipping_address1']);
$client->shipping_address2 = trim($this->input['shipping_address2']);
$client->shipping_city = trim($this->input['shipping_city']);
$client->shipping_state = trim($this->input['shipping_state']);
$client->shipping_postal_code = trim($this->input['shipping_postal_code']);
$client->shipping_country_id = trim($this->input['shipping_country_id']);
} }
if ($client->isDirty()) {
$client->save(); $client->save();
}
} }
protected function paymentDetails($paymentMethod = false) protected function paymentDetails($paymentMethod = false)

View File

@ -158,15 +158,15 @@
->addGroupClass('gateway-option') ->addGroupClass('gateway-option')
->value(1) !!} ->value(1) !!}
{!! Former::checkbox('show_shipping_address') {!! Former::checkbox('update_address')
->label(trans('texts.shipping_address')) ->label(' ')
->text(trans('texts.show_shipping_address_help')) ->text(trans('texts.update_address_help'))
->addGroupClass('gateway-option') ->addGroupClass('gateway-option')
->value(1) !!} ->value(1) !!}
{!! Former::checkbox('update_address') {!! Former::checkbox('show_shipping_address')
->label(' ') ->label(trans('texts.shipping_address'))
->text(trans('texts.update_address_help')) ->text(trans('texts.show_shipping_address_help'))
->addGroupClass('gateway-option') ->addGroupClass('gateway-option')
->value(1) !!} ->value(1) !!}
@ -303,7 +303,7 @@
} }
function enableUpdateAddress(event) { function enableUpdateAddress(event) {
var disabled = ! $('#show_address').is(':checked') && ! $('#show_shipping_address').is(':checked'); var disabled = ! $('#show_address').is(':checked');
$('#update_address').prop('disabled', disabled); $('#update_address').prop('disabled', disabled);
$('label[for=update_address]').css('color', disabled ? '#888' : '#000'); $('label[for=update_address]').css('color', disabled ? '#888' : '#000');
} }

View File

@ -236,12 +236,14 @@
@if (!empty($accountGateway->show_shipping_address)) @if (!empty($accountGateway->show_shipping_address))
<h3>{{ trans('texts.shipping_address') }} &nbsp;&nbsp; <h3>{{ trans('texts.shipping_address') }} &nbsp;&nbsp;
<span> @if ($accountGateway->show_address)
<label for="shipToBillingAddress" style="font-weight:normal"> <span>
<input id="shipToBillingAddress" type="checkbox"/> <label for="shipToBillingAddress" style="font-weight:normal">
{{ trans('texts.ship_to_billing_address') }} <input id="shipToBillingAddress" type="checkbox"/>
</label> {{ trans('texts.ship_to_billing_address') }}
</span> </label>
</span>
@endif
</h3> </h3>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">