mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2025-12-23 17:47:54 -05:00
Allow empty tax category id (#4285)
This commit is contained in:
@@ -635,10 +635,10 @@ class Items extends Secure_Controller
|
||||
$item_data['reorder_level'] = 0;
|
||||
}
|
||||
|
||||
$tax_category_id = intval($this->request->getPost('tax_category_id'));
|
||||
$tax_category_id = $this->request->getPost('tax_category_id');
|
||||
|
||||
if (!isset($tax_category_id)) {
|
||||
$item_data['tax_category_id'] = '';
|
||||
$item_data['tax_category_id'] = null;
|
||||
} else {
|
||||
$item_data['tax_category_id'] = empty($this->request->getPost('tax_category_id')) ? null : intval($this->request->getPost('tax_category_id'));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class MissingConfigKeys extends Migration
|
||||
class Migration_MissingConfigKeys extends Migration
|
||||
{
|
||||
/**
|
||||
* Perform a migration step.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class Migration_NullableTaxCategoryId extends Migration
|
||||
{
|
||||
/**
|
||||
* Perform a migration step.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
error_log('Migrating config table');
|
||||
|
||||
helper('migration');
|
||||
execute_script(APPPATH . 'Database/Migrations/sqlscripts/3.4.2_missing_config_keys.sql');
|
||||
|
||||
error_log('Migrating config table');
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert a migration step.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
-- Migration to make tax_category_id nullable in ospos_items
|
||||
ALTER TABLE ospos_items
|
||||
MODIFY COLUMN tax_category_id INT NULL;
|
||||
Reference in New Issue
Block a user