kivitendo/bin/mozilla/pe.pl @ 83b760fb
d319704a | Moritz Bunkus | #=====================================================================
|
||
# LX-Office ERP
|
||||
# Copyright (C) 2004
|
||||
# Based on SQL-Ledger Version 2.1.9
|
||||
# Web http://www.lx-office.org
|
||||
#
|
||||
#=====================================================================
|
||||
# SQL-Ledger Accounting
|
||||
# Copyright (c) 1998-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.
|
||||
#======================================================================
|
||||
#
|
||||
08844064 | Moritz Bunkus | # partsgroup, pricegroup administration
|
||
d319704a | Moritz Bunkus | #
|
||
#======================================================================
|
||||
use SL::PE;
|
||||
59f8f1fa | Moritz Bunkus | require "bin/mozilla/common.pl";
|
||
8fd85060 | Sven Schöling | use strict;
|
||
d319704a | Moritz Bunkus | 1;
|
||
# end of main
|
||||
sub add {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
8fd85060 | Sven Schöling | |||
1b83184a | Sven Schöling | $::form->{title} = "Add";
|
||
$::form->{callback} ||= "$::form->{script}?action=add&type=$::form->{type}";
|
||||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | call_sub("form_$::form->{type}");
|
||
8c7e4493 | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
sub edit {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
8c7e4493 | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::form->{title} = "Edit";
|
||
8fd85060 | Sven Schöling | |||
1b83184a | Sven Schöling | if ($::form->{type} eq 'partsgroup') {
|
||
PE->get_partsgroup(\%::myconfig, $::form);
|
||||
d319704a | Moritz Bunkus | }
|
||
1b83184a | Sven Schöling | if ($::form->{type} eq 'pricegroup') {
|
||
PE->get_pricegroup(\%::myconfig, $::form);
|
||||
195883fd | Stephan Köhler | }
|
||
1b83184a | Sven Schöling | call_sub("form_$::form->{type}");
|
||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
sub search {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | $::form->header;
|
||
print $::form->parse_html_template('pe/search', {
|
||||
is_pricegroup => $::form->{type} eq 'pricegroup',
|
||||
});
|
||||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
sub save {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
8fd85060 | Sven Schöling | |||
1b83184a | Sven Schöling | if ($::form->{type} eq 'partsgroup') {
|
||
$::form->isblank("partsgroup", $::locale->text('Group missing!'));
|
||||
PE->save_partsgroup(\%::myconfig, $::form);
|
||||
$::form->redirect($::locale->text('Group saved!'));
|
||||
d319704a | Moritz Bunkus | }
|
||
195883fd | Stephan Köhler | # choice pricegroup and save
|
||
1b83184a | Sven Schöling | if ($::form->{type} eq 'pricegroup') {
|
||
$::form->isblank("pricegroup", $::locale->text('Pricegroup missing!'));
|
||||
PE->save_pricegroup(\%::myconfig, $::form);
|
||||
$::form->redirect($::locale->text('Pricegroup saved!'));
|
||||
195883fd | Stephan Köhler | }
|
||
2b89ec97 | Thomas Kasulke | # saving the history
|
||
1b83184a | Sven Schöling | if(!exists $::form->{addition} && $::form->{id} ne "") {
|
||
$::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber};
|
||||
$::form->{addition} = "SAVED";
|
||||
$::form->save_history;
|
||||
2b89ec97 | Thomas Kasulke | }
|
||
8fd85060 | Sven Schöling | # /saving the history
|
||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
sub delete {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
8c7e4493 | Moritz Bunkus | |||
1b83184a | Sven Schöling | PE->delete_tuple(\%::myconfig, $::form);
|
||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | if ($::form->{type} eq 'partsgroup') {
|
||
$::form->redirect($::locale->text('Group deleted!'));
|
||||
d319704a | Moritz Bunkus | }
|
||
1b83184a | Sven Schöling | if ($::form->{type} eq 'pricegroup') {
|
||
$::form->redirect($::locale->text('Pricegroup deleted!'));
|
||||
195883fd | Stephan Köhler | }
|
||
2b89ec97 | Thomas Kasulke | # saving the history
|
||
1b83184a | Sven Schöling | if(!exists $::form->{addition}) {
|
||
$::form->{snumbers} = qq|projectnumber_| . $::form->{projectnumber};
|
||||
$::form->{addition} = "DELETED";
|
||||
$::form->save_history;
|
||||
2b89ec97 | Thomas Kasulke | }
|
||
# /saving the history
|
||||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
1b83184a | Sven Schöling | sub continue { call_sub($::form->{nextsub}); }
|
||
d319704a | Moritz Bunkus | |||
sub partsgroup_report {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
8fd85060 | Sven Schöling | |||
1b83184a | Sven Schöling | $::form->{$_} = $::form->unescape($::form->{$_}) for qw(partsgroup);
|
||
PE->partsgroups(\%::myconfig, $::form);
|
||||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | my $callback = build_std_url("action=partsgroup_report", qw(type status));
|
||
8c7e4493 | Moritz Bunkus | |||
1b83184a | Sven Schöling | my $option = '';
|
||
$option .= $::locale->text('All') if $::form->{status} eq 'all';
|
||||
$option .= $::locale->text('Orphaned') if $::form->{status} eq 'orphaned';
|
||||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | if ($::form->{partsgroup}) {
|
||
$callback .= "&partsgroup=$::form->{partsgroup}";
|
||||
$option .= ", " . $::locale->text('Group') . " : $::form->{partsgroup}";
|
||||
d319704a | Moritz Bunkus | }
|
||
# escape callback
|
||||
1b83184a | Sven Schöling | $::form->{callback} = $callback;
|
||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::form->header;
|
||
print $::form->parse_html_template('pe/partsgroup_report', {
|
||||
option => $option,
|
||||
callback => $callback,
|
||||
editlink => build_std_url('action=edit', qw(type status callback)),
|
||||
});
|
||||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
1b83184a | Sven Schöling | sub form_partsgroup {
|
||
$::lxdebug->enter_sub;
|
||||
$::auth->assert('config');
|
||||
d319704a | Moritz Bunkus | |||
# $locale->text('Add Group')
|
||||
# $locale->text('Edit Group')
|
||||
1b83184a | Sven Schöling | $::form->{title} = $::locale->text("$::form->{title} Group");
|
||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::form->header;
|
||
print $::form->parse_html_template('pe/partsgroup_form');
|
||||
d319704a | Moritz Bunkus | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
d319704a | Moritz Bunkus | }
|
||
195883fd | Stephan Köhler | |||
sub pricegroup_report {
|
||||
1b83184a | Sven Schöling | $::lxdebug->enter_sub;
|
||
$::auth->assert('config');
|
||||
8fd85060 | Sven Schöling | |||
1b83184a | Sven Schöling | $::form->{$_} = $::form->unescape($::form->{$_}) for qw(pricegroup);
|
||
PE->pricegroups(\%::myconfig, $::form);
|
||||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | my $callback = build_std_url('action=pricegroup_report', qw(type status));
|
||
8c7e4493 | Moritz Bunkus | |||
1b83184a | Sven Schöling | my $option = '';
|
||
$option .= $::locale->text('All') if $::form->{status} eq 'all';
|
||||
$option .= $::locale->text('Orphaned') if $::form->{status} eq 'orphaned';
|
||||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | if ($::form->{pricegroup}) {
|
||
$callback .= "&pricegroup=$::form->{pricegroup}";
|
||||
$option .= ", " . $::locale->text('Pricegroup') . " : $::form->{pricegroup}";
|
||||
195883fd | Stephan Köhler | }
|
||
# escape callback
|
||||
1b83184a | Sven Schöling | $::form->{callback} = $callback;
|
||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | $::form->header;
|
||
print $::form->parse_html_template('pe/pricegroup_report', {
|
||||
option => $option,
|
||||
callback => $callback,
|
||||
editlink => build_std_url('action=edit', qw(type status callback)),
|
||||
});
|
||||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
195883fd | Stephan Köhler | }
|
||
1b83184a | Sven Schöling | sub form_pricegroup {
|
||
$::lxdebug->enter_sub;
|
||||
$::auth->assert('config');
|
||||
8c7e4493 | Moritz Bunkus | |||
45d0d9de | Stephan Köhler | # $locale->text('Add Pricegroup')
|
||
# $locale->text('Edit Pricegroup')
|
||||
1b83184a | Sven Schöling | $::form->{title} = $::locale->text("$::form->{title} Pricegroup");
|
||
45d0d9de | Stephan Köhler | |||
1b83184a | Sven Schöling | $::form->header;
|
||
print $::form->parse_html_template('pe/pricegroup_form');
|
||||
195883fd | Stephan Köhler | |||
1b83184a | Sven Schöling | $::lxdebug->leave_sub;
|
||
195883fd | Stephan Köhler | }
|