.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "LedgerSMB::Form 3pm" .TH LedgerSMB::Form 3pm "2014-06-10" "perl v5.18.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" LedgerSMB::Form \- Provides general legacy support functions and the central object. .SH "SYNOPSIS" .IX Header "SYNOPSIS" This module provides general legacy support functions and the central object .SH "STATUS" .IX Header "STATUS" Deprecated .SH "COPYRIGHT" .IX Header "COPYRIGHT" .Vb 10 \& #==================================================================== \& # LedgerSMB \& # Small Medium Business Accounting software \& # http://www.ledgersmb.org/ \& # \& # Copyright (C) 2006 \& # 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 \& # Antti Kaihola \& # Moritz Bunkus (tex) \& # Jim Rawlings (DB2) \& #==================================================================== \& # \& # This file has undergone whitespace cleanup. \& # \& #==================================================================== \& # \& # main package \& # \& #==================================================================== .Ve .SH "METHODS" .IX Header "METHODS" .IP "new Form([$argstr])" 4 .IX Item "new Form([$argstr])" Returns a reference to new Form object. The initial set of attributes is obtained from \f(CW$argstr\fR, a \s-1CGI\s0 query string, or \f(CW$ARGV\fR[0]. All the values are run through unescape to undo any \s-1URI\s0 encoding. .Sp The version and dbversion attributes are set to hardcoded values; action, nextsub, path, script, and login are filtered to remove some dangerous values. Both menubar and lynx are set if path matches lynx. .Sp \&\f(CW$form\fR\->error may be called to deny access on some attribute values. .IP "\fIopen_form()\fR" 4 .IX Item "open_form()" This sets a \f(CW$self\fR\->{form_id} to be used in later form validation (anti-XSRF measure). .IP "\fIcheck_form()\fR" 4 .IX Item "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). .IP "\fIclose_form()\fR" 4 .IX Item "close_form()" Identical with \fIcheck_form()\fR above, but also removes the form_id from the session. This should be used when back-button actions are not valid. .ie n .IP "$form\->debug([$file]);" 4 .el .IP "\f(CW$form\fR\->debug([$file]);" 4 .IX Item "$form->debug([$file]);" Outputs the sorted contents of \f(CW$form\fR. If a filename is specified, log to it, otherwise output to \s-1STDOUT.\s0 .ie n .IP "$form\->\fIencode_all()\fR;" 4 .el .IP "\f(CW$form\fR\->\fIencode_all()\fR;" 4 .IX Item "$form->encode_all();" Does nothing and is unused. Contains merely the comment # \s-1TODO\s0; .ie n .IP "$form\->\fIdecode_all()\fR;" 4 .el .IP "\f(CW$form\fR\->\fIdecode_all()\fR;" 4 .IX Item "$form->decode_all();" Does nothing and is unused. Contains merely the comment # \s-1TODO\s0 .ie n .IP "$form\->escape($str[, $beenthere]);" 4 .el .IP "\f(CW$form\fR\->escape($str[, \f(CW$beenthere\fR]);" 4 .IX Item "$form->escape($str[, $beenthere]);" Returns the URI-encoded \f(CW$str\fR. \f(CW$beenthere\fR is a boolean that when true forces a single encoding run. When false, it escapes the string twice if it detects that it is running on a version of Apache 2.0 earlier than 2.0.44. .Sp Note that recurring transaction support depends on this function escaping ','. .ie n .IP "$form\->unescape($str);" 4 .el .IP "\f(CW$form\fR\->unescape($str);" 4 .IX Item "$form->unescape($str);" Returns the unencoded form of the URI-encoded \f(CW$str\fR. .ie n .IP "$form\->quote($str);" 4 .el .IP "\f(CW$form\fR\->quote($str);" 4 .IX Item "$form->quote($str);" Replaces all double quotes in \f(CW$str\fR with '"'. Does nothing if \f(CW$str\fR is a reference. .ie n .IP "$form\->unquote($str);" 4 .el .IP "\f(CW$form\fR\->unquote($str);" 4 .IX Item "$form->unquote($str);" Replaces all '"' in \f(CW$str\fR with double quotes. Does nothing if \f(CW$str\fR is a reference. .ie n .IP "$form\->hide_form([...]);" 4 .el .IP "\f(CW$form\fR\->hide_form([...]);" 4 .IX Item "$form->hide_form([...]);" Outputs hidden \s-1HTML\s0 form fields to \s-1STDOUT. \s0 If values are passed into this function, only those \f(CW$form\fR values are output. If no values are passed in, all \&\f(CW$form\fR values are output as well as deleting \f(CW$form\fR\->{header}. Values from the \&\f(CW$form\fR object are run through \f(CW$form\fR\->quote, whereas keys/names are not. .Sp Sample output: .Sp .Vb 1 \& .Ve .ie n .IP "$form\->error($msg);" 4 .el .IP "\f(CW$form\fR\->error($msg);" 4 .IX Item "$form->error($msg);" Output an error message, \f(CW$msg\fR. If a \s-1CGI\s0 environment is detected, this outputs an \s-1HTTP\s0 and \s-1HTML\s0 header section if required, and displays the message after running it through \f(CW$form\fR\->format_string. If it is not a \s-1CGI\s0 environment and \&\f(CW$ENV\fR{error_function} is set, call the specified function with \f(CW$msg\fR as the sole argument. Otherwise, this function simply dies with \f(CW$msg\fR. .Sp This function does not return. Execution is terminated at the end of the appropriate path. .ie n .IP "$form\->\fIfinalize_request()\fR;" 4 .el .IP "\f(CW$form\fR\->\fIfinalize_request()\fR;" 4 .IX Item "$form->finalize_request();" Stops further processing, allowing post-request cleanup on intermediate levels by throwing an exception. .Sp This function replaces explicit '\fIexit()\fR' calls. .ie n .IP "$form\->info($msg);" 4 .el .IP "\f(CW$form\fR\->info($msg);" 4 .IX Item "$form->info($msg);" Output an informational message, \f(CW$msg\fR. If a \s-1CGI\s0 environment is detected, this outputs an \s-1HTTP\s0 and \s-1HTML\s0 header section if required, and displays the message in bold tags without escaping. If it is not a \s-1CGI\s0 environment and \&\f(CW$ENV\fR{info_function} is set, call the specified function with \f(CW$msg\fR as the sole argument. Otherwise, this function simply prints \f(CW$msg\fR to \s-1STDOUT.\s0 .ie n .IP "$form\->numtextrows($str, $cols[, $maxrows]);" 4 .el .IP "\f(CW$form\fR\->numtextrows($str, \f(CW$cols\fR[, \f(CW$maxrows\fR]);" 4 .IX Item "$form->numtextrows($str, $cols[, $maxrows]);" Returns the number of rows of \f(CW$cols\fR columns can be formed by \f(CW$str\fR. If \f(CW$maxrows\fR is set and the number of rows is greater than \f(CW$maxrows\fR, this returns \f(CW$maxrows\fR. In the determination of rowcount, newline characters, \*(L"\en\*(R", are taken into account while spaces are not. .ie n .IP "$form\->dberror($msg);" 4 .el .IP "\f(CW$form\fR\->dberror($msg);" 4 .IX Item "$form->dberror($msg);" Outputs a message as in \f(CW$form\fR\->error but with \f(CW$DBI::errstr\fR automatically appended to \f(CW$msg\fR. .ie n .IP "$form\->isblank($name, $msg);" 4 .el .IP "\f(CW$form\fR\->isblank($name, \f(CW$msg\fR);" 4 .IX Item "$form->isblank($name, $msg);" Calls \f(CW$form\fR\->error($msg) if the value of \f(CW$form\fR\->{$name} matches /^\es*$/. .ie n .IP "$form\->header([$init, $headeradd]);" 4 .el .IP "\f(CW$form\fR\->header([$init, \f(CW$headeradd\fR]);" 4 .IX Item "$form->header([$init, $headeradd]);" Outputs \s-1HTML\s0 and \s-1HTTP\s0 headers and sets \f(CW$form\fR\->{header} to indicate that headers have been output. If called with \f(CW$form\fR\->{header} set or in a non-CGI environment, does not output anything. \f(CW$init\fR is ignored. \f(CW$headeradd\fR is data to be added to the portion of the output headers. \f(CW$form\fR\->{stylesheet}, \&\f(CW$form\fR\->{title}, \f(CW$form\fR\->{titlebar}, and \f(CW$form\fR\->{pre} all affect the output of this function. .Sp If the stylesheet indicated by \f(CW$form\fR\->{stylesheet} exists, output a link tag to reference it. If \f(CW$form\fR\->{title} is false, the title text is the value of \&\f(CW$form\fR\->{titlebar}. If \f(CW$form\fR\->{title} is true, the title text takes the form of \&\*(L"$form\->{title} \- \f(CW$form\fR\->{titlebar}\*(R". The value of \f(CW$form\fR\->{pre} is output immediately after the closing of . .ie n .IP "$form\->open_status_div" 4 .el .IP "\f(CW$form\fR\->open_status_div" 4 .IX Item "$form->open_status_div" Returns a div tag with an id of statusdiv. .Sp If \f(CW$form\fR\->{id} is set and \f(CW$form\fR\->{approved} the class is set to \*(L"posted\*(R" and if id is set but not approved, this is set to \*(L"saved.\*(R" If neither applies, we set to \*(L"new.\*(R" .ie n .IP "$form\->close_status_div" 4 .el .IP "\f(CW$form\fR\->close_status_div" 4 .IX Item "$form->close_status_div" Simply returns a tag. This is included for clarity of code. .ie n .IP "$form\->redirect([$msg]);" 4 .el .IP "\f(CW$form\fR\->redirect([$msg]);" 4 .IX Item "$form->redirect([$msg]);" If \f(CW$form\fR\->{callback} is set or \f(CW$msg\fR is not set, call the redirect function in common.pl. If main::redirect returns, exit. .Sp Otherwise, output \f(CW$msg\fR as an informational message with \f(CW$form\fR\->info($msg). .ie n .IP "$form\->sort_columns(@columns);" 4 .el .IP "\f(CW$form\fR\->sort_columns(@columns);" 4 .IX Item "$form->sort_columns(@columns);" Sorts the list \f(CW@columns\fR. If \f(CW$form\fR\->{sort} is unset, do nothing. If the value of \f(CW$form\fR\->{sort} does not exist in \f(CW@columns\fR, returns the list formed by the value of \f(CW$form\fR\->{sort} followed by the values of \f(CW@columns\fR. If the value of \&\f(CW$form\fR\->{sort} is in \f(CW@columns\fR, return the list formed by \f(CW@columns\fR with the value of \f(CW$form\fR\->{sort} moved to the head of the list. .ie n .IP "$form\->sort_order($columns[, $ordinal]);" 4 .el .IP "\f(CW$form\fR\->sort_order($columns[, \f(CW$ordinal\fR]);" 4 .IX Item "$form->sort_order($columns[, $ordinal]);" Returns a string that contains ordering details for the columns in \s-1SQL\s0 form. \&\f(CW$columns\fR is a reference to a list of columns, \f(CW$ordinal\fR is a reference to a hash that maps column names to ordinal positions. This function depends upon the values of \f(CW$form\fR\->{direction}, \f(CW$form\fR\->{sort}, and \f(CW$form\fR\->{oldsort}. .Sp If \f(CW$form\fR\->{direction} is false, it becomes '\s-1ASC\s0'. If \f(CW$form\fR\->{direction} is true and \f(CW$form\fR\->{sort} and \f(CW$form\fR\->{oldsort} are equal, reverse the order specified by \&\f(CW$form\fR\->{direction}. \f(CW$form\fR\->{oldsort} is set to the same value as \f(CW$form\fR\->{sort} .Sp The actual sorting of \f(CW$columns\fR happens as in \f(CW$form\fR\->sort_columns(@$columns). .Sp If \f(CW$ordinal\fR is set, the positions given by it are substituted for the names of columns returned. .ie n .IP "$form\->convert_date($date, $myconfig)" 4 .el .IP "\f(CW$form\fR\->convert_date($date, \f(CW$myconfig\fR)" 4 .IX Item "$form->convert_date($date, $myconfig)" This takes a date in YYYY-MM-DD format and returns it in the format of the user. .ie n .IP "$form\->format_amount($myconfig, $amount, $places, $dash);" 4 .el .IP "\f(CW$form\fR\->format_amount($myconfig, \f(CW$amount\fR, \f(CW$places\fR, \f(CW$dash\fR);" 4 .IX Item "$form->format_amount($myconfig, $amount, $places, $dash);" Returns \f(CW$amount\fR as formatted in the form specified by \f(CW$form\fR\->{numberformat}. \&\f(CW$places\fR is the number of decimal places to have in the output. \f(CW$dash\fR indicates how to represent conditions surrounding values. .Sp .Vb 9 \& +\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+ \& | $dash | \-1.00 | 1.00 | 0.00 | \& +\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+ \& | \- | (1.00) | 1.00 | \- | \& | DRCR | 1.00 DR | 1.00 CR | DRCR | \& | 0 | \-1.00 | 1.00 | 0.00 | \& | x | \-1.00 | 1.00 | x | \& | undef | \-1.00 | 1.00 | | \& +\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-+ .Ve .Sp Sample behaviour of the formatted output of various numbers for select \f(CW$dash\fR values. .ie n .IP "$form\->parse_amount($myconfig, $amount);" 4 .el .IP "\f(CW$form\fR\->parse_amount($myconfig, \f(CW$amount\fR);" 4 .IX Item "$form->parse_amount($myconfig, $amount);" Return a Math::BigFloat containing the value of \f(CW$amount\fR where \f(CW$amount\fR is formatted as \f(CW$myconfig\fR\->{numberformat}. If \f(CW$amount\fR is '' or undefined, it is treated as zero. \s-1DRCR\s0 and parenthesis notation is accepted in addition to negative sign notation. .Sp Calls \f(CW$form\fR\->error if the value is NaN. .ie n .IP "$form\->round_amount($amount, $places);" 4 .el .IP "\f(CW$form\fR\->round_amount($amount, \f(CW$places\fR);" 4 .IX Item "$form->round_amount($amount, $places);" Rounds the provided \f(CW$amount\fR to \f(CW$places\fR decimal places. .ie n .IP "$form\->db_parse_numeric('sth' => $sth, ['arrayref' => $arrayref, 'hashref' => $hashref])" 4 .el .IP "\f(CW$form\fR\->db_parse_numeric('sth' => \f(CW$sth\fR, ['arrayref' => \f(CW$arrayref\fR, 'hashref' => \f(CW$hashref\fR])" 4 .IX Item "$form->db_parse_numeric('sth' => $sth, ['arrayref' => $arrayref, 'hashref' => $hashref])" Converts numeric values in the result set \f(CW$arrayref\fR or \f(CW$hashref\fR to Math::BigFloat using \f(CW$sth\fR to determine which fields are numeric. .ie n .IP "$form\->get_my_emp_num($myconfig);" 4 .el .IP "\f(CW$form\fR\->get_my_emp_num($myconfig);" 4 .IX Item "$form->get_my_emp_num($myconfig);" Function to get the employee number of the user \f(CW$form\fR\->{login}. \f(CW$myconfig\fR is only used to create \f(CW%myconfig\fR. \f(CW$form\fR\->{emp_num} is set to the retrieved value. .Sp This function is currently (2007\-08\-02) only used by pos.conf.pl. .ie n .IP "$form\->format_string(@fields);" 4 .el .IP "\f(CW$form\fR\->format_string(@fields);" 4 .IX Item "$form->format_string(@fields);" Escape the values of \f(CW$form\fR selected by \f(CW@fields\fR for the format specified by \&\f(CW$form\fR\->{format}. .ie n .IP "$form\->datetonum($myconfig, $date[, $picture]);" 4 .el .IP "\f(CW$form\fR\->datetonum($myconfig, \f(CW$date\fR[, \f(CW$picture\fR]);" 4 .IX Item "$form->datetonum($myconfig, $date[, $picture]);" Converts \f(CW$date\fR from the format \f(CW$myconfig\fR\->{dateformat} to the format 'yyyymmdd'. If the year extracted is only two-digits, the year given is assumed to be in the range 2000\-2099. .Sp If \f(CW$date\fR does not contain any non-digits, datetonum does nothing. .Sp \&\f(CW$picture\fR is ignored. .ie n .IP "$form\->add_date($myconfig, $date, $repeat, $unit);" 4 .el .IP "\f(CW$form\fR\->add_date($myconfig, \f(CW$date\fR, \f(CW$repeat\fR, \f(CW$unit\fR);" 4 .IX Item "$form->add_date($myconfig, $date, $repeat, $unit);" Returns the date \f(CW$repeat\fR \f(CW$units\fR from \f(CW$date\fR in the input format. \f(CW$date\fR can either be in \f(CW$myconfig\fR\->{dateformat} or 'yyyymmdd' (four digit year required for this option). The valid values for \f(CW$unit\fR are 'days', 'weeks', 'months', and \&'years'. .Sp This function is unreliable for \f(CW$unit\fR values other than 'days' or 'weeks' and can die horribly. .ie n .IP "$form\->print_button($button, $name);" 4 .el .IP "\f(CW$form\fR\->print_button($button, \f(CW$name\fR);" 4 .IX Item "$form->print_button($button, $name);" Outputs a submit button to \s-1STDOUT. \s0 \f(CW$button\fR is a hashref that contains data about buttons, \f(CW$name\fR is the key for the element in \f(CW$button\fR to output. Each value in \f(CW$button\fR is a reference to a hash of two elements, 'key' and 'value'. .Sp \&\f(CW$name\fR is the value of the button that gets sent to the server when clicked, \&\f(CW$button\fR\->{$name}{key} is the accesskey, and \f(CW$button\fR\->{$name}{value} is the label for the button. .IP "test_should_get_images" 4 .IX Item "test_should_get_images" Returns true if images should get be retrieved for embedding in templates .ie n .IP "$form\->db_init($myconfig);" 4 .el .IP "\f(CW$form\fR\->db_init($myconfig);" 4 .IX Item "$form->db_init($myconfig);" Connect to the database that \f(CW$myconfig\fR is set to use and initialise the base parameters. The connection handle becomes \f(CW$form\fR\->{dbh} and \&\f(CW$form\fR\->{custom_db_fields} is populated. The connection initiated has autocommit disabled. .ie n .IP "$form\->run_custom_queries($tablename, $query_type[, $linenum]);" 4 .el .IP "\f(CW$form\fR\->run_custom_queries($tablename, \f(CW$query_type\fR[, \f(CW$linenum\fR]);" 4 .IX Item "$form->run_custom_queries($tablename, $query_type[, $linenum]);" Runs queries against custom fields for the specified \f(CW$query_type\fR against \&\f(CW$tablename\fR. .Sp Valid values for \f(CW$query_type\fR are any casing of '\s-1SELECT\s0', '\s-1INSERT\s0', and '\s-1UPDATE\s0'. .ie n .IP "$form\->dbconnect($myconfig);" 4 .el .IP "\f(CW$form\fR\->dbconnect($myconfig);" 4 .IX Item "$form->dbconnect($myconfig);" Returns an autocommit connection to the database specified in \f(CW$myconfig\fR. .ie n .IP "$form\->dbconnect_noauto($myconfig);" 4 .el .IP "\f(CW$form\fR\->dbconnect_noauto($myconfig);" 4 .IX Item "$form->dbconnect_noauto($myconfig);" Returns a non-autocommit connection to the database specified in \f(CW$myconfig\fR. .ie n .IP "$form\->dbquote($var);" 4 .el .IP "\f(CW$form\fR\->dbquote($var);" 4 .IX Item "$form->dbquote($var);" If \f(CW$var\fR is an empty string, return \s-1NULL,\s0 otherwise return \f(CW$var\fR as quoted by \&\f(CW$form\fR\->{dbh}\->quote($var). .ie n .IP "$form\->update_balance($dbh, $table, $field, $where, $value);" 4 .el .IP "\f(CW$form\fR\->update_balance($dbh, \f(CW$table\fR, \f(CW$field\fR, \f(CW$where\fR, \f(CW$value\fR);" 4 .IX Item "$form->update_balance($dbh, $table, $field, $where, $value);" \&\fB\s-1WARNING\s0\fR: This is a dangerous private function. All apps calling it must be careful to avoid \s-1SQL\s0 injection issues. .Sp If \f(CW$value\fR is set, sets the value of \f(CW$field\fR in \f(CW$table\fR to the sum of the current stored value and \f(CW$value\fR. In order to not annihilate the values in \f(CW$table\fR, \&\f(CW$where\fR must contain a \s-1WHERE\s0 clause that limits the \s-1UPDATE\s0 to a single row. .ie n .IP "$form\->update_exchangerate($dbh, $curr, $transdate, $buy, $sell);" 4 .el .IP "\f(CW$form\fR\->update_exchangerate($dbh, \f(CW$curr\fR, \f(CW$transdate\fR, \f(CW$buy\fR, \f(CW$sell\fR);" 4 .IX Item "$form->update_exchangerate($dbh, $curr, $transdate, $buy, $sell);" Updates the exchange rates \f(CW$buy\fR and \f(CW$sell\fR for the given \f(CW$currency\fR on \f(CW$transdate\fR. If there is not yet an exchange rate for \f(CW$currency\fR on \f(CW$transdate\fR, an entry is inserted. This returns without doing anything if \f(CW$curr\fR eq ''. .Sp \&\f(CW$dbh\fR is not used, favouring \f(CW$self\fR\->{dbh}. .ie n .IP "$form\->save_exchangerate($myconfig, $currency, $transdate, $rate, $fld);" 4 .el .IP "\f(CW$form\fR\->save_exchangerate($myconfig, \f(CW$currency\fR, \f(CW$transdate\fR, \f(CW$rate\fR, \f(CW$fld\fR);" 4 .IX Item "$form->save_exchangerate($myconfig, $currency, $transdate, $rate, $fld);" Saves the exchange rate \f(CW$rate\fR for the given \f(CW$currency\fR on \f(CW$transdate\fR for the provided purpose in \f(CW$fld\fR. \f(CW$fld\fR can be either 'buy' or 'sell'. .Sp \&\f(CW$myconfig\fR is not used. \f(CW$self\fR\->update_exchangerate is used for the majority of the work. .ie n .IP "$form\->get_exchangerate($dbh, $curr, $transdate, $fld);" 4 .el .IP "\f(CW$form\fR\->get_exchangerate($dbh, \f(CW$curr\fR, \f(CW$transdate\fR, \f(CW$fld\fR);" 4 .IX Item "$form->get_exchangerate($dbh, $curr, $transdate, $fld);" Returns the exchange rate in relation to the default currency for \f(CW$currency\fR on \&\f(CW$transdate\fR for the purpose indicated by \f(CW$fld\fR. \f(CW$fld\fR can be either 'buy' or \&'sell' to get usable results. .Sp \&\f(CW$dbh\fR is not used, favouring \f(CW$self\fR\->{dbh}. .ie n .IP "$form\->check_exchangerate($myconfig, $currency, $transdate, $fld);" 4 .el .IP "\f(CW$form\fR\->check_exchangerate($myconfig, \f(CW$currency\fR, \f(CW$transdate\fR, \f(CW$fld\fR);" 4 .IX Item "$form->check_exchangerate($myconfig, $currency, $transdate, $fld);" Returns some true value when an entry for \f(CW$currency\fR on \f(CW$transdate\fR is true for the purpose indicated by \f(CW$fld\fR. \f(CW$fld\fR can be either 'buy' or 'sell' to get usable results. Returns false if \f(CW$transdate\fR is not set. .Sp \&\f(CW$myconfig\fR is not used. .ie n .IP "$form\->add_shipto($dbh, $id);" 4 .el .IP "\f(CW$form\fR\->add_shipto($dbh, \f(CW$id\fR);" 4 .IX Item "$form->add_shipto($dbh, $id);" Inserts a new address into the table shipto if the value of any of the shipto address components in \f(CW$form\fR differs to the regular attribute in \f(CW$form\fR. The inserted value of trans_id is \f(CW$id\fR, the other fields correspond with the shipto address components of \f(CW$form\fR. .Sp \&\f(CW$dbh\fR is unused. .ie n .IP "$form\->get_shipto ($location_id)" 4 .el .IP "\f(CW$form\fR\->get_shipto ($location_id)" 4 .IX Item "$form->get_shipto ($location_id)" Returns the shipto record of the corresponding location, and attaches the info as expected for the templates .ie n .IP "$form\->get_employee($dbh);" 4 .el .IP "\f(CW$form\fR\->get_employee($dbh);" 4 .IX Item "$form->get_employee($dbh);" Returns a list containing the name and id of the employee \f(CW$form\fR\->{login}. Any portion of \f(CW$form\fR\->{login} including and past '@' are ignored. .Sp \&\f(CW$dbh\fR is unused. .ie n .IP "$form\->get_name($myconfig, $table[, $transdate])" 4 .el .IP "\f(CW$form\fR\->get_name($myconfig, \f(CW$table\fR[, \f(CW$transdate\fR])" 4 .IX Item "$form->get_name($myconfig, $table[, $transdate])" Sets \f(CW$form\fR\->{name_list} to refer to a list of customers or vendors whose names or numbers match the value found in \f(CW$form\fR\->{$table} and returns the number of matches. \f(CW$table\fR can be 'vendor', 'customer', or 'employee'; if the optional field \f(CW$transdate\fR is provided, the result set is further limited to \f(CW$table\fR entries which were active on the provided date as determined by the start and end dates. The elements of \f(CW$form\fR\->{name_list} are references returned rows in hashref form and are sorted by the name field. The fields of the hash are those of the view \f(CW$table\fR and the table entity. .Sp \&\f(CW$myconfig\fR is unused. .ie n .IP "$form\->all_vc($myconfig, $vc, $module, $dbh, $transdate, $job);" 4 .el .IP "\f(CW$form\fR\->all_vc($myconfig, \f(CW$vc\fR, \f(CW$module\fR, \f(CW$dbh\fR, \f(CW$transdate\fR, \f(CW$job\fR);" 4 .IX Item "$form->all_vc($myconfig, $vc, $module, $dbh, $transdate, $job);" Populates the list referred to by \f(CW$form\fR\->{all_${vc}} with hashes of either vendor or customer id and name, ordered by the name. This will be vendor details unless \f(CW$vc\fR is set to 'customer'. This list can be limited to only vendors or customers which are usable on a given day by specifying \f(CW$transdate\fR. As a further restriction, \f(CW$form\fR\->{all_${vc}} will not be populated if the number of vendors or customers that would be present in that list exceeds, or is equal to, \f(CW$myconfig\fR\->{vclimit}. .Sp In addition to the possible population of \f(CW$form\fR\->{all_${vc}}, \&\f(CW$form\fR\->{employee_id} is looked up if not already set, the list \&\f(CW$form\fR\->{all_language} is populated using the language table and is sorted by the description, and \f(CW$form\fR\->all_employees, \f(CW$form\fR\->all_departments, \&\f(CW$form\fR\->all_projects, and \f(CW$form\fR\->all_taxaccounts are all run. .Sp \&\f(CW$module\fR and \f(CW$dbh\fR are unused. .ie n .IP "$form\->get_regular_metadata($myconfig, $vc, $module, $dbh, $transdate, $job)" 4 .el .IP "\f(CW$form\fR\->get_regular_metadata($myconfig, \f(CW$vc\fR, \f(CW$module\fR, \f(CW$dbh\fR, \f(CW$transdate\fR, \f(CW$job\fR)" 4 .IX Item "$form->get_regular_metadata($myconfig, $vc, $module, $dbh, $transdate, $job)" This is API-compatible with all_vc. It is a handy wrapper function that calls the following functions: all_employees all_departments all_projects all_taxaccounts .Sp It is preferable to using all_vc where the latter does not work properly due to variable collisions, etc. .Sp \&\f(CW$form\fR\->{employee_id} is looked up if not already set, the list \&\f(CW$form\fR\->{all_language} is populated using the language table and is sorted by the description, and \f(CW$form\fR\->all_employees, \f(CW$form\fR\->all_departments, \&\f(CW$form\fR\->all_projects, and \f(CW$form\fR\->all_taxaccounts are all run. .Sp \&\f(CW$module\fR and \f(CW$dbh\fR are unused. .ie n .IP "$form\->\fIall_accounts()\fR" 4 .el .IP "\f(CW$form\fR\->\fIall_accounts()\fR" 4 .IX Item "$form->all_accounts()" Sets \f(CW$form\fR\->{accounts} to all accounts. Returns the list as well. Example: my \f(CW@account_list\fR = \f(CW$form\fR\->\fIall_accounts()\fR; .ie n .IP "$form\->all_taxaccounts($myconfig, $dbh2[, $transdate]);" 4 .el .IP "\f(CW$form\fR\->all_taxaccounts($myconfig, \f(CW$dbh2\fR[, \f(CW$transdate\fR]);" 4 .IX Item "$form->all_taxaccounts($myconfig, $dbh2[, $transdate]);" Get the tax rates and numbers for all the taxes in \f(CW$form\fR\->{taxaccounts}. Does nothing if \f(CW$form\fR\->{taxaccounts} is false. Taxes are listed as a space separated list of account numbers from the chart. The retrieved values are placed within \&\f(CW$form\fR\->{${accno}_rate} and \f(CW$form\fR\->{${accno}_taxnumber}. If \f(CW$transdate\fR is set, then only process taxes that were valid on \f(CW$transdate\fR. .Sp \&\f(CW$myconfig\fR and \f(CW$dbh2\fR are unused. .ie n .IP "$form\->all_employees($myconfig, $dbh2, $transdate, $sales);" 4 .el .IP "\f(CW$form\fR\->all_employees($myconfig, \f(CW$dbh2\fR, \f(CW$transdate\fR, \f(CW$sales\fR);" 4 .IX Item "$form->all_employees($myconfig, $dbh2, $transdate, $sales);" Sets \f(CW$form\fR\->{all_employee} to be a reference to an array referencing hashes of employee information. The hashes are of the form {'id' => id, 'name' => name}. If \f(CW$transdate\fR is set, the query is limited to employees who are active on that day. If \f(CW$sales\fR is true, only employees with the sales flag set are added. .Sp \&\f(CW$dbh2\fR is unused. .ie n .IP "$form\->all_projects($myconfig, $dbh2[, $transdate, $job]);" 4 .el .IP "\f(CW$form\fR\->all_projects($myconfig, \f(CW$dbh2\fR[, \f(CW$transdate\fR, \f(CW$job\fR]);" 4 .IX Item "$form->all_projects($myconfig, $dbh2[, $transdate, $job]);" Populates the list referred to as \f(CW$form\fR\->{all_project} with hashes detailing all projects. If \f(CW$job\fR is true, limit the projects to those whose ids are not also present in parts with a project_id > 0. If \f(CW$transdate\fR is set, the projects are limited to those valid on \f(CW$transdate\fR. If \f(CW$form\fR\->{language_code} is set, include the translation description in the project list and limit to translations with a matching language_code. The result list, \&\f(CW$form\fR\->{all_project}, is sorted by projectnumber. .Sp \&\f(CW$myconfig\fR and \f(CW$dbh2\fR are unused. \f(CW$job\fR appears to be part of attempted job\- costing support. .ie n .IP "$form\->all_departments($myconfig, $dbh2, $vc);" 4 .el .IP "\f(CW$form\fR\->all_departments($myconfig, \f(CW$dbh2\fR, \f(CW$vc\fR);" 4 .IX Item "$form->all_departments($myconfig, $dbh2, $vc);" Set \f(CW$form\fR\->{all_department} to be a reference to a list of hashrefs describing departments of the form {'id' => id, 'description' => description}. If \f(CW$vc\fR is 'customer', further limit the results to those whose role is 'P' (Profit Center). .Sp This procedure is internally followed by a call to \f(CW$form\fR\->all_years($myconfig). .Sp \&\f(CW$dbh2\fR is not used. .ie n .IP "$form\->all_languages($myconfig);" 4 .el .IP "\f(CW$form\fR\->all_languages($myconfig);" 4 .IX Item "$form->all_languages($myconfig);" Set \f(CW$form\fR\->{all_language} to be a reference to a list of hashrefs describing languages using the form {'code' => code, 'description' => description}. .ie n .IP "$form\->all_years($myconfig[, $dbh2]);" 4 .el .IP "\f(CW$form\fR\->all_years($myconfig[, \f(CW$dbh2\fR]);" 4 .IX Item "$form->all_years($myconfig[, $dbh2]);" Populates the hash \f(CW$form\fR\->{all_month} with a mapping between a two-digit month number and the English month name. Populates the list \f(CW$form\fR\->{all_years} with all years which contain transactions. .Sp \&\f(CW$dbh2\fR is unused. .ie n .IP "$form\->create_links( { module => $module, myconfig => $myconfig, vc => $vc, billing => $billing [, job => $job ] });" 4 .el .IP "\f(CW$form\fR\->create_links( { module => \f(CW$module\fR, myconfig => \f(CW$myconfig\fR, vc => \f(CW$vc\fR, billing => \f(CW$billing\fR [, job => \f(CW$job\fR ] });" 4 .IX Item "$form->create_links( { module => $module, myconfig => $myconfig, vc => $vc, billing => $billing [, job => $job ] });" Populates the hash referred to as \f(CW$form\fR\->{${module}_links} details about accounts that have \f(CW$module\fR in their link field. The hash is keyed upon link elements such as 'AP_amount' and 'AR_tax' and they refer to lists of hashes containing accno and description for the appropriate accounts. If the key does not contain 'tax', the account number is appended to the space separated list \&\f(CW$form\fR\->{accounts}. \f(CW$module\fR is typically '\s-1AR\s0' or '\s-1AP\s0' and is the base type of the accounts looked up. .Sp If \f(CW$form\fR\->{id} is not set, check \f(CW$form\fR\->{\*(L"$form\->{vc}_id\*(R"}. If neither is set, use \f(CW$form\fR\->lastname_used to populate the details. If \f(CW$form\fR\->{id} is set, populate the invnumber, transdate, ${vc}_id, datepaid, duedate, ordnumber, taxincluded, currency, notes, intnotes, ${vc}, department_id, department, oldinvtotal, oldtotalpaid, employee_id, employee, language_code, ponumber, reverse, printed, emailed, queued, recurring, exchangerate, and acc_trans attributes of \f(CW$form\fR with details about the transaction \f(CW$form\fR\->{id}. All of these attributes, save for acc_trans, are scalar; \f(CW$form\fR\->{acc_trans} refers to a hash keyed by link elements whose values are lists of references to hashes describing acc_trans table entries corresponding to the transaction \f(CW$form\fR\->{id}. The elements in the acc_trans entry hashes are accno, description, source, amount, memo, transdate, cleared, project_id, projectnumber, and exchangerate. .Sp The closedto, separate_duties, revtrans, and currencies \f(CW$form\fR attributes are filled with values from the defaults table, while \f(CW$form\fR\->{current_date} is populated with the current date. If \f(CW$form\fR\->{id} is not set, then \f(CW$form\fR\->{transdate} also takes on the current date. .Sp When \f(CW$billing\fR is provided and true, the email addresses are selected from the billing contact classes, when available, falling back to the normal email classes when not. .Sp After all this, it calls \f(CW$form\fR\->all_vc to conclude. .ie n .IP "$form\->lastname_used($myconfig, $dbh2, $vc, $module);" 4 .el .IP "\f(CW$form\fR\->lastname_used($myconfig, \f(CW$dbh2\fR, \f(CW$vc\fR, \f(CW$module\fR);" 4 .IX Item "$form->lastname_used($myconfig, $dbh2, $vc, $module);" Fills the name, currency, ${vc}_id, duedate, and possibly invoice_notes attributes of \f(CW$form\fR with the last used values for the transaction type specified by both \f(CW$vc\fR and \f(CW$form\fR\->{type}. \f(CW$vc\fR can be either 'vendor' or 'customer' and if unspecified will take on the value given in \f(CW$form\fR\->{vc}, defaulting to 'vendor'. If \f(CW$form\fR\->{type} matches /_order/, the transaction type used is order, if it matches /_quotation/, quotations are looked through. If \f(CW$form\fR\->{type} does not match either of the above, then ar or ap transactions are used. .Sp \&\f(CW$myconfig\fR, \f(CW$dbh2\fR, and \f(CW$module\fR are unused. .ie n .IP "$form\->current_date($myconfig[, $thisdate, $days]);" 4 .el .IP "\f(CW$form\fR\->current_date($myconfig[, \f(CW$thisdate\fR, \f(CW$days\fR]);" 4 .IX Item "$form->current_date($myconfig[, $thisdate, $days]);" If \f(CW$thisdate\fR is false, get the current date from the database. .Sp If \f(CW$thisdate\fR is true, get the date \f(CW$days\fR days from \f(CW$thisdate\fR in the date format specified by \f(CW$myconfig\fR\->{dateformat} from the database. .ie n .IP "$form\->like($str);" 4 .el .IP "\f(CW$form\fR\->like($str);" 4 .IX Item "$form->like($str);" Returns '%$str%' .ie n .IP "$form\->redo_rows($flds, $new, $count, $numrows);" 4 .el .IP "\f(CW$form\fR\->redo_rows($flds, \f(CW$new\fR, \f(CW$count\fR, \f(CW$numrows\fR);" 4 .IX Item "$form->redo_rows($flds, $new, $count, $numrows);" \&\f(CW$flds\fR refers to a list of field names and \f(CW$new\fR refers to a list of row detail hashes with the elements of \f(CW$flds\fR as keys as well as runningnumber for an order or another multi-row item that normally expresses elements in the form \&\f(CW$form\fR\->{${fieldname}_${index}}. .Sp For every \f(CW$field\fR in @{$flds} populates \f(CW$form\fR\->{${field}_$i} with an appropriate value from a \f(CW$new\fR detail hash where \f(CW$i\fR is an index between 1 and \f(CW$count\fR. The ordering of the details is done in terms of the runningnumber element of the row detail hashes in \f(CW$new\fR. .Sp All \f(CW$form\fR attributes with names of the form ${field}_$i where the index \f(CW$i\fR is between \f(CW$count\fR + 1 and \f(CW$numrows\fR is deleted. .ie n .IP "$form\->get_partsgroup($myconfig[, $p]);" 4 .el .IP "\f(CW$form\fR\->get_partsgroup($myconfig[, \f(CW$p\fR]);" 4 .IX Item "$form->get_partsgroup($myconfig[, $p]);" Populates the list referred to as \f(CW$form\fR\->{all_partsgroup}. \f(CW$p\fR refers to a hash that describes which partsgroups to retrieve. \f(CW$p\fR\->{searchitems} can be 'part', \&'service', 'assembly', 'labor', or 'nolabor' and will limit the groups to those that contain the item type described. \f(CW$p\fR\->{searchitems} and \f(CW$p\fR\->{all} conflict. If \f(CW$p\fR\->{all} is set and \f(CW$p\fR\->{language_code} is not, all partsgroups are retrieved. If \f(CW$p\fR\->{language_code} is set, also include the translation description specified by \f(CW$p\fR\->{language_code} for the partsgroup. .Sp The results in \f(CW$form\fR\->{all_partsgroup} are normally sorted by partsgroup name. If a language_code is specified, the results are then sorted by the translated description. .Sp \&\f(CW$myconfig\fR is unused. .ie n .IP "$form\->update_status($myconfig);" 4 .el .IP "\f(CW$form\fR\->update_status($myconfig);" 4 .IX Item "$form->update_status($myconfig);" DELETEs all status rows which have a formname of \f(CW$form\fR\->{formname} and a trans_id of \f(CW$form\fR\->{id}. INSERTs a new row into status where trans_id is \&\f(CW$form\fR\->{id}, formname is \f(CW$form\fR\->{formname}, printed and emailed are true if their respective \f(CW$form\fR attributes match /$form\->{formname}/, and spoolfile is the file extracted from the string \f(CW$form\fR\->{queued} or \s-1NULL\s0 if there is no entry for \f(CW$form\fR\->{formname}. .Sp \&\f(CW$myconfig\fR is unused. .ie n .IP "$form\->\fIsave_status()\fR;" 4 .el .IP "\f(CW$form\fR\->\fIsave_status()\fR;" 4 .IX Item "$form->save_status();" Clears out any old status entries for \f(CW$form\fR\->{id} and saves new status entries. Queued form names are extracted from \f(CW$form\fR\->{queued}. Printed and emailed form names are extracted from \f(CW$form\fR\->{printed} and \f(CW$form\fR\->{emailed}. The queued, printed, and emailed fields are space separated lists. .ie n .IP "$form\->\fIget_recurring()\fR;" 4 .el .IP "\f(CW$form\fR\->\fIget_recurring()\fR;" 4 .IX Item "$form->get_recurring();" Sets \f(CW$form\fR\->{recurring} to contain info about the recurrence schedule for the action \f(CW$form\fR\->{id}. \f(CW$form\fR\->{recurring} is of the same form used by \&\f(CW$form\fR\->save_recurring($dbh2, \f(CW$myconfig\fR). .Sp .Vb 2 \& reference,startdate,repeat,unit,howmany,payment,print,email,message \& text date int text int int text text text .Ve .ie n .IP "$form\->save_recurring($dbh2, $myconfig);" 4 .el .IP "\f(CW$form\fR\->save_recurring($dbh2, \f(CW$myconfig\fR);" 4 .IX Item "$form->save_recurring($dbh2, $myconfig);" Saves or deletes recurring transaction scheduling. \f(CW$form\fR\->{id} is used to determine the id used in the various recurring tables. A recurring transaction schedule is deleted by having \f(CW$form\fR\->{recurring} be false. For adding or updating a schedule, \f(CW$form\fR\->{recurring} is a comma separated field with partial subfield quoting of the form: .Sp .Vb 2 \& reference,startdate,repeat,unit,howmany,payment,print,email,message \& text date int text int int text text text .Ve .RS 4 .IP "reference" 4 .IX Item "reference" A URI-encoded reference string for the recurrence set. .IP "startdate" 4 .IX Item "startdate" The index date for the recurrence. .IP "repeat" 4 .IX Item "repeat" The unitless repetition frequency. .IP "unit" 4 .IX Item "unit" The interval unit used. Can be 'days', 'weeks', 'months', or 'years', capitalisation and pluralisation ignored. .IP "howmany" 4 .IX Item "howmany" The number of recurrences for the transaction. .IP "payment" 4 .IX Item "payment" Flag to indicate if a payment is included in the transaction. .IP "print" 4 .IX Item "print" A colon separated list of formname:format:printer triplets. .IP "email" 4 .IX Item "email" A colon separated list of formname:format pairs. .IP "message" 4 .IX Item "message" A URI-encoded message for the emails to be sent. .RE .RS 4 .Sp Values for the nextdate and enddate columns of the recurring table are calculated using startdate, repeat, unit, howmany, and the current database date. All other fields of the recurring, recurringemail, and recurringprint are obtained directly from \f(CW$form\fR\->{recurring}. .Sp \&\fB\s-1WARNING\s0\fR: This function does not check the validity of most subfields of \&\f(CW$form\fR\->{recurring}. .Sp \&\f(CW$dbh2\fR is not used. .RE .ie n .IP "$form\->save_intnotes($myconfig, $vc);" 4 .el .IP "\f(CW$form\fR\->save_intnotes($myconfig, \f(CW$vc\fR);" 4 .IX Item "$form->save_intnotes($myconfig, $vc);" Sets the intnotes field of the entry in the table \f(CW$vc\fR that has the id \&\f(CW$form\fR\->{id} to the value of \f(CW$form\fR\->{intnotes}. .Sp Does nothing if \f(CW$form\fR\->{id} is not set. .ie n .IP "$form\->update_defaults($myconfig, $fld[, $dbh [, $nocommit]);" 4 .el .IP "\f(CW$form\fR\->update_defaults($myconfig, \f(CW$fld\fR[, \f(CW$dbh\fR [, \f(CW$nocommit\fR]);" 4 .IX Item "$form->update_defaults($myconfig, $fld[, $dbh [, $nocommit]);" Updates the defaults entry for the setting \f(CW$fld\fR following rules specified by the existing value and returns the processed value that results. If \f(CW$form\fR is false, such as the case when invoked as \*(L"Form::update_defaults('',...)\*(R", \f(CW$dbh\fR is used as the handle. When \f(CW$form\fR is set, it uses \f(CW$form\fR\->{dbh}, initialising the connection if it does not yet exist. The entry \f(CW$fld\fR must exist prior to executing this function and this update function does not handle the general case of updating the defaults table. .Sp Note that nocommit prevents the db from committing in this function. .Sp \&\fB\s-1NOTE\s0\fR: rules handling is currently broken. .Sp Rules followed by this function's processing: .RS 4 .IP "\(bu" 4 If digits are found in the field, increment the left-most set. This change, unlike the others is reflected in the \s-1UPDATE.\s0 .IP "\(bu" 4 Replace with the date specified in \f(CW$form\fR\->{transdate} formatted as \f(CW$myconfig\fR\->{dateformat}. .IP "\(bu" 4 Replace with the value of \f(CW$form\fR\->{currency} .RE .RS 4 .RE .ie n .IP "$form\->db_prepare_vars(var1, var2, ..., var\fIn\fR)" 4 .el .IP "\f(CW$form\fR\->db_prepare_vars(var1, var2, ..., var\fIn\fR)" 4 .IX Item "$form->db_prepare_vars(var1, var2, ..., varn)" Undefines \f(CW$form\fR\->{var\fIm\fR}, 1 <= \fIm\fR <= \fIn\fR, iff \f(CW$form\fR\-<{var\fIm\fR is both false and not \*(L"0\*(R". .ie n .IP "$form\->split_date($dateformat[, $date]);" 4 .el .IP "\f(CW$form\fR\->split_date($dateformat[, \f(CW$date\fR]);" 4 .IX Item "$form->split_date($dateformat[, $date]);" Returns ($rv, \f(CW$yy\fR, \f(CW$mm\fR, \f(CW$dd\fR) for the provided \f(CW$date\fR, or the current date if no date is provided. \f(CW$rv\fR is a seperator-free merging of the fields \f(CW$yy\fR, \f(CW$mm\fR, and \&\f(CW$dd\fR in the ordering supplied by \f(CW$dateformat\fR. If the supplied \f(CW$date\fR does not contain non-digit characters, \f(CW$rv\fR is \f(CW$date\fR and the other return values are undefined. .Sp \&\f(CW$yy\fR is two digits. .ie n .IP "$form\->format_date($date);" 4 .el .IP "\f(CW$form\fR\->format_date($date);" 4 .IX Item "$form->format_date($date);" Returns \f(CW$date\fR converted from 'yyyy\-mm\-dd' format to the format specified by \&\f(CW$form\fR\->{db_dateformat}. If the supplied date does not match /^\ed{4}\eD/, return the supplied date. .Sp This function takes a four digit year and returns the date with a four digit year. .ie n .IP "$form\->from_to($yyyy, $mm[, $interval]);" 4 .el .IP "\f(CW$form\fR\->from_to($yyyy, \f(CW$mm\fR[, \f(CW$interval\fR]);" 4 .IX Item "$form->from_to($yyyy, $mm[, $interval]);" Returns the date \f(CW$yyyy\fR\-$mm\-01 and the the last day of the month interval \- 1 months from then in the form ($form\->format_date(fromdate), \&\f(CW$form\fR\->format_date(later)). If \f(CW$interval\fR is false but defined, the later date is the current date. .Sp This function dies horribly when \f(CW$mm\fR + \f(CW$interval\fR > 24 .ie n .IP "$form\->audittrail($dbh, $myconfig, $audittrail);" 4 .el .IP "\f(CW$form\fR\->audittrail($dbh, \f(CW$myconfig\fR, \f(CW$audittrail\fR);" 4 .IX Item "$form->audittrail($dbh, $myconfig, $audittrail);" Audit trail has been replaced by triggers which work on a very similar manner.