HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wp-content/plugins/erp/includes/updates/update-1.6.3.php
<?php

namespace WeDevs\ERP\HRM\Update;

function erp_acct_alter_invoice_receipts_1_6_3() {
    global $wpdb;

    // Add hash column in `erp_crm_contact_subscriber` table
    $cols  = $wpdb->get_col( "DESC $table" );

    if ( ! in_array( 'transaction_charge', $cols ) ) {
        $wpdb->query(
            "ALTER TABLE {$wpdb->prefix}erp_acct_invoice_receipts ADD `transaction_charge` decimal(20,2) DEFAULT 0 AFTER `amount`;"
        );
    }
}

function erp_acct_insert_to_erp_acct_ledgers_1_6_3() {
    global $wpdb;

    $check_data = $wpdb->get_row(
        $wpdb->prepare(
            "SELECT * FROM {$wpdb->prefix}erp_acct_ledgers WHERE slug = %s", [ 'bank_transaction_charge' ]
        )
    );

    if ( empty( $check_data ) ) {
        $wpdb->query(
            $wpdb->prepare(
                "INSERT INTO {$wpdb->prefix}erp_acct_ledgers ( `chart_id`, `name`, `slug`, `code`, `system`, `created_at` ) VALUES ( %d, %s, %s, %s, %d, %s )",
                  [ 5, 'Bank Transaction Charge', 'bank_transaction_charge', '606', 0, date( 'Y-m-d' ) ]
            )
        );
    }
}

erp_acct_alter_invoice_receipts_1_6_3();
erp_acct_insert_to_erp_acct_ledgers_1_6_3();