Main Koha release repository https://koha-community.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.1 KiB

  1. package Koha::Template::Plugin::Price;
  2. # This file is part of Koha.
  3. #
  4. # Copyright 2014 BibLibre
  5. #
  6. # Koha is free software; you can redistribute it and/or modify it
  7. # under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # Koha is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Koha; if not, see <http://www.gnu.org/licenses>.
  18. use Modern::Perl;
  19. use Template::Plugin::Filter;
  20. use base qw( Template::Plugin::Filter );
  21. use Koha::Number::Price;
  22. our $DYNAMIC = 1;
  23. sub filter {
  24. my ( $self, $value, $args, $config ) = @_;
  25. $value ||= 0;
  26. $config->{on_editing} //= 0;
  27. return $config->{on_editing}
  28. ? Koha::Number::Price->new( $value )->format_for_editing
  29. : Koha::Number::Price->new( $value )->format( $config );
  30. }
  31. 1;