Hello, I´m really new in openMRS and I have thousands of doubts. I have reading several step-by-step guides and your wiki and there are a lot of information. I have started playing with my new module wirh reference application. I have my first module deployed in an openmrs-sdk instance…but I would like to know if I can take a fragment from another module…I would like to add a patient search at the top of my module. I have seen the patient search module in the default openmrs distribution. Can I use that code in my module with an “includefragment” or similar? or I have to write the code again? Thanks so much. Regards.
Welcome to the community and thanks @david.corrales for this inquiry, someone here will be able to help you.
yes @ david.corrales , in openmrs , as long as the code in a given module was written follwing the standard openmrs convestions , when you install that module as a dependence in your module , you can always use code from it. in otherwords , you can include fragmnets from another module without re-writing the code , if you first install that module as a dependence in your module , and provided , the fragments were defined in the standard openmrs way of doing it
if you read this https://wiki.openmrs.org/display/docs/Include+an+Existing+Fragment, youll find a phrase like “a library of re-usable fragments”
check this out for how to install a module as a dependence in another module https://wiki.openmrs.org/display/docs/Module+Dependencies
And basically… that’s it (I think). You don’t even need Core Apps to depend on UI Commons, or to require it. You will see that Core Apps does depend on uicommons-api, but I think that’s for a complete different reason, it’s because it uses its global constants (here).
thanks @mksd for a more clarification.
in other-words you do need even to first install another module as a dependence as i had earlier said, but atleast what am sure of is , you must make sure whichever module you’re getting fragments from must be installed and running at the time of running your module
Ok! thanks so much! Done! I follow doing several test.