Commit 809d27ef authored by Ioritz Cia's avatar Ioritz Cia Committed by Asier Lostalé
Browse files

[tsvector] Fix column creation and field creation in AD

- Fix button to create columns from AD in table tab
- Fix button not to create fields that belong to columns of type TSVector
parent 7347be27
......@@ -22,7 +22,7 @@
* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
* All Rights Reserved.
* Contributor(s): Openbravo SLU
* Contributions are Copyright (C) 2001-2019 Openbravo, S.L.U.
* Contributions are Copyright (C) 2001-2020 Openbravo, S.L.U.
*
* Specifically, this derivative work is based upon the following Compiere
* file and version.
......@@ -213,6 +213,9 @@
v_AD_Reference_ID:='23';
ELSIF(Cur_Column.Data_Type IN ('TEXT', 'CLOB')) THEN
v_AD_Reference_ID:='14';
ELSIF(Cur_Column.Data_Type IN ('TSVECTOR')) THEN
v_AD_Reference_ID:='81FCDA657A5540F69B0AE57B4E0F8A51';
v_FieldLength:=0;
ELSE
v_AD_Reference_ID:='10'; -- if not found, use String
v_CorrectType:='N';
......
......@@ -22,7 +22,7 @@
* parts created by ComPiere are Copyright (C) ComPiere, Inc.;
* All Rights Reserved.
* Contributor(s): Openbravo SLU
* Contributions are Copyright (C) 2001-2012 Openbravo, S.L.U.
* Contributions are Copyright (C) 2001-2020 Openbravo, S.L.U.
*
* Specifically, this derivative work is based upon the following Compiere
* file and version.
......@@ -124,14 +124,16 @@
FOR Cur_Column IN(-- added by Pablo Sarobe
SELECT c.Columnname, c.Name, c.Description, c.Help, c.AD_Column_ID, c.FieldLength, t.tablename, c.AD_Module_ID, c.IsIdentifier, c.sqllogic
FROM AD_Column c, AD_Table t
FROM AD_Column c, AD_Table t, user_tab_columns utc
WHERE NOT EXISTS
(SELECT *
FROM AD_Field f
WHERE c.AD_Column_ID=f.AD_Column_ID AND c.AD_Table_ID=v_AD_Table_ID AND f.AD_Tab_ID=v_Record_ID
)
AND c.AD_Table_ID=v_AD_Table_ID AND c.AD_Table_ID=t.AD_Table_ID -- added by Pablo Sarobe
AND utc.table_name = t.tablename AND utc.column_name = c.Columnname
AND UPPER(c.Columnname) NOT IN ('CREATED', 'UPDATED', 'CREATEDBY', 'UPDATEDBY') AND c.IsActive='Y'
AND utc.data_type <> 'TSVECTOR'
ORDER BY POSITION)
LOOP
v_showInRelation:='N';
......
......@@ -2,7 +2,6 @@
<database name="TRIGGER AD_FIELD_MOD_TRG">
<trigger name="AD_FIELD_MOD_TRG" table="AD_FIELD" fires="before" insert="true" update="true" delete="true" foreach="row">
<body><![CDATA[
/*************************************************************************
* The contents of this file are subject to the Openbravo Public License
* Version 1.1 (the "License"), being the Mozilla Public License
......@@ -15,7 +14,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
* All portions are Copyright (C) 2008-2012 Openbravo SLU
* All portions are Copyright (C) 2008-2020 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************/
......@@ -101,6 +100,20 @@ BEGIN
END IF;
END IF;
IF (UPDATING OR INSERTING) THEN
SELECT COUNT(*)
INTO vAux
FROM AD_COLUMN c, AD_TABLE t, USER_TAB_COLUMNS utc
WHERE c.AD_Table_ID = t.AD_Table_ID
AND UPPER(utc.Column_Name) = UPPER(c.ColumnName)
AND UPPER(utc.Table_Name) = UPPER(t.TableName)
AND c.AD_Column_ID = :NEW.AD_Column_ID
AND utc.Data_Type = 'TSVECTOR';
IF (vAux!=0) THEN
RAISE_APPLICATION_ERROR(-20000, '@TSV_NotAllowedInFields@');
END IF;
END IF;
IF ((DELETING OR INSERTING) AND devModule='N') THEN
RAISE_APPLICATION_ERROR(-20000, '@20533@');
END IF;
......
......@@ -22009,6 +22009,18 @@ You can upgrade the license of your instance by contacting Openbravo sales staff
<!--7E3E5C3B752A4026A78ADDFA826E4A1C--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--7E3E5C3B752A4026A78ADDFA826E4A1C--></AD_MESSAGE>
 
<!--7EA86C24AF2E45909CA009FF3EE30EFF--><AD_MESSAGE>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <AD_MESSAGE_ID><![CDATA[7EA86C24AF2E45909CA009FF3EE30EFF]]></AD_MESSAGE_ID>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <ISACTIVE><![CDATA[Y]]></ISACTIVE>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <VALUE><![CDATA[TSV_NotAllowedInFields]]></VALUE>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <MSGTEXT><![CDATA[It is not allowed to create a Field linked to a Column of type TSVECTOR.]]></MSGTEXT>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <MSGTYPE><![CDATA[E]]></MSGTYPE>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
<!--7EA86C24AF2E45909CA009FF3EE30EFF--></AD_MESSAGE>
<!--7F28FD8C7EDA46D2A2816407790740F9--><AD_MESSAGE>
<!--7F28FD8C7EDA46D2A2816407790740F9--> <AD_MESSAGE_ID><![CDATA[7F28FD8C7EDA46D2A2816407790740F9]]></AD_MESSAGE_ID>
<!--7F28FD8C7EDA46D2A2816407790740F9--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment