This module will give you the possibility to create business cards for users in IdM. Business card is some pdf document. Data for this document must be saved in IdM. It doesn't matter where the data are saved. You have the option to create business card from basic identity attribute, EAV, contract attribute, etc.
In default implementation which you get out of box when you enable this module you will be able to generate business card in following design:
If you want to generate business card for one specific user you can just go to the user detail and there you will find tab "Business card" When you click on this tab you will see form as you can see on the picture below.
You can change the information as you want before you generate business card, but if you want to generate business card again you will need to make these changes again. For this reason, we recommend to change the source from the information are pre filled. Business cards using these attributes:
If you want to create business card for more then one user, you can use standard bulk action which is available in users agenda. After that you will see modal window where you can select if you want to save business cards automatically to drive. Data which will be used for each user are calculated automatically based on primary contract.
Add the module and its dependecies (https://github.com/bcvsolutions/czechidm-business-card/blob/develop/Realization/libraries.tar) to /data/volumes/czechidm/modules/
Add frontend sources (https://github.com/bcvsolutions/czechidm-business-card/tree/develop/Realization/frontend/czechidm-bsc) to /data/volumes/czechidm/frontend-modules/czechidm-bsc/
Create following structure in the /data/volumes/czechidm/data:
├── business_cards │ ├── background │ │ └── defaulBck.png │ ├── cards │ ├── config │ │ ├── fop-businessCard.xml │ │ ├── fop.conf │ │ └── fonts │ │ ├── OpenSans-Bold.ttf │ │ └── OpenSans-Regular.ttf │ └── images │ └── 54321.png └── temp
The folder images can be omitted if we generate cards from profile photos.
The file defaulBck.png is the background used for business cards (use this exact name).
Configure following application properties:
idm.sec.bsc.configuration.bck.path=//opt/czechidm/data/business_cards/background/ idm.sec.bsc.configuration.fop.config.path=//opt/czechidm/data/business_cards/config/fop.conf idm.sec.bsc.configuration.image.file.extension=png idm.sec.bsc.configuration.save.path=//opt/czechidm/data/business_cards/cards/ idm.sec.bsc.configuration.template.path=//opt/czechidm/data/business_cards/config/fop-businessCard.xml idm.sec.bsc.configuration.tmp.path=//tmp/ idm.sec.bsc.configuration.additional.text=Some additional text
After that EAV attribute must be created. Go into Settings → Form definitions → IdmTreeNode (default) → Form Attributes → Create new one: Code: businessCardName Name: It can be whatever. E.g. Name of organisation on business card Attribute Type: Text Face Type: TextArea Regular Expression: (?>[^\r\n]*(?>\r\n?|\n)){0,3}[^\r\n]*\z Validation message: Text can have maximum of 4 rows.
The module may be configured to support multiple types of business cards. This is mostly needed when you need different background for different types of users, or some different text on the card.
In such case, the type of business card is determined by specific EAV (form) attribute businessCardType of identities or contracts.
Installation (example where you want to use different background image and different text):
idm.sec.bsc.configuration.bck.path
Usage:
Note: The EAV businessCardType can be defined for identities or identity contracts. If it is defined and contains values for both types, the EAV on identity is preferred.
This module is using Apache FOP library for generating pdf files. This module needs some files to be able to generate pdf correctly:
Whole project can be found on our github page. If you need other attributes then the default ones you can fork this repo or just override DefaultBscBusinessCardService and use annotation @Priority(-10) you can use different number just be sure that the priority is higher then the default one (0).
All methods has javadoc so you should be able the get the idea of the purpose of each method. If you want some different attributes you definitely need to override getFormInstance method where you can define which attributes will shown and which values will be pre filled into it.
For rendering attributes we are using EAV. That means that we will render attributes according to FormInstance which is returned by the above mentioned method getFormInstance Only difference between for example identity EAV is that the EAV are not persisted as the FormInstance is build on runtime. The reason for this is, that we don't persist Business card object to database so we can't use the "Form definitions" tabs in IdM setting to specify these attributes. We have only DTO which is used for data transfer between BE and FE.
Example properties for older installations for Windows:
Folder where is stored background for card - file named "defaulBck.png" If path is on Linux you need to use two forward slashes at the beginning e.g opt/somepath idm.sec.bsc.configuration.bck.path C:\somepath\background\ Path to Apache FOP config file idm.sec.bsc.configuration.fop.config.path C:\somepath\config\fop.conf Optional - Folder with user images which are used on business cards. File names inside this folder must be as PERSONALNUMBER.png Dont use this property if you want to use profile photos from identities. idm.sec.bsc.configuration.image.path C:\somepath\images\ File type extension of images which are used idm.sec.bsc.configuration.image.file.extension png Folder where the generated business cards will be saved automatically if you check the options to auto save idm.sec.bsc.configuration.save.path C:\somepath\business-cards\ Path to Apache FOP template idm.sec.bsc.configuration.template.path C:\somepath\config\fop-businessCard.xml Folder where IdM will save tmp files for generating If path is on Linux you need to use two forward slashes at the beginning e.g opt/somepath idm.sec.bsc.configuration.tmp.path C:\somepath\tmp\
Optional - Additional text for business card idm.sec.bsc.configuration.additional.text This card is created by Idstory