X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=sql-ledger%2Fbin%2Fmozilla%2Fam.pl;fp=sql-ledger%2Fbin%2Fmozilla%2Fam.pl;h=0000000000000000000000000000000000000000;hp=8342903430e6f729c361eced591f0a6504224500;hb=86b1b489a4ed2f9bc0cba6cafeab0d6eca5584dc;hpb=948b8acdd4b9b3864342062d0c397a11f57c5700 diff --git a/sql-ledger/bin/mozilla/am.pl b/sql-ledger/bin/mozilla/am.pl deleted file mode 100644 index 834290343..000000000 --- a/sql-ledger/bin/mozilla/am.pl +++ /dev/null @@ -1,2394 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (c) 2001 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#====================================================================== -# -# administration -# -#====================================================================== - - -use SL::AM; -use SL::CA; -use SL::Form; -use SL::User; -use SL::RP; -use SL::GL; - - -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}; - - &account_header; - &form_footer; - -} - - -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"; - } - - &account_header; - &form_footer; - -} - - -sub account_header { - - $form->{title} = $locale->text("$form->{title} Account"); - - $checked{$form->{charttype}} = "checked"; - $checked{"$form->{category}_"} = "checked"; - $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked"; - - map { $form->{$_} = $form->quote($form->{$_}) } qw(accno description); - -# this is for our parser only! -# type=submit $locale->text('Add Account') -# type=submit $locale->text('Edit Account') - - $form->header; - - print qq| - - -
{script}> - -{id}> - - -{inventory_accno_id}> -{income_accno_id}> -{expense_accno_id}> -{fxgain_accno_id}> -{fxloss_accno_id}> - - - - - - - - - - - - -
$form->{title}
- - - - - - - - - - - - - -|; - - -if ($form->{charttype} eq "A") { - print qq| - - - - - - - - - - - - -|; -} - -print qq| - - - - -
|.$locale->text('Account Number').qq|
|.$locale->text('Description').qq|
|.$locale->text('Account Type').qq| - - - - - - -
 |.$locale->text('Asset').qq|\n
-  |.$locale->text('Contra').qq|\n
-  |.$locale->text('Liability').qq|\n
-  |.$locale->text('Equity').qq|\n
-  |.$locale->text('Income').qq|\n
-  |.$locale->text('Expense') - .qq|
  -  |.$locale->text('Heading').qq|
-  |.$locale->text('Account') - .qq|
-
- - - - - -
|.$locale->text('Is this a summary account to record').qq| - {AR}> |.$locale->text('AR') - .qq| {AP}> |.$locale->text('AP') - .qq| {IC}> |.$locale->text('Inventory') - .qq|
-
|.$locale->text('Include in drop-down menus').qq|
- - - - - - - - - - - - - - - -
|.$locale->text('Receivables').qq||.$locale->text('Payables').qq||.$locale->text('Parts Inventory').qq||.$locale->text('Service Items').qq||.$locale->text('Labor/Overhead').qq|
- {AR_amount}> |.$locale->text('Income').qq|\n
- {AR_paid}> |.$locale->text('Payment').qq|\n
- {AR_tax}> |.$locale->text('Tax') .qq| -
- {AP_amount}> |.$locale->text('Expense/Asset').qq|\n
- {AP_paid}> |.$locale->text('Payment').qq|\n
- {AP_tax}> |.$locale->text('Tax') .qq| -
- {IC_sale}> |.$locale->text('Income').qq|\n
- {IC_cogs}> |.$locale->text('COGS').qq|\n
- {IC_taxpart}> |.$locale->text('Tax') .qq| -
- {IC_income}> |.$locale->text('Income').qq|\n
- {IC_expense}> |.$locale->text('Expense').qq|\n
- {IC_taxservice}> |.$locale->text('Tax') .qq| -
-
- {IC_cogs}> |.$locale->text('COGS').qq|\n
-
-
- - - - - -
|.$locale->text('Include this account on the customer/vendor forms to flag customer/vendor as taxable?').qq| - {CT_tax}> |.$locale->text('Yes').qq|  -  |.$locale->text('No') - .qq| -
-
|.$locale->text('GIFI').qq|{gifi_accno}>
-

