1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #======================================================================
30 # partsgroup administration
32 #======================================================================
36 require "bin/mozilla/common.pl";
45 $::lxdebug->enter_sub;
46 $::auth->assert('config');
48 $::form->{title} = "Add";
49 $::form->{callback} ||= "$::form->{script}?action=add&type=$::form->{type}";
51 call_sub("form_$::form->{type}");
53 $::lxdebug->leave_sub;
57 $::lxdebug->enter_sub;
58 $::auth->assert('config');
60 $::form->{title} = "Edit";
62 if ($::form->{type} eq 'partsgroup') {
63 PE->get_partsgroup(\%::myconfig, $::form);
65 call_sub("form_$::form->{type}");
67 $::lxdebug->leave_sub;
71 $::lxdebug->enter_sub;
72 $::auth->assert('config');
75 print $::form->parse_html_template('pe/search', {
76 is_pricegroup => $::form->{type} eq 'pricegroup',
79 $::lxdebug->leave_sub;
83 $::lxdebug->enter_sub;
84 $::auth->assert('config');
86 if ($::form->{type} eq 'partsgroup') {
87 $::form->isblank("partsgroup", $::locale->text('Group missing!'));
88 PE->save_partsgroup(\%::myconfig, $::form);
89 $::form->redirect($::locale->text('Group saved!'));
93 if(!exists $::form->{addition} && $::form->{id} ne "") {
94 $::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber};
95 $::form->{addition} = "SAVED";
96 $::form->save_history;
100 $::lxdebug->leave_sub;
104 $::lxdebug->enter_sub;
105 $::auth->assert('config');
107 PE->delete_tuple(\%::myconfig, $::form);
109 if ($::form->{type} eq 'partsgroup') {
110 $::form->redirect($::locale->text('Group deleted!'));
112 $::lxdebug->leave_sub;
115 sub continue { call_sub($::form->{nextsub}); }
117 sub partsgroup_report {
118 $::lxdebug->enter_sub;
119 $::auth->assert('config');
121 $::form->{$_} = $::form->unescape($::form->{$_}) for qw(partsgroup);
122 PE->partsgroups(\%::myconfig, $::form);
124 my $callback = build_std_url("action=partsgroup_report", qw(type status));
127 $option .= $::locale->text('All') if $::form->{status} eq 'all';
128 $option .= $::locale->text('Orphaned') if $::form->{status} eq 'orphaned';
130 if ($::form->{partsgroup}) {
131 $callback .= "&partsgroup=$::form->{partsgroup}";
132 $option .= ", " . $::locale->text('Group') . " : $::form->{partsgroup}";
136 $::form->{callback} = $callback;
139 print $::form->parse_html_template('pe/partsgroup_report', {
141 callback => $callback,
142 editlink => build_std_url('action=edit', qw(type status callback)),
145 $::lxdebug->leave_sub;
148 sub form_partsgroup {
149 $::lxdebug->enter_sub;
150 $::auth->assert('config');
152 # $locale->text('Add Group')
153 # $locale->text('Edit Group')
154 $::form->{title} = $::locale->text("$::form->{title} Group");
157 print $::form->parse_html_template('pe/partsgroup_form');
159 $::lxdebug->leave_sub;