X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=sql-ledger%2Fbin%2Fmozilla%2Fpe.pl;fp=sql-ledger%2Fbin%2Fmozilla%2Fpe.pl;h=0000000000000000000000000000000000000000;hp=841c3fef24fb3a602dee92a064f7c4b7b3c4f565;hb=86b1b489a4ed2f9bc0cba6cafeab0d6eca5584dc;hpb=948b8acdd4b9b3864342062d0c397a11f57c5700 diff --git a/sql-ledger/bin/mozilla/pe.pl b/sql-ledger/bin/mozilla/pe.pl deleted file mode 100644 index 841c3fef2..000000000 --- a/sql-ledger/bin/mozilla/pe.pl +++ /dev/null @@ -1,1236 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (c) 2002 -# -# 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. -#====================================================================== -# -# project administration -# partsgroup administration -# translation maintainance -# -#====================================================================== - - -use SL::PE; - -1; -# end of main - - - -sub add { - - $form->{title} = "Add"; - - # construct callback - $form->{callback} = "$form->{script}?action=add&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}" unless $form->{callback}; - - &{ "$form->{type}_header" }; - &{ "$form->{type}_footer" }; - -} - - -sub edit { - - $form->{title} = "Edit"; - - &{ "PE::get_$form->{type}" }("", \%myconfig, \%$form); - &{ "$form->{type}_header" }; - &{ "$form->{type}_footer" }; - -} - - -sub search { - - if ($form->{type} eq 'project') { - $report = "project_report"; - $sort = 'projectnumber'; - $form->{title} = $locale->text('Projects'); - - $number = qq| - - |.$locale->text('Number').qq| - - - - |.$locale->text('Description').qq| - - -|; - - } - if ($form->{type} eq 'partsgroup') { - $report = "partsgroup_report"; - $sort = 'partsgroup'; - $form->{title} = $locale->text('Groups'); - - $number = qq| - - |.$locale->text('Group').qq| - - -|; - - } - if ($form->{type} eq 'pricegroup') { - $report = "pricegroup_report"; - $sort = 'pricegroup'; - $form->{title} = $locale->text('Pricegroups'); - - $number = qq| - - |.$locale->text('Pricegroup').qq| - - -|; - - } - - - $form->header; - - print qq| - - -
{script}> - - -{type}> - - - - - - - - - - - - -
$form->{title}
- - $number - - - - -
 |.$locale->text('All').qq| -  |.$locale->text('Orphaned').qq|
-

