Skip to content

Modifying a journal uses today's date for voiding the existing journal resulting in DB error if there is no current financial year #10

@rkilchmn

Description

@rkilchmn

Version FA 2.4.14
When modifying a journal the existing journal gets voided using todays date
/usr/share/webapps/frontaccounting/gl/includes/db/gl_journal.inc
$msg = void_transaction($trans_type, $cart->order_id, Today(), _("Document reentered."));

That causes a DB error in /usr/share/webapps/frontaccounting/includes/db/audit_trail_db.inc
function add_audit_trail($trans_type, $trans_no, $trans_date, $descr='')
Line 34

Example: the exiting journals transaction date is '2012-05-12' but the query tries to find a financial year for today and fails with error "Column 'fiscal_year' cannot be null". I am using the "demo" company with active financial year in 2012
"UPDATE 0_audit_trail audit LEFT JOIN 0_fiscal_year year ON year.begin<='2022-12-11' AND year.end>='2022-12-11'
SET audit.gl_seq = IF(audit.id=601, 0, NULL),audit.fiscal_year=year.id WHERE type='0' AND trans_no='53'"

For most other transaction types , the original transaction's date is used for voiding:
Example: /usr/share/webapps/frontaccounting/gl/includes/db/gl_db_banking.inc:
$msg = void_transaction($trans_type, $old_trans, $date_, _("Document reentered."));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions