Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a7cb4783

Von Moritz Bunkus vor etwa 17 Jahren hinzugefügt

  • ID a7cb47837062e43aa3a0c233361756b7ba889a71
  • Vorgänger 180842d8
  • Nachfolger 553e3b0e

Umstellung der Maske "Benutzereinstellungen" auf die Verwendung von Template.

Unterschiede anzeigen:

bin/mozilla/am.pl
2352 2352
  $lxdebug->leave_sub();
2353 2353
}
2354 2354

  
2355
sub _build_cfg_options {
2356
  my $idx   = shift;
2357
  my $array = uc($idx) . 'S';
2358

  
2359
  $form->{$array} = [];
2360
  foreach my $item (@_) {
2361
    push @{ $form->{$array} }, {
2362
      'name'     => $item,
2363
      'value'    => $item,
2364
      'selected' => $item eq $myconfig{$idx},
2365
    };
2366
  }
2367
}
2368

  
2355 2369
sub config {
2356 2370
  $lxdebug->enter_sub();
2357 2371

  
2358 2372
  # get defaults for account numbers and last numbers
2359 2373
  AM->defaultaccounts(\%myconfig, \%$form);
2360 2374

  
2361
  foreach $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) {
2362
    $dateformat .=
2363
      ($item eq $myconfig{dateformat})
2364
      ? "<option selected>$item\n"
2365
      : "<option>$item\n";
2366
  }
2375
  map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
2367 2376

  
2368
  foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) {
2369
    $numberformat .=
2370
      ($item eq $myconfig{numberformat})
2371
      ? "<option selected>$item\n"
2372
      : "<option>$item\n";
2373
  }
2374

  
2375
  foreach $item (qw(name company address signature)) {
2376
    $myconfig{$item} =~ s/\"/&quot;/g;
2377
  }
2378

  
2379
  foreach $item (qw(address signature)) {
2380
    $myconfig{$item} =~ s/\\n/\r\n/g;
2381
  }
2377
  _build_cfg_options('dateformat', qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd));
2378
  _build_cfg_options('numberformat', qw(1,000.00 1000.00 1.000,00 1000,00));
2382 2379

  
2383 2380
  @formats = ();
2384 2381
  if ($opendocument_templates && $openofficeorg_writer_bin &&
......
2402 2399
  if (!$myconfig{"template_format"}) {
2403 2400
    $myconfig{"template_format"} = "pdf";
2404 2401
  }
2405
  my $template_format = "";
2402
  $form->{TEMPLATE_FORMATS} = [];
2406 2403
  foreach $item (@formats) {
2407
    $template_format .=
2408
      "<option value=\"$item->{value}\"" .
2409
      ($item->{"value"} eq $myconfig{"template_format"} ?
2410
       " selected" : "") .
2411
       ">" . H($item->{"name"}) . "</option>";
2404
    push @{ $form->{TEMPLATE_FORMATS} }, {
2405
      'name'     => $item->{name},
2406
      'value'    => $item->{value},
2407
      'selected' => $item->{value} eq $myconfig{template_format},
2408
    };
2412 2409
  }
2413 2410

  
2414 2411
  if (!$myconfig{"default_media"}) {
2415 2412
    $myconfig{"default_media"} = "screen";
2416 2413
  }
2414

  
2417 2415
  my %selected = ($myconfig{"default_media"} => "selected");
2418
  my $default_media = qq|
2419
  <option value="screen" $selected{'screen'}>| . $locale->text("Screen") . qq|</option>
2420
  <option value="printer" $selected{'printer'}>| . $locale->text("Printer") . qq|</option>
2421
  <option value="queue" $selected{'queue'}>| . $locale->text("Queue") . qq|</option>
2422
|;
2416
  $form->{MEDIA} = [
2417
    { 'name' => $locale->text('Screen'),  'value' => 'screen',  'selected' => $selected{screen}, },
2418
    { 'name' => $locale->text('Printer'), 'value' => 'printer', 'selected' => $selected{printer}, },
2419
    { 'name' => $locale->text('Queue'),   'value' => 'queue',   'selected' => $selected{queue}, },
2420
    ];
2423 2421

  
2424
  %selected = ();
2425
  $selected{$myconfig{"default_printer_id"}} = "selected"
2426
    if ($myconfig{"default_printer_id"});
2427
  my $default_printer = qq|<option></option>|;
2428 2422
  AM->printer(\%myconfig, $form);
2423

  
2424
  $form->{PRINTERS} = [];
2429 2425
  foreach my $printer (@{$form->{"ALL"}}) {
2430
    $default_printer .= qq|<option value="| . Q($printer->{"id"}) .
2431
      qq|" $selected{$printer->{'id'}}>| .
2432
      H($printer->{"printer_description"}) . qq|</option>|;
2426
    push @{ $form->{PRINTERS} }, {
2427
      'name'     => $printer->{printer_description},
2428
      'value'    => $printer->{id},
2429
      'selected' => $printer->{id} == $myconfig{default_printer_id},
2430
    };
2433 2431
  }
2434 2432

  
2435 2433
  %countrycodes = User->country_codes;
2436
  $countrycodes = '';
2437
  foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} }
