Overriding custom module

English! place to talk about development, programming and coding
Post Reply
voiprodrigo
Znuny newbie
Posts: 62
Joined: 03 Dec 2014, 18:49
Znuny Version: OTRS 4
Location: Portugal
Contact:

Overriding custom module

Post by voiprodrigo »

Hi,

I have an add-on installed that places a different version of TicketOverviewSmall.pm in otrs/Custom/..., thus overriding the core one.

I'd like to put a modified version of it, but without removing the add-on file. So, in a way, replicate what Custom/ already enabled, for a module inside Custom/ (I hope to make sense here). I just want to leave all original code/files intact.

Any idea for this?
Linux (Ubuntu 14.04.1 LTS) | MySQL 5.5.40 | OTRS 4.0.7
eandrex
Znuny expert
Posts: 213
Joined: 04 Nov 2012, 23:58
Znuny Version: OTRS 4.x
Real Name: Esteban
Company: NORTON DE COLOMBIA

Re: Overriding custom module

Post by eandrex »

If your addon is already using the "Custom" folder, then there is no way to achieve what you want (as far as i know).

My advice is to make a copy of your "Custom/.../TicketOverviewSmallpm" and rename it to "pm.bk"..after that, edit your "Custom/.../TicketOverviewSmall.pm" file
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: Overriding custom module

Post by RStraub »

But that will trigger a warning in the package manager ("Package not correctly installed") and it will get overwritten when you upgrade / reinstall said package.
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
reneeb
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: Overriding custom module

Post by reneeb »

Go the "KIX" way ;-)

Create a MyCustom directory in the same level as Custom. And add "use lib '/path/to/MyCustom';" to your Kernel/Config.pm. Then you can place your own modules in the MyCustom directory (you have to use the same structure Kernel/Output/... as in Custom/).
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
voiprodrigo
Znuny newbie
Posts: 62
Joined: 03 Dec 2014, 18:49
Znuny Version: OTRS 4
Location: Portugal
Contact:

Re: Overriding custom module

Post by voiprodrigo »

reneeb wrote:Go the "KIX" way ;-)

Create a MyCustom directory in the same level as Custom. And add "use lib '/path/to/MyCustom';" to your Kernel/Config.pm. Then you can place your own modules in the MyCustom directory (you have to use the same structure Kernel/Output/... as in Custom/).
:) a beer for this gentleman!

thank you all.
Linux (Ubuntu 14.04.1 LTS) | MySQL 5.5.40 | OTRS 4.0.7
voiprodrigo
Znuny newbie
Posts: 62
Joined: 03 Dec 2014, 18:49
Znuny Version: OTRS 4
Location: Portugal
Contact:

Re: Overriding custom module

Post by voiprodrigo »

Hello,

I've been using the method suggested by @reneeb, and it's been working wonderfully on my OTRS4 installation.

But now I'm testing OTRS5, and I'm noticing something very very odd..

For example, I have modified versions of these two files, AgentTicketStatusView.pm and AgentTicketResponsibleView.pm, where I enable additional ticket filters to show on the views menu bar.

What's happening with OTRS5, is that sometimes they load with the additional filters, some other times they just load the original modules without the additional filters. And there are no error logs. It's very strange.

Any suggestion anyone?
Thanks in advance.
Linux (Ubuntu 14.04.1 LTS) | MySQL 5.5.40 | OTRS 4.0.7
voiprodrigo
Znuny newbie
Posts: 62
Joined: 03 Dec 2014, 18:49
Znuny Version: OTRS 4
Location: Portugal
Contact:

Re: Overriding custom module

Post by voiprodrigo »

Nevermind, forgot to add the custom path to apache2-perl-startup.pl, seems stable now :)
Linux (Ubuntu 14.04.1 LTS) | MySQL 5.5.40 | OTRS 4.0.7
Post Reply