1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02: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
if ($this->accountGateway->update_address) {
$client = $this->client();
if ($this->accountGateway->show_address) {
$client->address1 = trim($this->input['address1']);
$client->address2 = trim($this->input['address2']);
$client->city = trim($this->input['city']);
$client->state = trim($this->input['state']);
$client->postal_code = trim($this->input['postal_code']);
$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']);
}
$client = $this->client();
if ($this->accountGateway->show_address && $this->accountGateway->update_address) {
$client->address1 = trim($this->input['address1']);
$client->address2 = trim($this->input['address2']);
$client->city = trim($this->input['city']);
$client->state = trim($this->input['state']);
$client->postal_code = trim($this->input['postal_code']);
$client->country_id = trim($this->input['country_id']);
}
if (! $this->accountGateway->show_address || ! $this->accountGateway->update_address) {
return;
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']);
}
$client->save();
if ($client->isDirty()) {
$client->save();
}
}
protected function paymentDetails($paymentMethod = false)

View File

@ -158,15 +158,15 @@
->addGroupClass('gateway-option')
->value(1) !!}
{!! Former::checkbox('show_shipping_address')
->label(trans('texts.shipping_address'))
->text(trans('texts.show_shipping_address_help'))
{!! Former::checkbox('update_address')
->label(' ')
->text(trans('texts.update_address_help'))
->addGroupClass('gateway-option')
->value(1) !!}
{!! Former::checkbox('update_address')
->label(' ')
->text(trans('texts.update_address_help'))
{!! Former::checkbox('show_shipping_address')
->label(trans('texts.shipping_address'))
->text(trans('texts.show_shipping_address_help'))
->addGroupClass('gateway-option')
->value(1) !!}
@ -303,7 +303,7 @@
}
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);
$('label[for=update_address]').css('color', disabled ? '#888' : '#000');
}

View File

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