iDempiere plug-in project

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>org.idempiere</groupId>
	<artifactId>org.idempiere.parent</artifactId>
	<version>7.1.0-SNAPSHOT</version>
	<relativePath>../idempiere2020/org.idempiere.parent/pom.xml</relativePath>
    </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>tw.aierp.aps</groupId>
  <artifactId>tw.aierp.aps</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
    <parent>
        <groupId>org.idempiere</groupId>
	<artifactId>org.idempiere.parent</artifactId>
	<version>7.1.0-SNAPSHOT</version>
	<relativePath>../idempiere2020/org.idempiere.parent/pom.xml</relativePath>
    </parent>

修改pom.xml 插入 <parent> </parent>標籤

MyProcessFactory.java

package tw.aierp.aps.factories;
import org.adempiere.base.IProcessFactory;
import org.compiere.process.ProcessCall;

import tw.aierp.aps.process.CopyPlanMonth;
public class MyProcessFactory implements IProcessFactory {

	@Override
	public ProcessCall newProcessInstance(String className) {
		if(className == null)
			return null;
		if(className.equals(CopyPlanMonth.class.getName()))
			return new CopyPlanMonth();
		return null;	
	}

}
Leave a comment

Jasperreport Install Extension Font

Add new Font in Jasper studio setting.
Window -> Preferences -> Jaspersoft Studio -> Fonts

Family Name: Arial Unicode MS

True Type (.ttf) /home/ray/JaspersoftWorkspace/font/ARIALUNI.TTF

PDF Encoding: identity-H (Unicode with horizontal writing)

Leave a comment

關閉Ubuntu Desktop GUI

To disiable GUI

sudo systemctl set-default multi-user.target

To enable GUI again issue the command:

sudo systemctl set-default graphical.target

To start Gnome session on a system without a current GUI just execute:

sudo systemctl start gdm3.service

Leave a comment

Workflow 人機簽核分流

Short Code:[SYSTEM]

Workflow 除了員工進行審核,確認. 許多結點(Node)也會配合自動化設備自動執待.等待系統完成工作後.自動推動Workflow.為了避免人員誤觸系統確認結點. 在結點名字定義一組 Short Code [SYSTEM], 人員簽核畫面會自動過濾, 避免誤觸.

	private String getWhereActivities() {
		final String where =
			"a.Processed='N' AND a.WFState='OS' "
			+ " AND (EXISTS (select * from AD_WF_Node wfn where "
					+ " a.AD_WF_Node_ID = wfn.AD_WF_Node_ID "
					+ " and  not ( substring(wfn.name,1,8) = '[SYSTEM]' and wfn.action = 'Z' ) ) )"
			
			+ " AND ("
			//	Owner of Activity
			+ " a.AD_User_ID=?"	//	#1
			//	Invoker (if no invoker = all)
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
			+ " AND r.ResponsibleType='H' AND COALESCE(r.AD_User_ID,0)=0 AND COALESCE(r.AD_Role_ID,0)=0 AND (a.AD_User_ID=? OR a.AD_User_ID IS NULL))"	//	#2
			//  Responsible User
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID"
			+ " AND r.ResponsibleType='H' AND r.AD_User_ID=?)"		//	#3
			//	Responsible Role
			+ " OR EXISTS (SELECT * FROM AD_WF_Responsible r INNER JOIN AD_User_Roles ur ON (r.AD_Role_ID=ur.AD_Role_ID)"
			+ " WHERE a.AD_WF_Responsible_ID=r.AD_WF_Responsible_ID AND r.ResponsibleType='R' AND ur.AD_User_ID=? AND ur.isActive = 'Y')"	//	#4
			///* Manual Responsible */ 
			+ " OR EXISTS (SELECT * FROM AD_WF_ActivityApprover r "
			+ " WHERE a.AD_WF_Activity_ID=r.AD_WF_Activity_ID AND r.AD_User_ID=? AND r.isActive = 'Y')" 
			+ ") AND a.AD_Client_ID=?";	//	#5
		return where;
	}
Leave a comment

MySQL Quickly set up in 4 step

MySQL Script

#Create Database
CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;
#Create New User
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
#Set Permission
GRANT ALL PRIVILEGES ON mydatabase. * TO 'newuser'@'localhost';
#Refresh Privileges
FLUSH PRIVILEGES;
Leave a comment

獨立SMTP寄信伺服器 + Auto Ban

自架伺服器,一定會遇到擾人的問題。有人不斷來試你的寄信主機,然後試出密碼後,借用你的寄信伺服器大量寄發垃圾郵件。
解決方案:利用 Mail Log 搭配 iptables 防火牆管理惡意入侵IP。

可以自行開發或使用流通的解決方案。

自行開發:

檢查 /var/log/mail.log 登入失敗過多的IP,寫入IPTABLE DROP

使用社群套件:
https://help.ubuntu.com/community/Postfix

https://help.ubuntu.com/community/Fail2ban

Leave a comment