2438
                keys %countrycodes
2439
    ) {
2440
    $countrycodes .=
2441
      ($myconfig{countrycode} eq $key)
2442
      ? "<option selected value=$key>$countrycodes{$key}\n"
2443
      : "<option value=$key>$countrycodes{$key}\n";
2444
  }
2445
  $countrycodes = "<option>American English\n$countrycodes";
2446 2434

  
2447
  foreach $key (keys %{ $form->{IC} }) {
2448
    foreach $accno (sort keys %{ $form->{IC}{$key} }) {
2449
      $myconfig{$key} .=
2450
        ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key})
2451
        ? "<option selected>$accno--$form->{IC}{$key}{$accno}{description}\n"
2452
        : "<option>$accno--$form->{IC}{$key}{$accno}{description}\n";
2453
    }
2435
  $countrycodes{""} = "American English";
2436
  $form->{COUNTRYCODES} = [];
2437
  foreach $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
2438
    push @{ $form->{COUNTRYCODES} }, {
2439
      'name'     => $countrycodes{$countrycode},
2440
      'value'    => $countrycode,
2441
      'selected' => $countrycode eq $myconfig{countrycode},
2442
    };
2454 2443
  }
2455 2444

  
2456
#  opendir CSS, "css/.";
2457
#  @all = grep /.*\.css$/, readdir CSS;
2458
#  closedir CSS;
2459

  
2460
# css dir has styles that are not intended as general layouts.
2461
# reverting to hardcoded list
2462
  @all = qw(lx-office-erp.css Win2000.css);
