]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Don't cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 30 Apr 2020 21:41:37 +0000 (23:41 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 30 Apr 2020 21:41:37 +0000 (23:41 +0200)
- renamed class field financialBean to financialIncomeBean as this reflects
  the real purpose of the EJB.
- exposed incomeEnabled flag in admin-add-income form
- removed some needless tags as it can be done easier in PrimeFaces
- added missing i18n strings

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jfinancials/beans/financial/model/income/FinancialsIncomeWebRequestBean.java
src/java/org/mxchange/localization/project_de_DE.properties
src/java/org/mxchange/localization/project_en_US.properties
web/user/financials/login_financials_add_income.xhtml

index eee3e8634ab0ea6bb14e0789209cad2ec35c3be4..a8fd89399e9947f6952a1b35f09218fa58f60552 100644 (file)
@@ -49,7 +49,12 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsBean implement
         * EJB for general financial income purposes
         */
        @EJB (lookup = "java:global/jfinancials-ejb/financialIncome!org.mxchange.jfinancials.model.income.FinancialIncomeSessionBeanRemote")
-       private FinancialIncomeSessionBeanRemote financialBean;
+       private FinancialIncomeSessionBeanRemote financialIncomeBean;
+
+       /**
+        * Whether the income is enabled
+        */
+       private Boolean incomeEnabled;
 
        /**
         * Income interval
@@ -106,11 +111,17 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsBean implement
                }
 
                // Now that all required data has been entered, prepare new income instance
-               final BillableIncome income = new FinancialIncome(this.getIncomeTitle(), this.getIncomeSingleAmount(), this.getIncomeInterval(), this.userLoginController.getLoggedInUser());
+               final BillableIncome income = new FinancialIncome(
+                                                        this.getIncomeTitle(),
+                                                        this.getIncomeSingleAmount(),
+                                                        this.getIncomeInterval(),
+                                                        this.userLoginController.getLoggedInUser(),
+                                                        this.getIncomeEnabled()
+                                        );
 
                // Handle it over to the EJB
                // @TODO Use updated income instance, e.g. fire event
-               final BillableIncome updatedIncome = this.financialBean.addIncome(income);
+               final BillableIncome updatedIncome = this.financialIncomeBean.addIncome(income);
        }
 
        /**
@@ -123,6 +134,24 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsBean implement
                return Arrays.asList(FinancialInterval.values());
        }
 
+       /**
+        * Getter for incomeEnabled flag
+        * <p>
+        * @return incomeEnabled flag
+        */
+       public Boolean getIncomeEnabled () {
+               return this.incomeEnabled;
+       }
+
+       /**
+        * Setter for incomeEnabled flag
+        * <p>
+        * @param incomeEnabled incomeEnabled flag
+        */
+       public void setIncomeEnabled (final Boolean incomeEnabled) {
+               this.incomeEnabled = incomeEnabled;
+       }
+
        /**
         * Getter for income interval
         * <p>
index b55de5ed7b777d5f4d56405a2221e85aca92b2a7..dc6379b163aa8cc244651dd5d0a91603247a79c7 100644 (file)
@@ -192,3 +192,8 @@ BUTTON_ADMIN_EDIT_RECEIPT_ITEM=Kassenboneintrag aendern
 RECEIPT_ITEM_UPDATED_TITLE=Wann dieser Kassenboneintrag als letztes geaendert wurde.
 #@TODO Please fix German umlauts!
 ADMIN_ERROR_FINANCIAL_RECEIPT_ITEM_NOT_CHANGED=Fehler: Sie haben den Kassenboneintrag nicht geaendert.
+#@TODO Please fix German umlauts!
+ADMIN_ENABLE_INCOME_REQUIRED=Sie muessen entweder das Einkommen aktivieren oder deaktivieren.
+ADMIN_ENABLE_INCOME=Einkommen aktiviert?
+#@TODO Please fix German umlauts!
+ADMIN_ENABLE_INCOME_TITLE=Bitte waehlen Sie aus, ob das Einkommen aktiviert ist.
index 1140fa17f66cafd3aa67242c271f23d39a6f1082..d9bf44d2126c117beefb0591d02a5ea3938a1300 100644 (file)
@@ -159,3 +159,6 @@ ADMIN_EDIT_RECEIPT_ITEM_MINIMUM_DATA=Enter minimum data, marked with (*) for thi
 BUTTON_ADMIN_EDIT_RECEIPT_ITEM=Change receipt item
 RECEIPT_ITEM_UPDATED_TITLE=Then this receipt item has been recently updated.
 ADMIN_ERROR_FINANCIAL_RECEIPT_ITEM_NOT_CHANGED=Error: You did not change the receipt item.
+ADMIN_ENABLE_INCOME_REQUIRED=You have to whether enable or disabled the income.
+ADMIN_ENABLE_INCOME=Income enabled?
+ADMIN_ENABLE_INCOME_TITLE=Please choose whether the income is enabled.
index 3f4777ce72c0e2a7a458900321257ee5a4055dd1..f827e87cd16b3c67633a729b3463e5ab99ecfc77 100644 (file)
 
        <ui:define name="content">
                <h:form>
-                       <h:panelGroup layout="block">
-                               <div class="table-header">
-                                       <h:outputText value="#{project.LOGIN_FINANCIAL_ADD_INCOME_FORM_TITLE}" />
-                               </div>
-
-                               <h:panelGroup styleClass="table-row" layout="block">
-                                       <div class="table-left-medium">
-                                               <p:outputLabel for="incomeTitle" value="#{project.LOGIN_FINANCIAL_INCOME_TITLE}" />
-                                       </div>
+                       <h:panelGroup
+                               styleClass="table-header"
+                               layout="block"
+                               >
+                               <h:outputText value="#{project.LOGIN_FINANCIAL_ADD_INCOME_FORM_TITLE}" />
+                       </h:panelGroup>
 
-                                       <div class="table-right-medium">
-                                               <p:inputText id="incomeTitle" size="2" maxlength="10" value="#{financialIncomeController.incomeTitle}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_TITLE_REQUIRED}">
-                                                       <f:validator validatorId="IncomeTitleValidator" />
-                                               </p:inputText>
-                                       </div>
-                               </h:panelGroup>
+                       <p:panelGrid
+                               columns="2"
+                               layout="grid"
+                               >
+                               <p:outputLabel for="incomeTitle" value="#{project.LOGIN_FINANCIAL_INCOME_TITLE}" />
+                               <p:inputText id="incomeTitle" size="2" maxlength="10" value="#{financialIncomeController.incomeTitle}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_TITLE_REQUIRED}">
+                                       <f:validator validatorId="IncomeTitleValidator" />
+                               </p:inputText>
 
-                               <h:panelGroup styleClass="table-row" layout="block">
-                                       <div class="table-left-medium">
-                                               <p:outputLabel for="incomeInterval" value="#{project.LOGIN_FINANCIAL_INCOME_INTERVAL}" />
-                                       </div>
+                               <p:outputLabel for="incomeInterval" value="#{project.LOGIN_FINANCIAL_INCOME_INTERVAL}" />
+                               <p:selectOneMenu
+                                       id="incomeInterval"
+                                       value="#{financialIncomeController.incomeInterval}"
+                                       filter="true"
+                                       filterMatchMode="contains"
+                                       required="true"
+                                       requiredMessage="#{project.FIELD_FINANCIAL_INCOME_REQUIRED}"
+                                       >
+                                       <f:selectItems
+                                               value="#{financialIncomeController.allIncomeIntervals()}"
+                                               var="incomeInterval"
+                                               itemValue="#{incomeInterval}"
+                                               itemLabel="#{msg[incomeInterval.concat('_INTERVAL')]}"
+                                               />
+                               </p:selectOneMenu>
 
-                                       <div class="table-right-medium">
-                                               <p:selectOneMenu
-                                                       id="incomeInterval"
-                                                       value="#{financialIncomeController.incomeInterval}"
-                                                       filter="true"
-                                                       filterMatchMode="contains"
-                                                       required="true"
-                                                       requiredMessage="#{project.FIELD_FINANCIAL_INCOME_REQUIRED}"
-                                                       >
-                                                       <f:selectItems
-                                                               value="#{financialIncomeController.allIncomeIntervals()}"
-                                                               var="incomeInterval"
-                                                               itemValue="#{incomeInterval}"
-                                                               itemLabel="#{msg[incomeInterval.concat('_INTERVAL')]}"
-                                                               />
-                                               </p:selectOneMenu>
-                                       </div>
-                               </h:panelGroup>
+                               <p:outputLabel for="incomeSingleValue" value="#{project.LOGIN_FINANCIAL_INCOME_SINGLE_VALUE}" />
+                               <p:inputText id="incomeSingleValue" size="5" maxlength="20" value="#{financialIncomeController.incomeSingleAmount}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_SINGLE_VALUE_REQUIRED}">
+                                       <f:validator validatorId="CurrencyAmountValidator" />
+                               </p:inputText>
 
-                               <h:panelGroup styleClass="table-row" layout="block">
-                                       <div class="table-left-medium">
-                                               <p:outputLabel for="incomeSingleValue" value="#{project.LOGIN_FINANCIAL_INCOME_SINGLE_VALUE}" />
-                                       </div>
+                               <p:outputLabel for="incomeEnabled" value="#{project.ADMIN_ENABLE_INCOME}" />
+                               <p:selectBooleanCheckbox
+                                       id="incomeEnabled"
+                                       value="#{financialIncomeController.incomeEnabled}"
+                                       required="true"
+                                       requiredMessage="#{project.ADMIN_ENABLE_INCOME_REQUIRED}"
+                                       title="#{project.ADMIN_ENABLE_INCOME_TITLE}"
+                                       />
+                       </p:panelGrid>
 
-                                       <div class="table-right-medium">
-                                               <p:inputText id="incomeSingleValue" size="5" maxlength="20" value="#{financialIncomeController.incomeSingleAmount}" required="true" requiredMessage="#{project.FIELD_FINANCIAL_INCOME_SINGLE_VALUE_REQUIRED}">
-                                                       <f:validator validatorId="CurrencyAmountValidator" />
-                                               </p:inputText>
-                                       </div>
-                               </h:panelGroup>
+                       <p:panelGrid columns="2" layout="grid">
+                               <p:commandButton
+                                       type="reset"
+                                       value="#{msg.BUTTON_RESET_FORM}"
+                                       />
 
-                               <p:panelGrid columns="2" layout="grid">
-                                       <p:commandButton
-                                               type="reset"
-                                               value="#{msg.BUTTON_RESET_FORM}"
-                                               />
-
-                                       <p:commandButton
-                                               type="submit"
-                                               value="#{project.BUTTON_LOGIN_FINANCIAL_ADD_INCOME}"
-                                               action="#{financialIncomeController.addIncome()}"
-                                               />
-                               </p:panelGrid>
-                       </h:panelGroup>
+                               <p:commandButton
+                                       type="submit"
+                                       value="#{project.BUTTON_LOGIN_FINANCIAL_ADD_INCOME}"
+                                       action="#{financialIncomeController.addIncome()}"
+                                       />
+                       </p:panelGrid>
                </h:form>
        </ui:define>
 </ui:composition>