Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 66022cbd

Von Sven Schöling vor fast 15 Jahren hinzugefügt

  • ID 66022cbd0893e066eec8826a15884d2d0457fe4f
  • Vorgänger ddaf7f50
  • Nachfolger c09536f4

Dokumentation einheitlich in den Footer verschoben, Datei mit END abgeschlossen (beschleunigt parsen), und POD Fehler gefixt.

Unterschiede anzeigen:

SL/CVar.pm
606 606
  return ($date_fields, $number_fields);
607 607
}
608 608

  
609
=head2 VALIDITY
610

  
611
Suppose the following scenario:
612

  
613
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.
614

  
615
Validity is assumed. If you modify validity, you actually save B<invalidity>.
616
iNvalidity is saved as a function of config_id, and the trans_id
617

  
618
In the naive way, disable an attribute for a specific id (simple)
619

  
620
=cut
621 609
sub save_custom_variables_validity {
622 610
  $main::lxdebug->enter_sub();
623 611

  
......
683 671
}
684 672

  
685 673
1;
674

  
675
__END__
676

  
677
=head1 NAME
678

  
679
SL::CVar.pm - Custom Variables module
680

  
681
=head1 SYNOPSIS
682

  
683
  # dealing with configs
684

  
685
  my $all_configs = CVar->get_configs()
686
  my $config      = CVar->get_config(id => '1234')
687

  
688
  CVar->save_config($config);
689
  CVar->delete->config($config)
690

  
691
  # dealing with custom vars
692

  
693
  CVar->get_custom_variables(module => 'ic')
694

  
695
=head2 VALIDITY
696

  
697
Suppose the following scenario:
698

  
699
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.
700

  
701
Validity is assumed. If you modify validity, you actually save B<invalidity>.
702
Invalidity is saved as a function of config_id, and the trans_id
703

  
704
In the naive way, disable an attribute for a specific id (simple)
705

  
706
=cut
SL/DBUtils.pm
558 558

  
559 559
=back
560 560

  
561
=head1 SEE ALSO
562

  
563 561
=head1 MODULE AUTHORS
564 562

  
565 563
Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
SL/Form.pm
68 68
  }
69 69
}
70 70

  
71
=item _store_value()
72

  
73
parses a complex var name, and stores it in the form.
74

  
75
syntax:
76
  $form->_store_value($key, $value);
77

  
78
keys must start with a string, and can contain various tokens.
79
supported key structures are:
80

  
81
1. simple access
82
  simple key strings work as expected
83

  
84
  id => $form->{id}
85

  
86
2. hash access.
87
  separating two keys by a dot (.) will result in a hash lookup for the inner value
88
  this is similar to the behaviour of java and templating mechanisms.
89

  
90
  filter.description => $form->{filter}->{description}
91

  
92
3. array+hashref access
93

  
94
  adding brackets ([]) before the dot will cause the next hash to be put into an array.
95
  using [+] instead of [] will force a new array index. this is useful for recurring
96
  data structures like part lists. put a [+] into the first varname, and use [] on the
97
  following ones.
98

  
99
  repeating these names in your template:
100

  
101
    invoice.items[+].id
102
    invoice.items[].parts_id
103

  
104
  will result in:
105

  
106
    $form->{invoice}->{items}->[
107
      {
108
        id       => ...
109
        parts_id => ...
110
      },
111
      {
112
        id       => ...
113
        parts_id => ...
114
      }
115
      ...
116
    ]
117

  
118
4. arrays
119

  
120
  using brackets at the end of a name will result in a pure array to be created.
121
  note that you mustn't use [+], which is reserved for array+hash access and will
122
  result in undefined behaviour in array context.
123

  
124
  filter.status[]  => $form->{status}->[ val1, val2, ... ]
125

  
126
=cut
127 71
sub _store_value {
128 72
  $main::lxdebug->enter_sub(2);
129 73

  
......
3315 3259
  return $var;
3316 3260
}
3317 3261

  
3318
=item update_business
3319

  
3320
PARAMS (not named):
3321
 \%config,     - config hashref
3322
 $business_id, - business id
3323
 $dbh          - optional database handle
