1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

rebasing commits from v5-develop

This commit is contained in:
David Bomba 2022-07-27 11:28:30 +10:00
parent d78415b6bf
commit 0d4eb7e37a
4 changed files with 29 additions and 5 deletions

View File

@ -42,6 +42,15 @@ class ProductFilters extends QueryFilters
});
}
public function product_key(string $filter = '') : Builder
{
if (strlen($filter) == 0) {
return $this->builder;
}
return $this->builder->where('product_key', $filter);
}
/**
* Filters the list based on the status
* archived, active, deleted.

View File

@ -83,9 +83,6 @@ class InvitationController extends Controller
$invitation = $entity_obj::withTrashed()
->with($entity)
->where('key', $invitation_key)
// ->whereHas($entity, function ($query) {
// $query->where('is_deleted',0);
// })
->with('contact.client')
->first();

View File

@ -170,7 +170,21 @@ class BaseImport
{
$count = 0;
$is_free_hosted_client = $this->company->account->isFreeHostedClient();
$hosted_client_count = $this->company->account->hosted_client_count;
foreach ($data as $key => $record) {
if($this->factory_name instanceof ClientFactory && $is_free_hosted_client && ($this->company->clients()->count() > $hosted_client_count))
{
$this->error_array[$entity_type][] = [
$entity_type => $record,
'error' => 'Client limit reached',
];
return $count;
}
try {
$entity = $this->transformer->transform($record);
// $validator = $this->request_name::runFormRequest($entity);

View File

@ -76,6 +76,8 @@ class CreditCard implements MethodInterface
{
$client = new \stdClass;
$country = $this->square_driver->client->country ? $this->square_driver->client->country->iso_3166_2 : $this->square_driver->client->company->country()->iso_3166_2;
$client->addressLines = [$this->square_driver->client->address1 ?: '', $this->square_driver->client->address2 ?: ''];
$client->givenName = $this->square_driver->client->present()->first_name();
$client->familyName = $this->square_driver->client->present()->last_name();
@ -83,7 +85,7 @@ class CreditCard implements MethodInterface
$client->phone = $this->square_driver->client->phone;
$client->city = $this->square_driver->client->city;
$client->region = $this->square_driver->client->state;
$client->country = $this->square_driver->client->country->iso_3166_2;
$client->country = $country;
return (array) $client;
}
@ -202,6 +204,8 @@ class CreditCard implements MethodInterface
private function createClient()
{
$country = $this->square_driver->client->country ? $this->square_driver->client->country->iso_3166_2 : $this->square_driver->client->company->country()->iso_3166_2;
/* Step two - create the customer */
$billing_address = new \Square\Models\Address();
$billing_address->setAddressLine1($this->square_driver->client->address1);
@ -209,7 +213,7 @@ class CreditCard implements MethodInterface
$billing_address->setLocality($this->square_driver->client->city);
$billing_address->setAdministrativeDistrictLevel1($this->square_driver->client->state);
$billing_address->setPostalCode($this->square_driver->client->postal_code);
$billing_address->setCountry($this->square_driver->client->country->iso_3166_2);
$billing_address->setCountry($country);
$body = new \Square\Models\CreateCustomerRequest();
$body->setGivenName($this->square_driver->client->present()->name());