Provided by: ledgersmb_1.3.25-1_all bug

NAME

       LedgerSMB - The Base class for many LedgerSMB objects, including DBObject.

SYNOPSIS

       This module creates a basic request handler with utility functions available in database objects
       (LedgerSMB::DBObject)

METHODS

       new ()
           This  method  creates a new base request instance. It also validates the session/user credentials, as
           appropriate for the run mode.  Finally, it sets up the database connections for the user.

       date_to_number (user => $LedgerSMB::User, date => $string);
           This function takes the date in the format provided and returns a numeric string  in  YYMMDD  format.
           This may be moved to User in the future.

       open_form()
           This sets a $self->{form_id} to be used in later form validation (anti-XSRF measure).

       check_form()
           This  returns true if the form_id was associated with the session, and false if not.  Use this if the
           form may be re-used (back-button actions are valid).

       close_form()
           Identical with check_form() above, but also removes the form_id from the  session.   This  should  be
           used when back-button actions are not valid.

       debug (file => $path);
           This dumps the current object to the file if that is defined and otherwise to standard output.

       escape (string => $string);
           This function returns the current string escaped using %hexhex notation.

       unescape (string => $string);
           This function returns the $string encoded using %hexhex using ordinary notation.

       format_amount (user => $LedgerSMB::User::hash, amount => $string, precision => $integer, neg_format =>
       (-|DRCR));
           The  function  takes a monetary amount and formats it according to the user preferences, the negative
           format (- or DR/CR).  Note that it may move to LedgerSMB::User at some point in the future.

       parse_amount (user => $LedgerSMB::User::hash, amount => $variable);
           If $amount is a Bigfloat, it is returned as is.  If it is a string, it is  parsed  according  to  the
           user preferences stored in the LedgerSMB::User object.

       is_blank (name => $string)
           This  function returns true if $self->{$string} only consists of whitespace characters or is an empty
           string.

       is_run_mode ('(cli|cgi|mod_perl)')
           This function returns 1 if the run mode is what is specified.  Otherwise returns 0.

       is_allowed_role({allowed_roles => @role_names})
           This function returns 1 if the user's roles include any of the roles in @role_names.

       num_text_rows (string => $string, cols => $number, max => $number);
           This function determines the likely number of rows needed to hold text  in  a  textbox.   It  returns
           either that number or max, which ever is lower.

       merge ($hashref, keys => @list, index => $number);
           This command merges the $hashref into the current object.  If keys are specified, only those keys are
           used.  Otherwise all keys are merged.

           If  an  index is specified, the merged keys are given a form of "$key" . "_$index", otherwise the key
           is used on both sides.

       redirect (msg => $string)
           This function redirects to the script and argument set determined by $self->{callback}, and  if  this
           is not set, goes to an info screen and prints $msg.

       redo_rows (fields => \@list, count => $integer, [index => $string);
           This  function is undergoing serious redesign at the moment.  If index is defined, that field is used
           for ordering the rows.  If not, runningnumber is used.  Behavior is not defined when index points  to
           a field containing non-numbers.

       set (@attrs)
           Copies the given key=>vars to $self. Allows for finer control of merging hashes into self.

       remove_cgi_globals()
           Removes  all  elements starting with a . because these elements conflict with the ability to hide the
           entire structure for things like CSV lookups.

       get_default_value_by_key($key)
           Retrieves a default value for the given key, it is just a wrapper on LedgerSMB::Setting;

       call_procedure( procname => $procname, args => $args )
           Function that allows you to call a stored procedure by name and map the appropriate argument  to  the
           function values.

           Args  is  an  arrayref.   The members of args can be scalars or arrayrefs in which case they are just
           bound to the placeholders (arrayref to Pg array conversion occurs automatically in DBD::Pg  2.x),  or
           they  can  be hashrefs of the following syntax: {value => $data, type=> $db_type}.  The type field is
           any SQL type DBD::Pg supports (such as 'PG_BYTEA').

       dberror()
           Localizes and returns database errors and error codes within LedgerSMB

       error()
           Returns HTML errors in LedgerSMB. Needs refactored into a general Error class.

       get_user_info()
           Loads user configuration info from LedgerSMB::User

       round_amount()
           Uses Math::Float with an amount and a set number of decimal places to round the amount and return it.

           Defaults to the default decimal places setting in the LedgerSMB configuration if there is  no  places
           argument passed in.

           They should be changed to allow different rules for different accounts.

       sanitize_for_display()
           Expands  a  hash  into human-readable key => value pairs, and formats and rounds amounts, recursively
           expanding hashes until there are no hash members present.

       take_top_level()
           Removes blank keys and non-reference keys from a hash and returns a  hash  with  only  non-blank  and
           referenced keys.

       type()
           Ensures that the $ENV{REQUEST_METHOD} is defined and either "HEAD", "GET", "POST".

       finalize_request()
           This  function  throws  a  CancelFurtherProcessing exception to be caught by the outermost processing
           script.  This construct allows the outer script and intermediate levels to clean up, if required.

           This construct replaces 'exit;' calls randomly scattered around the code everywhere.

Copyright (C) 2006, The LedgerSMB core team.

        # This work contains copyrighted information from a number of sources
        # all used with permission.
        #
        # This file contains source code included with or based on SQL-Ledger
        # which is Copyright Dieter Simader and DWS Systems Inc. 2000-2005
        # and licensed under the GNU General Public License version 2 or, at
        # your option, any later version.  For a full list including contact
        # information of contributors, maintainers, and copyright holders,
        # see the CONTRIBUTORS file.
        #
        # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
        # Copyright (C) 2000
        #
        #  Author: DWS Systems Inc.
        #     Web: http://www.sql-ledger.org
        #
        # Contributors: Thomas Bayen <bayen@gmx.de>
        #               Antti Kaihola <akaihola@siba.fi>
        #               Moritz Bunkus (tex)
        #               Jim Rawlings <jim@your-dba.com> (DB2)
        #====================================================================

perl v5.14.2                                       2012-12-03                                     LedgerSMB(3pm)