-|; - -} - - -sub form_footer { - - print qq| - - - -{path}> -{login}> -{sessionid}> - -
- -|; - - if ($form->{id}) { - print qq| - -|; - } - - if ($form->{id} && $form->{orphaned}) { - print qq||; - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -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}) { - map { $a .= $form->{$_} } qw(AR AP IC); - $form->error($locale->text('Cannot set account for more than one of AR, AP or IC')) if length $a > 2; - - map { $form->error("$form->{AR}$form->{AP}$form->{IC} ". $locale->text('account cannot be set to any other type of account')) if $form->{$_} } qw(AR_amount AR_tax AR_paid AP_amount AP_tax AP_paid IC_sale IC_cogs IC_taxpart IC_income IC_expense IC_taxservice); - } - - foreach $item ("AR", "AP") { - $i = 0; - map { $i++ if $form->{$_} } ("${item}_amount", "${item}_paid", "${item}_tax"); - $form->error($locale->text('Cannot set multiple options for')." $item") if $i > 1; - } - - $i = 0; - map { $i++ if $form->{$_} } qw(IC_sale IC_cogs IC_taxpart); - $form->error($locale->text('Cannot set multiple options for Parts Inventory')) if $i > 1; - - $i = 0; - map { $i++ if $form->{$_} } qw(IC_income IC_expense IC_taxservice); - $form->error($locale->text('Cannot set multiple options for Service Items')) if $i > 1; - - $form->redirect($locale->text('Account saved!')) if (AM->save_account(\%myconfig, \%$form)); - $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}"; - - @column_index = qw(accno gifi_accno description debit credit link); - - $column_header{accno} = qq||.$locale->text('Account').qq||; - $column_header{gifi_accno} = qq||.$locale->text('GIFI').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - $column_header{debit} = qq||.$locale->text('Debit').qq||; - $column_header{credit} = qq||.$locale->text('Credit').qq||; - $column_header{link} = qq||.$locale->text('Link').qq||; - - - $form->header; - $colspan = $#column_index + 1; - - print qq| - - - - - - - - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - # escape callback - $callback = $form->escape($callback); - - foreach $ca (@{ $form->{CA} }) { - - $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/:/
/og; - - if ($ca->{charttype} eq "H") { - print qq||; - - $column_data{accno} = qq||; - $column_data{gifi_accno} = qq||; - $column_data{description} = qq||; - $column_data{debit} = qq||; - $column_data{credit} = qq| |; - $column_data{link} = qq||; - - } else { - $i++; $i %= 2; - print qq| -|; - $column_data{accno} = qq||; - $column_data{gifi_accno} = qq||; - $column_data{description} = qq||; - $column_data{debit} = qq||; - $column_data{credit} = qq||; - $column_data{link} = qq||; - - } - - map { print "$column_data{$_}\n" } @column_index; - - print "\n"; - } - - print qq| - -
$form->{title}
{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ca->{accno}{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ca->{gifi_accno} $ca->{description}    
{script}?action=edit_account&id=$ca->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ca->{accno}{script}?action=edit_gifi&accno=$ca->{gifi_accno}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ca->{gifi_accno} $ca->{description} $ca->{debit}$ca->{credit}$ca->{link} 

- - - -|; - -} - - -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!')); - } - } - - $form->redirect($locale->text('Account deleted!')) if (AM->delete_account(\%myconfig, \%$form)); - $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'); - - # construct callback - $callback = "$form->{script}?action=list_gifi&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - @column_index = qw(accno description); - - $column_header{accno} = qq||.$locale->text('GIFI').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - - - $form->header; - $colspan = $#column_index + 1; - - print qq| - - - - - - - - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - # escape callback - $callback = $form->escape($callback); - - foreach $ca (@{ $form->{ALL} }) { - - $i++; $i %= 2; - - print qq| -|; - - $column_data{accno} = qq||; - $column_data{description} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print "\n"; - } - - print qq| - - - -
$form->{title}
{script}?action=edit_gifi&coa=1&accno=$ca->{accno}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ca->{accno}$ca->{description} 

