Inactive batch numbers won't die

Greetings all,

I have been asked to implement the batch system for our vaccines, and so have just started to see how it all works.  I notice that after a batch number is inactivated, it still appears in the batch number pulldown for the product.  It seems to me that this should not be.  In fact, it would seem that if only one active batch number is currently assigned to the product, it should auto-fill the batch number as it does when historically, one batch number (and only one batch number) has been assigned.

Is this behavior a bug... or a feature?

Thanks,

Sam

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Inactive batch numbers won't die

The first part is a bug. The batch dropdown is only excluding batches based on their expiry date, not their active status.
As a workaround, you could backdate the expiry date to exclude them, but this will affect reporting. Raised as OVPMS-1693

The second part is also a bug. It will default the batch number for new line items, if there is a single batch, but not for line items that have been saved previously. This is so that editing a previously saved charge doesn't automatically populate the batch if none was selected in the prior edit. It shouldn't prevent defaulting the batch number if the product is changed. Raised as OVPMS-1694.

-Tim

 

Re: Inactive batch numbers won't die

Hi Tim,

Thanks for reviewing that.  I had already considered the workaround of backdating the expiry to remove the inactive batch code from circulation, but thought that there might be some nasty ramifications if there was ever a client complaint and our records suggested that we had used "out-of-date" vaccines.  

For the time being, I will just have to stress to the staff that they need to be careful with the pulldown, to make sure they get the proper batch number.

Sam

 

Re: Inactive batch numbers won't die

I suspect the fix for the first issue is to change the org.openvpms.web.component.im.product.ProductBatchResultSet constructor from:

public ProductBatchResultSet(String value, Product product, Date from, IMObjectReference stockLocation,
                             int rows) {
    this(Constraints.shortName(ProductArchetypes.PRODUCT_BATCH), value, product, null, from, null, stockLocation,
         from, null, EXPIRY_DATES, rows);
}

to:

public ProductBatchResultSet(String value, Product product, Date from, IMObjectReference stockLocation,
                             int rows) {
    this(Constraints.shortName(ProductArchetypes.PRODUCT_BATCH, true), value, product, null, from, null, stockLocation,
         from, null, EXPIRY_DATES, rows);
}

I haven't tested this however.

Re: Inactive batch numbers won't die

OK, thanks for giving a place to start.  I'll try rebuilding with that change when I get access to my test server tomorrow.

Sam

Re: Inactive batch numbers won't die

Well, I did sort out a test-bed here at home and that change didn't seem to have any noticeable effect.  As noted before, the only way to get rid of the invalidated one is to fudge the expiry date.

Sam

Re: Inactive batch numbers won't die

Changing the:

Constraints.shortName(ProductArchetypes.PRODUCT_BATCH)

to:

Constraints.shortName(ProductArchetypes.PRODUCT_BATCH, true)

worked for me. The latter only lists active batches.

 

Re: Inactive batch numbers won't die

That's great.  OK, I must be doing something wrong in my intelliJ > deployment process.  Maybe I'm missing a step and source code changes aren't making it all the way through.  I'll keep playing with it.

Thanks. 

Sam

Re: Inactive batch numbers won't die

There's got to be a faster way to test locally than what I'm doing... compiling and pushing the .war up to the server and testing from there.... but in any event, I got your fix working.  Awesome.

Thanks!

Sam 

Re: Inactive batch numbers won't die

There is. In the openvpms-web/openvpms-web-app directory, type:

mvn tomcat7:run

This will run up an instance of tomcat on port 8080.

You can preload the openvpms-1_8 database with sample data using:

cd ../../openvpms-archetypes
mvn hibernate3:hbm2ddl openvpms-archetype:load openvpms-data:load
cd ../openvpms-sms
mvn openvpms-archetype:load
cd ../openvpms-release
mvn openvpms-report:load

I generate a sample database using the above, and then back it up using mysqldump so I can restore it to a clean state after testing.

 

 

Re: Inactive batch numbers won't die

Cha-ching!

Thanks!

Sam

Syndicate content