3324

  
3325
handles business (thats customer/vendor types) sequences.
3326

  
3327
special behaviour for empty strings in customerinitnumber field:
3328
will in this case not increase the value, and return undef.
3329

  
3330
=cut
3331 3262
sub update_business {
3332 3263
  $main::lxdebug->enter_sub();
3333 3264

  
......
3501 3432
}
3502 3433

  
3503 3434
1;
3435

  
3436
__END__
3437

  
3438
=head1 NAME
3439

  
3440
SL::Form.pm - main data object.
3441

  
3442
=head1 SYNOPSIS
3443

  
3444
This is the main data object of Lx-Office.
3445
Unfortunately it also acts as a god object for certain data retrieval procedures used in the entry points.
3446
Points of interest for a beginner are:
3447

  
3448
 - $form->error            - renders a generic error in html. accepts an error message
3449
 - $form->get_standard_dbh - returns a database connection for the
3450

  
3451
=head1 SPECIAL FUNCTIONS
3452

  
3453
=over 4
3454

  
3455
=item _store_value()
3456

  
3457
parses a complex var name, and stores it in the form.
3458

  
3459
syntax:
3460
  $form->_store_value($key, $value);
3461

  
3462
keys must start with a string, and can contain various tokens.
3463
supported key structures are:
3464

  
3465
1. simple access
3466
  simple key strings work as expected
3467

  
3468
  id => $form->{id}
3469

  
3470
2. hash access.
3471
  separating two keys by a dot (.) will result in a hash lookup for the inner value
3472
  this is similar to the behaviour of java and templating mechanisms.
3473

  
3474
  filter.description => $form->{filter}->{description}
3475

  
3476
3. array+hashref access
3477

  
3478
  adding brackets ([]) before the dot will cause the next hash to be put into an array.
3479
  using [+] instead of [] will force a new array index. this is useful for recurring
3480
  data structures like part lists. put a [+] into the first varname, and use [] on the
3481
  following ones.
3482

  
3483
  repeating these names in your template:
3484

  
3485
    invoice.items[+].id
3486
    invoice.items[].parts_id
3487

  
3488
  will result in:
3489

  
3490
    $form->{invoice}->{items}->[
3491
      {
3492
        id       => ...
3493
        parts_id => ...
3494
      },
3495
      {
3496
        id       => ...
3497
        parts_id => ...
3498
      }
3499
      ...
3500
    ]
3501

  
3502
4. arrays
3503

  
3504
  using brackets at the end of a name will result in a pure array to be created.
3505
  note that you mustn't use [+], which is reserved for array+hash access and will
3506
  result in undefined behaviour in array context.
3507

  
3508
  filter.status[]  => $form->{status}->[ val1, val2, ... ]
3509

  
3510
=item update_business PARAMS
3511

  
3512
PARAMS (not named):
3513
 \%config,     - config hashref
3514
 $business_id, - business id
3515
 $dbh          - optional database handle
3516

  
3517
handles business (thats customer/vendor types) sequences.
3518

  
3519
special behaviour for empty strings in customerinitnumber field:
3520
will in this case not increase the value, and return undef.
3521

  
3522
=back
3523

  
3524
=cut
SL/MoreCommon.pm
88 88
  return 0;
89 89
}
90 90

  
91
=item cross BLOCK ARRAY ARRAY
92

  
93
Evaluates BLOCK for each combination of elements in ARRAY1 and ARRAY2
94
and returns a new list consisting of BLOCK's return values.
95
The two elements are set to $a and $b.
96
Note that those two are aliases to the original value so changing them
97
will modify the input arrays.
98

  
99
  # append each to each
100
  @a = qw/a b c/;
101
  @b = qw/1 2 3/;
102
  @x = cross { "$a$b" } @a, @b;
103
  # returns a1, a2, a3, b1, b2, b3, c1, c2, c3
104

  
105
As cross expects an array but returns a list it is not directly chainable
106
at the moment. This will be corrected in the future.
107

  
108
=cut
109 91
sub cross(&\@\@) {
110 92
  my $op = shift;
111 93
  use vars qw/@A @B/;
......
167 149
}
168 150

  
169 151
1;
152

  
153
__END__
154

  
155
=head1 NAME
156

  
157
SL::MoreCommon.pm - helper functions
158

  
159
=head1 DESCRIPTION
160

  
161
this is a collection of helper functions used in Lx-Office.
162
Most of them are either obvious or too obscure to care about unless you really have to.
163
The exceptions are documented here.
164

  
165
=head2 FUNCTIONS
166

  
167
=over 4
168

  
169
=item save_form
170
=item restore_form
171

  
172
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.
173

  
174
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.
175

  
176
=item cross BLOCK ARRAY ARRAY
177

  
178
Evaluates BLOCK for each combination of elements in ARRAY1 and ARRAY2
179
and returns a new list consisting of BLOCK's return values.
180
The two elements are set to $a and $b.
181
Note that those two are aliases to the original value so changing them
182
will modify the input arrays.
183

  
184
  # append each to each
