Add dubai timezone

This commit is contained in:
David Bomba 2024-07-17 09:18:08 +10:00
parent 05019e7575
commit 79ed0abf6b
3 changed files with 69 additions and 0 deletions

View File

@ -449,10 +449,41 @@ class Activity extends StaticModel
$replacements['created_at'] = $this->created_at ?? '';
$replacements['ip'] = $this->ip ?? '';
if($this->activity_type_id == 141)
$replacements = $this->harvestNoteEntities($replacements);
return $replacements;
}
private function harvestNoteEntities(array $replacements): array
{
$entities = [
':invoice',
':quote',
':credit',
':payment',
':task',
':expense',
':purchase_order',
':recurring_invoice',
':recurring_expense',
':client',
];
foreach($entities as $entity)
{
$entity_key = substr($entity, 1);
if($this?->{$entity_key})
$replacements = array_merge($replacements, $this->matchVar($entity));
}
return $replacements;
}
private function matchVar(string $variable)
{
$system = ctrans('texts.system');

View File

@ -0,0 +1,37 @@
<?php
use App\Models\Timezone;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$t = \App\Models\Timezone::find(115);
if(!$t){
$t = new Timezone();
$t->id = 115;
$t->name = 'Asia/Dubai';
$t->location = '(GMT+04:00) Dubai';
$t->utc_offset = 14400;
$t->save();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

@ -151,6 +151,7 @@ class ConstantsSeeder extends Seeder
$timezones[] = ['name'=>'Asia/Magadan', 'location' => '(GMT+12:00) Magadan', 'utc_offset' => 43200];
$timezones[] = ['name'=>'Pacific/Auckland', 'location' => '(GMT+12:00) Auckland', 'utc_offset' => 43200];
$timezones[] = ['name'=>'Pacific/Fiji', 'location' => '(GMT+12:00) Fiji', 'utc_offset' => 43200];
$timezones[] = ['name' => 'Asia/Dubai', 'location' => '(GMT+04:00) Dubai', 'utc_offset' => 14400];
$x = 1;
foreach ($timezones as $timezone) {