- - - -|; - -} - - -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; - - &gifi_header; - &gifi_footer; - -} - - -sub edit_gifi { - - $form->{title} = "Edit"; - - AM->get_gifi(\%myconfig, \%$form); - - $form->error($locale->text('Account does not exist!')) unless $form->{accno}; - - &gifi_header; - &gifi_footer; - -} - - -sub gifi_header { - - $form->{title} = $locale->text("$form->{title} GIFI"); - -# $locale->text('Add GIFI') -# $locale->text('Edit GIFI') - - map { $form->{$_} = $form->quote($form->{$_}) } qw(accno description); - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - - - -
$form->{title}
- - - - - - - - - -
|.$locale->text('GIFI').qq|
|.$locale->text('Description').qq|
-

-|; - -} - - -sub gifi_footer { - - print qq| - - - -{path}> -{login}> -{sessionid}> - -
|; - - if ($form->{coa}) { - print qq| - -|; - - if ($form->{accno} && $form->{orphaned}) { - print qq||; - } - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -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"; - - &account_header; - &form_footer; - -} - - -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}; - - &department_header; - &form_footer; - -} - - -sub edit_department { - - $form->{title} = "Edit"; - - AM->get_department(\%myconfig, \%$form); - - &department_header; - &form_footer; - -} - - -sub list_department { - - AM->departments(\%myconfig, \%$form); - - $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}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Departments'); - - @column_index = qw(description cost profit); - - $column_header{description} = qq||.$locale->text('Description').qq||; - $column_header{cost} = qq||.$locale->text('Cost Center').qq||; - $column_header{profit} = qq||.$locale->text('Profit Center').qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; $i %= 2; - - print qq| - -|; - - $costcenter = ($ref->{role} eq "C") ? "*" : " "; - $profitcenter = ($ref->{role} eq "P") ? "*" : " "; - - $column_data{description} = qq||; - $column_data{cost} = qq||; - $column_data{profit} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{description}$costcenter$profitcenter
-

- -
-
{script}> - - - - - -{path}> -{login}> -{sessionid}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub department_header { - - $form->{title} = $locale->text("$form->{title} Department"); - -# $locale->text('Add Department') -# $locale->text('Edit Department') - - $form->{description} = $form->quote($form->{description}); - - if (($rows = $form->numtextrows($form->{description}, 60)) > 1) { - $description = qq||; - } else { - $description = qq||; - } - - $costcenter = "checked" if $form->{role} eq "C"; - $profitcenter = "checked" if $form->{role} eq "P"; - - $form->header; - - print qq| - - -
{script}> - -{id}> - - - - - - - - - - - - - - - - - -
$form->{title}
|.$locale->text('Description').qq|$description
|.$locale->text('Cost Center').qq| - |.$locale->text('Profit Center').qq| -

-|; - -} - - -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!')); - -} - - -sub add_business { - - $form->{title} = "Add"; - - $form->{callback} = "$form->{script}?action=add_business&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; - - &business_header; - &form_footer; - -} - - -sub edit_business { - - $form->{title} = "Edit"; - - AM->get_business(\%myconfig, \%$form); - - &business_header; - - $form->{orphaned} = 1; - &form_footer; - -} - - -sub list_business { - - AM->business(\%myconfig, \%$form); - - $href = "$form->{script}?action=list_business&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - $form->sort_order(); - - $form->{callback} = "$form->{script}?action=list_business&direction=$form->{direction}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Type of Business'); - - @column_index = qw(description discount); - - $column_header{description} = qq||.$locale->text('Description').qq||; - $column_header{discount} = qq||.$locale->text('Discount').qq| %|; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; $i %= 2; - - print qq| - -|; - - $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100, 2, " "); - - $column_data{description} = qq||; - $column_data{discount} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_business&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{description}$discount
-