2463

  
2464
  foreach $item (@all) {
2465
    if ($item eq $myconfig{stylesheet}) {
2466
      $selectstylesheet .= qq|<option selected>$item\n|;
2467
    } else {
2468
      $selectstylesheet .= qq|<option>$item\n|;
2445
  foreach $key (keys %{ $form->{IC} }) {
2446
    foreach $accno (sort keys %{ $form->{IC}->{$key} }) {
2447
      my $array = "ACCNOS_" . uc($key);
2448
      $form->{$array} ||= [];
2449

  
2450
      my $value = "${accno}--" . $form->{IC}->{$key}->{$accno}->{description};
2451
      push @{ $form->{$array} }, {
2452
        'name'     => $value,
2453
        'value'    => $value,
2454
        'selected' => $form->{IC}->{$key}->{$accno}->{id} == $form->{defaults}->{$key},
2455
      };
2469 2456
    }
2470 2457
  }
2471
  $selectstylesheet .= "<option>\n";
2472

  
2473
  $form->{title} = $locale->text('Edit Preferences for') . qq| $form->{login}|;
2474 2458

  
2475
  $form->header;
2476

  
2477
  if ($myconfig{menustyle} eq "old") {
2478
    $menustyle_old = "checked";
2479
  } elsif ($myconfig{menustyle} eq "neu") {
2480
    $menustyle_neu = "checked";
2481
  } elsif ($myconfig{menustyle} eq "v3") {
2482
    $menustyle_v3 = "checked";
2459
  $form->{STYLESHEETS} = [];
2460
  foreach $item (qw(lx-office-erp.css Win2000.css)) {
2461
    push @{ $form->{STYLESHEETS} }, {
2462
      'name'     => $item,
2463
      'value'    => $item,
2464
      'selected' => $item eq $myconfig{stylesheet},
2465
    };
2483 2466
  }
2484 2467

  
2485
  my ($show_form_details, $hide_form_details);
2486
  $myconfig{"show_form_details"} = 1
2487
    unless (defined($myconfig{"show_form_details"}));
2488
  $show_form_details = "checked" if ($myconfig{"show_form_details"});
2489
  $hide_form_details = "checked" unless ($myconfig{"show_form_details"});
2490

  
2491
  print qq|
2492
<body>
2468
  $myconfig{show_form_details}              = 1 unless (defined($myconfig{show_form_details}));
2469
  $form->{"menustyle_$myconfig{menustyle}"} = 1;
2493 2470

  
2494
<form method=post action=$form->{script}>
2471
  $form->{title}                            = $locale->text('Edit Preferences for #1', $form->{login});
2495 2472

  
2496
<input type=hidden name=old_password value=$myconfig{password}>
2497
<input type=hidden name=type value=preferences>
2498
<input type=hidden name=role value=$myconfig{role}>
2499

  
2500
<table width=100%>
2501
  <tr><th class=listtop>$form->{title}</th></tr>
2502
  <tr>
2503
    <td>
2504
      <table>
2505
        <tr>
2506
	  <th align=right>| . $locale->text('Name') . qq|</th>
2507
	  <td><input name=name size=15 value="$myconfig{name}"></td>
2508
	</tr>
2509
	<tr>
2510
	  <th align=right>| . $locale->text('Password') . qq|</th>
2511
	  <td><input type=password name=new_password size=10 value=$myconfig{password}></td>
2512
	</tr>
2513
	<tr>
2514
	  <th align=right>| . $locale->text('E-mail') . qq|</th>
2515
	  <td><input name=email size=30 value="$myconfig{email}"></td>
2516
	</tr>
2517
	<tr valign=top>
2518
	  <th align=right>| . $locale->text('Signature') . qq|</th>
2519
	  <td><textarea name=signature rows=3 cols=50>$myconfig{signature}</textarea></td>
2520
	</tr>
2521
	<tr>
2522
	  <th align=right>| . $locale->text('Phone') . qq|</th>
2523
	  <td><input name=tel size=14 value="$myconfig{tel}"></td>
2524
	</tr>
2525
	<tr>
2526
	  <th align=right>| . $locale->text('Fax') . qq|</th>
2527
	  <td><input name=fax size=14 value="$myconfig{fax}"></td>
2528
	</tr>
2529
	<tr>
2530
	  <th align=right>| . $locale->text('Company') . qq|</th>
2531
	  <td><input name=company size=30 value="$myconfig{company}"></td>
2532
	</tr>
2533
	<tr valign=top>
2534
	  <th align=right>| . $locale->text('Address') . qq|</th>
2535
	  <td><textarea name=address rows=4 cols=50>$myconfig{address}</textarea></td>
2536
	</tr>
2537
	<tr>
2538
	  <th align=right>| . $locale->text('Date Format') . qq|</th>
2539
	  <td><select name=dateformat>$dateformat</select></td>
2540
	</tr>
2541
	<tr>
2542
	  <th align=right>| . $locale->text('Output Number Format') . qq|</th>
2543
	  <td><select name=numberformat>$numberformat</select></td>
2544
	</tr>
2545

  
2546
	<tr>
2547
	  <th align=right>| . $locale->text('Dropdown Limit') . qq|</th>
2548
	  <td><input name=vclimit size=10 value="$myconfig{vclimit}"></td>
2549
	</tr>
2550
	<tr>
2551
	  <th align=right>| . $locale->text('Language') . qq|</th>
2552
	  <td><select name=countrycode>$countrycodes</select></td>
2553
	</tr>
2554
	<tr>
2555
	  <th align=right>| . $locale->text('Stylesheet') . qq|</th>
2556
	  <td><select name=usestylesheet>$selectstylesheet</select></td>
2557
	</tr>
2558
	<tr>
2559
	  <th align=right>| . $locale->text('Setup Menu') . qq|</th>
2560
	  <td><input name=menustyle type=radio class=radio value=v3 $menustyle_v3>&nbsp;| .
2561
    $locale->text("Top (CSS)") . qq|
2562
	  <input name=menustyle type=radio class=radio value=neu $menustyle_neu>&nbsp;| .
2563
    $locale->text("Top (Javascript)") . qq|
2564
    <input name=menustyle type=radio class=radio value=old $menustyle_old>&nbsp;| .
2565
    $locale->text("Old (on the side)") . qq|</td>
2566
  </tr>
2567
  <tr>
2568
    <th align=right>| . $locale->text('Form details (second row)') . qq|</th>
2569
    <td><input type="radio" id="rad_show_form_details" name="show_form_details" value="1" $show_form_details>&nbsp;
2570
    <label for="rad_show_form_details">| . $locale->text('Show by default') . qq|</label>
2571
    <input type="radio" id="rad_hide_form_details" name="show_form_details" value="0" $hide_form_details>&nbsp;
2572
    <label for="rad_hide_form_details">| . $locale->text('Hide by default') . qq|</label></td>
2573
	</tr>
2574
	<input name=printer type=hidden value="$myconfig{printer}">
2575
	<tr class=listheading>
2576
	  <th colspan=2>| . $locale->text("Print options") . qq|</th>
2577
	</tr>
2578
	<tr>
2579
	  <th align=right>| . $locale->text('Default template format') . qq|</th>
2580
	  <td><select name="template_format">$template_format</select></td>
2581
	</tr>
2582
	<tr>
2583
	  <th align=right>| . $locale->text('Default output medium') . qq|</th>
2584
	  <td><select name="default_media">$default_media</select></td>
2585
	</tr>
2586
	<tr>
2587
	  <th align=right>| . $locale->text('Default printer') . qq|</th>
2588
	  <td><select name="default_printer_id">$default_printer</select></td>
2589
	</tr>
2590
	<tr>
2591
	  <th align=right>| . $locale->text('Number of copies') . qq|</th>
2592
	  <td><input name="copies" size="10" value="| .
2593
    $form->quote($myconfig{"copies"}) . qq|"></td>
2594
	</tr>
2595

  
2596

  
2597
	<tr class=listheading>
2598
	  <th colspan=2>&nbsp;</th>
2599
	</tr>
2600
	<tr>
2601
	  <th align=right>| . $locale->text('Business Number') . qq|</th>
2602
	  <td><input name=businessnumber size=25 value="$myconfig{businessnumber}"></td>
2603
	</tr>
2604
	<tr>
2605
		<th align=right>| . $locale->text('Year End') . qq| (mm/dd)</th>
2606
		<td><input name=yearend size=5 value=$form->{defaults}{yearend}></td>
2607
	</tr>
2608
	<tr class=listheading>
2609
	  <th colspan=2>|
2610
    . $locale->text('Last Numbers & Default Accounts') . qq|</th>
2611
	</tr>
2612
	<tr>
2613
	  <td colspan=2>
2614
	    <table width=100%>
2615
	      <tr>
2616
		<th align=right nowrap>| . $locale->text('Inventory Account') . qq|</th>
2617
		<td><select name=inventory_accno>$myconfig{IC}</select></td>
2618
	      </tr>
2619
	      <tr>
2620
		<th align=right nowrap>| . $locale->text('Revenue Account') . qq|</th>
2621
		<td><select name=income_accno>$myconfig{IC_income}</select></td>
2622
	      </tr>
2623
	      <tr>
2624
		<th align=right nowrap>| . $locale->text('Expense Account') . qq|</th>
2625
		<td><select name=expense_accno>$myconfig{IC_expense}</select></td>
2626
	      </tr>
2627
	      <tr>
2628
		<th align=right nowrap>| . $locale->text('Foreign Exchange Gain') . qq|</th>
2629
		<td><select name=fxgain_accno>$myconfig{FX_gain}</select></td>
2630
	      </tr>
2631
	      <tr>
2632
		<th align=right nowrap>| . $locale->text('Foreign Exchange Loss') . qq|</th>
2633
		<td><select name=fxloss_accno>$myconfig{FX_loss}</select></td>
2634
	      </tr>
2635
	      <tr>
2636
		<td colspan=2>|
2637
    . $locale->text(
2638
    'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies'
2639
    )
2640
    . qq|<br><input name=curr size=40 value="$form->{defaults}{curr}"></td>
2641
	      </tr>
2642
            </table>
2643
          </td>
2644
         </tr>
2645
         <tr>
2646
           <td colspan=2>
2647
             <table width=100%>
2648
	      <tr>
2649
		<th align=right nowrap>| . $locale->text('Last Invoice Number') . qq|</th>
2650
		<td><input name=invnumber size=10 value=$form->{defaults}{invnumber}></td>
2651
                <th align=right nowrap>|
2652
    . $locale->text('Last Customer Number') . qq|</th>
2653
		<td><input name=customernumber size=10 value=$form->{defaults}{customernumber}></td>
2654
	      </tr>
2655
	      <tr>
2656
		<th align=right nowrap>|
2657
    . $locale->text('Last Credit Note Number') . qq|</th>
2658
		<td><input name=cnnumber size=10 value=$form->{defaults}{cnnumber}></td>
2659
                <th align=right nowrap>|
2660
    . $locale->text('Last Vendor Number') . qq|</th>
2661
		<td><input name=vendornumber size=10 value=$form->{defaults}{vendornumber}></td>
2662
	      </tr>
2663
	      <tr>
2664
		<th align=right nowrap>|
2665
    . $locale->text('Last Sales Order Number') . qq|</th>
2666
		<td><input name=sonumber size=10 value=$form->{defaults}{sonumber}></td>
2667
	      </tr>
2668
	      <tr>
2669
		<th align=right nowrap>|
2670
    . $locale->text('Last Purchase Order Number') . qq|</th>
2671
		<td><input name=ponumber size=10 value=$form->{defaults}{ponumber}></td>
2672
                <th align=right nowrap>|
2673
    . $locale->text('Last Article Number') . qq|</th>
2674
		<td><input name=articlenumber size=10 value=$form->{defaults}{articlenumber}></td>
2675
	      </tr>
2676
	      <tr>
2677
		<th align=right nowrap>|
2678
    . $locale->text('Last Sales Quotation Number') . qq|</th>
2679
		<td><input name=sqnumber size=10 value=$form->{defaults}{sqnumber}></td>
2680
                <th align=right nowrap>|
2681
    . $locale->text('Last Service Number') . qq|</th>
2682
		<td><input name=servicenumber size=10 value=$form->{defaults}{servicenumber}></td>
2683
	      </tr>
2684
	      <tr>
2685
		<th align=right nowrap>| . $locale->text('Last RFQ Number') . qq|</th>
2686
		<td><input name=rfqnumber size=10 value=$form->{defaults}{rfqnumber}></td>
2687
                <th align=right nowrap></th>
2688
		<td></td>
2689
	      </tr>
2690
	    </table>
2691
	  </td>
2692
	</tr>|;
2693
# 	<tr class=listheading>
2694
# 	  <th colspan=2>| . $locale->text('Tax Accounts') . qq|</th>
2695
# 	</tr>
2696
# 	<tr>
2697
# 	  <td colspan=2>
2698
# 	    <table>
2699
# 	      <tr>
2700
# 		<th>&nbsp;</th>
2701
# 		<th>| . $locale->text('Rate') . qq| (%)</th>
2702
# 		<th>| . $locale->text('Number') . qq|</th>
2703
# 	      </tr>
2704
# |;
2705
# 
2706
#   foreach $accno (sort keys %{ $form->{taxrates} }) {
2707
#     print qq|
2708
#               <tr>
2709
# 		<th align=right>$form->{taxrates}{$accno}{description}</th>
2710
# 		<td><input name=$form->{taxrates}{$accno}{id} size=6 value=$form->{taxrates}{$accno}{rate}></td>
2711
# 		<td><input name="taxnumber_$form->{taxrates}{$accno}{id}" value="$form->{taxrates}{$accno}{taxnumber}"></td>
2712
# 	      </tr>
2713
# |;
2714
#     $form->{taxaccounts} .= "$form->{taxrates}{$accno}{id} ";
2715
#   }
2716
# 
2717
#   chop $form->{taxaccounts};
2718
# 
2719
#   print qq|
2720
# <input name=taxaccounts type=hidden value="$form->{taxaccounts}">
2721
# 
2722
#             </table>
2723
# 	  </td>
2724
# 	</tr>
2725
print qq|      </table>
2726
    </td>
2727
  </tr>
2728
  <tr>
2729
    <td><hr size=3 noshade></td>
2730
  </tr>
2731
</table>
2732

  
2733
<input type=hidden name=login value=$form->{login}>
2734
<input type=hidden name=password value=$form->{password}>
2735

  
2736
<br>
2737
<input type=submit class=submit name=action value="|
2738
    . $locale->text('Save') . qq|">
2739

  
2740
  </form>
2741

  
2742
</body>
2743
</html>
2744
|;
2473
  $form->header();
2474
  print $form->parse_html_template2('am/config');
2745 2475

  
2746 2476
  $lxdebug->leave_sub();
2747 2477
}

Auch abrufbar als: Unified diff