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., 51 Franklin Street, Fifth Floor, Boston,
29 #======================================================================
31 # partsgroup administration
33 #======================================================================
37 require "bin/mozilla/common.pl";
46 $::lxdebug->enter_sub;
47 $::auth->assert('config');
49 $::form->{title} = "Add";
50 $::form->{callback} ||= "$::form->{script}?action=add&type=$::form->{type}";
52 call_sub("form_$::form->{type}");
54 $::lxdebug->leave_sub;
58 $::lxdebug->enter_sub;
59 $::auth->assert('config');
61 $::form->{title} = "Edit";
63 if ($::form->{type} eq 'partsgroup') {
64 PE->get_partsgroup(\%::myconfig, $::form);
66 call_sub("form_$::form->{type}");
68 $::lxdebug->leave_sub;
72 $::lxdebug->enter_sub;
73 $::auth->assert('config');
76 print $::form->parse_html_template('pe/search', {
77 is_pricegroup => $::form->{type} eq 'pricegroup',
80 $::lxdebug->leave_sub;
84 $::lxdebug->enter_sub;
85 $::auth->assert('config');
87 if ($::form->{type} eq 'partsgroup') {
88 $::form->isblank("partsgroup", $::locale->text('Group missing!'));
89 PE->save_partsgroup(\%::myconfig, $::form);
90 $::form->redirect($::locale->text('Group saved!'));
94 if(!exists $::form->{addition} && $::form->{id} ne "") {
95 $::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber};
96 $::form->{addition} = "SAVED";
97 $::form->save_history;
101 $::lxdebug->leave_sub;
105 $::lxdebug->enter_sub;
106 $::auth->assert('config');
108 PE->delete_tuple(\%::myconfig, $::form);
110 if ($::form->{type} eq 'partsgroup') {
111 $::form->redirect($::locale->text('Group deleted!'));
113 $::lxdebug->leave_sub;
116 sub continue { call_sub($::form->{nextsub}); }
118 sub partsgroup_report {
119 $::lxdebug->enter_sub;
120 $::auth->assert('config');
122 $::form->{$_} = $::form->unescape($::form->{$_}) for qw(partsgroup);
123 PE->partsgroups(\%::myconfig, $::form);
125 my $callback = build_std_url("action=partsgroup_report", qw(type status));
128 $option .= $::locale->text('All') if $::form->{status} eq 'all';
129 $option .= $::locale->text('Orphaned') if $::form->{status} eq 'orphaned';
131 if ($::form->{partsgroup}) {
132 $callback .= "&partsgroup=$::form->{partsgroup}";
133 $option .= ", " . $::locale->text('Group') . " : $::form->{partsgroup}";
137 $::form->{callback} = $callback;
140 print $::form->parse_html_template('pe/partsgroup_report', {
142 callback => $callback,
143 editlink => build_std_url('action=edit', qw(type status callback)),
146 $::lxdebug->leave_sub;
149 sub form_partsgroup {
150 $::lxdebug->enter_sub;
151 $::auth->assert('config');
153 # $locale->text('Add Group')
154 # $locale->text('Edit Group')
155 $::form->{title} = $::locale->text("$::form->{title} Group");
158 print $::form->parse_html_template('pe/partsgroup_form');
160 $::lxdebug->leave_sub;