1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00

add stock quantity to imports

This commit is contained in:
David Bomba 2024-07-14 08:16:29 +10:00
parent d22c9a3bd9
commit d53f3062cf
14 changed files with 323 additions and 305 deletions

View File

@ -97,11 +97,6 @@ class Handler extends ExceptionHandler
{
if (Ninja::isHosted()) {
// if($exception instanceof ThrottleRequestsException && class_exists(\Modules\Admin\Events\ThrottledExceptionRaised::class)) {
// $uri = urldecode(request()->getRequestUri());
// event(new \Modules\Admin\Events\ThrottledExceptionRaised(auth()->user()?->account?->key, $uri, request()->ip()));
// }
Integration::configureScope(function (Scope $scope): void {
$name = 'hosted@invoiceninja.com';

View File

@ -97,7 +97,8 @@ class CreditFilters extends QueryFilters
$q->where('first_name', 'like', '%'.$filter.'%')
->orWhere('last_name', 'like', '%'.$filter.'%')
->orWhere('email', 'like', '%'.$filter.'%');
});
})
->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
});
}

View File

@ -124,7 +124,8 @@ class InvoiceFilters extends QueryFilters
$q->where('first_name', 'like', '%'.$filter.'%')
->orWhere('last_name', 'like', '%'.$filter.'%')
->orWhere('email', 'like', '%'.$filter.'%');
});
})
->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
});
}

View File

@ -45,7 +45,8 @@ class QuoteFilters extends QueryFilters
$q->where('first_name', 'like', '%'.$filter.'%')
->orWhere('last_name', 'like', '%'.$filter.'%')
->orWhere('email', 'like', '%'.$filter.'%');
});
})
->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
});
}

View File

@ -48,7 +48,8 @@ class RecurringInvoiceFilters extends QueryFilters
$q->where('first_name', 'like', '%'.$filter.'%')
->orWhere('last_name', 'like', '%'.$filter.'%')
->orWhere('email', 'like', '%'.$filter.'%');
});
})
->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(line_items, '$[*].notes')) LIKE ?", ['%'.$filter.'%']);
});
}

View File

@ -144,8 +144,6 @@ class SetupController extends Controller
define('STDIN', fopen('php://stdin', 'r'));
Artisan::call('config:clear');
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true]);
Artisan::call('config:clear');

View File

@ -31,7 +31,8 @@ class ProductMap
12 => 'product.custom_value2',
13 => 'product.custom_value3',
14 => 'product.custom_value4',
15 => 'product.image_url'
15 => 'product.image_url',
16 => 'product.in_stock_quantity',
];
}
@ -54,6 +55,7 @@ class ProductMap
13 => 'texts.custom_value',
14 => 'texts.custom_value',
15 => 'texts.image_url',
16 => 'texts.in_stock_quantity',
];
}
}

View File

@ -822,6 +822,20 @@ class Client extends BaseModel implements HasLocalePreference
}
public function utc_offset(): int
{
$offset = 0;
$timezone = $this->timezone();
date_default_timezone_set('GMT');
$date = new \DateTime("now", new \DateTimeZone($timezone->name));
$offset = $date->getOffset();
return $offset;
}
public function timezone_offset(): int
{
$offset = 0;

View File

@ -180,10 +180,12 @@ class ClientService
public function updatePaymentBalance()
{
$amount = Payment::query()->where('client_id', $this->client->id)
$amount = Payment::query()
->withTrashed()
->where('client_id', $this->client->id)
->where('is_deleted', 0)
->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED])
->selectRaw('SUM(payments.amount - payments.applied) as amount')->first()->amount ?? 0;
->selectRaw('SUM(payments.amount - payments.applied - payments.refunded) as amount')->first()->amount ?? 0;
DB::connection(config('database.default'))->transaction(function () use ($amount) {
$this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();

View File

@ -153,9 +153,9 @@ class CompanyLevel
// #[SerializedName('cbc:AccountingCostCode')]
// public $AccountingCostCode;
// /** @var string */
// #[SerializedName('cbc:AccountingCost')]
// public string $AccountingCost;
/** @var string */
#[SerializedName('cbc:AccountingCost')]
public string $AccountingCost;
// /** @var LineCountNumeric */
// #[SerializedName('cbc:LineCountNumeric')]

View File

@ -93,7 +93,7 @@ class AccountTransformer extends EntityTransformer
'has_iap_plan' => (bool)$account->inapp_transaction_id,
'tax_api_enabled' => (bool) config('services.tax.zip_tax.key') ? true : false,
'nordigen_enabled' => (bool) (config('ninja.nordigen.secret_id') && config('ninja.nordigen.secret_key')) ? true : false,
'upload_extensions' => (string) config('ninja.upload_extensions'),
'upload_extensions' => (string) "png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx,webp,xml,zip,csv,ods,odt,odp,".config('ninja.upload_extensions'),
];
}

View File

@ -211,7 +211,7 @@ class CompanyTransformer extends EntityTransformer
'smtp_password' => $company->smtp_password ? '********' : '',
'smtp_local_domain' => (string)$company->smtp_local_domain ?? '',
'smtp_verify_peer' => (bool)$company->smtp_verify_peer,
// 'e_invoice' => $company->e_invoice ?: new \stdClass(),
'e_invoice' => $company->e_invoice ?: new \stdClass(),
];
}

View File

@ -130,6 +130,8 @@ class HtmlEngine
$data = [];
$data['$date_client_now'] = ['value' => now()->setTimezone($this->client->timezone()->name)->addSeconds($this->client->utc_offset())->format($this->client->date_format()), 'label' => ''];
$data['$date_company_now'] = ['value' => now()->setTimezone($this->company->timezone()->name)->addSeconds($this->company->utc_offset())->format($this->company->date_format()), 'label' => ''];
$data['$global_margin'] = ['value' => '6.35mm', 'label' => ''];
$data['$company_logo_size'] = ['value' => $this->resolveCompanyLogoSize(), 'label' => ''];
$data['$show_shipping_address'] = ['value' => $this->settings->show_shipping_address ? 'flex' : 'none', 'label' => ''];

573
composer.lock generated

File diff suppressed because it is too large Load Diff