Custom Filter Module based on dev docs example
Moderator: crythias
-
- Znuny newbie
- Posts: 5
- Joined: 18 Jan 2022, 21:53
- Znuny Version: 6 Community
- Real Name: Scott Toderash
- Company: 100% Helpdesk
Custom Filter Module based on dev docs example
I used the example in the developer docs
https://doc.znuny.org/doc/manual/develo ... ayers.html
and I created a Perl module in Kernel/System/PostMaster/Filter
and an XML file in Kernel/Config/Files
hoping these hooks would pick up my code and execute it.
I see no evidence that it is being executed, so there must be another step somewhere.
I noticed Kernel/Config/Files/XML so I moved the XML file there but it made no difference.
I restarted the scheduler daemon to make sure it would be using the most recent changes. Do I have to register this module somewhere? I can't find anything telling me how other than creating the XML file.
I just need to figure out how to get it to execute my code.
https://doc.znuny.org/doc/manual/develo ... ayers.html
and I created a Perl module in Kernel/System/PostMaster/Filter
and an XML file in Kernel/Config/Files
hoping these hooks would pick up my code and execute it.
I see no evidence that it is being executed, so there must be another step somewhere.
I noticed Kernel/Config/Files/XML so I moved the XML file there but it made no difference.
I restarted the scheduler daemon to make sure it would be using the most recent changes. Do I have to register this module somewhere? I can't find anything telling me how other than creating the XML file.
I just need to figure out how to get it to execute my code.
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Custom Filter Module based on dev docs example
Hi,
Kernel/Config/Files/XML is the proper location. Have you executing
bin/otrs.Console.pl Maint::Config;:Rebuild
after putting all your files in place?
- Roy
Kernel/Config/Files/XML is the proper location. Have you executing
bin/otrs.Console.pl Maint::Config;:Rebuild
after putting all your files in place?
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny newbie
- Posts: 5
- Joined: 18 Jan 2022, 21:53
- Znuny Version: 6 Community
- Real Name: Scott Toderash
- Company: 100% Helpdesk
Re: Custom Filter Module based on dev docs example
I did not do that step. I will try that.
What exactly does the Rebuild do?
What exactly does the Rebuild do?
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Custom Filter Module based on dev docs example
Hi,100percent wrote: ↑20 Jan 2022, 00:08 I did not do that step. I will try that.
What exactly does the Rebuild do?
Generates the sytem configuration settings out if the XML files. See https://doc.znuny.org/doc/manual/develo ... xml-config
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Custom Filter Module based on dev docs example
If you used the XML sample from the developer manual for your config file, it is the wrong version. The tagnames etc. changed from framework version 5 to 6.
Old:
New:
This is just an excerpt. If you post your config file, I can convert it from the old version to the new one. If you have a Znuny LTS version, there is a tool: https://github.com/znuny/Znuny/blob/rel ... ructure.pm
Just run
Old:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<otrs_config version="1.0" init="Application">
<ConfigItem Name="Frontend::Module###AgentQuickClose" Required="0" Valid="1">
<Description Translatable="1">Frontend module registration for the QuickClose agent interface.</Description>
<Group>QuickClose</Group>
<SubGroup>Frontend::Agent::ModuleRegistration</SubGroup>
<Setting>
<FrontendModuleReg>
<Description>QuickClose</Description>
<NavBarName></NavBarName>
<Title Translatable="1">QuickClose</Title>
</FrontendModuleReg>
</Setting>
</ConfigItem>
</otrs_config>
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<otrs_config version="2.0" init="Application">
<Setting Name="Frontend::Module###AgentQuickClose" Required="0" Valid="1">
<Description Translatable="1">Frontend module registration for the QuickClose agent interface.</Description>
<Navigation>Frontend::Agent::ModuleRegistration</Navigation>
<Value>
<Item ValueType="FrontendRegistration">
<Hash>
<Item Key="Group">
<Array>
</Array>
</Item>
<Item Key="GroupRo">
<Array>
</Array>
</Item>
<Item Key="Description">QuickClose</Item>
<Item Key="NavBarName"></Item>
<Item Key="Title" Translatable="1">QuickClose</Item>
</Hash>
</Item>
</Value>
</Setting>
</otrs_config>
Just run
Code: Select all
perl bin/otrs.Console.pl Dev::Tools::Migrate::ConfigXMLStructure --source-directory <path/to/you/current_config.xml>
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
-
- Znuny newbie
- Posts: 5
- Joined: 18 Jan 2022, 21:53
- Znuny Version: 6 Community
- Real Name: Scott Toderash
- Company: 100% Helpdesk
Re: Custom Filter Module based on dev docs example
I'm returning to this today to try some more. The rebuild threw errors, although changing the format to the new XML version helped.
However now the rebuild gives me several errors of "Message: Need Data!" (but I don't know what data) and then fails on SQL insert:
[Wed Jan 26 13:14:01 2022] otrs.Console.pl: DBD::mysql::db do failed: Column 'effective_value' cannot be null at /home/pcthd/otrs-rel-6_0/Kernel/System/DB.pm line 470.
ERROR: OTRS-otrs.Console.pl-Maint::Config::Rebuild-10 Perl: 5.16.3 OS: linux Time: Wed Jan 26 13:14:01 2022
Message: Column 'effective_value' cannot be null, SQL: '
INSERT INTO sysconfig_default (
name,description,navigation,is_invisible,is_readonly,is_required,is_valid,has_configlevel,user_modification_possible,user_modification_active,user_preferences_group,xml_content_raw,xml_content_parsed,xml_filename,effective_value,is_dirty,exclusive_lock_guid,create_time,create_by,change_time,change_by
)VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'2022-01-26 13:14:01',?,'2022-01-26 13:14:01',? )'
So now I know that the rebuild process takes the XML data and inserts it into a table called sysconfig_default. That's helpful. I'm guessing that if I fill in more values in the XML file then the insert will succeed. I don't know what it's looking for though.
However now the rebuild gives me several errors of "Message: Need Data!" (but I don't know what data) and then fails on SQL insert:
[Wed Jan 26 13:14:01 2022] otrs.Console.pl: DBD::mysql::db do failed: Column 'effective_value' cannot be null at /home/pcthd/otrs-rel-6_0/Kernel/System/DB.pm line 470.
ERROR: OTRS-otrs.Console.pl-Maint::Config::Rebuild-10 Perl: 5.16.3 OS: linux Time: Wed Jan 26 13:14:01 2022
Message: Column 'effective_value' cannot be null, SQL: '
INSERT INTO sysconfig_default (
name,description,navigation,is_invisible,is_readonly,is_required,is_valid,has_configlevel,user_modification_possible,user_modification_active,user_preferences_group,xml_content_raw,xml_content_parsed,xml_filename,effective_value,is_dirty,exclusive_lock_guid,create_time,create_by,change_time,change_by
)VALUES ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'2022-01-26 13:14:01',?,'2022-01-26 13:14:01',? )'
So now I know that the rebuild process takes the XML data and inserts it into a table called sysconfig_default. That's helpful. I'm guessing that if I fill in more values in the XML file then the insert will succeed. I don't know what it's looking for though.
-
- Znuny superhero
- Posts: 635
- Joined: 24 Feb 2012, 03:58
- Znuny Version: LTS and Features
- Real Name: Mo Azfar
- Location: Kuala Lumpur, MY
- Contact:
Re: Custom Filter Module based on dev docs example
effective_value represent default value of the config..
can you share your xml at least ?
can you share your xml at least ?
My Github
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This
Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
OTRS CE/LTS Discord Channel
Cant Update Package Anymore ? Check This
Professional OTRS, Znuny & OTOBO services: efflux.de/en
Free and premium add-ons: English
-
- Znuny newbie
- Posts: 5
- Joined: 18 Jan 2022, 21:53
- Znuny Version: 6 Community
- Real Name: Scott Toderash
- Company: 100% Helpdesk
Re: Custom Filter Module based on dev docs example
Here is the XML. The name of my module is 100Percent.pm. This is almost identical to the XML from the developer docs, since that is what it's based on.
<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="2.0" init="Config">
<Setting Name="PostMaster::PreFilterModule###1-100Percent" Required="0" Valid="1">
<Description Translatable="1">Custom module to tag CustomerID in new tickets.</Description>
<Navigation>Core::Email::PostMaster</Navigation>
<Hash>
<Item Key="Module">Kernel::System::PostMaster::Filter::100Percent</Item>
<Item Key="Match">
<Hash>
<Item Key="From">noreply@</Item>
</Hash>
</Item>
<Item Key="Set">
<Hash>
<Item Key="X-OTRS-Ignore">yes</Item>
</Hash>
</Item>
</Hash>
</Setting>
</otrs_config>
<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="2.0" init="Config">
<Setting Name="PostMaster::PreFilterModule###1-100Percent" Required="0" Valid="1">
<Description Translatable="1">Custom module to tag CustomerID in new tickets.</Description>
<Navigation>Core::Email::PostMaster</Navigation>
<Hash>
<Item Key="Module">Kernel::System::PostMaster::Filter::100Percent</Item>
<Item Key="Match">
<Hash>
<Item Key="From">noreply@</Item>
</Hash>
</Item>
<Item Key="Set">
<Hash>
<Item Key="X-OTRS-Ignore">yes</Item>
</Hash>
</Item>
</Hash>
</Setting>
</otrs_config>
-
- Administrator
- Posts: 4002
- Joined: 18 Dec 2007, 12:23
- Znuny Version: Znuny and Znuny LTS
- Real Name: Roy Kaldung
- Company: Znuny
- Contact:
Re: Custom Filter Module based on dev docs example
Hi,
I would say this XML is not a valid one for version 6. I do not see <Value> node. From where do you got the example?
- Roy
I would say this XML is not a valid one for version 6. I do not see <Value> node. From where do you got the example?
- Roy
Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
Use a test system - always.
Do you need professional services? Check out https://www.znuny.com/
Do you want to contribute or want to know where it goes ?
-
- Znuny newbie
- Posts: 5
- Joined: 18 Jan 2022, 21:53
- Znuny Version: 6 Community
- Real Name: Scott Toderash
- Company: 100% Helpdesk
Re: Custom Filter Module based on dev docs example
https://doc.znuny.org/doc/manual/develo ... ayers.html
I don't know what the value is supposed to be. I only want it to load my module and execute my code.
I don't know what the value is supposed to be. I only want it to load my module and execute my code.
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: Custom Filter Module based on dev docs example
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="2.0" init="Config">
<Setting Name="PostMaster::PreFilterModule###1-100Percent" Required="0" Valid="1">
<Description Translatable="1">Custom module to tag CustomerID in new tickets.</Description>
<Navigation>Core::Email::PostMaster</Navigation>
<Value>
<Hash>
<Item Key="Module">Kernel::System::PostMaster::Filter::100Percent</Item>
<Item Key="Match">
<Hash>
<Item Key="From">noreply@</Item>
</Hash>
</Item>
<Item Key="Set">
<Hash>
<Item Key="X-OTRS-Ignore">yes</Item>
</Hash>
</Item>
</Hash>
</Value>
</Setting>
</otrs_config>
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de