185
  @a = qw/a b c/;
186
  @b = qw/1 2 3/;
187
  @x = cross { "$a$b" } @a, @b;
188
  # returns a1, a2, a3, b1, b2, b3, c1, c2, c3
189

  
190
As cross expects an array but returns a list it is not directly chainable
191
at the moment. This will be corrected in the future.
192

  
193
=back
194

  
195
=cut
SL/OE.pm
43 43

  
44 44
use strict;
45 45

  
46
=head1 NAME
47

  
48
OE.pm - Order entry module
49

  
50
=head1 DESCRIPTION
51

  
52
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>.
53

  
54
=head1 FUNCTIONS
55

  
56
=over 4
57

  
58
=cut
59

  
60 46
sub transactions {
61 47
  $main::lxdebug->enter_sub();
62 48

  
......
957 943
  return $rc;
958 944
}
959 945

  
960
=item retrieve_simple PARAMS
961

  
962
simple OE retrieval by id. does not look up customer, vendor, units or any other stuff. only oe and orderitems.
963

  
964
  my $order = retrieve_simple(id => 2);
965

  
966
  $order => {
967
    %_OE_CONTENT,
968
    orderitems => [
969
      %_ORDERITEM_ROW_1,
970
      %_ORDERITEM_ROW_2,
971
      ...
972
    ]
973
  }
974

  
975
=cut
976 946
sub retrieve_simple {
977 947
  $main::lxdebug->enter_sub();
978 948

  
......
1308 1278
}
1309 1279

  
1310 1280
1;
1281

  
1282
__END__
1283

  
1284
=head1 NAME
1285

  
1286
OE.pm - Order entry module
1287

  
1288
=head1 DESCRIPTION
1289

  
1290
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>.
1291

  
1292
=head1 FUNCTIONS
1293

  
1294
=over 4
1295

  
1296
=item retrieve_simple PARAMS
1297

  
1298
simple OE retrieval by id. does not look up customer, vendor, units or any other stuff. only oe and orderitems.
1299

  
1300
  my $order = retrieve_simple(id => 2);
1301

  
1302
  $order => {
1303
    %_OE_CONTENT,
1304
    orderitems => [
1305
      %_ORDERITEM_ROW_1,
1306
      %_ORDERITEM_ROW_2,
1307
      ...
1308
    ]
1309
  }
1310

  
1311
=back
1312

  
1313
=cut
SL/RecordLinks.pm
241 241

  
242 242
=head1 DESCRIPTION
243 243

  
244
=over 4
245

  
246 244
Transitive RecordLinks mit get_links_via.
247 245

  
248 246
get_links_via erwartet den zus?tzlichen parameter via. via ist ein
......
279 277

  
280 278
  oe:11 -> ar:13 -> do:14
281 279

  
282
=back
283

  
284 280
=cut
bin/mozilla/wh.pl
968 968
  return -1;
969 969
}
970 970

  
971
=item new_item
972

  
973
call new item dialogue from warehouse masks.
974

  
975
PARAMS:
976
  action  => name of sub to be called when new item is done
977

  
978
=cut
979 971
sub new_item {
980 972
  $main::lxdebug->enter_sub();
981 973
  my %params = @_;
......
1017 1009
}
1018 1010

  
1019 1011
1;
1012

  
1013
__END__
1014

  
1015
=head1 NAME
1016

  
1017
bin/mozilla/wh.pl - Warehouse frontend.
1018

  
1019
=head1 FUNCTIONS
1020

  
1021
=over 4
1022

  
1023
=item new_item
1024

  
1025
call new item dialogue from warehouse masks.
1026

  
1027
PARAMS:
1028
  action  => name of sub to be called when new item is done
1029

  
1030
=back
1031

  
1032
=cut

Auch abrufbar als: Unified diff