Hi,
We implement OTRS and for customer/customer-company we implement external data source , in which many of the column contains value 1 or 0.
But as of now they all show 1 or 0 on web interface as well, but we require to show them as yes (if 1) and no (if 0) on web interface.
How can we implement this. If anyone has idea on this , it will be very helpful to us.
Thanks in advance.
Regards,
GMunjal
Show yes/no instead of 1/0 on webinterface
Moderator: crythias
-
- 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: Show yes/no instead of 1/0 on webinterface
Create your own .pm file in Kernel/System/CustomerUser/... (e.g. copy DB.pm) and change the source so that columns that are 0 are changed to "No" and 1 to "Yes".
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 advanced
- Posts: 108
- Joined: 23 Oct 2013, 09:17
- Znuny Version: 3.3.0 beta 2
- Real Name: Gaurav Munjal
- Company: Nagarro
Re: Show yes/no instead of 1/0 on webinterface
Can you please provide me the example or complete description to implement this functionality.
Many thanks.
GMunjal
Many thanks.
GMunjal
-
- 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: Show yes/no instead of 1/0 on webinterface
Have a look at https://github.com/OTRS/otrs/blob/rel-3 ... User/DB.pm
In the sub "CustomerUserDataGet", you can add code in line 586 that sets the new values. Something like
In the sub "CustomerUserDataGet", you can add code in line 586 that sets the new values. Something like
Code: Select all
for my $Column ( qw(Column1 MyColumn) ) {
if ( $Data{$Column} == 1 ) {
$Data{$Column} = 'yes';
}
elsif ( $Data{$Column} == 0 ) {
$Data{$Column} = 'no';
}
}
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 advanced
- Posts: 108
- Joined: 23 Oct 2013, 09:17
- Znuny Version: 3.3.0 beta 2
- Real Name: Gaurav Munjal
- Company: Nagarro
Re: Show yes/no instead of 1/0 on webinterface
Thanks for the information, this resolves my issue.
-
- Moderator
- Posts: 10170
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Show yes/no instead of 1/0 on webinterface
Another thought (I haven't tested) is to use the "Selections" Config.pm option for this.
See Defaults.pm for examples to use after CustomerUser Map, etc:
See Defaults.pm for examples to use after CustomerUser Map, etc:
Code: Select all
Selections => {
UserField => {
'1' => 'Yes',
'0' => 'No',
},
},
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
-
- Znuny advanced
- Posts: 108
- Joined: 23 Oct 2013, 09:17
- Znuny Version: 3.3.0 beta 2
- Real Name: Gaurav Munjal
- Company: Nagarro
Re: Show yes/no instead of 1/0 on webinterface
Great !!
Many Thanks!!
Many Thanks!!