[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[4313] trunk
- Subject: SF.net SVN: ledger-smb:[4313] trunk
- From: ..hidden..
- Date: Tue, 14 Feb 2012 14:36:55 +0000
Revision: 4313
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4313&view=rev
Author: einhverfr
Date: 2012-02-14 14:36:54 +0000 (Tue, 14 Feb 2012)
Log Message:
-----------
Removing project/department logic that will be in new interface
Modified Paths:
--------------
trunk/LedgerSMB/PE.pm
trunk/bin/am.pl
trunk/bin/pe.pl
Modified: trunk/LedgerSMB/PE.pm
===================================================================
--- trunk/LedgerSMB/PE.pm 2012-02-14 14:22:59 UTC (rev 4312)
+++ trunk/LedgerSMB/PE.pm 2012-02-14 14:36:54 UTC (rev 4313)
@@ -167,145 +167,7 @@
}
-=item PE->get_project($myconfig, $form)
-If $form->{id} is set, populates the $form attributes projectnumber,
-description, startdate, enddate, parts_id, production, completed, and
-customer_id with details from the project record and name with the associated
-customer name. If the project is not used in any transaction, invoice, order,
-or time card, $form->{orphaned} is set to true, otherwise false.
-
-Even if $form->{id} is false, PE->get_customer is run, along with any custom
-SELECT queries for the table 'project'.
-
-=cut
-
-# Remove as soon as new business unit management interface is complete
-sub get_project {
- my ( $self, $myconfig, $form ) = @_;
-
- my $dbh = $form->{dbh};
-
- my $query;
- my $sth;
- my $ref;
- my $where;
-
- if ( $form->{id} ) {
-
- $query = qq|
- SELECT pr.*, e.name AS customer
- FROM project pr
- LEFT JOIN entity_credit_account c
- ON (c.id = pr.credit_id)
- LEFT JOIN entity e ON (c.entity_id = e.id)
- WHERE pr.id = ?|;
- $sth = $dbh->prepare($query);
- $sth->execute( $form->{id} ) || $form->dberror($query);
-
- $ref = $sth->fetchrow_hashref(NAME_lc);
-
- for ( keys %$ref ) { $form->{$_} = $ref->{$_} }
-
- $sth->finish;
-
- # check if it is orphaned
- $query = qq|
- SELECT count(*)
- FROM acc_trans
- WHERE project_id = ?
- UNION
- SELECT count(*)
- FROM invoice
- WHERE project_id = ?
- UNION
- SELECT count(*)
- FROM orderitems
- WHERE project_id = ?
- UNION
- SELECT count(*)
- FROM jcitems
- WHERE project_id = ?|;
- $sth = $dbh->prepare($query);
- $sth->execute( $form->{id}, $form->{id}, $form->{id}, $form->{id} )
- || $form->dberror($query);
-
- my $count;
- while ( ($count) = $sth->fetchrow_array ) {
- $form->{orphaned} += $count;
- }
- $sth->finish;
- $form->{orphaned} = !$form->{orphaned};
- }
-
- PE->get_customer( $myconfig, $form, $dbh );
-
- $form->run_custom_queries( 'project', 'SELECT' );
-
- $dbh->commit;
-
-}
-
-=item PE->save_project($myconfig, $form)
-
-Updates a project, or adds a new one if $form->{id} is not set.
-
-The $form attributes of startdate, enddate, customer_id, description, and
-projectnumber are used for the project record. If $form->{projectnumber} is
-false, a new one is obtained through $form->update_defaults. When a new
-project is added, $form->{id} is set to that new id. Any custom queries for
-UPDATE on the project table are run.
-
-=cut
-
-# Remove as soon as new project management interface is complete
-sub save_project {
- my ( $self, $myconfig, $form ) = @_;
-
- my $dbh = $form->{dbh};
-
- $form->{customer_id} ||= undef;
-
- $form->{projectnumber} =
- $form->update_defaults( $myconfig, "projectnumber", $dbh )
- unless $form->{projectnumber};
- my $enddate;
- my $startdate;
- $enddate = $form->{enddate} if $form->{enddate};
- $startdate = $form->{startdate} if $form->{startdate};
-
- if ( $form->{id} ) {
-
- $query = qq|
- UPDATE project
- SET projectnumber = ?,
- description = ?,
- startdate = ?,
- enddate = ?,
- credit_id = ?
- WHERE id = | . $dbh->quote( $form->{id} );
- }
- else {
-
- $query = qq|
- INSERT INTO project (projectnumber, description,
- startdate, enddate, credit_id)
- VALUES (?, ?, ?, ?, ?)|;
- }
- $sth = $dbh->prepare($query);
- $sth->execute( $form->{projectnumber},
- $form->{description}, $startdate, $enddate, $form->{customer_id} )
- || $form->dberror($query);
- if (!$form->{id}){
- $query = "SELECT currval('project_id_seq')";
- ($form->{id}) = $dbh->selectrow_array($query) || $form->dberror($query);
- }
- $form->run_custom_queries( 'project', 'UPDATE' );
-
- $dbh->commit;
-
-}
-
=item PE->get_customer($myconfig, $form[, $dbh]);
Populates the list referred to as $form->{all_customer} with hashes containing
@@ -317,7 +179,7 @@
=cut
-# This may be subject to deletion after new business unit interface is up
+
sub get_customer {
my ( $self, $myconfig, $form, $dbh ) = @_;
Modified: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl 2012-02-14 14:22:59 UTC (rev 4312)
+++ trunk/bin/am.pl 2012-02-14 14:36:54 UTC (rev 4313)
@@ -547,164 +547,6 @@
}
-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};
-
- my %hiddens;
- my @buttons;
- my $rows = &department_header(\%hiddens);
- &form_footer_buttons(\%hiddens, ..hidden..);
-
- my $template = LedgerSMB::Template->new_UI(
- user => \%myconfig,
- locale => $locale,
- template => 'am-department-form');
- $template->render({
- form => $form,
- row_count => $rows,
- buttons => ..hidden..,
- hiddens => \%hiddens,
- });
-}
-
-sub edit_department {
-
- $form->{title} = "Edit";
-
- AM->get_department( \%myconfig, \%$form );
-
- my %hiddens;
- my @buttons;
- my $rows = &department_header(\%hiddens);
- &form_footer_buttons(\%hiddens, ..hidden..);
-
- my $template = LedgerSMB::Template->new_UI(
- user => \%myconfig,
- locale => $locale,
- template => 'am-department-form');
- $template->render({
- form => $form,
- row_count => $rows,
- buttons => ..hidden..,
- hiddens => \%hiddens,
- });
-}
-
-sub list_department {
-
- AM->departments( \%myconfig, \%$form );
-
- my $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}";
-
- my $callback = $form->escape( $form->{callback} );
-
- $form->{title} = $locale->text('Departments');
-
- my @column_index = qw(description cost profit);
- my %column_header;
-
- $column_header{description} = { text => $locale->text('Description'),
- href => $href};
- $column_header{cost} = $locale->text('Cost Center');
- $column_header{profit} = $locale->text('Profit Center');
-
-
- my @rows;
- my $i = 0;
- foreach my $ref ( @{ $form->{ALL} } ) {
-
- my %column_data;
- $i++;
- $i %= 2;
- $column_data{i} = $i;
-
- $column_data{cost} = ( $ref->{role} eq "C" ) ? "*" : " ";
- $column_data{profit} = ( $ref->{role} eq "P" ) ? "*" : " ";
-
- $column_data{description} = { text => $ref->{description},
- href => qq|$form->{script}?action=edit_department&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback|,};
-
- push @rows, \%column_data;
- }
-
- $form->{type} = "department";
-
- my @hiddens = qw(type callback path login sessionid);
-
- ## SC: removing this for now
- #if ( $form->{lynx} ) {
- # require "bin/menu.pl";
- # &menubar;
- #}
-
- my @buttons;
- push @buttons, {
- name => 'action',
- value => 'add_department',
- text => $locale->text('Add Department'),
- type => 'submit',
- class => 'submit',
- };
-
- my $template = LedgerSMB::Template->new_UI(
- user => \%myconfig,
- locale => $locale,
- template => 'am-list-departments');
- $template->render({
- form => $form,
- buttons => ..hidden..,
- columns => ..hidden..,
- heading => \%column_header,
- rows => ..hidden..,
- hiddens => ..hidden..,
- });
-}
-
-sub department_header {
- my $hiddens = shift;
-
- $form->{title} = $locale->text("[_1] Department", $form->{title});
-
- # $locale->text('Add Department')
- # $locale->text('Edit Department')
-
- $form->{description} = $form->quote( $form->{description} );
-
- my $rows = $form->numtextrows( $form->{description}, 60 );
-
- $hiddens->{id} = $form->{id};
- $hiddens->{type} = 'department';
-
- $rows;
-}
-
-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";
Modified: trunk/bin/pe.pl
===================================================================
--- trunk/bin/pe.pl 2012-02-14 14:22:59 UTC (rev 4312)
+++ trunk/bin/pe.pl 2012-02-14 14:36:54 UTC (rev 4313)
@@ -129,66 +129,6 @@
<input name=status class=radio type=radio value=orphaned> |
. $locale->text('Orphaned');
- if ( $form->{type} eq 'project' ) {
- $report = "project_report";
- $sort = "projectnumber";
- $form->{title} = $locale->text('Projects');
-
- $number = qq|
- <tr>
- <th align=right width=1%>| . $locale->text('Number') . qq|</th>
- <td><input name=projectnumber size=20></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=60></td>
- </tr>
-|;
- }
-
- if ( $form->{type} eq 'stock' ) {
- $report = "list_stock";
- $form->{title} = $locale->text('Stock Finished Goods');
- PE->list_stock( \%myconfig, \%$form );
-
- $selectperiod = "";
- $orphaned = "";
- $fromto = qq|
- <tr>
- <th align=right nowrap>| . $locale->text('As of') . qq|</th>
- <td><input class="date" name=stockingdate size=11 title="$myconfig{dateformat}"></td>
- </tr>
-|;
-
- $number = qq|
- <tr>
- <th align=right width=1%>| . $locale->text('Job Number') . qq|</th>
- <td><input name=projectnumber size=20></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=60></td>
- </tr>
-|;
- }
-
- if ( $form->{type} eq 'job' ) {
- $report = "job_report";
- $sort = "projectnumber";
- $form->{title} = $locale->text('Jobs');
-
- $number = qq|
- <tr>
- <th align=right width=1%>| . $locale->text('Number') . qq|</th>
- <td><input name=projectnumber size=20></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td><input name=description size=60></td>
- </tr>
-|;
- }
-
if ( $form->{type} eq 'partsgroup' ) {
$report = "partsgroup_report";
$sort = 'partsgroup';
@@ -283,381 +223,9 @@
}
-sub project_report {
- for (qw(projectnumber description)) {
- $form->{$_} = $form->unescape( $form->{$_} );
- }
- PE->projects( \%myconfig, \%$form );
-
- $form->{action} = "project_report";
- &list_projects;
-
}
-sub list_projects {
-
- $href = "$form->{script}?";
- for (
- qw(action direction oldsort type path login sessionid status startdatefrom startdateto)
- )
- {
- $href .= "$_=$form->{$_}&";
- }
-
- $form->sort_order();
-
- $callback = "$form->{script}?";
- for (
- qw(action direction oldsort type path login sessionid status startdatefrom startdateto)
- )
- {
- $callback .= "$_=$form->{$_}&";
- }
-
- @column_index =
- $form->sort_columns(qw(projectnumber description name startdate enddate));
-
- if ( $form->{status} eq 'all' ) {
- $option = $locale->text('All');
- }
- if ( $form->{status} eq 'orphaned' ) {
- $option .= $locale->text('Orphaned');
- }
- if ( $form->{status} eq 'active' ) {
- $option = $locale->text('Active');
- @column_index =
- $form->sort_columns(qw(projectnumber description name startdate));
- }
- if ( $form->{status} eq 'inactive' ) {
- $option = $locale->text('Inactive');
- }
-
- if ( $form->{type} eq 'project' ) {
- $label = $locale->text('Project');
- $form->{title} = $locale->text('Projects');
- }
- else {
- $label = $locale->text('Job');
- push @column_index, qw(partnumber production completed);
- $form->{title} = $locale->text('Jobs');
- }
-
- if ( $form->{projectnumber} ) {
- $href .= "&projectnumber=" . $form->escape( $form->{projectnumber} );
- $callback .= "&projectnumber=$form->{projectnumber}";
- $option .= "\n<br>$label : $form->{projectnumber}";
- }
- if ( $form->{description} ) {
- $href .= "&description=" . $form->escape( $form->{description} );
- $callback .= "&description=$form->{description}";
- $option .=
- "\n<br>" . $locale->text('Description') . " : $form->{description}";
- }
- if ( $form->{startdatefrom} ) {
- $href .= "&startdatefrom=$form->{startdatefrom}";
- $option .= "\n<br>"
- . $locale->text('From')
- . " "
- . $locale->date( \%myconfig, $form->{startdatefrom}, 1 );
- }
- if ( $form->{startdateto} ) {
- $href .= "&startdateto=$form->{startdateto}";
- if ( $form->{startdatefrom} ) {
- $option .= " ";
- }
- else {
- $option .= "\n<br>" if ($option);
- }
- $option .=
- $locale->text('To') . " "
- . $locale->date( \%myconfig, $form->{startdateto}, 1 );
- }
-
- $column_header{projectnumber} =
- qq|<th><a class=listheading href=$href&sort=projectnumber>|
- . $locale->text('Number')
- . qq|</a></th>|;
- $column_header{description} =
- qq|<th><a class=listheading href=$href&sort=description>|
- . $locale->text('Description')
- . qq|</a></th>|;
- $column_header{startdate} =
- qq|<th width=10><a class=listheading href=$href&sort=startdate>|
- . $locale->text('Startdate')
- . qq|</a></th>|;
- $column_header{enddate} =
- qq|<th width=10><a class=listheading href=$href&sort=enddate>|
- . $locale->text('Enddate')
- . qq|</a></th>|;
-
- $column_header{partnumber} =
- "<th><a class=listheading href=$href&sort=partnumber>"
- . $locale->text('Assembly')
- . "</a></th>";
- $column_header{production} =
- "<th width=10 class=listheading>" . $locale->text('Production') . "</th>";
- $column_header{completed} =
- "<th width=10 class=listheading>" . $locale->text('Completed') . "</th>";
- $column_header{name} =
- "<th class=listheading>" . $locale->text('Customer') . "</th>";
-
- $form->header;
-
- if ( @{ $form->{all_project} } ) {
- $sameitem = $form->{all_project}->[0]->{ $form->{sort} };
- }
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>$option</td>
- </tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- for (@column_index) { print "$column_header{$_}\n" }
-
- print qq|
- </tr>
-|;
-
- # escape callback
- $form->{callback} = $callback .= "&sort=$form->{sort}";
-
- # escape callback for href
- $callback = $form->escape($callback);
-
- # flip direction
- $direction = ( $form->{direction} eq 'ASC' ) ? "ASC" : "DESC";
- $href =~ s/&direction=(\w+)&/&direction=$direction&/;
-
- foreach $ref ( @{ $form->{all_project} } ) {
-
- for (qw(description startdate enddate name)) {
- $column_data{$_} = qq|<td>$ref->{$_} </td>|;
- }
-
- for (qw(production completed)) {
- $column_data{$_} =
- qq|<td align=right>|
- . $form->format_amount( \%myconfig, $ref->{$_} );
- }
-
- $column_data{projectnumber} =
-qq|<td><a href=$form->{script}?action=edit&type=$form->{type}&status=$form->{status}&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&project=$form->{project}&callback=$callback>$ref->{projectnumber}</td>|;
- $column_data{partnumber} =
-qq|<td><a href=ic.pl?action=edit&id=$ref->{id}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}&callback=$callback>$ref->{partnumber}</td>|;
-
- $j++;
- $j %= 2;
-
- print qq|
- <tr valign=top class=listrow$j>
-|;
-
- for (@column_index) { print "$column_data{$_}\n" }
-
- print "
- </tr>
-";
- }
-
- $i = 1;
- if ( $form->{type} eq 'project' ) {
- if ( $myconfig{acs} !~ /Projects--Projects/ ) {
- $button{'Projects--Add Project'}{code} =
-qq|<button class="submit" type="submit" name="action" value="add_project">|
- . $locale->text('Add Project')
- . qq|</button> |;
- $button{'Projects--Add Project'}{order} = $i++;
-
- for ( split /;/, $myconfig{acs} ) {
- delete $button{$_};
- }
- }
- }
- else {
- if ( $myconfig{acs} !~ /Job Costing--Job Costing/ ) {
- $button{'Job Costing--Add Job'}{code} =
-qq|<button class="submit" type="submit" name="action" value="add_job">|
- . $locale->text('Add Job')
- . qq|</button> |;
- $button{'Job Costing--Add Job'}{order} = $i++;
-
- for ( split /;/, $myconfig{acs} ) {
- delete $button{$_};
- }
- }
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=$form->{script}>
-|;
-
- $form->hide_form(qw(callback type path login sessionid));
-
- foreach $item ( sort { $a->{order} <=> $b->{order} } %button ) {
- print $item->{code};
- }
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
- </form>
-
-</body>
-</html>
-|;
-
-}
-
-sub project_header {
-
- $form->{description} = $form->quote( $form->{description} );
-
- if ( ( $rows = $form->numtextrows( $form->{description}, 60 ) ) > 1 ) {
- $description =
-qq|<textarea name="description" rows=$rows cols=60 style="width: 100%" wrap=soft>$form->{description}</textarea>|;
- }
- else {
- $description =
- qq|<input name=description size=60 value="$form->{description}">|;
- }
-
- $form->{"select$form->{vc}"} =
- $form->unescape( $form->{"select$form->{vc}"} );
- $form->{"select$form->{vc}"} =~ s/ selected//;
- $form->{"select$form->{vc}"} =~
- s/(<option value="\Q$form->{"$form->{vc}"}\E")/$1 selected/;
-
- $label = ucfirst $form->{vc};
- if ( $form->{"select$form->{vc}"} ) {
- $name = qq|
- <tr>
- <th align=right nowrap>| . $locale->text($label) . qq|</th>
- <td colspan=3><select name="$form->{vc}">$form->{"select$form->{vc}"}</select></td>
- <input type=hidden name="select$form->{vc}" value="|
- . $form->escape( $form->{"select$form->{vc}"}, 1 ) . qq|">
- </tr>
-|;
- }
- else {
- $name = qq|
- <tr>
- <th align=right nowrap>| . $locale->text($label) . qq|</th>
- <td colspan=3><input name="$form->{vc}" value="$form->{"$form->{vc}"}" size=35></td>
- <input type=hidden name="select$form->{vc}" value="|
- . $form->escape( $form->{"select$form->{vc}"}, 1 ) . qq|">
- </tr>
-|;
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
- $form->hide_form(
- "id", "type",
- "old$form->{vc}", "$form->{vc}_id",
- "orphaned", "vc",
- "title"
- );
-
- print qq|
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table>
- <tr>
- <th align=right>| . $locale->text('Number') . qq|</th>
- <td><input name=projectnumber size=20 value="$form->{projectnumber}"></td>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td>$description</td>
- </tr>
- $name
- <tr>
- <th align=right>| . $locale->text('Startdate') . qq|</th>
- <td><input class="date" name=startdate size=11 title="($myconfig{dateformat})" value=$form->{startdate}></td>
- <th align=right>| . $locale->text('Enddate') . qq|</th>
- <td><input class="date" name=enddate size=11 title="($myconfig{dateformat})" value=$form->{enddate}></td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
-}
-
-sub project_footer {
-
- $form->hide_form(qw(callback path login sessionid));
-
- %button =
- ( 'update' => { ndx => 1, key => 'U', value => $locale->text('Update') },
- );
-
- if ( $myconfig{acs} !~ /Projects--Add Project/ ) {
- $button{'save'} =
- { ndx => 3, key => 'S', value => $locale->text('Save') };
-
- if ( $form->{id} && $form->{orphaned} ) {
- $button{'delete'} =
- { ndx => 16, key => 'D', value => $locale->text('Delete') };
- }
- }
-
- for ( sort { $button{$a}->{ndx} <=> $button{$b}->{ndx} } keys %button ) {
- $form->print_button( \%button, $_ );
- }
-
- if ( $form->{lynx} ) {
- require "bin/menu.pl";
- &menubar;
- }
-
- print qq|
-</form>
-
-</body>
-</html>
-|;
-
-}
-
sub save {
if ( $form->{translation} ) {
@@ -666,88 +234,17 @@
$form->finalize_request();
}
- if ( $form->{type} eq 'project' ) {
- if ( $form->{"select$form->{vc}"} ) {
- ( $null, $form->{"$form->{vc}_id"} ) = split /--/,
- $form->{"$form->{vc}"};
- }
- else {
- if ( $form->{"old$form->{vc}"} ne
- qq|$form->{"$form->{vc}"}--$form->{"$form->{vc}_id"}| )
- {
-
- if (
- (
- $rv = $form->get_name(
- \%myconfig, $form->{vc}, $form->{startdate}
- )
- ) > 1
- )
- {
- &select_name;
- $form->finalize_request();
- }
-
- if ( $rv == 1 ) {
- $form->{"$form->{vc}_id"} = $form->{name_list}[0]->{id};
- $form->{"$form->{vc}"} = $form->{name_list}[0]->{name};
- $form->{"old$form->{vc}"} =
- qq|$form->{"$form->{vc}"}--$form->{"$form->{vc}_id"}|;
- }
- }
- }
-
- 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' ) {
+ elsif ( $form->{type} eq 'pricegroup' ) {
$form->isblank( "pricegroup", $locale->text('Pricegroup missing!') );
PE->save_pricegroup( \%myconfig, \%$form );
$form->redirect( $locale->text('Pricegroup saved!') );
}
-
- if ( $form->{type} eq 'job' ) {
- if ( $form->{"select$form->{vc}"} ) {
- ( $null, $form->{"$form->{vc}_id"} ) = split /--/,
- $form->{"$form->{vc}"};
- }
- else {
- if ( $form->{"old$form->{vc}"} ne
- qq|$form->{"$form->{vc}"}--$form->{"$form->{vc}_id"}| )
- {
-
- if (
- (
- $rv = $form->get_name(
- \%myconfig, $form->{vc}, $form->{startdate}
- )
- ) > 1
- )
- {
- &select_name;
- $form->finalize_request();
- }
-
- if ( $rv == 1 ) {
- $form->{"$form->{vc}_id"} = $form->{name_list}[0]->{id};
- $form->{"$form->{vc}"} = $form->{name_list}[0]->{name};
- $form->{"old$form->{vc}"} =
- qq|$form->{"$form->{vc}"}--$form->{"$form->{vc}_id"}|;
- }
- }
- }
-
- PE->save_job( \%myconfig, \%$form );
- $form->redirect( $locale->text('Job saved!') );
- }
-
}
sub delete {
@@ -759,19 +256,11 @@
}
else {
- if ( $form->{type} eq 'project' ) {
- PE->delete_project( \%myconfig, \%$form );
- $form->redirect( $locale->text('Project deleted!') );
- }
- if ( $form->{type} eq 'job' ) {
- PE->delete_job( \%myconfig, \%$form );
- $form->redirect( $locale->text('Job deleted!') );
- }
if ( $form->{type} eq 'partsgroup' ) {
PE->delete_partsgroup( \%myconfig, \%$form );
$form->redirect( $locale->text('Group deleted!') );
}
- if ( $form->{type} eq 'pricegroup' ) {
+ elsif ( $form->{type} eq 'pricegroup' ) {
PE->delete_pricegroup( \%myconfig, \%$form );
$form->redirect( $locale->text('Pricegroup deleted!') );
}
@@ -1593,72 +1082,6 @@
}
- if ( $form->{type} =~ /(job|project)/ ) {
-
- # $locale->text('Customer not on file!')
- # $locale->text('Vendor not on file!')
-
- for (qw(production listprice sellprice weight)) {
- $form->{$_} = $form->parse_amount( \%myconfig, $form->{$_} );
- }
-
- $form->{projectnumber} =
- $form->update_defaults( \%myconfig, "projectnumber" )
- unless $form->{projectnumber};
-
- if ( $form->{"select$form->{vc}"} ) {
- if ( $form->{startdate} ne $form->{oldstartdate}
- || $form->{enddate} ne $form->{oldenddate} )
- {
-
- PE->get_customer( \%myconfig, \%$form );
-
- if ( @{ $form->{"all_$form->{vc}"} } ) {
- $form->{"select$form->{vc}"} = qq|<option>\n|;
- for ( @{ $form->{"all_$form->{vc}"} } ) {
- $form->{"select$form->{vc}"} .=
- qq|<option value="$_->{name}--$_->{id}">$_->{name}\n|;
- }
- }
- }
-
- $form->{"old$form->{vc}"} = $form->{"$form->{vc}"};
- ( $null, $form->{"$form->{vc}_id"} ) = split /--/,
- $form->{"$form->{vc}"};
-
- }
- else {
-
- if ( $form->{"old$form->{vc}"} ne
- qq|$form->{"$form->{vc}"}--$form->{"$form->{vc}_id"}| )
- {
-
- if (
- (
- $rv = $form->get_name(
- \%myconfig, $form->{vc}, $form->{startdate}
- )
- ) > 1
- )
- {
- &select_name;
- $form->finalize_request();
- }
-
- if ( $rv == 1 ) {
- $form->{"$form->{vc}_id"} = $form->{name_list}[0]->{id};
- $form->{"$form->{vc}"} = $form->{name_list}[0]->{name};
- $form->{"old$form->{vc}"} =
- qq|$form->{"$form->{vc}"}--$form->{"$form->{vc}_id"}|;
- }
- else {
- $msg = ucfirst $form->{vc} . " not on file!";
- $form->error( $locale->text($msg) );
- }
- }
- }
- }
-
&display_form;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.