- -
-{script}> - - - - - -{path}> -{login}> -{sessionid}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| - -
- - - -|; - -} - - -sub business_header { - - $form->{title} = $locale->text("$form->{title} Business"); - -# $locale->text('Add Business') -# $locale->text('Edit Business') - - $form->{description} = $form->quote($form->{description}); - $form->{discount} = $form->format_amount(\%myconfig, $form->{discount} * 100); - - $form->header; - - print qq| - - -
{script}> - -{id}> - - - - - - - - - - - - - -
$form->{title}
- - - - - - - - - -
|.$locale->text('Type of Business').qq|
|.$locale->text('Discount').qq| %{discount}>
-

-|; - -} - - -sub save_business { - - $form->isblank("description", $locale->text('Description missing!')); - AM->save_business(\%myconfig, \%$form); - $form->redirect($locale->text('Business saved!')); - -} - - -sub delete_business { - - AM->delete_business(\%myconfig, \%$form); - $form->redirect($locale->text('Business deleted!')); - -} - - - -sub add_sic { - - $form->{title} = "Add"; - - $form->{callback} = "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; - - &sic_header; - &form_footer; - -} - - -sub edit_sic { - - $form->{title} = "Edit"; - - $form->{code} =~ s/\\'/'/g; - $form->{code} =~ s/\\\\/\\/g; - - AM->get_sic(\%myconfig, \%$form); - $form->{id} = $form->{code}; - - &sic_header; - - $form->{orphaned} = 1; - &form_footer; - -} - - -sub list_sic { - - AM->sic(\%myconfig, \%$form); - - $href = "$form->{script}?action=list_sic&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - $form->sort_order(); - - $form->{callback} = "$form->{script}?action=list_sic&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Standard Industrial Codes'); - - @column_index = $form->sort_columns(qw(code description)); - - $column_header{code} = qq||.$locale->text('Code').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; $i %= 2; - - if ($ref->{sictype} eq 'H') { - print qq| - -|; - $column_data{code} = qq||; - $column_data{description} = qq||; - - } else { - print qq| - -|; - - $column_data{code} = qq||; - $column_data{description} = qq||; - - } - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}$ref->{description}
{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}$ref->{description}
-

- -
-{script}> - - - - - -{path}> -{login}> -{sessionid}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub sic_header { - - $form->{title} = $locale->text("$form->{title} SIC"); - -# $locale->text('Add SIC') -# $locale->text('Edit SIC') - - map { $form->{$_} = $form->quote($form->{$_}) } qw(code description); - - $checked = ($form->{sictype} eq 'H') ? "checked" : ""; - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - - - - - - - - - - - -
$form->{title}
|.$locale->text('Code').qq|
|.$locale->text('Heading').qq|
|.$locale->text('Description').qq|

-|; - -} - - -sub save_sic { - - $form->isblank("code", $locale->text('Code missing!')); - $form->isblank("description", $locale->text('Description missing!')); - AM->save_sic(\%myconfig, \%$form); - $form->redirect($locale->text('SIC saved!')); - -} - - -sub delete_sic { - - AM->delete_sic(\%myconfig, \%$form); - $form->redirect($locale->text('SIC deleted!')); - -} - - -sub add_language { - - $form->{title} = "Add"; - - $form->{callback} = "$form->{script}?action=add_language&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; - - &language_header; - &form_footer; - -} - - -sub edit_language { - - $form->{title} = "Edit"; - - $form->{code} =~ s/\\'/'/g; - $form->{code} =~ s/\\\\/\\/g; - - AM->get_language(\%myconfig, \%$form); - $form->{id} = $form->{code}; - - &language_header; - - $form->{orphaned} = 1; - &form_footer; - -} - - -sub list_language { - - AM->language(\%myconfig, \%$form); - - $href = "$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - $form->sort_order(); - - $form->{callback} = "$form->{script}?action=list_language&direction=$form->{direction}&oldsort=$form->{oldsort}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Languages'); - - @column_index = $form->sort_columns(qw(code description)); - - $column_header{code} = qq||.$locale->text('Code').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; $i %= 2; - - print qq| - -|; - - $column_data{code} = qq||; - $column_data{description} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_language&code=$ref->{code}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{code}$ref->{description}
-

- -
-{script}> - - - - - -{path}> -{login}> -{sessionid}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub language_header { - - $form->{title} = $locale->text("$form->{title} Language"); - -# $locale->text('Add Language') -# $locale->text('Edit Language') - - map { $form->{$_} = $form->quote($form->{$_}) } qw(code description); - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - - - - - - - -
$form->{title}
|.$locale->text('Code').qq|
|.$locale->text('Description').qq|

-|; - -} - - -sub save_language { - - $form->isblank("code", $locale->text('Code missing!')); - $form->isblank("description", $locale->text('Description missing!')); - AM->save_language(\%myconfig, \%$form); - $form->redirect($locale->text('Language saved!')); - -} - - -sub delete_language { - - AM->delete_language(\%myconfig, \%$form); - $form->redirect($locale->text('Language deleted!')); - -} - - -sub display_stylesheet { - - $form->{file} = "css/$myconfig{stylesheet}"; - &display_form; - -} - - -sub display_form { - - $form->{file} =~ s/^(.:)*?\/|\.\.\///g; - $form->{file} =~ s/^\/*//g; - $form->{file} =~ s/$userspath//; - - $form->error("$!: $form->{file}") unless -f $form->{file}; - - AM->load_template(\%$form); - - $form->{title} = $form->{file}; - - # if it is anything but html - if ($form->{file} !~ /\.html$/) { - $form->{body} = "
\n$form->{body}\n
"; - } - - $form->header; - - print qq| - - -$form->{body} - -{script}> - -{file}> - - -{path}> -{login}> -{sessionid}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub edit_template { - - AM->load_template(\%$form); - - $form->{title} = $locale->text('Edit Template'); - # convert   to &nbsp; - $form->{body} =~ s/ /&nbsp;/gi; - - - $form->header; - - print qq| - - -
{script}> - -{file}> - - -{path}> -{login}> -{sessionid}> - - - - - -
-|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print q| -
- - - - -|; - -} - - -sub save_template { - - AM->save_template(\%$form); - $form->redirect($locale->text('Template saved!')); - -} - - -sub defaults { - - # get defaults for account numbers and last numbers - AM->defaultaccounts(\%myconfig, \%$form); - - foreach $key (keys %{ $form->{IC} }) { - foreach $accno (sort keys %{ $form->{IC}{$key} }) { - $form->{account}{$key} .= ($form->{IC}{$key}{$accno}{id} == $form->{defaults}{$key}) ? "