Files
opensourcepos/app/Database/Migrations/20190712150200_fix_empty_reports.php
BudsieBuds e83c23cf0c Improve code style and PSR-12 compliance (#4204)
* Improve code style and PSR-12 compliance
- refactored code formatting to adhere to PSR-12 guidelines
- standardized coding conventions across the codebase
- added missing framework files and reverted markup changes
- reformatted arrays for enhanced readability
- updated language files for consistent styling and clarity
- minor miscellaneous improvements
2025-05-02 19:37:06 +02:00

33 lines
894 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Migration_fix_empty_reports extends Migration
{
/**
* Perform a migration step.
*/
public function up(): void
{
$builder = $this->db->table('stock_locations');
$builder->select('location_name');
$builder->where('location_id', 1);
$builder->limit(1);
$location_name = $builder->get()->getResultArray()[0]['location_name'];
$location_name = str_replace(' ', '_', $location_name);
$builder = $this->db->table('permissions');
$builder->set('location_id', 1);
$builder->where('permission_id', 'receivings_' . $location_name);
$builder->orWhere('permission_id', 'sales_' . $location_name);
$builder->update();
}
/**
* Revert a migration step.
*/
public function down(): void {}
}