feat(chequebook): add RETURNED leaf status for dishonoured/bounced cheques

Adds a maker-checker-gated "return" command on cheque books that flags
presented-and-dishonoured leaves as terminal RETURNED (distinct from
STOP_PAYMENT/drawer-initiated and LOST/custody-failure), following the
same reason/actor/timestamp pattern already used for lost/cancelled/used
leaves on m_cheque_leaf.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-07-15 16:07:04 +05:30
co-authored by Claude Sonnet 5
parent 04d65d857f
commit 3bb7fc8050
11 changed files with 144 additions and 10 deletions
@@ -408,4 +408,5 @@
<include file="parts/0385_chequebook_pending_requests.xml" relativeToChangelogFile="true"/>
<include file="parts/0386_enable_global_maker_checker.xml" relativeToChangelogFile="true"/>
<include file="parts/0387_chequeleaf_serial_unique_per_lot.xml" relativeToChangelogFile="true"/>
<include file="parts/0388_chequeleaf_returned_status.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<!--
A RETURNED status for a cheque leaf — the leaf was presented for payment and dishonoured/bounced
(insufficient funds, signature mismatch, etc.), as distinct from STOP_PAYMENT (drawer-initiated) or
LOST (custody failure). Follows the same free-text reason pattern already used for lost_reason/
cancelled_reason/used_reason on this table, rather than introducing a one-off code-value list.
Terminal like LOST/CANCELLED/USED — no revoke, matching this table's existing conventions.
-->
<changeSet id="0388-cheque-leaf-returned-columns" author="CBS">
<preConditions onFail="MARK_RAN">
<not><columnExists tableName="m_cheque_leaf" columnName="return_reason"/></not>
</preConditions>
<addColumn tableName="m_cheque_leaf">
<column name="return_reason" type="VARCHAR(500)"/>
<column name="returned_by" type="BIGINT"/>
<column name="returned_on" type="TIMESTAMP WITH TIME ZONE"/>
</addColumn>
</changeSet>
<changeSet id="0388-permission" author="CBS" runOnChange="false">
<sql>
INSERT INTO m_permission (grouping, code, entity_name, action_name, can_maker_checker)
SELECT 'portfolio', 'RETURN_CHEQUEBOOK', 'CHEQUEBOOK', 'RETURN', true
WHERE NOT EXISTS (SELECT 1 FROM m_permission WHERE code = 'RETURN_CHEQUEBOOK');
</sql>
</changeSet>
</databaseChangeLog>