From 66022cbd0893e066eec8826a15884d2d0457fe4f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 11 Dec 2009 12:06:42 +0100 Subject: [PATCH] Dokumentation einheitlich in den Footer verschoben, Datei mit __END__ abgeschlossen (beschleunigt parsen), und POD Fehler gefixt. --- SL/CVar.pm | 45 +++++++++---- SL/DBUtils.pm | 2 - SL/Form.pm | 159 ++++++++++++++++++++++++++-------------------- SL/MoreCommon.pm | 62 ++++++++++++------ SL/OE.pm | 63 +++++++++--------- SL/RecordLinks.pm | 4 -- bin/mozilla/wh.pl | 29 ++++++--- 7 files changed, 221 insertions(+), 143 deletions(-) diff --git a/SL/CVar.pm b/SL/CVar.pm index 0099b7cbf..4d9b6a700 100644 --- a/SL/CVar.pm +++ b/SL/CVar.pm @@ -606,18 +606,6 @@ sub get_field_format_list { return ($date_fields, $number_fields); } -=head2 VALIDITY - -Suppose the following scenario: - -You have a lot of parts in your database, and a set of properties cofigured. Now not every part has every of these properties, some combinations will just make no sense. In order to clean up your inputs a bit, you want to mark certain combinations as invalid, blocking them from modification and possibly display. - -Validity is assumed. If you modify validity, you actually save B. -iNvalidity is saved as a function of config_id, and the trans_id - -In the naive way, disable an attribute for a specific id (simple) - -=cut sub save_custom_variables_validity { $main::lxdebug->enter_sub(); @@ -683,3 +671,36 @@ sub get_custom_variables_validity { } 1; + +__END__ + +=head1 NAME + +SL::CVar.pm - Custom Variables module + +=head1 SYNOPSIS + + # dealing with configs + + my $all_configs = CVar->get_configs() + my $config = CVar->get_config(id => '1234') + + CVar->save_config($config); + CVar->delete->config($config) + + # dealing with custom vars + + CVar->get_custom_variables(module => 'ic') + +=head2 VALIDITY + +Suppose the following scenario: + +You have a lot of parts in your database, and a set of properties cofigured. Now not every part has every of these properties, some combinations will just make no sense. In order to clean up your inputs a bit, you want to mark certain combinations as invalid, blocking them from modification and possibly display. + +Validity is assumed. If you modify validity, you actually save B. +Invalidity is saved as a function of config_id, and the trans_id + +In the naive way, disable an attribute for a specific id (simple) + +=cut diff --git a/SL/DBUtils.pm b/SL/DBUtils.pm index 6d20a695c..e041e1001 100644 --- a/SL/DBUtils.pm +++ b/SL/DBUtils.pm @@ -558,8 +558,6 @@ Dumps a query using LXDebug->message, using LEVEL for the debug-level of LXDebug =back -=head1 SEE ALSO - =head1 MODULE AUTHORS Moritz Bunkus Em.bunkus@linet-services.deE diff --git a/SL/Form.pm b/SL/Form.pm index d2a51e624..a0c8ce176 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -68,62 +68,6 @@ END { } } -=item _store_value() - -parses a complex var name, and stores it in the form. - -syntax: - $form->_store_value($key, $value); - -keys must start with a string, and can contain various tokens. -supported key structures are: - -1. simple access - simple key strings work as expected - - id => $form->{id} - -2. hash access. - separating two keys by a dot (.) will result in a hash lookup for the inner value - this is similar to the behaviour of java and templating mechanisms. - - filter.description => $form->{filter}->{description} - -3. array+hashref access - - adding brackets ([]) before the dot will cause the next hash to be put into an array. - using [+] instead of [] will force a new array index. this is useful for recurring - data structures like part lists. put a [+] into the first varname, and use [] on the - following ones. - - repeating these names in your template: - - invoice.items[+].id - invoice.items[].parts_id - - will result in: - - $form->{invoice}->{items}->[ - { - id => ... - parts_id => ... - }, - { - id => ... - parts_id => ... - } - ... - ] - -4. arrays - - using brackets at the end of a name will result in a pure array to be created. - note that you mustn't use [+], which is reserved for array+hash access and will - result in undefined behaviour in array context. - - filter.status[] => $form->{status}->[ val1, val2, ... ] - -=cut sub _store_value { $main::lxdebug->enter_sub(2); @@ -3315,19 +3259,6 @@ sub update_defaults { return $var; } -=item update_business - -PARAMS (not named): - \%config, - config hashref - $business_id, - business id - $dbh - optional database handle - -handles business (thats customer/vendor types) sequences. - -special behaviour for empty strings in customerinitnumber field: -will in this case not increase the value, and return undef. - -=cut sub update_business { $main::lxdebug->enter_sub(); @@ -3501,3 +3432,93 @@ sub restore_vars { } 1; + +__END__ + +=head1 NAME + +SL::Form.pm - main data object. + +=head1 SYNOPSIS + +This is the main data object of Lx-Office. +Unfortunately it also acts as a god object for certain data retrieval procedures used in the entry points. +Points of interest for a beginner are: + + - $form->error - renders a generic error in html. accepts an error message + - $form->get_standard_dbh - returns a database connection for the + +=head1 SPECIAL FUNCTIONS + +=over 4 + +=item _store_value() + +parses a complex var name, and stores it in the form. + +syntax: + $form->_store_value($key, $value); + +keys must start with a string, and can contain various tokens. +supported key structures are: + +1. simple access + simple key strings work as expected + + id => $form->{id} + +2. hash access. + separating two keys by a dot (.) will result in a hash lookup for the inner value + this is similar to the behaviour of java and templating mechanisms. + + filter.description => $form->{filter}->{description} + +3. array+hashref access + + adding brackets ([]) before the dot will cause the next hash to be put into an array. + using [+] instead of [] will force a new array index. this is useful for recurring + data structures like part lists. put a [+] into the first varname, and use [] on the + following ones. + + repeating these names in your template: + + invoice.items[+].id + invoice.items[].parts_id + + will result in: + + $form->{invoice}->{items}->[ + { + id => ... + parts_id => ... + }, + { + id => ... + parts_id => ... + } + ... + ] + +4. arrays + + using brackets at the end of a name will result in a pure array to be created. + note that you mustn't use [+], which is reserved for array+hash access and will + result in undefined behaviour in array context. + + filter.status[] => $form->{status}->[ val1, val2, ... ] + +=item update_business PARAMS + +PARAMS (not named): + \%config, - config hashref + $business_id, - business id + $dbh - optional database handle + +handles business (thats customer/vendor types) sequences. + +special behaviour for empty strings in customerinitnumber field: +will in this case not increase the value, and return undef. + +=back + +=cut diff --git a/SL/MoreCommon.pm b/SL/MoreCommon.pm index e93dd172e..0d5413b1a 100644 --- a/SL/MoreCommon.pm +++ b/SL/MoreCommon.pm @@ -88,24 +88,6 @@ sub any (&@) { return 0; } -=item cross BLOCK ARRAY ARRAY - -Evaluates BLOCK for each combination of elements in ARRAY1 and ARRAY2 -and returns a new list consisting of BLOCK's return values. -The two elements are set to $a and $b. -Note that those two are aliases to the original value so changing them -will modify the input arrays. - - # append each to each - @a = qw/a b c/; - @b = qw/1 2 3/; - @x = cross { "$a$b" } @a, @b; - # returns a1, a2, a3, b1, b2, b3, c1, c2, c3 - -As cross expects an array but returns a list it is not directly chainable -at the moment. This will be corrected in the future. - -=cut sub cross(&\@\@) { my $op = shift; use vars qw/@A @B/; @@ -167,3 +149,47 @@ sub listify { } 1; + +__END__ + +=head1 NAME + +SL::MoreCommon.pm - helper functions + +=head1 DESCRIPTION + +this is a collection of helper functions used in Lx-Office. +Most of them are either obvious or too obscure to care about unless you really have to. +The exceptions are documented here. + +=head2 FUNCTIONS + +=over 4 + +=item save_form +=item restore_form + +A lot of the old sql-ledger routines are strictly procedural. They search for params in the $form object, do stuff with it, and return a status code. + +Once in a while you'll want something from such a function without altering $form. Yeah, you could rewrite the routine from scratch... not. Just save you form, execute the routine, grab your results, and restore the previous form while you curse at the original design. + +=item cross BLOCK ARRAY ARRAY + +Evaluates BLOCK for each combination of elements in ARRAY1 and ARRAY2 +and returns a new list consisting of BLOCK's return values. +The two elements are set to $a and $b. +Note that those two are aliases to the original value so changing them +will modify the input arrays. + + # append each to each + @a = qw/a b c/; + @b = qw/1 2 3/; + @x = cross { "$a$b" } @a, @b; + # returns a1, a2, a3, b1, b2, b3, c1, c2, c3 + +As cross expects an array but returns a list it is not directly chainable +at the moment. This will be corrected in the future. + +=back + +=cut diff --git a/SL/OE.pm b/SL/OE.pm index 1bf8a719a..75867c333 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -43,20 +43,6 @@ use SL::IC; use strict; -=head1 NAME - -OE.pm - Order entry module - -=head1 DESCRIPTION - -OE.pm is part of the OE module. OE is responsible for sales and purchase orders, as well as sales quotations and purchase requests. This file abstracts the database tables C and C. - -=head1 FUNCTIONS - -=over 4 - -=cut - sub transactions { $main::lxdebug->enter_sub(); @@ -957,22 +943,6 @@ sub retrieve { return $rc; } -=item retrieve_simple PARAMS - -simple OE retrieval by id. does not look up customer, vendor, units or any other stuff. only oe and orderitems. - - my $order = retrieve_simple(id => 2); - - $order => { - %_OE_CONTENT, - orderitems => [ - %_ORDERITEM_ROW_1, - %_ORDERITEM_ROW_2, - ... - ] - } - -=cut sub retrieve_simple { $main::lxdebug->enter_sub(); @@ -1308,3 +1278,36 @@ sub project_description { } 1; + +__END__ + +=head1 NAME + +OE.pm - Order entry module + +=head1 DESCRIPTION + +OE.pm is part of the OE module. OE is responsible for sales and purchase orders, as well as sales quotations and purchase requests. This file abstracts the database tables C and C. + +=head1 FUNCTIONS + +=over 4 + +=item retrieve_simple PARAMS + +simple OE retrieval by id. does not look up customer, vendor, units or any other stuff. only oe and orderitems. + + my $order = retrieve_simple(id => 2); + + $order => { + %_OE_CONTENT, + orderitems => [ + %_ORDERITEM_ROW_1, + %_ORDERITEM_ROW_2, + ... + ] + } + +=back + +=cut diff --git a/SL/RecordLinks.pm b/SL/RecordLinks.pm index ae61edd34..54a068357 100644 --- a/SL/RecordLinks.pm +++ b/SL/RecordLinks.pm @@ -241,8 +241,6 @@ SL::RecordLinks - Verlinkung von Lx-Office Objekten. =head1 DESCRIPTION -=over 4 - Transitive RecordLinks mit get_links_via. get_links_via erwartet den zusätzlichen parameter via. via ist ein @@ -279,6 +277,4 @@ finden, nicht aber: oe:11 -> ar:13 -> do:14 -=back - =cut diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index b6165a87e..8e94f326e 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -968,14 +968,6 @@ sub get_bin_idx { return -1; } -=item new_item - -call new item dialogue from warehouse masks. - -PARAMS: - action => name of sub to be called when new item is done - -=cut sub new_item { $main::lxdebug->enter_sub(); my %params = @_; @@ -1017,3 +1009,24 @@ sub stock { } 1; + +__END__ + +=head1 NAME + +bin/mozilla/wh.pl - Warehouse frontend. + +=head1 FUNCTIONS + +=over 4 + +=item new_item + +call new item dialogue from warehouse masks. + +PARAMS: + action => name of sub to be called when new item is done + +=back + +=cut -- 2.20.1