Revision 66022cbd
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
SL/CVar.pm | ||
---|---|---|
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>.
|
||
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();
|
||
|
||
... | ... | |
}
|
||
|
||
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>.
|
||
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
|
SL/DBUtils.pm | ||
---|---|---|
|
||
=back
|
||
|
||
=head1 SEE ALSO
|
||
|
||
=head1 MODULE AUTHORS
|
||
|
||
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
|
SL/Form.pm | ||
---|---|---|
}
|
||
}
|
||
|
||
=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);
|
||
|
||
... | ... | |
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();
|
||
|
||
... | ... | |
}
|
||
|
||
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
|
SL/MoreCommon.pm | ||
---|---|---|
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/;
|
||
... | ... | |
}
|
||
|
||
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
|
SL/OE.pm | ||
---|---|---|
|
||
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<oe> and C<orderitems>.
|
||
|
||
=head1 FUNCTIONS
|
||
|
||
=over 4
|
||
|
||
=cut
|
||
|
||
sub transactions {
|
||
$main::lxdebug->enter_sub();
|
||
|
||
... | ... | |
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();
|
||
|
||
... | ... | |
}
|
||
|
||
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<oe> and C<orderitems>.
|
||
|
||
=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
|
SL/RecordLinks.pm | ||
---|---|---|
|
||
=head1 DESCRIPTION
|
||
|
||
=over 4
|
||
|
||
Transitive RecordLinks mit get_links_via.
|
||
|
||
get_links_via erwartet den zus?tzlichen parameter via. via ist ein
|
||
... | ... | |
|
||
oe:11 -> ar:13 -> do:14
|
||
|
||
=back
|
||
|
||
=cut
|
bin/mozilla/wh.pl | ||
---|---|---|
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 = @_;
|
||
... | ... | |
}
|
||
|
||
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
|
Auch abrufbar als: Unified diff
Dokumentation einheitlich in den Footer verschoben, Datei mit END abgeschlossen (beschleunigt parsen), und POD Fehler gefixt.