Skip to content

Commit

Permalink
INT-114 Rename bill to invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Gorodishenin committed Feb 21, 2020
1 parent d183b15 commit 50b34ac
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ v1.5 [unreleased]
- [#11](https://github.com/latera/camunda-ext/pull/11) Rename Invoice to Charge log
- [#13](https://github.com/latera/camunda-ext/pull/13) Fix id and non-id fields in helpers.hydra.Individual trait methods
- [#35](https://github.com/latera/camunda-ext/pull/35) Set private modifier for hid.hydra.Account#put* methods
- [#36](https://github.com/latera/camunda-ext/pull/36) Rename Bill to Invoice

v1.4.2 [unreleased]
-------------------
Expand Down
4 changes: 2 additions & 2 deletions src/org/camunda/latera/bss/connectors/hid/Hydra.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.camunda.latera.bss.connectors.hid.hydra.Document
import org.camunda.latera.bss.connectors.hid.hydra.Contract
import org.camunda.latera.bss.connectors.hid.hydra.PriceOrder
import org.camunda.latera.bss.connectors.hid.hydra.ChargeLog
import org.camunda.latera.bss.connectors.hid.hydra.Bill
import org.camunda.latera.bss.connectors.hid.hydra.Invoice
import org.camunda.latera.bss.connectors.hid.hydra.Subject
import org.camunda.latera.bss.connectors.hid.hydra.Company
import org.camunda.latera.bss.connectors.hid.hydra.Person
Expand All @@ -34,7 +34,7 @@ import org.camunda.latera.bss.connectors.hid.hydra.Param
import org.camunda.latera.bss.connectors.hid.hydra.Search
import org.camunda.latera.bss.connectors.hid.hydra.Tag

class Hydra implements Ref, Message, DataType, AddParam, Good, Document, Contract, PriceOrder, ChargeLog, Bill, Subject, Company, Person, Reseller, Group, Customer, Account, Subscription, Equipment, Region, Address, Param, Search, Tag {
class Hydra implements Ref, Message, DataType, AddParam, Good, Document, Contract, PriceOrder, ChargeLog, Invoice, Subject, Company, Person, Reseller, Group, Customer, Account, Subscription, Equipment, Region, Address, Param, Search, Tag {
private static String DEFAULT_USER = 'hydra'
private static String DEFAULT_LOCALE = 'ru'
HID hid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
package org.camunda.latera.bss.connectors.hid.hydra

import static org.camunda.latera.bss.utils.Oracle.encodeDateStr
import static org.camunda.latera.bss.utils.Constants.DOC_TYPE_Bill
import static org.camunda.latera.bss.utils.Constants.WFLOW_Bill
import static org.camunda.latera.bss.utils.Constants.WFLOW_AdvanceBill
import static org.camunda.latera.bss.utils.Constants.WFLOW_PrepaymentBill
import static org.camunda.latera.bss.utils.Constants.DOC_TYPE_Invoice
import static org.camunda.latera.bss.utils.Constants.WFLOW_Invoice
import static org.camunda.latera.bss.utils.Constants.WFLOW_ProformaInvoice
import static org.camunda.latera.bss.utils.Constants.WFLOW_PrepaymentInvoice

trait Bill {
private static String BILLS_TABLE = 'SD_V_BILLS_T'
private static String BILL_LINES_TABLE = 'SD_V_BILLS_C'
trait Invoice {
private static String INVOICES_TABLE = 'SD_V_INVOICES_T'
private static String INVOICE_LINES_TABLE = 'SD_V_INVOICES_C'

String getBillsTable() {
return BILLS_TABLE
String getInvoicesTable() {
return INVOICES_TABLE
}

String getBillLinesTable() {
return BILL_LINES_TABLE
String getInvoiceLinesTable() {
return INVOICE_LINES_TABLE
}

String getBillType() {
return getRefCode(getBillTypeId())
String getInvoiceType() {
return getRefCode(getInvoiceTypeId())
}

Number getBillTypeId() {
return DOC_TYPE_Bill
Number getInvoiceTypeId() {
return DOC_TYPE_Invoice
}

String getDefaultBillWorkflow() {
return getRefCode(getDefaultBillWorkflowId())
String getDefaultInvoiceWorkflow() {
return getRefCode(getDefaultInvoiceWorkflowId())
}

Number getDefaultBillWorkflowId() {
return WFLOW_Bill
Number getDefaultInvoiceWorkflowId() {
return WFLOW_Invoice
}

String getDefaultAdvanceBillWorkflow() {
return getRefCode(getDefaultAdvanceBillWorkflowId())
String getDefaultProformaInvoiceWorkflow() {
return getRefCode(getDefaultProformaInvoiceWorkflowId())
}

Number getDefaultAdvanceBillWorkflowId() {
return WFLOW_AdvanceBill
Number getDefaultProformaInvoiceWorkflowId() {
return WFLOW_ProformaInvoice
}

String getDefaultPrepaidBillWorkflow() {
return getRefCode(getDefaultPrepaidBillWorkflowId())
String getDefaultPrepaymentInvoiceWorkflow() {
return getRefCode(getDefaultPrepaymentInvoiceWorkflowId())
}

Number getDefaultPrepaidBillWorkflowId() {
return WFLOW_PrepaymentBill
Number getDefaultPrepaymentInvoiceWorkflowId() {
return WFLOW_PrepaymentInvoice
}

Map getBill(def docId) {
Map getInvoice(def docId) {
LinkedHashMap where = [
n_doc_id: docId
]
return hid.getTableFirst(getBillsTable(), where: where)
return hid.getTableFirst(getInvoicesTable(), where: where)
}

List getBillsBy(Map input) {
input.docTypeId = getBillTypeId()
List getInvoicesBy(Map input) {
input.docTypeId = getInvoiceTypeId()
return getDocumentsBy([providerId: null] + input)
}

Map getBillBy(Map input) {
input.docTypeId = getBillTypeId()
Map getInvoiceBy(Map input) {
input.docTypeId = getInvoiceTypeId()
return getDocumentBy([providerId: null] + input)
}

Boolean isBill(def entityOrEntityType) {
Boolean isInvoice(def entityOrEntityType) {
if (entityOrEntityType == null) {
return false
}

Number entityIdOrEntityTypeId = toIntSafe(entityOrEntityType)
if (entityIdOrEntityTypeId != null) {
return entityIdOrEntityTypeId == getBillTypeId() || getDocument(entityIdOrEntityTypeId).n_doc_type_id == getBillTypeId()
return entityIdOrEntityTypeId == getInvoiceTypeId() || getDocument(entityIdOrEntityTypeId).n_doc_type_id == getInvoiceTypeId()
} else {
return entityOrEntityType == getBillType()
return entityOrEntityType == getInvoiceType()
}
}

Boolean actualizeBill(def docId) {
Boolean actualizeInvoice(def docId) {
return actualizeDocument(docId)
}

Boolean executeBill(def docId) {
Boolean executeInvoice(def docId) {
return executeDocument(docId)
}

Boolean cancelBill(def docId) {
Boolean cancelInvoice(def docId) {
return cancelDocument(docId)
}

List getBillLinesBy(Map input) {
List getInvoiceLinesBy(Map input) {
LinkedHashMap params = mergeParams([
docId : null,
lineId : null,
Expand Down Expand Up @@ -196,49 +196,49 @@ trait Bill {
String oracleDate = encodeDateStr(params.operationDate)
where[oracleDate] = [between: "d_begin and nvl(d_end, ${oracleDate})"]
}
return hid.getTableData(getBillLinesTable(), where: where, order: params.order, limit: params.limit)
return hid.getTableData(getInvoiceLinesTable(), where: where, order: params.order, limit: params.limit)
}

List getBillLines(def docId, Integer limit = 0) {
List getInvoiceLines(def docId, Integer limit = 0) {
LinkedHashMap where = [
n_doc_id : docId,
n_move_type_id : ['not in': [getChargeCanceledTypeId()]]
]
return hid.getTableData(getBillLinesTable(), where: where, limit: limit)
return hid.getTableData(getInvoiceLinesTable(), where: where, limit: limit)
}

Map getBillLineBy(Map input) {
return getBillLinesBy(input + [limit: 1])?.getAt(0)
Map getInvoiceLineBy(Map input) {
return getInvoiceLinesBy(input + [limit: 1])?.getAt(0)
}

Map getBillLine(def lineId) {
Map getInvoiceLine(def lineId) {
LinkedHashMap where = [
n_line_id: lineId
]
return hid.getTableFirst(getBillLinesTable(), where: where)
return hid.getTableFirst(getInvoiceLinesTable(), where: where)
}

Map addBillTag(Map input) {
Map addInvoiceTag(Map input) {
return addDocumentTag(input)
}

Map addBillTag(def docId, CharSequence tag) {
return addBillTag(docId: docId, tag: tag)
Map addInvoiceTag(def docId, CharSequence tag) {
return addInvoiceTag(docId: docId, tag: tag)
}

Map addBillTag(Map input = [:], def docId) {
return addBillTag(input + [docId: docId])
Map addInvoiceTag(Map input = [:], def docId) {
return addInvoiceTag(input + [docId: docId])
}

Boolean deleteBillTag(def docTagId) {
Boolean deleteInvoiceTag(def docTagId) {
return deleteDocumentTag(docTagId)
}

Boolean deleteBillTag(Map input) {
Boolean deleteInvoiceTag(Map input) {
return deleteDocumentTag(input)
}

Boolean deleteBillTag(def docId, CharSequence tag) {
return deleteBillTag(docId: docId, tag: tag)
Boolean deleteInvoiceTag(def docId, CharSequence tag) {
return deleteInvoiceTag(docId: docId, tag: tag)
}
}
}
8 changes: 4 additions & 4 deletions src/org/camunda/latera/bss/utils/Constants.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Constants {
public static final Integer DOC_TYPE_ChargeLog = 3002
public static final Integer DOC_TYPE_CashWarrant = 4002
public static final Integer DOC_TYPE_PaymentOrder = 5002
public static final Integer DOC_TYPE_Bill = 6002
public static final Integer DOC_TYPE_Invoice = 6002
public static final Integer DOC_TYPE_PriceOrder = 7002
public static final Integer DOC_TYPE_BaseContract = 9002
public static final Integer DOC_TYPE_RecordOfBank = 11002
Expand Down Expand Up @@ -145,9 +145,9 @@ class Constants {
public static final Integer WFLOW_ChargeLog = 30021
public static final Integer WFLOW_CashWarrant = 40021
public static final Integer WFLOW_PaymentOrder = 50021
public static final Integer WFLOW_Bill = 60021
public static final Integer WFLOW_AdvanceBill = 60022
public static final Integer WFLOW_PrepaymentBill = 60023
public static final Integer WFLOW_Invoice = 60021
public static final Integer WFLOW_ProformaInvoice = 60022
public static final Integer WFLOW_PrepaymentInvoice = 60023
public static final Integer WFLOW_PriceOrder = 70021
public static final Integer WFLOW_BaseContract = 90021
public static final Integer WFLOW_RecordOfBank = 110021
Expand Down

0 comments on commit 50b34ac

Please sign in to comment.