Update bunines bugs
Some checks failed
Some checks failed
This commit is contained in:
@@ -25,6 +25,19 @@ public function index()
|
|||||||
{
|
{
|
||||||
$business_id = auth()->user()->business_id;
|
$business_id = auth()->user()->business_id;
|
||||||
|
|
||||||
|
if (is_null($business_id)) {
|
||||||
|
$business = Business::with('category', 'enrolled_plan')->first();
|
||||||
|
if (!$business) {
|
||||||
|
return response()->json([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'No business found'
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
$business_id = $business->id;
|
||||||
|
} else {
|
||||||
|
$business = Business::with('category:id,name', 'enrolled_plan:id,plan_id,business_id,price,duration,allow_multibranch', 'enrolled_plan.plan:id,subscriptionName')->findOrFail($business_id);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure currency exists
|
// Ensure currency exists
|
||||||
$business_currency = UserCurrency::select('id', 'name', 'code', 'symbol', 'position')
|
$business_currency = UserCurrency::select('id', 'name', 'code', 'symbol', 'position')
|
||||||
->where('business_id', $business_id)
|
->where('business_id', $business_id)
|
||||||
@@ -60,16 +73,31 @@ public function index()
|
|||||||
->get()
|
->get()
|
||||||
->firstWhere('value.business_id', $business_id);
|
->firstWhere('value.business_id', $business_id);
|
||||||
|
|
||||||
$invoice_logo = $option->value['invoice_logo'] ?? null;
|
if (!$option) {
|
||||||
$a4_invoice_logo = $option->value['a4_invoice_logo'] ?? null;
|
$invoice_logo = null;
|
||||||
$thermal_invoice_logo = $option->value['thermal_invoice_logo'] ?? null;
|
$a4_invoice_logo = null;
|
||||||
$invoice_scanner_logo = $option->value['invoice_scanner_logo'] ?? null;
|
$thermal_invoice_logo = null;
|
||||||
$sale_rounding_option = $option->value['sale_rounding_option'] ?? 'none';
|
$invoice_scanner_logo = null;
|
||||||
$note_label = $option->value['note_label'] ?? null;
|
$sale_rounding_option = 'none';
|
||||||
$note = $option->value['note'] ?? null;
|
$note_label = null;
|
||||||
$gratitude_message = $option->value['gratitude_message'] ?? null;
|
$note = null;
|
||||||
$warranty_void_label = $option->value['warranty_void_label'] ?? null;
|
$gratitude_message = null;
|
||||||
$warranty_void = $option->value['warranty_void'] ?? null;
|
$warranty_void_label = null;
|
||||||
|
$warranty_void = null;
|
||||||
|
$option_value = [];
|
||||||
|
} else {
|
||||||
|
$option_value = $option->value;
|
||||||
|
$invoice_logo = $option_value['invoice_logo'] ?? null;
|
||||||
|
$a4_invoice_logo = $option_value['a4_invoice_logo'] ?? null;
|
||||||
|
$thermal_invoice_logo = $option_value['thermal_invoice_logo'] ?? null;
|
||||||
|
$invoice_scanner_logo = $option_value['invoice_scanner_logo'] ?? null;
|
||||||
|
$sale_rounding_option = $option_value['sale_rounding_option'] ?? 'none';
|
||||||
|
$note_label = $option_value['note_label'] ?? null;
|
||||||
|
$note = $option_value['note'] ?? null;
|
||||||
|
$gratitude_message = $option_value['gratitude_message'] ?? null;
|
||||||
|
$warranty_void_label = $option_value['warranty_void_label'] ?? null;
|
||||||
|
$warranty_void = $option_value['warranty_void'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
$data = array_merge(
|
$data = array_merge(
|
||||||
$business->toArray(),
|
$business->toArray(),
|
||||||
@@ -87,12 +115,12 @@ public function index()
|
|||||||
['gratitude_message' => $gratitude_message],
|
['gratitude_message' => $gratitude_message],
|
||||||
['warranty_void_label' => $warranty_void_label],
|
['warranty_void_label' => $warranty_void_label],
|
||||||
['warranty_void' => $warranty_void],
|
['warranty_void' => $warranty_void],
|
||||||
['show_note' => (int) ($option->value['show_note'] ?? 0)],
|
['show_note' => (int) ($option_value['show_note'] ?? 0)],
|
||||||
['show_gratitude_msg' => (int) ($option->value['show_gratitude_msg'] ?? 0)],
|
['show_gratitude_msg' => (int) ($option_value['show_gratitude_msg'] ?? 0)],
|
||||||
['show_invoice_scanner_logo' => (int) ($option->value['show_invoice_scanner_logo'] ?? 0)],
|
['show_invoice_scanner_logo' => (int) ($option_value['show_invoice_scanner_logo'] ?? 0)],
|
||||||
['show_a4_invoice_logo' => (int) ($option->value['show_a4_invoice_logo'] ?? 0)],
|
['show_a4_invoice_logo' => (int) ($option_value['show_a4_invoice_logo'] ?? 0)],
|
||||||
['show_thermal_invoice_logo' => (int) ($option->value['show_thermal_invoice_logo'] ?? 0)],
|
['show_thermal_invoice_logo' => (int) ($option_value['show_thermal_invoice_logo'] ?? 0)],
|
||||||
['show_warranty' => (int) ($option->value['show_warranty'] ?? 0)],
|
['show_warranty' => (int) ($option_value['show_warranty'] ?? 0)],
|
||||||
['develop_by_level' => $develop_by_level],
|
['develop_by_level' => $develop_by_level],
|
||||||
['develop_by' => $develop_by],
|
['develop_by' => $develop_by],
|
||||||
['develop_by_link' => $develop_by_link],
|
['develop_by_link' => $develop_by_link],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
@@ -27,7 +28,7 @@ public function run(): void
|
|||||||
if (DB::getDriverName() === 'pgsql') {
|
if (DB::getDriverName() === 'pgsql') {
|
||||||
DB::statement("SET session_replication_role = 'replica';");
|
DB::statement("SET session_replication_role = 'replica';");
|
||||||
} else {
|
} else {
|
||||||
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
Schema::disableForeignKeyConstraints();
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle = fopen($sqlPath, "r");
|
$handle = fopen($sqlPath, "r");
|
||||||
@@ -88,9 +89,8 @@ public function run(): void
|
|||||||
DB::statement("SET session_replication_role = 'origin';");
|
DB::statement("SET session_replication_role = 'origin';");
|
||||||
// Update sequences for PostgreSQL
|
// Update sequences for PostgreSQL
|
||||||
$this->updatePostgresSequences();
|
$this->updatePostgresSequences();
|
||||||
} else {
|
|
||||||
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
|
||||||
}
|
}
|
||||||
|
Schema::enableForeignKeyConstraints();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user