h1. Limiting product combination

Date last updated: 17 May 2007 -- Nesrine

UI Screens for this feature are available `here <https://mifos.dev.java.net/source/browse/_checkout_/mifos/documents/ui-workspace/05_Apr_2007.zip>`_.

Test cases are available `here <https://mifos.dev.java.net/files/documents/5045/62251/file_62251.dat/TestCasesGAP(12)%20V1.0.0.xls>`_.


h2. Scope

Only the following restriction will be covered by the current feature: Product mix:
* A client couldn't have two active loan accounts with products that are not allowed (i.e that couldn't coexist).


h2. Conventions

Those conventions will be used in the whole document:
* UC: Use Case
* Mandatory fields will be proceeded by *
* Links are _italicized_
* Buttons are put between brackets : `{Button}`
* Only the following loan products are configured into Mifos: *A*, *B*, *C*, and *D* * *A* *<>* *B* : this means that *A* couldn't coexist with *B*


h2. Feature summary

This feature is a prelude to address the following request: A client couldn't have two or more, active loan accounts with products that are not allowed (i.e don't match). I.e.: If *A* *<>* *B*, a client that have an active loan account (Active in good standing or active in bad standing) in *A*, couldn't have an active loan account in *B* ; since *A* and *B* don't match.

Background ----------

Currently, Mifos doesn't perform any restriction concerned with products mix. A client could match all products in his active portfolio. When adding the product mix issue, the system will perform the "product mix" validation when moving the account status to "Active", i.e at loan disbursal


h2. Feature Description


h2. UC1: Define product mix


h3. Prerequisites
* Product mix is defined for active products


h3. Primary Flow
* The user enter the Mifos system
* From the admin section the user clicks on _Define Product Mix_
* A new page *Define product mix* is displayed
* In the Mix details section, the user choose the product type (In the navigational UI prototype, choose "loan" in the drop down field)
* The user choose the product instance name (In the navigational UI prototype, *A* is displayed in the drop down field)
* In the right hand box, are displayed allowed products; i.e those that match with the selected product
* In the left hand box, are displayed not allowed products; i.e those that don't match with the selected product
* By default, a product is allowed with all active products existing in the system, even itself. However if the choosen product was defined not allowed in another product mix, this later should appear in the left hand box(In t he UI prototypes: *A* is by default allowed with all existing active products, which are : *A*, *B*, *C* and *D*)
* The user selects from the right hand box, the product which is not allowed ( in the UI prototypes: *B* *<>* *A*) then clicks `{Remove}`
* Through this swap mechanism, the removed product will be displayed in the left hand box (not allowed products).
* Actions allowed from this page `{Preview}` and `{cancel}`
* When the user clicks on `{preview}`, the *preview* page is displayed
* Actions allowed from this page `{Edit product mix}`, `{Submit}` and `{Cancel}`
* When the user clicks on `{submit}`, the product Mix data are recorded and the following is displayed: "You have successfully defined the product Mix"
* The user could view product mix details or define mix for a new product
* When the user clicks on _define mix for a new product_
* The *Define product mix* page is displayed. The user choose a new product. (product *B* for example)
* Right hand box displays the allowed products (By default *C*, *D*and *B*)
* Left hand box displays the not allowed products (*A* in this case)
* The user selects the product *A*, then clicks on `{add}`, to add *A* to the allowed products list
* The *preview* page is displayed with the following warning message : "This/Those product(s) is/are not allowed to *B*. If you want to continue click on submit to save this mix"
* _text in red_: "The others products mixes will be updated automatically."
* The user clicks on `{cancel}` to return to the admin page without submitting any information.


h3. Post-conditions:
# The product records are updated with the new mix
# When moving a loan account status to "active", i.e at each loan disbursal, the system performs the following validation steps:
* Check if the client has active loan accounts
* Check if the new loan product to disburse is allowed to the existent active loan product
* If the two products are not allowed, a new page is displayed with the following message: "The loan couldn't be disbursed as *A* and *B* are not allowed"


h3. Alternate Flow
* If the user clicks on `{cancel}` in the *Define product mix* page, the admin page is displayed and no changes are recorded.
* If the user clicks on `{Edit product mix}` in the *preview product mix* page, the *Define product mix* page is displayed with the information already captured.
* If the user clicks on `{cancel}` in the *preview product mix* page, the admin page is displayed without recording any changes.


h2. UC2: View / Edit product mix


h3. Prerequisites
* There are products in the system for which product mix was defined


h3. Primary Flow
* The user enter the Mifos system
* From the admin section the user clicks on _view product mix_
* A new page is displayed with the following: products for which mixes were defined,
* When the user clicks on the _product instance name_, the *product mix* page is displayed with the following:  * Actions allowed from this page `{Edit product mix}`,and `{View change log}`
* When the user clicks on `{Edit product mix}`, the *Edit product mix* page is displayed.
* The user modifies the product's mix and submit


h3. Post-conditions:
* The system performs the changes only for the new loan accounts, and thus at loan disbursal.


h3. Alternate Flow
* If the user clicks on `{view change log}`, *the change log* page is displayed


h3. UI Screens

In the admin page:
* New subsection in the admin section labeled: "Manage Products Mix"
* Links labeled: _View product mix_ | _Define product mix_


h3. Additional information
* Tagging products for which mixes were defined
* Product mix Changes Tracking:
| The logs have the following information for the changes made to the product mix records: Date of change • Changed by • Old value="old product mix" • New value = "new product mix"
* Roles and permissions:

New permissions need to be added into the system:
* Can Define product mix
* Can Edit product mix
* Managing errors:

Appropriate errors should be managed based on the system consistency.


h3. Open issue

*NB*: When developing the UI, we need to:
* Work on better text, ex:remove not allowed products
* Reduce the white space between "product instance name" and "remove not allowed products