summaryrefslogtreecommitdiff
path: root/tests/etc/ssh/sshd_config
diff options
context:
space:
mode:
Diffstat (limited to 'tests/etc/ssh/sshd_config')
0 files changed, 0 insertions, 0 deletions
lass="hl"># This file has NOT undergone whitespace cleanup.
  • #
  • #======================================================================
  • #
  • # administration
  • #
  • #======================================================================
  • use LedgerSMB::AM;
  • use LedgerSMB::CA;
  • use LedgerSMB::Form;
  • use LedgerSMB::User;
  • use LedgerSMB::RP;
  • use LedgerSMB::GL;
  • use LedgerSMB::Template;
  • 1;
  • # end of main
  • sub add { &{"add_$form->{type}"} }
  • sub edit { &{"edit_$form->{type}"} }
  • sub save { &{"save_$form->{type}"} }
  • sub delete { &{"delete_$form->{type}"} }
  • sub save_as_new {
  • delete $form->{id};
  • &save;
  • }
  • sub add_account {
  • $form->{title} = "Add";
  • $form->{charttype} = "A";
  • $form->{callback} =
  • "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"
  • unless $form->{callback};
  • my %hiddens;
  • my @buttons;
  • my $checked = &account_header(\%hiddens);
  • &form_footer_buttons(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-account-form');
  • $template->render({
  • form => $form,
  • checked => $checked,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub edit_account {
  • $form->{title} = "Edit";
  • $form->{accno} =~ s/\\'/'/g;
  • $form->{accno} =~ s/\\\\/\\/g;
  • AM->get_account( \%myconfig, \%$form );
  • foreach my $item ( split( /:/, $form->{link} ) ) {
  • $form->{$item} = "checked";
  • }
  • my %hiddens;
  • my @buttons;
  • my $checked = &account_header(\%hiddens);
  • &form_footer_buttons(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-account-form');
  • $template->render({
  • form => $form,
  • checked => $checked,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub account_header {
  • my $hiddens = shift;
  • $form->{title} = $locale->text("$form->{title} Account");
  • my %checked;
  • $checked{ $form->{charttype} } = "checked";
  • $checked{contra} = "checked" if $form->{contra};
  • $checked{"$form->{category}_"} = "checked";
  • for (qw(accno description)) { $form->{$_} = $form->quote( $form->{$_} ) }
  • # this is for our parser only!
  • # type=submit $locale->text('Add Account')
  • # type=submit $locale->text('Edit Account')
  • $hiddens->{type} = 'account';
  • $hiddens->{$_} eq $form->{$_} foreach qw(id inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id);
  • \%checked;
  • }
  • sub form_footer_buttons {
  • my ($hiddens, $buttons) = @_;
  • $hiddens->{$_} = $form->{$_} foreach qw(callback path login sessionid);
  • # type=submit $locale->text('Save')
  • # type=submit $locale->text('Save as new')
  • # type=submit $locale->text('Delete')
  • %button = ();
  • if ( $form->{id} ) {
  • $button{'save'} =
  • { ndx => 3, key => 'S', value => $locale->text('Save') };
  • $button{'save_as_new'} =
  • { ndx => 7, key => 'N', value => $locale->text('Save as new') };
  • if ( $form->{orphaned} ) {
  • $button{'delete'} =
  • { ndx => 16, key => 'D', value => $locale->text('Delete') };
  • }
  • }
  • else {
  • $button{'save'} =
  • { ndx => 3, key => 'S', value => $locale->text('Save') };
  • }
  • for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button ) {
  • push @{$buttons}, {
  • name => 'action',
  • value => $_,
  • accesskey => $button{$_}{key},
  • title => "$button{$_}{value} [Alt-$button{$_}{key}]",
  • text => $button{$_}{value},
  • };
  • }
  • ##SC: Temporary removal
  • ## if ( $form->{lynx} ) {
  • ## require "bin/menu.pl";
  • ## &menubar;
  • ## }
  • }
  • sub save_account {
  • $form->isblank( "accno", $locale->text('Account Number missing!') );
  • $form->isblank( "category", $locale->text('Account Type missing!') );
  • # check for conflicting accounts
  • if ( $form->{AR} || $form->{AP} || $form->{IC} ) {
  • $a = "";
  • for (qw(AR AP IC)) { $a .= $form->{$_} }
  • $form->error(
  • $locale->text(
  • 'Cannot set account for more than one of AR, AP or IC')
  • ) if length $a > 2;
  • for (
  • qw(AR_amount AR_tax AR_paid AR_overpayment AR_discount AP_amount AP_tax AP_paid AP_overpayment AP_discount IC_taxpart IC_taxservice IC_sale IC_cogs IC_income IC_expense)
  • )
  • {
  • $form->error(
  • "$form->{AR}$form->{AP}$form->{IC} "
  • . $locale->text(
  • 'account cannot be set to any other type of account')
  • ) if $form->{$_};
  • }
  • }
  • foreach $item ( "AR", "AP" ) {
  • $i = 0;
  • for ( "${item}_amount", "${item}_paid", "${item}_tax", "${item}_overpayment", "${item}_discount" ) {
  • $i++ if $form->{$_};
  • }
  • $form->error(
  • $locale->text( 'Cannot set multiple options for [_1]', $item ) )
  • if $i > 1;
  • }
  • if ( AM->save_account( \%myconfig, \%$form ) ) {
  • $form->redirect( $locale->text('Account saved!') );
  • }
  • else {
  • $form->error( $locale->text('Cannot save account!') );
  • }
  • }
  • sub list_account {
  • CA->all_accounts( \%myconfig, \%$form );
  • $form->{title} = $locale->text('Chart of Accounts');
  • # construct callback
  • $callback =
  • "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • $form->{callback} = $callback;
  • @column_index = qw(accno gifi_accno description debit credit link);
  • $column_header{accno} = $locale->text('Account');
  • $column_header{gifi_accno} = $locale->text('GIFI');
  • $column_header{description} = $locale->text('Description');
  • $column_header{debit} = $locale->text('Debit');
  • $column_header{credit} = $locale->text('Credit');
  • $column_header{link} = $locale->text('Link');
  • # escape callback
  • $callback = $form->escape($callback);
  • my @rows;
  • foreach my $ca ( @{ $form->{CA} } ) {
  • my %column_data;
  • $ca->{debit} = " ";
  • $ca->{credit} = " ";
  • if ( $ca->{amount} > 0 ) {
  • $ca->{credit} =
  • $form->format_amount( \%myconfig, $ca->{amount}, 2, " " );
  • }
  • if ( $ca->{amount} < 0 ) {
  • $ca->{debit} =
  • $form->format_amount( \%myconfig, -$ca->{amount}, 2, " " );
  • }
  • #$ca->{link} =~ s/:/<br>/og;
  • $gifi_accno = $form->escape( $ca->{gifi_accno} );
  • if ( $ca->{charttype} eq "H" ) {
  • $column_data{class} = 'heading';
  • $column_data{accno} = {
  • text => $ca->{accno},
  • href => "$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback"};
  • $column_data{gifi_accno} = {
  • text => $ca->{gifi_accno},
  • href => "$form->{script}?action=edit_gifi&accno=$gifi_accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback"};
  • $column_data{description} = $ca->{description};
  • $column_data{debit} = " ";
  • $column_data{credit} = " ";
  • $column_data{link} = " ";
  • }
  • else {
  • $i++;
  • $i %= 2;
  • $column_data{i} = $i;
  • $column_data{accno} = {
  • text => $ca->{accno},
  • href => "$form->{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback"};
  • $column_data{gifi_accno} = {
  • text => $ca->{gifi_accno},
  • href => "$form->{script}?action=edit_gifi&accno=$gifi_accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback"};
  • $column_data{description} = $ca->{description};
  • $column_data{debit} = $ca->{debit};
  • $column_data{credit} = $ca->{credit};
  • $column_data{link} = {text => $ca->{link}, delimiter => ':'};
  • }
  • push @rows, \%column_data;
  • }
  • my @buttons;
  • for my $type (qw(CSV XLS ODS)) {
  • push @buttons, {
  • name => 'action',
  • value => lc "${type}_list_account",
  • text => $locale->text("$type Report"),
  • type => 'submit',
  • class => 'submit',
  • };
  • }
  • my %hiddens = (
  • callback => $callback,
  • action => 'list_account',
  • path => $form->{path},
  • login => $form->{login},
  • sessionid => $form->{sessionid},
  • );
  • my %row_alignment = ('credit' => 'right', 'debit' => 'right');
  • my $format = uc substr($form->{action}, 0, 3);
  • my $template = LedgerSMB::Template->new(
  • user => \%myconfig,
  • locale => $locale,
  • path => 'UI',
  • template => 'form-dynatable',
  • format => ($format ne 'LIS')? $format: 'HTML');
  • $template->render({
  • form => $form,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • columns => \@column_index,
  • heading => \%column_header,
  • rows => \@rows,
  • row_alignment => \%row_alignment,
  • });
  • }
  • sub csv_list_account { &list_account }
  • sub xls_list_account { &list_account }
  • sub ods_list_account { &list_account }
  • sub delete_account {
  • $form->{title} = $locale->text('Delete Account');
  • foreach $id (
  • qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)
  • )
  • {
  • if ( $form->{id} == $form->{$id} ) {
  • $form->error( $locale->text('Cannot delete default account!') );
  • }
  • }
  • if ( AM->delete_account( \%myconfig, \%$form ) ) {
  • $form->redirect( $locale->text('Account deleted!') );
  • }
  • else {
  • $form->error( $locale->text('Cannot delete account!') );
  • }
  • }
  • sub list_gifi {
  • @{ $form->{fields} } = qw(accno description);
  • $form->{table} = "gifi";
  • AM->gifi_accounts( \%myconfig, \%$form );
  • $form->{title} = $locale->text('GIFI');
  • my %hiddens;
  • # construct callback
  • my $callback =
  • "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • $form->{callback} = $callback;
  • $hiddens{callback} = $callback;
  • $hiddens{action} = 'list_gifi';
  • $hiddens{path} = $form->{path};
  • $hiddens{login} = $form->{login};
  • $hiddens{sessionid} = $form->{sessionid};
  • my @column_index = qw(accno description);
  • my %column_header;
  • my @rows;
  • $column_header{accno} = $locale->text('GIFI');
  • $column_header{description} = $locale->text('Description');
  • my $i = 0;
  • foreach $ca ( @{ $form->{ALL} } ) {
  • my %column_data;
  • $i++;
  • $i %= 2;
  • $column_data{i} = $i;
  • $accno = $form->escape( $ca->{accno} );
  • $column_data{accno} = {text => $ca->{accno}, href =>
  • qq|$form->{script}?action=edit_gifi&coa=1&accno=$accno&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback|};
  • $column_data{description} = $ca->{description};
  • push @rows, \%column_data;
  • }
  • my @buttons;
  • push @buttons, {
  • name => 'action',
  • value => 'csv_list_gifi',
  • text => $locale->text('CSV Report'),
  • type => 'submit',
  • class => 'submit',
  • };
  • my $template = LedgerSMB::Template->new(
  • user => \%myconfig,
  • locale => $locale,
  • path => 'UI',
  • template => 'form-dynatable',
  • format => ($form->{action} =~ /^csv/)? 'CSV': 'HTML');
  • $template->render({
  • form => \%$form,
  • hiddens => \%hiddens,
  • buttons => \@buttons,
  • columns => \@column_index,
  • heading => \%column_header,
  • rows => \@rows,
  • });
  • }
  • sub csv_list_gifi { &list_gifi }
  • sub add_gifi {
  • $form->{title} = "Add";
  • # construct callback
  • $form->{callback} =
  • "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • $form->{coa} = 1;
  • my %hiddens;
  • my @buttons;
  • &gifi_header(\%hiddens);
  • &gifi_footer(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-gifi-form');
  • $template->render({
  • form => $form,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub edit_gifi {
  • $form->{title} = "Edit";
  • AM->get_gifi( \%myconfig, \%$form );
  • $form->error( $locale->text('Account does not exist!') )
  • unless $form->{accno};
  • my %hiddens;
  • my @buttons;
  • &gifi_header(\%hiddens);
  • &gifi_footer(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-gifi-form');
  • $template->render({
  • form => $form,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub gifi_header {
  • my $hiddens = shift;
  • $form->{title} = $locale->text("$form->{title} GIFI");
  • # $locale->text('Add GIFI')
  • # $locale->text('Edit GIFI')
  • for (qw(accno description)) { $form->{$_} = $form->quote( $form->{$_} ) }
  • $hiddens->{id} = $form->{accno};
  • $hiddens->{type} = 'gifi';
  • }
  • sub gifi_footer {
  • my ($hiddens, $buttons) = @_;
  • $hiddens->{$_} = $form->{$_} foreach qw(callback path login sessionid);
  • # type=submit $locale->text('Save')
  • # type=submit $locale->text('Copy to COA')
  • # type=submit $locale->text('Delete')
  • my %button = ();
  • $button{'save'} = { ndx => 3, key => 'S', value => $locale->text('Save') };
  • if ( $form->{accno} ) {
  • if ( $form->{orphaned} ) {
  • $button{'delete'} =
  • { ndx => 16, key => 'D', value => $locale->text('Delete') };
  • }
  • }
  • if ( $form->{coa} ) {
  • $button{'copy_to_coa'} =
  • { ndx => 7, key => 'C', value => $locale->text('Copy to COA') };
  • }
  • for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button ) {
  • push @{$buttons}, {
  • name => 'action',
  • value => $_,
  • accesskey => $button{$_}{key},
  • title => "$button{$_}{value} [Alt-$button{$_}{key}]",
  • text => $button{$_}{value},
  • };
  • }
  • ##SC: Temporary commenting
  • ## if ( $form->{lynx} ) {
  • ## require "bin/menu.pl";
  • ## &menubar;
  • ## }
  • }
  • sub save_gifi {
  • $form->isblank( "accno", $locale->text('GIFI missing!') );
  • AM->save_gifi( \%myconfig, \%$form );
  • $form->redirect( $locale->text('GIFI saved!') );
  • }
  • sub copy_to_coa {
  • $form->isblank( "accno", $locale->text('GIFI missing!') );
  • AM->save_gifi( \%myconfig, \%$form );
  • delete $form->{id};
  • $form->{gifi_accno} = $form->{accno};
  • $form->{title} = "Add";
  • $form->{charttype} = "A";
  • my %hiddens;
  • my @buttons;
  • my $checked = &account_header(\%hiddens);
  • &form_footer_buttons(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-account-form');
  • $template->render({
  • form => $form,
  • checked => $checked,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub delete_gifi {
  • AM->delete_gifi( \%myconfig, \%$form );
  • $form->redirect( $locale->text('GIFI deleted!') );
  • }
  • sub add_department {
  • $form->{title} = "Add";
  • $form->{role} = "P";
  • $form->{callback} =
  • "$form->{script}?action=add_department&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"
  • unless $form->{callback};
  • my %hiddens;
  • my @buttons;
  • my $rows = &department_header(\%hiddens);
  • &form_footer_buttons(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-department-form');
  • $template->render({
  • form => $form,
  • row_count => $rows,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub edit_department {
  • $form->{title} = "Edit";
  • AM->get_department( \%myconfig, \%$form );
  • my %hiddens;
  • my @buttons;
  • my $rows = &department_header(\%hiddens);
  • &form_footer_buttons(\%hiddens, \@buttons);
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-department-form');
  • $template->render({
  • form => $form,
  • row_count => $rows,
  • buttons => \@buttons,
  • hiddens => \%hiddens,
  • });
  • }
  • sub list_department {
  • AM->departments( \%myconfig, \%$form );
  • my $href =
  • "$form->{script}?action=list_department&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • $form->sort_order();
  • $form->{callback} =
  • "$form->{script}?action=list_department&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}";
  • my $callback = $form->escape( $form->{callback} );
  • $form->{title} = $locale->text('Departments');
  • my @column_index = qw(description cost profit);
  • my %column_header;
  • $column_header{description} = { text => $locale->text('Description'),
  • href => $href};
  • $column_header{cost} = $locale->text('Cost Center');
  • $column_header{profit} = $locale->text('Profit Center');
  • my @rows;
  • my $i = 0;
  • foreach my $ref ( @{ $form->{ALL} } ) {
  • my %column_data;
  • $i++;
  • $i %= 2;
  • $column_data{i} = $i;
  • $column_data{cost} = ( $ref->{role} eq "C" ) ? "*" : " ";
  • $column_data{profit} = ( $ref->{role} eq "P" ) ? "*" : " ";
  • $column_data{description} = { text => $ref->{description},
  • href => qq|$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback|,};
  • push @rows, \%column_data;
  • }
  • $form->{type} = "department";
  • my @hiddens = qw(type callback path login sessionid);
  • ## SC: removing this for now
  • #if ( $form->{lynx} ) {
  • # require "bin/menu.pl";
  • # &menubar;
  • #}
  • my @buttons;
  • push @buttons, {
  • name => 'action',
  • value => 'add_department',
  • text => $locale->text('Add Department'),
  • type => 'submit',
  • class => 'submit',
  • };
  • my $template = LedgerSMB::Template->new_UI(
  • user => \%myconfig,
  • locale => $locale,
  • template => 'am-list-departments');
  • $template->render({
  • form => $form,
  • buttons => \@buttons,
  • columns => \@column_index,
  • heading => \%column_header,
  • rows => \@rows,
  • hiddens => \@hiddens,
  • });
  • }
  • sub department_header {
  • my $hiddens = shift;
  • $form->{title} = $locale->text("$form->{title} Department");
  • # $locale->text('Add Department')
  • # $locale->text('Edit Department')
  • $form->{description} = $form->quote( $form->{description} );
  • my $rows = $form->numtextrows( $form->{description}, 60 );
  • $hiddens->{id} = $form->{id};
  • $hiddens->{type} = 'department';
  • $rows;
  • }
  • sub save_department {
  • $form->isblank( "description", $locale->text('Description missing!') );
  • AM->save_department( \%myconfig, \%$form );
  • $form->redirect( $locale->text('Department saved!') );
  • }
  • sub delete_department {
  • AM->delete_department( \%myconfig, \%$form );
  • $form->redirect( $locale->text('Department deleted!') );