Skip to content

Commit

Permalink
Remove unused 'entity_id' and 'till' columns from AR/AP
Browse files Browse the repository at this point in the history
POS functionality has been removed years ago, so till doesn't
serve a  purpose anymore. For entity_id, it looks like it was never
used...
  • Loading branch information
ehuelsmann committed Jun 1, 2023
1 parent 210156a commit 8194867
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 59 deletions.
6 changes: 0 additions & 6 deletions UI/Reports/filters/gl.html
Expand Up @@ -301,12 +301,6 @@
type="checkbox"
value="1"
} %] [% text('Cleared') %]</td>
<td nowrap>[% PROCESS input element_data = {
name="col_till"
class="checkbox"
type="checkbox"
value="1"
} %] [% text('Till') %]</td>
</tr>
<tr>
<td nowrap>[% PROCESS input element_data = {
Expand Down
6 changes: 0 additions & 6 deletions UI/Reports/filters/invoice_outstanding.html
Expand Up @@ -246,12 +246,6 @@
value = '1'
label = text('Notes')
} %]</td>
<td>[% PROCESS input element_data = {
name = 'col_till'
type = 'checkbox'
value = '1'
label = text('Till')
} %]</td>
</tr>
<tr>
<td>[% PROCESS input element_data = {
Expand Down
6 changes: 0 additions & 6 deletions UI/Reports/filters/invoice_search.html
Expand Up @@ -393,12 +393,6 @@
value = '1'
label = text('Notes')
} %]</td>
<td>[% PROCESS input element_data = {
name = 'col_till'
type = 'checkbox'
value = '1'
label = text('Till')
} %]</td>
</tr>
<tr>
<td>[% PROCESS input element_data = {
Expand Down
5 changes: 0 additions & 5 deletions lib/LedgerSMB/Report/GL.pm
Expand Up @@ -166,11 +166,6 @@ sub columns {
type => 'text',
pwidth => '3', },

{col_id => 'till',
name => $self->Text('Till'),
type => 'text',
pwidth => '1', },

{col_id => 'chart_id',
name => $self->Text('Chart ID'),
type => 'text',
Expand Down
6 changes: 0 additions & 6 deletions lib/LedgerSMB/Report/Invoices/Outstanding.pm
Expand Up @@ -157,8 +157,6 @@ has '+order_by' => (default => 'meta_number');
=item notes
=item till
=item employee_name
=item manager_name
Expand Down Expand Up @@ -274,10 +272,6 @@ sub columns {
name => $self->Text('Notes'),
type => 'text',
pwidth => 15, },
{col_id => 'till',
name => $self->Text('Till'),
type => 'text',
pwidth => 8, },
{col_id => 'salesperson',
name => $self->Text('Salesperson'),
type => 'text',
Expand Down
5 changes: 0 additions & 5 deletions lib/LedgerSMB/Report/Invoices/Transactions.pm
Expand Up @@ -224,8 +224,6 @@ This is the customer or vendor name
=item notes text
=item till text
=item salesperson text
=item manager text
Expand Down Expand Up @@ -302,9 +300,6 @@ sub columns {
{ col_id => 'notes',
name => $self->Text('Notes'),
type => 'text'},
{ col_id => 'till',
name => $self->Text('Till'),
type => 'text'},
{ col_id => 'salesperson',
name => $self->Text('Salesperson'),
type => 'text'},
Expand Down
5 changes: 2 additions & 3 deletions old/lib/LedgerSMB/IS.pm
Expand Up @@ -1189,7 +1189,6 @@ sub post_invoice {
taxincluded = ?,
curr = ?,
person_id = ?,
till = ?,
language_code = ?,
ponumber = ?,
approved = ?,
Expand All @@ -1212,7 +1211,7 @@ sub post_invoice {
$form->{terms}, $form->{notes},
$form->{intnotes}, $form->{taxincluded},
$form->{currency},
$form->{employee_id}, $form->{till},
$form->{employee_id},
$form->{language_code}, $form->{ponumber}, $approved,
$form->{crdate} || 'today', $form->{reverse},
$form->{is_return}, $form->{setting_sequence},
Expand Down Expand Up @@ -1255,7 +1254,7 @@ sub retrieve_invoice {
a.shippingpoint, a.shipvia, a.terms, a.notes,
a.intnotes,
a.duedate, a.taxincluded, a.curr AS currency,
a.person_id as employee_id, e.name AS employee, a.till,
a.person_id as employee_id, e.name AS employee,
a.reverse, a.entity_credit_account as customer_id,
a.language_code, a.ponumber, a.crdate,
a.on_hold, a.description, a.setting_sequence,
Expand Down
9 changes: 9 additions & 0 deletions sql/changes/1.11/aa-column-cleanup.sql
@@ -0,0 +1,9 @@

alter table ar
drop column entity_id,
drop column till;

alter table ap
drop column entity_id,
drop column till;

3 changes: 0 additions & 3 deletions sql/changes/1.11/rm-aa-entity_id.sql

This file was deleted.

2 changes: 1 addition & 1 deletion sql/changes/LOADORDER
Expand Up @@ -177,5 +177,5 @@ mc/delete-migration-validation-data.sql
1.11/enable-barcode-on-invoices.sql
1.11/reversed-transactions.sql
1.11/negative-assets-liablilities-reclass.sql
1.11/rm-aa-entity_id.sql
1.11/ar-ap-role-naming-consistency.sql
1.11/aa-column-cleanup.sql
31 changes: 13 additions & 18 deletions sql/modules/Report.sql
Expand Up @@ -60,7 +60,6 @@ CREATE TYPE report_aging_item AS (
"language" text,
invnumber text,
transdate date,
till text,
ordnumber text,
ponumber text,
notes text,
Expand Down Expand Up @@ -103,7 +102,7 @@ RETURN QUERY EXECUTE $sql$
)
SELECT c.entity_id, c.meta_number::text, e.name,
e.name as contact_name, c.language_code::text as "language",
a.invnumber, a.transdate, a.till::text, a.ordnumber,
a.invnumber, a.transdate, a.ordnumber,
a.ponumber, a.notes,
CASE WHEN a.age/30 = 0
THEN (a.sign * sum(ac.amount_bc))
Expand All @@ -129,7 +128,7 @@ RETURN QUERY EXECUTE $sql$
JOIN invoice i ON (i.parts_id = p.id)
WHERE i.trans_id = a.id) AS line_items,
(coalesce($5, now())::date - a.transdate) as age
FROM (select id, invnumber, till, ordnumber, amount_bc, duedate,
FROM (select id, invnumber, ordnumber, amount_bc, duedate,
curr, ponumber, notes, entity_credit_account,
-1 AS sign, transdate, force_closed,
CASE WHEN $7
Expand Down Expand Up @@ -178,7 +177,7 @@ RETURN QUERY EXECUTE $sql$
GROUP BY c.entity_id, c.meta_number, e.name, c.language_code,
l.line_one, l.line_two, l.line_three,
l.city, l.state, l.mail_code, country.name,
a.invnumber, a.transdate, a.till, a.ordnumber,
a.invnumber, a.transdate, a.ordnumber,
a.ponumber, a.notes, a.amount_bc, a.sign,
a.duedate, a.id, a.curr, a.age
HAVING ($6 is null
Expand Down Expand Up @@ -237,7 +236,6 @@ CREATE TYPE gl_report_item AS (
amount_tc numeric,
accno text,
gifi_accno text,
till text,
cleared bool,
memo text,
accname text,
Expand Down Expand Up @@ -290,26 +288,24 @@ FOR retval IN
)
SELECT g.id, g.type, g.invoice, g.reference, g.eca_name, g.description, ac.transdate,
ac.source, ac.amount_bc, ac.curr, ac.amount_tc, c.accno, c.gifi_accno,
g.till, ac.cleared, ac.memo, c.description AS accname,
ac.cleared, ac.memo, c.description AS accname,
ac.chart_id, ac.entry_id,
sum(ac.amount_bc) over (order by ac.transdate, ac.trans_id,
c.accno, ac.entry_id)
+ t_balance
as running_balance,
array_agg(ARRAY[bac.class_id, bac.bu_id])
FROM (select id, 'gl' as type, false as invoice, reference,
null::text as eca_name, description, approved,
null::text as till
null::text as eca_name, description, approved
FROM gl
UNION
SELECT ar.id, 'ar', invoice, invnumber, e.name, ar.description, approved, till
SELECT ar.id, 'ar', invoice, invnumber, e.name, ar.description, approved
FROM ar
JOIN entity_credit_account eca ON ar.entity_credit_account
= eca.id
JOIN entity e ON e.id = eca.entity_id
UNION
SELECT ap.id, 'ap', invoice, invnumber, e.name, ap.description, approved,
null as till
SELECT ap.id, 'ap', invoice, invnumber, e.name, ap.description, approved
FROM ap
JOIN entity_credit_account eca ON ap.entity_credit_account
= eca.id
Expand Down Expand Up @@ -350,7 +346,7 @@ FOR retval IN
AND (in_category = c.category OR in_category IS NULL)
GROUP BY g.id, g.type, g.invoice, g.reference, g.eca_name, g.description, ac.transdate,
ac.source, ac.amount_bc, c.accno, c.gifi_accno,
g.till, ac.cleared, ac.memo, c.description,
ac.cleared, ac.memo, c.description,
ac.chart_id, ac.entry_id, ac.trans_id
HAVING in_business_units is null
or in_business_units <@ compound_array(bu_tree.path)
Expand Down Expand Up @@ -425,7 +421,6 @@ CREATE TYPE aa_transactions_line AS (
last_payment date,
due_date date,
notes text,
till text,
salesperson text,
manager text,
shipping_point text,
Expand All @@ -447,10 +442,10 @@ SELECT a.id, a.invoice, eeca.id, eca.meta_number::text, eeca.name, a.transdate,
a.invnumber, a.ordnumber, a.ponumber, a.curr, a.amount_bc, a.netamount_bc,
a.amount_bc - a.netamount_bc as tax,
a.amount_bc - p.due as paid, p.due, p.last_payment, a.duedate, a.notes,
a.till::text, ee.name, me.name, a.shippingpoint, a.shipvia,
ee.name, me.name, a.shippingpoint, a.shipvia,
'{}'::text[] as business_units -- TODO
FROM (select id, transdate, invnumber, curr, amount_bc, netamount_bc, duedate,
notes, till, person_id, entity_credit_account, invoice,
notes, person_id, entity_credit_account, invoice,
shippingpoint, shipvia, ordnumber, ponumber, description,
on_hold, force_closed
FROM ar
Expand Down Expand Up @@ -524,7 +519,7 @@ SELECT null::int as id, null::bool as invoice, entity_id, meta_number::text,
null::text as ordnumber, null::text as ponumber, curr,
sum(amount) as amount, sum(netamount) as netamount, sum(tax) as tax,
sum(paid) as paid, sum(due) as due, max(last_payment) as last_payment,
null::date as duedate, null::text as notes, null::text as till,
null::date as duedate, null::text as notes,
null::text as salesperson, null::text as manager,
null::text as shipping_point, null::text as ship_via,
null::text[] as business_units
Expand Down Expand Up @@ -580,12 +575,12 @@ SELECT a.id, a.invoice, eeca.id, eca.meta_number::text, eeca.name,
a.amount_bc - a.netamount_bc as tax, a.amount_bc - p.due,
p.due, p.last_payment,
a.duedate, a.notes,
a.till::text, eee.name as employee, mee.name as manager, a.shippingpoint,
eee.name as employee, mee.name as manager, a.shippingpoint,
a.shipvia, '{}'::text[]

FROM (select id, transdate, invnumber, curr, amount_bc, netamount_bc, duedate,
notes,
till, person_id, entity_credit_account, invoice, shippingpoint,
person_id, entity_credit_account, invoice, shippingpoint,
shipvia, ordnumber, ponumber, description, on_hold, force_closed
FROM ar
WHERE $1 = 2
Expand Down

0 comments on commit 8194867

Please sign in to comment.