Revision 2e798373
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/arap.pl | ||
---|---|---|
32 | 32 |
|
33 | 33 |
use SL::Projects; |
34 | 34 |
|
35 |
use strict; |
|
36 |
|
|
35 | 37 |
# any custom scripts for this one |
36 | 38 |
if (-f "bin/mozilla/custom_arap.pl") { |
37 | 39 |
eval { require "bin/mozilla/custom_arap.pl"; }; |
38 | 40 |
} |
39 |
if (-f "bin/mozilla/$form->{login}_arap.pl") { |
|
40 |
eval { require "bin/mozilla/$form->{login}_arap.pl"; }; |
|
41 |
if (-f "bin/mozilla/$main::form->{login}_arap.pl") {
|
|
42 |
eval { require "bin/mozilla/$main::form->{login}_arap.pl"; };
|
|
41 | 43 |
} |
42 | 44 |
|
43 | 45 |
1; |
... | ... | |
47 | 49 |
# end of main |
48 | 50 |
|
49 | 51 |
sub check_name { |
50 |
$lxdebug->enter_sub(); |
|
52 |
$main::lxdebug->enter_sub(); |
|
53 |
|
|
54 |
my $form = $main::form; |
|
55 |
my %myconfig = %main::myconfig; |
|
56 |
my $locale = $main::locale; |
|
51 | 57 |
|
52 |
$auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
58 |
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
|
53 | 59 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash |' . |
54 | 60 |
'purchase_delivery_order_edit | sales_delivery_order_edit'); |
55 | 61 |
|
... | ... | |
113 | 119 |
# name is not on file |
114 | 120 |
# $locale->text('Customer not on file or locked!') |
115 | 121 |
# $locale->text('Vendor not on file or locked!') |
116 |
$msg = ucfirst $name . " not on file or locked!"; |
|
122 |
my $msg = ucfirst $name . " not on file or locked!";
|
|
117 | 123 |
$form->error($locale->text($msg)); |
118 | 124 |
} |
119 | 125 |
} |
120 | 126 |
} |
121 | 127 |
$form->language_payment(\%myconfig); |
122 | 128 |
|
123 |
$lxdebug->leave_sub(); |
|
129 |
$main::lxdebug->leave_sub();
|
|
124 | 130 |
|
125 | 131 |
return $i; |
126 | 132 |
} |
... | ... | |
129 | 135 |
# $locale->text('Vendor not on file!') |
130 | 136 |
|
131 | 137 |
sub select_name { |
132 |
$lxdebug->enter_sub(); |
|
138 |
$main::lxdebug->enter_sub();
|
|
133 | 139 |
|
134 |
$auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
140 |
my $form = $main::form; |
|
141 |
my $locale = $main::locale; |
|
142 |
|
|
143 |
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
135 | 144 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash'); |
136 | 145 |
|
137 | 146 |
my ($table) = @_; |
138 | 147 |
|
139 |
@column_index = qw(ndx name address); |
|
148 |
my @column_index = qw(ndx name address);
|
|
140 | 149 |
|
141 |
$label = ucfirst $table; |
|
150 |
my $label = ucfirst $table; |
|
151 |
my %column_data; |
|
142 | 152 |
$column_data{ndx} = qq|<th> </th>|; |
143 | 153 |
$column_data{name} = |
144 | 154 |
qq|<th class=listheading>| . $locale->text($label) . qq|</th>|; |
... | ... | |
148 | 158 |
# list items with radio button on a form |
149 | 159 |
$form->header; |
150 | 160 |
|
151 |
$title = $locale->text('Select from one of the names below'); |
|
161 |
my $title = $locale->text('Select from one of the names below');
|
|
152 | 162 |
|
153 | 163 |
print qq| |
154 | 164 |
<body> |
... | ... | |
172 | 182 |
|; |
173 | 183 |
|
174 | 184 |
my $i = 0; |
175 |
foreach $ref (@{ $form->{name_list} }) { |
|
176 |
$checked = ($i++) ? "" : "checked"; |
|
185 |
my $j; |
|
186 |
foreach my $ref (@{ $form->{name_list} }) { |
|
187 |
my $checked = ($i++) ? "" : "checked"; |
|
177 | 188 |
|
178 | 189 |
$ref->{name} =~ s/\"/"/g; |
179 | 190 |
|
... | ... | |
216 | 227 |
map { delete $form->{$_} } qw(action name_list header); |
217 | 228 |
|
218 | 229 |
# save all other form variables |
219 |
foreach $key (keys %${form}) { |
|
230 |
foreach my $key (keys %${form}) {
|
|
220 | 231 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
221 | 232 |
$form->{$key} =~ s/\"/"/g; |
222 | 233 |
print qq|<input name=$key type=hidden value="$form->{$key}">\n|; |
... | ... | |
235 | 246 |
</html> |
236 | 247 |
|; |
237 | 248 |
|
238 |
$lxdebug->leave_sub(); |
|
249 |
$main::lxdebug->leave_sub();
|
|
239 | 250 |
} |
240 | 251 |
|
241 | 252 |
sub name_selected { |
242 |
$lxdebug->enter_sub(); |
|
253 |
$main::lxdebug->enter_sub(); |
|
254 |
|
|
255 |
my $form = $main::form; |
|
256 |
my %myconfig = %main::myconfig; |
|
243 | 257 |
|
244 |
$auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
258 |
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
|
245 | 259 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash'); |
246 | 260 |
|
247 | 261 |
# replace the variable with the one checked |
248 | 262 |
|
249 | 263 |
# index for new item |
250 |
$i = $form->{ndx}; |
|
264 |
my $i = $form->{ndx};
|
|
251 | 265 |
|
252 | 266 |
$form->{ $form->{vc} } = $form->{"new_name_$i"}; |
253 | 267 |
$form->{"$form->{vc}_id"} = $form->{"new_id_$i"}; |
... | ... | |
266 | 280 |
|
267 | 281 |
&update(1); |
268 | 282 |
|
269 |
$lxdebug->leave_sub(); |
|
283 |
$main::lxdebug->leave_sub();
|
|
270 | 284 |
} |
271 | 285 |
|
272 | 286 |
sub check_project { |
273 |
$lxdebug->enter_sub(); |
|
287 |
$main::lxdebug->enter_sub();
|
|
274 | 288 |
|
275 |
$auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
289 |
my $form = $main::form; |
|
290 |
my $locale = $main::locale; |
|
291 |
|
|
292 |
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
276 | 293 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report'); |
277 | 294 |
|
278 | 295 |
my $nextsub = shift || 'update'; |
279 | 296 |
|
280 |
for $i (1 .. $form->{rowcount}) { |
|
297 |
for my $i (1 .. $form->{rowcount}) {
|
|
281 | 298 |
my $suffix = $i ? "_$i" : ""; |
282 | 299 |
my $prefix = $i ? "" : "global"; |
283 | 300 |
$form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"}; |
... | ... | |
287 | 304 |
# get new project |
288 | 305 |
$form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"}; |
289 | 306 |
my %params = map { $_ => $form->{$_} } qw(projectnumber description active); |
307 |
my $rows; |
|
290 | 308 |
if (($rows = Projects->search_projects(%params)) > 1) { |
291 | 309 |
|
292 | 310 |
# check form->{project_list} how many there are |
... | ... | |
310 | 328 |
} |
311 | 329 |
} |
312 | 330 |
|
313 |
$lxdebug->leave_sub(); |
|
331 |
$main::lxdebug->leave_sub();
|
|
314 | 332 |
} |
315 | 333 |
|
316 | 334 |
sub select_project { |
317 |
$lxdebug->enter_sub(); |
|
335 |
$main::lxdebug->enter_sub(); |
|
336 |
|
|
337 |
my $form = $main::form; |
|
338 |
my $locale = $main::locale; |
|
339 |
my $cgi = $main::cgi; |
|
318 | 340 |
|
319 |
$auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
341 |
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
|
320 | 342 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report'); |
321 | 343 |
|
322 | 344 |
my ($is_global, $nextsub) = @_; |
323 | 345 |
|
324 |
@column_index = qw(ndx projectnumber description); |
|
346 |
my @column_index = qw(ndx projectnumber description);
|
|
325 | 347 |
|
348 |
my %column_data; |
|
326 | 349 |
$column_data{ndx} = qq|<th> </th>|; |
327 | 350 |
$column_data{projectnumber} = qq|<th>| . $locale->text('Number') . qq|</th>|; |
328 | 351 |
$column_data{description} = |
... | ... | |
331 | 354 |
# list items with radio button on a form |
332 | 355 |
$form->header; |
333 | 356 |
|
334 |
$title = $locale->text('Select from one of the projects below'); |
|
357 |
my $title = $locale->text('Select from one of the projects below');
|
|
335 | 358 |
|
336 | 359 |
print qq| |
337 | 360 |
<body> |
... | ... | |
357 | 380 |
|; |
358 | 381 |
|
359 | 382 |
my $i = 0; |
360 |
foreach $ref (@{ $form->{project_list} }) { |
|
361 |
$checked = ($i++) ? "" : "checked"; |
|
383 |
my $j; |
|
384 |
foreach my $ref (@{ $form->{project_list} }) { |
|
385 |
my $checked = ($i++) ? "" : "checked"; |
|
362 | 386 |
|
363 | 387 |
$ref->{name} =~ s/\"/"/g; |
364 | 388 |
|
... | ... | |
401 | 425 |
map { delete $form->{$_} } qw(action project_list header update); |
402 | 426 |
|
403 | 427 |
# save all other form variables |
404 |
foreach $key (keys %${form}) { |
|
428 |
foreach my $key (keys %${form}) {
|
|
405 | 429 |
next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); |
406 | 430 |
$form->{$key} =~ s/\"/"/g; |
407 | 431 |
print qq|<input name=$key type=hidden value="$form->{$key}">\n|; |
... | ... | |
421 | 445 |
</html> |
422 | 446 |
|; |
423 | 447 |
|
424 |
$lxdebug->leave_sub(); |
|
448 |
$main::lxdebug->leave_sub();
|
|
425 | 449 |
} |
426 | 450 |
|
427 | 451 |
sub project_selected { |
428 |
$lxdebug->enter_sub(); |
|
452 |
$main::lxdebug->enter_sub(); |
|
453 |
|
|
454 |
my $form = $main::form; |
|
429 | 455 |
|
430 |
$auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' . |
|
456 |
$main::auth->assert('general_ledger | vendor_invoice_edit | sales_order_edit | invoice_edit |' .
|
|
431 | 457 |
'request_quotation_edit | sales_quotation_edit | purchase_order_edit | cash | report'); |
432 | 458 |
|
433 | 459 |
# replace the variable with the one checked |
434 | 460 |
|
435 | 461 |
# index for new item |
436 |
$i = $form->{ndx}; |
|
462 |
my $i = $form->{ndx};
|
|
437 | 463 |
|
438 | 464 |
my $prefix = $form->{"is_global"} ? "global" : ""; |
439 | 465 |
my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}"; |
... | ... | |
455 | 481 |
|
456 | 482 |
call_sub($nextsub); |
457 | 483 |
|
458 |
$lxdebug->leave_sub(); |
|
484 |
$main::lxdebug->leave_sub();
|
|
459 | 485 |
} |
460 | 486 |
|
461 |
sub continue { call_sub($form->{"nextsub"}); } |
|
487 |
sub continue { call_sub($main::form->{"nextsub"}); }
|
|
462 | 488 |
|
Auch abrufbar als: Unified diff
arap strict