mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Add in custom fields for exports
This commit is contained in:
parent
7cc2f3c665
commit
54b64fe6ad
@ -94,7 +94,6 @@ class BaseExport
|
||||
"state" => "client.state",
|
||||
"postal_code" => "client.postal_code",
|
||||
"country" => "client.country_id",
|
||||
"custom_value4" => "contact.custom_value4",
|
||||
"shipping_address1" => "client.shipping_address1",
|
||||
"shipping_address2" => "client.shipping_address2",
|
||||
"shipping_city" => "client.shipping_city",
|
||||
@ -109,6 +108,15 @@ class BaseExport
|
||||
"first_name" => "contact.first_name",
|
||||
"last_name" => "contact.last_name",
|
||||
"email" => "contact.email",
|
||||
'custom_value1' => 'client.custom_value1',
|
||||
'custom_value2' => 'client.custom_value2',
|
||||
'custom_value3' => 'client.custom_value3',
|
||||
'custom_value4' => 'client.custom_value4',
|
||||
"contact_custom_value1" => "contact.custom_value1",
|
||||
"contact_custom_value2" => "contact.custom_value2",
|
||||
"contact_custom_value3" => "contact.custom_value3",
|
||||
"contact_custom_value4" => "contact.custom_value4",
|
||||
|
||||
];
|
||||
|
||||
protected array $invoice_report_keys = [
|
||||
|
@ -79,8 +79,7 @@ class ContactRegister
|
||||
// As a fallback for self-hosted, it will use default company in the system
|
||||
// if key isn't provided in the url.
|
||||
if (! $request->route()->parameter('company_key') && Ninja::isSelfHost()) {
|
||||
/** @var \App\Models\Company $company */
|
||||
$company = Account::first()->default_company;
|
||||
$company = Account::query()->first()->default_company;
|
||||
|
||||
if (! $company->client_can_register) {
|
||||
abort(400, 'Registration disabled');
|
||||
|
@ -74,8 +74,7 @@ class RegisterRequest extends FormRequest
|
||||
}
|
||||
|
||||
if (! $this->route()->parameter('company_key') && Ninja::isSelfHost()) {
|
||||
/** @var \App\Models\Company $company */
|
||||
$company = Account::first()->default_company;
|
||||
$company = Account::query()->first()->default_company;
|
||||
|
||||
if (! $company->client_can_register) {
|
||||
abort(403, 'This page is restricted');
|
||||
|
@ -74,7 +74,7 @@ class StoreShopClientRequest extends Request
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
$this->company = Company::where('company_key', request()->header('X-API-COMPANY-KEY'))->firstOrFail();
|
||||
$this->company = Company::query()->where('company_key', request()->header('X-API-COMPANY-KEY'))->firstOrFail();
|
||||
|
||||
$input = $this->all();
|
||||
|
||||
@ -93,7 +93,7 @@ class StoreShopClientRequest extends Request
|
||||
//is no settings->currency_id is set then lets dive in and find either a group or company currency all the below may be redundant!!
|
||||
if (! property_exists($settings, 'currency_id') && isset($input['group_settings_id'])) {
|
||||
$input['group_settings_id'] = $this->decodePrimaryKey($input['group_settings_id']);
|
||||
$group_settings = GroupSetting::find($input['group_settings_id']);
|
||||
$group_settings = GroupSetting::query()->find($input['group_settings_id']);
|
||||
|
||||
if ($group_settings && property_exists($group_settings->settings, 'currency_id') && isset($group_settings->settings->currency_id)) {
|
||||
$settings->currency_id = (string) $group_settings->settings->currency_id;
|
||||
|
@ -72,7 +72,6 @@ class ValidRefundableInvoices implements Rule
|
||||
|
||||
foreach ($this->input['invoices'] as $val) {
|
||||
if ($val['invoice_id'] == $invoice->id) {
|
||||
/** @var \App\Models\Paymentable $pivot_record */
|
||||
$pivot_record = $payment->paymentables->where('paymentable_id', $invoice->id)->first();
|
||||
|
||||
if ($val['amount'] > ($pivot_record->amount - $pivot_record->refunded)) {
|
||||
|
@ -89,7 +89,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Credit> $credits
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
|
||||
* @property \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $paymentables
|
||||
* @property \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment>|\Illuminate\Support\Collection $paymentables
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Payment extends BaseModel
|
||||
|
Loading…
Reference in New Issue
Block a user