Revision 302aa911
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
bin/mozilla/admin.pl | ||
---|---|---|
98 | 98 |
} |
99 | 99 |
|
100 | 100 |
sub adminlogin { |
101 |
my $form = $main::form;
|
|
102 |
my $locale = $main::locale;
|
|
101 |
my $form = $main::form; |
|
102 |
my $locale = $main::locale; |
|
103 | 103 |
|
104 | 104 |
$form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); |
105 | 105 |
|
... | ... | |
118 | 118 |
} |
119 | 119 |
|
120 | 120 |
sub check_auth_db_and_tables { |
121 |
my $form = $main::form;
|
|
122 |
my $locale = $main::locale;
|
|
121 |
my $form = $main::form; |
|
122 |
my $locale = $main::locale; |
|
123 | 123 |
|
124 | 124 |
my %params; |
125 | 125 |
|
... | ... | |
160 | 160 |
} |
161 | 161 |
|
162 | 162 |
sub create_auth_db { |
163 |
my $form = $main::form;
|
|
163 |
my $form = $main::form; |
|
164 | 164 |
|
165 | 165 |
$main::auth->create_database('superuser' => $form->{db_superuser}, |
166 |
'superuser_password' => $form->{db_superuser_password}, |
|
167 |
'template' => $form->{db_template}); |
|
166 |
'superuser_password' => $form->{db_superuser_password},
|
|
167 |
'template' => $form->{db_template});
|
|
168 | 168 |
login(); |
169 | 169 |
} |
170 | 170 |
|
171 | 171 |
sub create_auth_tables { |
172 |
my $form = $main::form;
|
|
173 |
my $locale = $main::locale;
|
|
172 |
my $form = $main::form; |
|
173 |
my $locale = $main::locale; |
|
174 | 174 |
|
175 | 175 |
$main::auth->create_tables(); |
176 | 176 |
$main::auth->set_session_value('rpw', $form->{rpw}); |
... | ... | |
195 | 195 |
sub migrate_users { |
196 | 196 |
$main::lxdebug->enter_sub(); |
197 | 197 |
|
198 |
my $form = $main::form; |
|
199 |
my $locale = $main::locale; |
|
198 |
my $form = $main::form;
|
|
199 |
my $locale = $main::locale;
|
|
200 | 200 |
|
201 | 201 |
my $memberdir = ""; |
202 | 202 |
|
... | ... | |
275 | 275 |
} |
276 | 276 |
|
277 | 277 |
sub create_standard_group_ask { |
278 |
my $form = $main::form;
|
|
279 |
my $locale = $main::locale;
|
|
278 |
my $form = $main::form; |
|
279 |
my $locale = $main::locale; |
|
280 | 280 |
|
281 | 281 |
$form->{title} = $locale->text('Create a standard group'); |
282 | 282 |
|
... | ... | |
285 | 285 |
} |
286 | 286 |
|
287 | 287 |
sub create_standard_group { |
288 |
my $form = $main::form;
|
|
289 |
my $locale = $main::locale;
|
|
288 |
my $form = $main::form; |
|
289 |
my $locale = $main::locale; |
|
290 | 290 |
|
291 | 291 |
my %members = $main::auth->read_all_users(); |
292 | 292 |
|
293 |
my $groups = $main::auth->read_groups(); |
|
293 |
my $groups = $main::auth->read_groups();
|
|
294 | 294 |
|
295 | 295 |
foreach my $group (values %{$groups}) { |
296 | 296 |
if (($form->{group_id} != $group->{id}) |
... | ... | |
318 | 318 |
sub user_migration_complete { |
319 | 319 |
my $standard_group_created = shift; |
320 | 320 |
|
321 |
my $form = $main::form; |
|
322 |
my $locale = $main::locale; |
|
321 |
my $form = $main::form;
|
|
322 |
my $locale = $main::locale;
|
|
323 | 323 |
|
324 | 324 |
$form->{title} = $locale->text('User migration complete'); |
325 | 325 |
$form->header(); |
... | ... | |
328 | 328 |
} |
329 | 329 |
|
330 | 330 |
sub list_users { |
331 |
my $form = $main::form;
|
|
332 |
my $locale = $main::locale;
|
|
331 |
my $form = $main::form; |
|
332 |
my $locale = $main::locale; |
|
333 | 333 |
|
334 | 334 |
my %members = $main::auth->read_all_users(); |
335 | 335 |
|
... | ... | |
346 | 346 |
} |
347 | 347 |
|
348 | 348 |
sub add_user { |
349 |
my $form = $main::form; |
|
350 |
my $locale = $main::locale; |
|
349 | 351 |
|
350 |
my $form = $main::form; |
|
351 |
my $locale = $main::locale; |
|
352 |
$form->{title} = "Lx-Office ERP " . $locale->text('Administration') . " / " . $locale->text('Add User'); |
|
352 | 353 |
|
353 |
$form->{title} = |
|
354 |
"Lx-Office ERP " |
|
355 |
. $locale->text('Administration') . " / " |
|
356 |
. $locale->text('Add User'); |
|
357 |
|
|
358 |
my $myconfig = { |
|
354 |
my $myconfig = { |
|
359 | 355 |
"vclimit" => 200, |
360 | 356 |
"countrycode" => "de", |
361 | 357 |
"numberformat" => "1.000,00", |
... | ... | |
368 | 364 |
} |
369 | 365 |
|
370 | 366 |
sub edit_user { |
371 |
my $form = $main::form; |
|
372 |
my $locale = $main::locale; |
|
373 |
|
|
367 |
my $form = $main::form; |
|
368 |
my $locale = $main::locale; |
|
374 | 369 |
|
375 |
$form->{title} = |
|
376 |
"Lx-Office ERP " |
|
377 |
. $locale->text('Administration') . " / " |
|
378 |
. $locale->text('Edit User'); |
|
379 |
$form->{edit} = 1; |
|
370 |
$form->{title} = "Lx-Office ERP " . $locale->text('Administration') . " / " . $locale->text('Edit User'); |
|
371 |
$form->{edit} = 1; |
|
380 | 372 |
|
381 | 373 |
$form->isblank("login", $locale->text("The login is missing.")); |
382 | 374 |
|
... | ... | |
392 | 384 |
sub edit_user_form { |
393 | 385 |
my ($myconfig) = @_; |
394 | 386 |
|
395 |
my $form = $main::form; |
|
396 |
my $locale = $main::locale; |
|
387 |
my $form = $main::form;
|
|
388 |
my $locale = $main::locale;
|
|
397 | 389 |
|
398 | 390 |
my @valid_dateformats = qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd); |
399 | 391 |
$form->{ALL_DATEFORMATS} = [ map { { "format" => $_, "selected" => $_ eq $myconfig->{dateformat} } } @valid_dateformats ]; |
... | ... | |
468 | 460 |
} |
469 | 461 |
|
470 | 462 |
sub save_user { |
471 |
my $form = $main::form; |
|
472 |
my $locale = $main::locale; |
|
463 |
my $form = $main::form;
|
|
464 |
my $locale = $main::locale;
|
|
473 | 465 |
|
474 | 466 |
$form->{dbdriver} = 'Pg'; |
475 | 467 |
|
... | ... | |
583 | 575 |
} |
584 | 576 |
|
585 | 577 |
sub save_user_as_new { |
586 |
my $form = $main::form; |
|
578 |
my $form = $main::form;
|
|
587 | 579 |
|
588 | 580 |
$form->{login} = $form->{new_user_login}; |
589 | 581 |
delete @{$form}{qw(edit new_user_login)}; |
... | ... | |
592 | 584 |
} |
593 | 585 |
|
594 | 586 |
sub delete_user { |
595 |
my $form = $main::form; |
|
596 |
my $locale = $main::locale; |
|
587 |
my $form = $main::form;
|
|
588 |
my $locale = $main::locale;
|
|
597 | 589 |
|
598 | 590 |
my %members = $main::auth->read_all_users(); |
599 | 591 |
my $templates = $members{$form->{login}}->{templates}; |
... | ... | |
629 | 621 |
} |
630 | 622 |
|
631 | 623 |
sub get_value { |
632 |
my $line = shift; |
|
633 |
|
|
634 |
my $form = $main::form; |
|
635 |
|
|
624 |
my $line = shift; |
|
636 | 625 |
my ($null, $value) = split(/=/, $line, 2); |
637 | 626 |
|
638 | 627 |
# remove comments |
... | ... | |
645 | 634 |
} |
646 | 635 |
|
647 | 636 |
sub pg_database_administration { |
648 |
my $form = $main::form;
|
|
637 |
my $form = $main::form; |
|
649 | 638 |
|
650 | 639 |
$form->{dbdriver} = 'Pg'; |
651 | 640 |
dbselect_source(); |
... | ... | |
653 | 642 |
} |
654 | 643 |
|
655 | 644 |
sub dbselect_source { |
656 |
my $form = $main::form; |
|
657 |
my $locale = $main::locale; |
|
645 |
my $form = $main::form;
|
|
646 |
my $locale = $main::locale;
|
|
658 | 647 |
|
659 | 648 |
$form->{dbport} = '5432'; |
660 | 649 |
$form->{dbuser} = 'postgres'; |
... | ... | |
671 | 660 |
} |
672 | 661 |
|
673 | 662 |
sub test_db_connection { |
674 |
my $form = $main::form;
|
|
675 |
my $locale = $main::locale;
|
|
663 |
my $form = $main::form; |
|
664 |
my $locale = $main::locale; |
|
676 | 665 |
|
677 | 666 |
$form->{dbdriver} = 'Pg'; |
678 | 667 |
User::dbconnect_vars($form, $form->{dbname}); |
... | ... | |
694 | 683 |
} |
695 | 684 |
|
696 | 685 |
sub update_dataset { |
697 |
my $form = $main::form; |
|
698 |
my $locale = $main::locale; |
|
686 |
my $form = $main::form;
|
|
687 |
my $locale = $main::locale;
|
|
699 | 688 |
|
700 |
$form->{title} = |
|
701 |
"Lx-Office ERP " |
|
702 |
. $locale->text('Database Administration') . " / " |
|
703 |
. $locale->text('Update Dataset'); |
|
689 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Update Dataset'); |
|
704 | 690 |
|
705 | 691 |
my @need_updates = User->dbneedsupdate($form); |
706 | 692 |
$form->{NEED_UPDATES} = \@need_updates; |
... | ... | |
711 | 697 |
} |
712 | 698 |
|
713 | 699 |
sub dbupdate { |
714 |
my $form = $main::form; |
|
715 |
my $locale = $main::locale; |
|
700 |
my $form = $main::form;
|
|
701 |
my $locale = $main::locale;
|
|
716 | 702 |
|
717 | 703 |
$form->{stylesheet} = "lx-office-erp.css"; |
718 | 704 |
$form->{title} = $locale->text("Dataset upgrade"); |
... | ... | |
749 | 735 |
} |
750 | 736 |
|
751 | 737 |
sub create_dataset { |
752 |
my $form = $main::form; |
|
753 |
my $locale = $main::locale; |
|
738 |
my $form = $main::form;
|
|
739 |
my $locale = $main::locale;
|
|
754 | 740 |
|
755 | 741 |
$form->{dbsources} = join " ", map { "[${_}]" } sort User->dbsources($form); |
756 | 742 |
|
757 |
$form->{CHARTS} = []; |
|
743 |
$form->{CHARTS} = [];
|
|
758 | 744 |
|
759 | 745 |
opendir SQLDIR, "sql/." or $form->error($ERRNO); |
760 | 746 |
foreach my $item (sort grep /-chart\.sql\z/, readdir SQLDIR) { |
... | ... | |
788 | 774 |
} |
789 | 775 |
} |
790 | 776 |
|
791 |
$form->{title} = |
|
792 |
"Lx-Office ERP " |
|
793 |
. $locale->text('Database Administration') . " / " |
|
794 |
. $locale->text('Create Dataset'); |
|
777 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Create Dataset'); |
|
795 | 778 |
|
796 | 779 |
$form->header(); |
797 | 780 |
print $form->parse_html_template("admin/create_dataset"); |
798 | 781 |
} |
799 | 782 |
|
800 | 783 |
sub dbcreate { |
801 |
my $form = $main::form;
|
|
802 |
my $locale = $main::locale;
|
|
784 |
my $form = $main::form; |
|
785 |
my $locale = $main::locale; |
|
803 | 786 |
|
804 | 787 |
$form->isblank("db", $locale->text('Dataset missing!')); |
805 | 788 |
|
806 | 789 |
User->dbcreate(\%$form); |
807 | 790 |
|
808 |
$form->{title} = |
|
809 |
"Lx-Office ERP " |
|
810 |
. $locale->text('Database Administration') . " / " |
|
811 |
. $locale->text('Create Dataset'); |
|
791 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Create Dataset'); |
|
812 | 792 |
|
813 | 793 |
$form->header(); |
814 | 794 |
print $form->parse_html_template("admin/dbcreate"); |
815 | 795 |
} |
816 | 796 |
|
817 | 797 |
sub delete_dataset { |
818 |
my $form = $main::form; |
|
819 |
my $locale = $main::locale; |
|
798 |
my $form = $main::form;
|
|
799 |
my $locale = $main::locale;
|
|
820 | 800 |
|
821 | 801 |
my @dbsources = User->dbsources_unused($form); |
822 | 802 |
$form->error($locale->text('Nothing to delete!')) unless @dbsources; |
823 | 803 |
|
824 |
$form->{title} = |
|
825 |
"Lx-Office ERP " |
|
826 |
. $locale->text('Database Administration') . " / " |
|
827 |
. $locale->text('Delete Dataset'); |
|
804 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Delete Dataset'); |
|
828 | 805 |
$form->{DBSOURCES} = [ map { { "name", $_ } } sort @dbsources ]; |
829 | 806 |
|
830 | 807 |
$form->header(); |
... | ... | |
832 | 809 |
} |
833 | 810 |
|
834 | 811 |
sub dbdelete { |
835 |
my $form = $main::form;
|
|
836 |
my $locale = $main::locale;
|
|
812 |
my $form = $main::form; |
|
813 |
my $locale = $main::locale; |
|
837 | 814 |
|
838 | 815 |
if (!$form->{db}) { |
839 | 816 |
$form->error($locale->text('No Dataset selected!')); |
... | ... | |
841 | 818 |
|
842 | 819 |
User->dbdelete(\%$form); |
843 | 820 |
|
844 |
$form->{title} = |
|
845 |
"Lx-Office ERP " |
|
846 |
. $locale->text('Database Administration') . " / " |
|
847 |
. $locale->text('Delete Dataset'); |
|
821 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Delete Dataset'); |
|
848 | 822 |
$form->header(); |
849 | 823 |
print $form->parse_html_template("admin/dbdelete"); |
850 | 824 |
} |
851 | 825 |
|
852 | 826 |
sub backup_dataset { |
853 |
my $form = $main::form; |
|
854 |
my $locale = $main::locale; |
|
827 |
my $form = $main::form;
|
|
828 |
my $locale = $main::locale;
|
|
855 | 829 |
|
856 |
$form->{title} = |
|
857 |
"Lx-Office ERP " |
|
858 |
. $locale->text('Database Administration') . " / " |
|
859 |
. $locale->text('Backup Dataset'); |
|
830 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Backup Dataset'); |
|
860 | 831 |
|
861 | 832 |
if ("$main::pg_dump_exe" eq "DISABLED") { |
862 | 833 |
$form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); |
... | ... | |
875 | 846 |
} |
876 | 847 |
|
877 | 848 |
sub backup_dataset_start { |
878 |
my $form = $main::form; |
|
879 |
my $locale = $main::locale; |
|
849 |
my $form = $main::form;
|
|
850 |
my $locale = $main::locale;
|
|
880 | 851 |
|
881 |
$form->{title} = |
|
882 |
"Lx-Office ERP " |
|
883 |
. $locale->text('Database Administration') . " / " |
|
884 |
. $locale->text('Backup Dataset'); |
|
852 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Backup Dataset'); |
|
885 | 853 |
|
886 | 854 |
$main::pg_dump_exe ||= "pg_dump"; |
887 | 855 |
|
... | ... | |
957 | 925 |
unlink "${tmpdir}/.pgpass", $tmp; |
958 | 926 |
rmdir $tmpdir; |
959 | 927 |
|
960 |
$form->{title} = |
|
961 |
"Lx-Office ERP " |
|
962 |
. $locale->text('Database Administration') . " / " |
|
963 |
. $locale->text('Backup Dataset'); |
|
928 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Backup Dataset'); |
|
964 | 929 |
|
965 | 930 |
$form->header(); |
966 | 931 |
print $form->parse_html_template("admin/backup_dataset_email_done"); |
... | ... | |
968 | 933 |
} |
969 | 934 |
|
970 | 935 |
sub restore_dataset { |
971 |
my $form = $main::form; |
|
972 |
my $locale = $main::locale; |
|
936 |
my $form = $main::form;
|
|
937 |
my $locale = $main::locale;
|
|
973 | 938 |
|
974 |
$form->{title} = |
|
975 |
"Lx-Office ERP " |
|
976 |
. $locale->text('Database Administration') . " / " |
|
977 |
. $locale->text('Restore Dataset'); |
|
939 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Restore Dataset'); |
|
978 | 940 |
|
979 | 941 |
if ("$main::pg_restore_exe" eq "DISABLED") { |
980 | 942 |
$form->error($locale->text('Database backups and restorations are disabled in lx-erp.conf.')); |
... | ... | |
996 | 958 |
} |
997 | 959 |
|
998 | 960 |
sub restore_dataset_start { |
999 |
my $form = $main::form; |
|
1000 |
my $locale = $main::locale; |
|
961 |
my $form = $main::form;
|
|
962 |
my $locale = $main::locale;
|
|
1001 | 963 |
|
1002 |
$form->{title} = |
|
1003 |
"Lx-Office ERP " |
|
1004 |
. $locale->text('Database Administration') . " / " |
|
1005 |
. $locale->text('Restore Dataset'); |
|
964 |
$form->{title} = "Lx-Office ERP " . $locale->text('Database Administration') . " / " . $locale->text('Restore Dataset'); |
|
1006 | 965 |
|
1007 | 966 |
$main::pg_restore_exe ||= "pg_restore"; |
1008 | 967 |
|
... | ... | |
1122 | 1081 |
} |
1123 | 1082 |
|
1124 | 1083 |
sub unlock_system { |
1125 |
my $form = $main::form;
|
|
1126 |
my $locale = $main::locale;
|
|
1084 |
my $form = $main::form; |
|
1085 |
my $locale = $main::locale; |
|
1127 | 1086 |
|
1128 | 1087 |
unlink "$main::userspath/nologin"; |
1129 | 1088 |
|
... | ... | |
1134 | 1093 |
} |
1135 | 1094 |
|
1136 | 1095 |
sub lock_system { |
1137 |
my $form = $main::form;
|
|
1138 |
my $locale = $main::locale;
|
|
1096 |
my $form = $main::form; |
|
1097 |
my $locale = $main::locale; |
|
1139 | 1098 |
|
1140 | 1099 |
open(FH, ">$main::userspath/nologin") |
1141 | 1100 |
or $form->error($locale->text('Cannot create Lock!')); |
... | ... | |
1160 | 1119 |
} |
1161 | 1120 |
|
1162 | 1121 |
sub edit { |
1163 |
my $form = $main::form;
|
|
1122 |
my $form = $main::form; |
|
1164 | 1123 |
|
1165 | 1124 |
$form->{edit_nextsub} ||= 'edit_user'; |
1166 | 1125 |
|
... | ... | |
1176 | 1135 |
} |
1177 | 1136 |
|
1178 | 1137 |
sub save { |
1179 |
my $form = $main::form;
|
|
1138 |
my $form = $main::form; |
|
1180 | 1139 |
|
1181 | 1140 |
$form->{save_nextsub} ||= 'save_user'; |
1182 | 1141 |
|
... | ... | |
1188 | 1147 |
} |
1189 | 1148 |
|
1190 | 1149 |
sub dispatcher { |
1191 |
my $form = $main::form;
|
|
1192 |
my $locale = $main::locale;
|
|
1150 |
my $form = $main::form; |
|
1151 |
my $locale = $main::locale; |
|
1193 | 1152 |
|
1194 | 1153 |
foreach my $action (qw(create_standard_group dont_create_standard_group |
1195 | 1154 |
save_user delete_user save_user_as_new)) { |
Auch abrufbar als: Unified diff
Kosmetik