mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix conflicts and issue with add_number_length migration
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Crater\Models\CompanySetting;
|
||||
use Crater\Models\User;
|
||||
|
||||
class AddNumberLengthSetting extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$user = User::where('role', 'super admin')->first();
|
||||
|
||||
if ($user) {
|
||||
$invoice_number_length = CompanySetting::getSetting('invoice_number_length', $user->company_id);
|
||||
if (empty($invoice_number_length)) {
|
||||
CompanySetting::setSettings(['invoice_number_length' => '6'], $user->company_id);
|
||||
}
|
||||
|
||||
$estimate_number_length = CompanySetting::getSetting('estimate_number_length', $user->company_id);
|
||||
if (empty($estimate_number_length)) {
|
||||
CompanySetting::setSettings(['estimate_number_length' => '6'], $user->company_id);
|
||||
}
|
||||
|
||||
$payment_number_length = CompanySetting::getSetting('payment_number_length', $user->company_id);
|
||||
if (empty($payment_number_length)) {
|
||||
CompanySetting::setSettings(['payment_number_length' => '6'], $user->company_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -53,16 +53,19 @@ class DefaultSettingsSeeder extends Seeder
|
||||
'notify_estimate_viewed' => 'NO',
|
||||
'tax_per_item' => 'NO',
|
||||
'discount_per_item' => 'NO',
|
||||
'invoice_auto_generate' => 'YES',
|
||||
'invoice_prefix' => 'INV',
|
||||
'invoice_auto_generate' => 'YES',
|
||||
'invoice_number_length' => 6,
|
||||
'invoice_email_attachment' => 'NO',
|
||||
'estimate_prefix' => 'EST',
|
||||
'estimate_auto_generate' => 'YES',
|
||||
'estimate_number_length' => 6,
|
||||
'estimate_email_attachment' => 'NO',
|
||||
'payment_prefix' => 'PAY',
|
||||
'payment_auto_generate' => 'YES',
|
||||
'save_pdf_to_disk' => 'NO',
|
||||
'invoice_email_attachment' => 'NO',
|
||||
'estimate_email_attachment' => 'NO',
|
||||
'payment_number_length' => 6,
|
||||
'payment_email_attachment' => 'NO',
|
||||
'save_pdf_to_disk' => 'NO',
|
||||
];
|
||||
|
||||
CompanySetting::setSettings($settings, $user->company_id);
|
||||
|
||||
Reference in New Issue
Block a user