1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/DataMapper/CompanySettings.php

206 lines
5.1 KiB
PHP
Raw Normal View History

<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\DataMapper;
use App\Models\Company;
/**
* CompanySettings
*/
class CompanySettings extends BaseSettings
{
public $timezone_id;
public $date_format;
public $datetime_format;
public $military_time;
public $start_of_week;
public $financial_year_start;
public $language_id;
public $currency_id;
2019-05-16 00:26:21 +02:00
public $precision;
public $show_currency_symbol;
public $show_currency_code;
public $payment_terms; //days
public $custom_label1;
public $custom_value1;
public $custom_label2;
public $custom_value2;
public $custom_label3;
public $custom_value3;
public $custom_label4;
public $custom_value5;
public $custom_client_label1;
public $custom_client_label2;
public $custom_client_label3;
public $custom_client_label4;
public $custom_client_contact_label1;
public $custom_client_contact_label2;
public $custom_client_contact_label3;
public $custom_client_contact_label4;
public $custom_invoice_label1;
public $custom_invoice_label2;
public $custom_invoice_label3;
public $custom_invoice_label4;
public $custom_product_label1;
public $custom_product_label2;
public $custom_product_label3;
public $custom_product_label4;
public $custom_task_label1;
public $custom_task_label2;
public $custom_task_label3;
public $custom_task_label4;
public $custom_expense_label1;
public $custom_expense_label2;
public $custom_expense_label3;
public $custom_expense_label4;
public $custom_taxes1;
public $custom_taxes2;
public $default_task_rate;
public $send_reminders;
public $show_tasks_in_portal;
public $custom_message_dashboard;
public $custom_message_unpaid_invoice;
public $custom_message_paid_invoice;
public $custom_message_unapproved_quote;
public $lock_sent_invoices;
public $auto_archive_invoice;
public $inclusive_taxes;
public $translations;
2019-09-09 13:05:53 +02:00
public $group_selectors;
public $groups;
2019-04-26 07:57:45 +02:00
/**
* Counter Variables
*/
public $invoice_number_prefix;
public $invoice_number_pattern;
public $invoice_number_counter;
2019-04-26 07:57:45 +02:00
public $quote_number_prefix;
public $quote_number_pattern;
public $quote_number_counter;
2019-04-26 07:57:45 +02:00
public $client_number_prefix;
public $client_number_pattern;
2019-04-29 14:14:11 +02:00
public $client_number_counter;
2019-04-26 07:57:45 +02:00
public $credit_number_prefix;
public $credit_number_pattern;
public $credit_number_counter;
2019-04-29 00:40:38 +02:00
public $shared_invoice_quote_counter;
2019-04-26 07:57:45 +02:00
2019-04-30 08:02:39 +02:00
public $recurring_invoice_number_prefix;
2019-04-26 07:57:45 +02:00
public $reset_counter_frequency_id;
public $reset_counter_date;
2019-04-29 14:14:11 +02:00
public $counter_padding;
2019-04-26 07:57:45 +02:00
public $design;
2019-09-08 14:13:55 +02:00
2019-09-09 04:19:19 +02:00
public $payment_gateways;
/**
* Cast object values and return entire class
* prevents missing properties from not being returned
* and always ensure an up to date class is returned
*
* @return \stdClass
*/
public function __construct($obj)
{
parent::__construct($obj);
}
/**
* Provides class defaults on init
* @return object
*/
public static function defaults() : \stdClass
{
$config = json_decode(config('ninja.settings'));
return (object) [
'entity' => Company::class,
2019-04-24 02:22:02 +02:00
'timezone_id' => config('ninja.i18n.timezone_id'),
'language_id' => config('ninja.i18n.language_id'),
'currency_id' => config('ninja.i18n.currency_id'),
2019-05-16 00:26:21 +02:00
'precision' => 2,
'payment_terms' => config('ninja.i18n.payment_terms'),
'datetime_format' => config('ninja.i18n.datetime_format'),
'military_time' => config('ninja.i18n.military_time'),
'date_format' => config('ninja.i18n.date_format'),
'start_of_week' => config('ninja.i18n.start_of_week'),
'financial_year_start' => config('ninja.i18n.financial_year_start'),
'default_task_rate' => 0,
2019-04-24 12:01:40 +02:00
'send_reminders' => 'TRUE',
'show_tasks_in_portal' => 'TRUE',
'show_currency_symbol' => 'TRUE',
'show_currency_code' => 'FALSE',
'inclusive_taxes' => 'TRUE',
'custom_taxes1' => 'FALSE',
'custom_taxes2' => 'FALSE',
'lock_sent_invoices' => 'TRUE',
2019-04-29 00:40:38 +02:00
'shared_invoice_quote_counter' => 'FALSE',
'invoice_number_counter' => 1,
'quote_number_counter' => 1,
'credit_number_counter' => 1,
2019-04-29 14:14:11 +02:00
'client_number_counter' => 1,
'counter_padding' => 0,
2019-04-30 14:30:47 +02:00
'recurring_invoice_number_prefix' => 'R',
2019-05-27 07:26:34 +02:00
'invoice_number_prefix' => '',
'quote_number_prefix' => '',
'credit_number_prefix' => '',
'client_number_prefix' => '',
'auto_archive_invoice' => 'FALSE',
2019-09-04 03:45:53 +02:00
'design' => 'views/pdf/design1.blade.php',
2019-09-08 14:13:55 +02:00
'translations' => (object) [],
2019-09-09 13:05:53 +02:00
'group_selectors' => self::groupSelectors(),
'groups' => self::groupObjects(),
];
}
/**
* Implements App\DataMapper\Group objects
* in order to customise grouped option behaviour
* @return object Settings objects
*/
private static function groupObjects()
{
return (object)[
'company_gateways' => NULL,
'invoice_designs' => NULL
];
}
/**
* Storage point for ALL Group options
* @return object Settings objects
*/
private static function groupSelectors()
{
return (object)[
'company_gateways' => NULL,
'invoice_designs' => NULL
];
}
}