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

Fixes for settings checker

This commit is contained in:
David Bomba 2023-10-05 21:47:24 +11:00
parent 4d8fef3e4e
commit def82e2d52
3 changed files with 36 additions and 11 deletions

View File

@ -21,15 +21,16 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int|null $user_id
* @property int|null $company_id
* @property string $name
* @property int $is_custom
* @property int $is_active
* @property bool $is_custom
* @property bool $is_active
* @property bool $is_template
* @property object|null $design
* @property int $is_deleted
* @property bool $is_deleted
* @property int|null $created_at
* @property int|null $updated_at
* @property int|null $deleted_at
* @property-read \App\Models\Company|null $company
* @property-read mixed $hashed_id
* @property-read string $hashed_id
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|Design filter(\App\Filters\QueryFilters $filters)

View File

@ -28,6 +28,15 @@ use App\Jobs\Company\CompanyTaxRate;
*/
trait CompanySettingsSaver
{
private array $string_ids = [
'payment_refund_design_id',
'payment_receipt_design_id',
'delivery_note_design_id',
'statement_design_id',
'besr_id',
'gmail_sending_user_id',
];
/**
* Saves a setting object.
*
@ -131,7 +140,8 @@ trait CompanySettingsSaver
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') {
$value = 'integer';
if ($key == 'besr_id') {
if(in_array($key, $this->string_ids)) {
// if ($key == 'besr_id') {
$value = 'string';
}
@ -199,13 +209,17 @@ trait CompanySettingsSaver
if (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') {
$value = 'integer';
if ($key == 'gmail_sending_user_id') {
$value = 'string';
if(in_array($key, $this->string_ids)) {
$value ='string';
}
if ($key == 'besr_id') {
$value = 'string';
}
// if ($key == 'gmail_sending_user_id') {
// $value = 'string';
// }
// if ($key == 'besr_id') {
// $value = 'string';
// }
if (! property_exists($settings, $key)) {
continue;

View File

@ -18,6 +18,15 @@ use App\DataMapper\CompanySettings;
*/
trait SettingsSaver
{
private array $string_ids = [
'payment_refund_design_id',
'payment_receipt_design_id',
'delivery_note_design_id',
'statement_design_id',
'besr_id',
'gmail_sending_user_id',
];
/**
* Used for custom validation of inbound
* settings request.
@ -54,7 +63,8 @@ trait SettingsSaver
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter' || ($key == 'payment_terms' && property_exists($settings, $key) && strlen($settings->{$key}) >= 1) || ($key == 'valid_until' && property_exists($settings, $key) && strlen($settings->{$key}) >= 1)) {
$value = 'integer';
if ($key == 'gmail_sending_user_id' || $key == 'besr_id') {
if(in_array($key, $this->string_ids)) {
// if ($key == 'gmail_sending_user_id' || $key == 'besr_id') {
$value = 'string';
}