- - - -{path}> -{login}> -{sessionid}> - -
- -
- - - -|; - -} - - - -sub project_report { - - map { $form->{$_} = $form->unescape($form->{$_}) } (projectnumber, description); - PE->projects(\%myconfig, \%$form); - - $href = "$form->{script}?action=project_report&direction=$form->{direction}&oldsort=$form->{oldsort}&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; - - $form->sort_order(); - - $callback = "$form->{script}?action=project_report&direction=$form->{direction}&oldsort=$form->{oldsort}&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; - - if ($form->{status} eq 'all') { - $option = $locale->text('All'); - } - if ($form->{status} eq 'orphaned') { - $option .= $locale->text('Orphaned'); - } - if ($form->{projectnumber}) { - $href .= "&projectnumber=".$form->escape($form->{projectnumber}); - $callback .= "&projectnumber=$form->{projectnumber}"; - $option .= "\n
".$locale->text('Project')." : $form->{projectnumber}"; - } - if ($form->{description}) { - $href .= "&description=".$form->escape($form->{description}); - $callback .= "&description=$form->{description}"; - $option .= "\n
".$locale->text('Description')." : $form->{description}"; - } - - - @column_index = $form->sort_columns(qw(projectnumber description)); - - $column_header{projectnumber} = qq||.$locale->text('Number').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - - $form->{title} = $locale->text('Projects'); - - $form->header; - - print qq| - - - - - - - - - - - - - - - - -
$form->{title}
$option
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - # escape callback - $form->{callback} = $callback .= "&sort=$form->{sort}"; - - # escape callback for href - $callback = $form->escape($callback); - - foreach $ref (@{ $form->{project_list} }) { - - $i++; $i %= 2; - - print qq| - -|; - - $column_data{projectnumber} = qq||; - $column_data{description} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print " - -"; - } - - $i = 1; - if ($myconfig{acs} !~ /Projects--Projects/) { - $button{'Projects--Add Project'}{code} = qq| |; - $button{'Projects--Add Project'}{order} = $i++; - - foreach $item (split /;/, $myconfig{acs}) { - delete $button{$item}; - } - } - - print qq| -
{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{projectnumber}$ref->{description} 
-

- -
-
{script}> - - - -{type}> - -{path}> -{login}> -{sessionid}> -|; - - foreach $item (sort { $a->{order} <=> $b->{order} } %button) { - print $item->{code}; - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub project_header { - - $form->{title} = $locale->text("$form->{title} Project"); - -# $locale->text('Add Project') -# $locale->text('Edit Project') - - $form->{description} = $form->quote($form->{description}); - - if (($rows = $form->numtextrows($form->{description}, 60)) > 1) { - $description = qq||; - } else { - $description = qq||; - } - - $form->header; - - print qq| - - -
{script}> - -{id}> - - - - - - - - - - - - - -
$form->{title}
- - - - - - - - - -
|.$locale->text('Number').qq|
|.$locale->text('Description').qq|$description
-

-|; - -} - - -sub project_footer { - - print qq| - - - -{path}> -{login}> -{sessionid}> -
-|; - - if ($myconfig{acs} !~ /Projects--Add Project/) { - print qq| - -|; - - if ($form->{id} && $form->{orphaned}) { - print qq| -|; - } - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub save { - - if ($form->{type} eq 'project') { - $form->isblank("projectnumber", $locale->text('Project Number missing!')); - PE->save_project(\%myconfig, \%$form); - $form->redirect($locale->text('Project saved!')); - } - if ($form->{type} eq 'partsgroup') { - $form->isblank("partsgroup", $locale->text('Group missing!')); - PE->save_partsgroup(\%myconfig, \%$form); - $form->redirect($locale->text('Group saved!')); - } - if ($form->{type} eq 'pricegroup') { - $form->isblank("pricegroup", $locale->text('Pricegroup missing!')); - PE->save_pricegroup(\%myconfig, \%$form); - $form->redirect($locale->text('Pricegroup saved!')); - } - if ($form->{translation}) { - PE->save_translation(\%myconfig, \%$form); - $form->redirect($locale->text('Translations saved!')); - } - -} - - -sub delete { - - if ($form->{translation}) { - PE->delete_translation(\%myconfig, \%$form); - $form->redirect($locale->text('Translation deleted!')); - - } else { - - PE->delete_tuple(\%myconfig, \%$form); - - if ($form->{type} eq 'project') { - $form->redirect($locale->text('Project deleted!')); - } - if ($form->{type} eq 'partsgroup') { - $form->redirect($locale->text('Group deleted!')); - } - if ($form->{type} eq 'pricegroup') { - $form->redirect($locale->text('Pricegroup deleted!')); - } - } - -} - - -sub continue { &{ $form->{nextsub} } }; - - -sub partsgroup_report { - - map { $form->{$_} = $form->unescape($form->{$_}) } (partsgroup); - PE->partsgroups(\%myconfig, \%$form); - - $href = "$form->{script}?action=partsgroup_report&direction=$form->{direction}&oldsort=$form->{oldsort}&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; - - $form->sort_order(); - - $callback = "$form->{script}?action=partsgroup_report&direction=$form->{direction}&oldsort=$form->{oldsort}&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; - - if ($form->{status} eq 'all') { - $option = $locale->text('All'); - } - if ($form->{status} eq 'orphaned') { - $option .= $locale->text('Orphaned'); - } - if ($form->{partsgroup}) { - $callback .= "&partsgroup=$form->{partsgroup}"; - $option .= "\n
".$locale->text('Group')." : $form->{partsgroup}"; - } - - - @column_index = $form->sort_columns(qw(partsgroup)); - - $column_header{partsgroup} = qq||.$locale->text('Group').qq||; - - $form->{title} = $locale->text('Groups'); - - $form->header; - - print qq| - - - - - - - - - - - - - - - - -
$form->{title}
$option
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - # escape callback - $form->{callback} = $callback; - - # escape callback for href - $callback = $form->escape($callback); - - foreach $ref (@{ $form->{item_list} }) { - - $i++; $i %= 2; - - print qq| - -|; - - $column_data{partsgroup} = qq||; - map { print "$column_data{$_}\n" } @column_index; - - print " - -"; - } - - $i = 1; - if ($myconfig{acs} !~ /Goods \& Services--Goods \& Services/) { - $button{'Goods & Services--Add Group'}{code} = qq| |; - $button{'Goods & Services--Add Group'}{order} = $i++; - - foreach $item (split /;/, $myconfig{acs}) { - delete $button{$item}; - } - } - - print qq| -
{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{partsgroup}
-

- -
-
{script}> - - - -{type}> - -{path}> -{login}> -{sessionid}> -|; - - foreach $item (sort { $a->{order} <=> $b->{order} } %button) { - print $item->{code}; - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub partsgroup_header { - - $form->{title} = $locale->text("$form->{title} Group"); - -# $locale->text('Edit Group') - - $form->{partsgroup} = $form->quote($form->{partsgroup}); - - - $form->header; - - print qq| - - -
{script}> - -{id}> -{type}> - - - - - - - - - - - - -
$form->{title}
- - - - - - -
|.$locale->text('Group').qq|
-

-|; - -} - - -sub partsgroup_footer { - - print qq| - - - -{path}> -{login}> -{sessionid}> -
-|; - - if ($myconfig{acs} !~ /Goods \& Services--Add Group/) { - print qq| - -|; - - if ($form->{id} && $form->{orphaned}) { - print qq| -|; - } - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub pricegroup_report { - - map { $form->{$_} = $form->unescape($form->{$_}) } (pricegroup); - PE->pricegroups(\%myconfig, \%$form); - - $href = "$form->{script}?action=pricegroup_report&direction=$form->{direction}&oldsort=$form->{oldsort}&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; - - $form->sort_order(); - - $callback = "$form->{script}?action=pricegroup_report&direction=$form->{direction}&oldsort=$form->{oldsort}&type=$form->{type}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&status=$form->{status}"; - - if ($form->{status} eq 'all') { - $option = $locale->text('All'); - } - if ($form->{status} eq 'orphaned') { - $option .= $locale->text('Orphaned'); - } - if ($form->{pricegroup}) { - $callback .= "&pricegroup=$form->{pricegroup}"; - $option .= "\n
".$locale->text('Pricegroup')." : $form->{pricegroup}"; - } - - - @column_index = $form->sort_columns(qw(pricegroup)); - - $column_header{pricegroup} = qq||.$locale->text('Pricegroup').qq||; - - $form->{title} = $locale->text('Pricegroups'); - - $form->header; - - print qq| - - - - - - - - - - - - - - - - -
$form->{title}
$option
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - # escape callback - $form->{callback} = $callback; - - # escape callback for href - $callback = $form->escape($callback); - - foreach $ref (@{ $form->{item_list} }) { - - $i++; $i %= 2; - - print qq| - -|; - - $column_data{pricegroup} = qq||; - map { print "$column_data{$_}\n" } @column_index; - - print " - -"; - } - - $i = 1; - if ($myconfig{acs} !~ /Goods \& Services--Goods \& Services/) { - $button{'Goods & Services--Add Pricegroup'}{code} = qq| |; - $button{'Goods & Services--Add Pricegroup'}{order} = $i++; - - foreach $item (split /;/, $myconfig{acs}) { - delete $button{$item}; - } - } - - print qq| -
{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{pricegroup}
-

- -
-
{script}> - - - -{type}> - -{path}> -{login}> -{sessionid}> -|; - - foreach $item (sort { $a->{order} <=> $b->{order} } %button) { - print $item->{code}; - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub pricegroup_header { - - $form->{title} = $locale->text("$form->{title} Pricegroup"); - -# $locale->text('Edit Pricegroup') - - $form->{pricegroup} = $form->quote($form->{pricegroup}); - - - $form->header; - - print qq| - - -
{script}> - -{id}> -{type}> - - - - - - - - - - - - -
$form->{title}
- - - - - - -
|.$locale->text('Pricegroup').qq|
-

-|; - -} - - -sub pricegroup_footer { - - print qq| - - - -{path}> -{login}> -{sessionid}> -
-|; - - if ($myconfig{acs} !~ /Goods \& Services--Add Pricegroup/) { - print qq| - -|; - - if ($form->{id} && $form->{orphaned}) { - print qq| -|; - } - } - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub translation { - - if ($form->{translation} eq 'description') { - $form->{title} = $locale->text('Description Translations'); - $sort = qq||; - $form->{number} = "partnumber"; - $number = qq| - - |.$locale->text('Number').qq| - - -|; - } - - if ($form->{translation} eq 'partsgroup') { - $form->{title} = $locale->text('Group Translations'); - $sort = qq||; - } - - if ($form->{translation} eq 'project') { - $form->{title} = $locale->text('Project Description Translations'); - $form->{number} = "projectnumber"; - $sort = qq||; - $number = qq| - - |.$locale->text('Project Number').qq| - - -|; - } - - - $form->header; - - print qq| - - -
{script}> - -{translation}> - -{number}> - - - - - - - - -
$form->{title}
- - $number - - - - -
|.$locale->text('Description').qq|
-

- - -$sort - -{path}> -{login}> -{sessionid}> - -
- -
- - - -|; - -} - - -sub list_translations { - - $title = $form->escape($form->{title},1); - - $callback = "$form->{script}?action=list_translations&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&translation=$form->{translation}&number=$form->{number}&title=$title"; - - if ($form->{"$form->{number}"}) { - $callback .= qq|&$form->{number}=$form->{"$form->{number}"}|; - $option .= $locale->text('Number').qq| : $form->{"$form->{number}"}
|; - } - if ($form->{description}) { - $callback .= "&description=$form->{description}"; - $description = $form->{description}; - $description =~ s/ /
/g; - $option .= $locale->text('Description').qq| : $form->{description}
|; - } - - if ($form->{translation} eq 'partsgroup') { - @column_index = qw(description language translation); - $form->{sort} = ""; - } else { - @column_index = $form->sort_columns("$form->{number}", "description", "language", "translation"); - } - - &{ "PE::$form->{translation}_translations" }("", \%myconfig, \%$form); - - $callback .= "&direction=$form->{direction}&oldsort=$form->{oldsort}"; - - $href = $callback; - - $form->sort_order(); - - $callback =~ s/(direction=).*\&{1}/$1$form->{direction}\&/; - - $column_header{"$form->{number}"} = qq|
{number}>|.$locale->text('Number').qq||; - $column_header{description} = qq||.$locale->text('Description').qq||; - $column_header{language} = qq||.$locale->text('Language').qq||; - $column_header{translation} = qq||.$locale->text('Translation').qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - - -
$form->{title}
$option
- - -|; - - map { print "\n$column_header{$_}" } @column_index; - - print qq| - - |; - - - # add order to callback - $form->{callback} = $callback .= "&sort=$form->{sort}"; - - # escape callback for href - $callback = $form->escape($callback); - - if (@{ $form->{translations} }) { - $sameitem = $form->{translations}->[0]->{$form->{sort}}; - } - - foreach $ref (@{ $form->{translations} }) { - - $ref->{description} =~ s/ /
/g; - - map { $column_data{$_} = "" } @column_index; - - $column_data{description} = ""; - - $i++; $i %= 2; - print ""; - - map { print "\n$column_data{$_}" } @column_index; - - print qq| - -|; - - } - - print qq| -
$ref->{$_} {script}?action=edit_translation&translation=$form->{translation}&number=$form->{number}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{description} 
-

- -|; - - print qq| - -
- -
{script}> - - - -{path}> -{login}> -{sessionid}> -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - -} - - -sub edit_translation { - - &{ "PE::$form->{translation}_translations" }("", \%myconfig, \%$form); - - $form->error($locale->text('Languages not defined!')) unless $form->{all_language}; - - $form->{selectlanguage} = qq|